CommandEncoder
A command encoder offering GPU memory copying operations.
Types
CommandEncoderProps
Property | Type | Description |
---|---|---|
N/A |
Members
device
:Device
- holds a reference to theDevice
that created thisCommandEncoder
.handle
:unknown
- holds the underlying WebGL or WebGPU shader objectprops
:CommandEncoderProps
- holds a copy of theCommandEncoderProps
used to create thisCommandEncoder
.
Methods
constructor(props: CommandEncoderProps)
CommandEncoder
is an abstract class and cannot be instantiated directly. Create with device.beginCommandEncoder(...)
.
setImageData(options : Object) : Texture2D
Texture.setImageData({
target = this.target,
pixels = null,
data = null,
width,
height,
level = 0,
type,
offset = 0,
border = 0,
compressed = false,
parameters= {}
});
data
(*) - Image data. Can be one of several data types see table belowpixels
(*) - alternative todata
width
(GLint) -height
(GLint) -level
(GLint) -format
(GLenum) - format of image data.type
(GLenum)
- format of array (autodetect from type) or
- (WEBGL2) format of buffer
offset
(Number) - (WEBGL2) offset from start of bufferborder
(GLint) - must be 0.compressed
(Boolean) -parameters
(Object) - GL parameters to be temporarily applied (most of the time, pixelStorage parameters) when updating the texture.
Valid image data types:
null
- create empty texture of specified format- Typed array - initializes from image data in typed array according to
format
Buffer
|WebGLBuffer
- (WEBGL2) initialized from image data in WebGLBuffer accoeding toformat
.HTMLImageElement
|Image
- Initializes with content of image. Auto deduces texture width/height from image.HTMLCanvasElement
- Inits with contents of canvas. Auto width/height.HTMLVideoElement
- Creates video texture that continuously updates. Auto width/height.
setSubImageData(options : Object) : Texture2D
Redefines an area of an existing texture Note: does not allocate storage
Texture.setSubImageData({
target = this.target,
pixels = null,
data = null,
x = 0,
y = 0,
width,
height,
level = 0,
type,
compressed = false,
offset = 0,
border = 0,
parameters = {}
});
x
(GLint
) - xOffset from where texture to be updatedy
(GLint
) - yOffset from where texture to be updatedwidth
(GLint
) - width of the sub image to be updatedheight
(GLint
) - height of the sub image to be updatedlevel
(GLint
) - mip level to be updatedformat
(GLenum
) - internal format of image data.typ
(GLenum
) - format of array (autodetect from type) or (WEBGL2) format of buffer or ArrayBufferViewdataFormat
(GLenum
) - format of image data.offset
(Number
) - (WEBGL2) offset from start of bufferborder
(GLint
) - must be 0.- parameters - temporary settings to be applied, can be used to supply pixel store settings.
See also gl.compressedTexSubImage2D, gl.texSubImage2D, gl.bindTexture, gl.bindBuffer