Movatterモバイル変換


[0]ホーム

URL:


  1. Web
  2. Web APIs
  3. GPUTextureView

GPUTextureView

Limited availability

This feature is not Baseline because it does not work in some of the most widely-used browsers.

Secure context: This feature is available only insecure contexts (HTTPS), in some or allsupporting browsers.

Note: This feature is available inWeb Workers.

TheGPUTextureView interface of theWebGPU API represents a view into a subset of the texture resources defined by a particularGPUTexture.

AGPUTextureView object instance is created using theGPUTexture.createView() method.

Instance properties

label

A string providing a label that can be used to identify the object, for example inGPUError messages or console warnings.

Examples

In the WebGPU SamplesCubemap demo, you will see multiple examples of howGPUTextureViews (created byGPUTexture.createView() calls) are used, both as aresource in aGPUDevice.createBindGroup() call, and as a providedview in thedepthStencilAttachment object of aGPUCommandEncoder.beginRenderPass() descriptor.

js
const uniformBindGroup = device.createBindGroup({  layout: pipeline.getBindGroupLayout(0),  entries: [    {      binding: 0,      resource: {        buffer: uniformBuffer,        offset: 0,        size: uniformBufferSize,      },    },    {      binding: 1,      resource: sampler,    },    {      binding: 2,      resource: cubemapTexture.createView({        dimension: "cube",      }),    },  ],});const renderPassDescriptor: GPURenderPassDescriptor = {  colorAttachments: [    {      view: undefined, // Assigned later      loadOp: "clear",      storeOp: "store",    },  ],  depthStencilAttachment: {    view: depthTexture.createView(),    depthClearValue: 1.0,    depthLoadOp: "clear",    depthStoreOp: "store",  },};// …const commandEncoder = device.createCommandEncoder();const passEncoder = commandEncoder.beginRenderPass(renderPassDescriptor);// …

Specifications

Specification
WebGPU
# gputextureview

Browser compatibility

See also

Help improve MDN

Learn how to contribute

This page was last modified on byMDN contributors.


[8]ページ先頭

©2009-2025 Movatter.jp