Class GPUTexture
- Namespace
- CSharpToJavaScript.APIs.JS
- Assembly
- CSharpToJavaScript.dll
The GPUTexture interface of the {{domxref("WebGPU API", "WebGPU API", "", "nocode")}} represents a container used to store 1D, 2D, or 3D arrays of data, such as images, to use in GPU rendering operations.
[Value("GPUTexture")]
public class GPUTexture
- Inheritance
-
GPUTexture
- Inherited Members
Remarks
A GPUTexture object instance is created using the CreateTexture(GPUTextureDescriptor) method.
-The WebGPU API
Constructors
GPUTexture()
public GPUTexture()
Properties
DepthOrArrayLayers
The depthOrArrayLayers read-only property of the
GPUTexture interface represents the depth or layer count of the GPUTexture.
[Value("depthOrArrayLayers")]
public ulong DepthOrArrayLayers { get; }
Property Value
- ulong
A number. This represents:In cases where the
GPUTexturedoes not have a depth or layers, the value is 1.
Remarks
This is set based on the size property in the descriptor object passed into the originating CreateTexture(GPUTextureDescriptor) call.
-The WebGPU API
Dimension
The dimension read-only property of the
GPUTexture interface represents the dimension of the set of texels for each GPUTexture subresource.
[Value("dimension")]
public GPUTextureDimension Dimension { get; }
Property Value
- GPUTextureDimension
An enumerated value. Possible values are:
Remarks
This is set via the dimension property in the descriptor object passed into the originating CreateTexture(GPUTextureDescriptor) call, which defaults to "2d" if omitted.
-The WebGPU API
Format
The format read-only property of the
GPUTexture interface represents the format of the GPUTexture.
[Value("format")]
public GPUTextureFormat Format { get; }
Property Value
- GPUTextureFormat
An enumerated value. See the Texture formats section of the specification for all the possible values.
Remarks
This is set via the format property in the descriptor object passed into the originating CreateTexture(GPUTextureDescriptor) call.
-The WebGPU API
Height
The height read-only property of the
GPUTexture interface represents the height of the GPUTexture.
[Value("height")]
public ulong Height { get; }
Property Value
- ulong
A number.
Remarks
This is set based on the value of the size property in the descriptor object passed into the originating CreateTexture(GPUTextureDescriptor) call.
-The WebGPU API
MipLevelCount
The mipLevelCount read-only property of the
GPUTexture interface represents the number of mip levels of the GPUTexture.
[Value("mipLevelCount")]
public ulong MipLevelCount { get; }
Property Value
- ulong
A number.
Remarks
This is set via the mipLevelCount property in the descriptor object passed into the originating CreateTexture(GPUTextureDescriptor) call. If omitted, this defaults to 1.
-The WebGPU API
SampleCount
The sampleCount read-only property of the
GPUTexture interface represents the sample count of the GPUTexture.
[Value("sampleCount")]
public ulong SampleCount { get; }
Property Value
- ulong
A number. Possible values are:
Remarks
This is set via the sampleCount property in the descriptor object passed into the originating CreateTexture(GPUTextureDescriptor) call. If omitted, this defaults to 1.
-The WebGPU API
Usage
The usage read-only property of the
GPUTexture interface is the {{glossary("bitwise flags")}} representing the allowed usages of the GPUTexture.
[Value("usage")]
public ulong Usage { get; }
Property Value
- ulong
The bitwise flags representing the original usages set when the
GPUTexturewas first created. The returned number is the sum of decimal values representing the different flags, as seen in the table below.Usage flag Usage description Hex equiv. Decimal equiv. GPUTextureUsage.COPY_SRCThe texture can be used as the source of a copy operation, for example the source argument of a CopyTextureToBuffer(GPUTexelCopyTextureInfo, GPUTexelCopyBufferInfo, Union222) call. 0x01 1 GPUTextureUsage.COPY_DSTThe texture can be used as the destination of a copy/write operation, for example the destination argument of a CopyBufferToTexture(GPUTexelCopyBufferInfo, GPUTexelCopyTextureInfo, Union222) call. 0x02 2 GPUTextureUsage.RENDER_ATTACHMENTThe texture can be used as a color or depth/stencil attachment in a render pass, for example as the viewproperty of the descriptor object in a BeginRenderPass(GPURenderPassDescriptor) call.0x10 16 GPUTextureUsage.STORAGE_BINDINGThe texture can be bound for use as a storage texture in a shader, for example as a resource in a bind group entry when creating a GPUBindGroup (via CreateBindGroup(GPUBindGroupDescriptor)), which adheres to a GPUBindGroupLayout entry with a specified storage texture binding layout. 0x08 8 GPUTextureUsage.TEXTURE_BINDINGThe texture can be bound for use as a sampled texture in a shader, for example as a resource in a bind group entry when creating a GPUBindGroup (via CreateBindGroup(GPUBindGroupDescriptor)), which adheres to a GPUBindGroupLayout entry with a specified texture binding layout. 0x04 4
Remarks
This is set via the usage property in the descriptor object passed into the originating CreateTexture(GPUTextureDescriptor) call.
-The WebGPU API
Width
The width read-only property of the
GPUTexture interface represents the width of the GPUTexture.
[Value("width")]
public ulong Width { get; }
Property Value
- ulong
A number.
Remarks
This is set based on the value of the size property in the descriptor object passed into the originating CreateTexture(GPUTextureDescriptor) call.
-The WebGPU API
Methods
CreateView(GPUTextureViewDescriptor)
The createView() method of the
GPUTexture interface creates a GPUTextureView representing a specific view of the GPUTexture.
[Value("createView")]
public GPUTextureView CreateView(GPUTextureViewDescriptor descriptor = null)
Parameters
descriptorGPUTextureViewDescriptor
Returns
- GPUTextureView
A GPUTextureView object instance.
Remarks
Destroy()
The destroy() method of the
GPUTexture interface destroys the GPUTexture.
[Value("destroy")]
public GlobalObject.Undefined Destroy()