GPUCommandEncoder¶
- class wgpu.GPUCommandEncoder¶
Bases:
GPUCommandsMixin
,GPUDebugCommandsMixin
,GPUObjectBase
Object to record a series of commands.
When done, call
finish()
to obtain aGPUCommandBuffer
object.Create a command encoder using GPUDevice.create_command_encoder().
- begin_compute_pass(**parameters)¶
Record the beginning of a compute pass. Returns a
GPUComputePassEncoder
object.- Parameters:
label (str) – A human readable label. Optional.
timestamp_writes – unused
- begin_render_pass(**parameters)¶
Record the beginning of a render pass. Returns a
GPURenderPassEncoder
object.- Parameters:
label (str) – A human readable label. Optional.
color_attachments (list) – List of
structs.RenderPassColorAttachment
dicts.depth_stencil_attachment (
structs.RenderPassDepthStencilAttachment
) – Describes the depth stencil attachment. Default None.occlusion_query_set (
GPUQuerySet
) – Default None. TODO NOT IMPLEMENTED in wgpu-native.timestamp_writes – unused
- clear_buffer(buffer, offset=0, size=None)¶
Set (part of) the given buffer to zeros. Both offset and size must be a multiple of 4. If size is None, the whole buffer after offset is cleared.
- copy_buffer_to_buffer(source, source_offset, destination, destination_offset, size)¶
Copy the contents of a buffer to another buffer.
- Parameters:
- copy_buffer_to_texture(source, destination, copy_size)¶
Copy the contents of a buffer to a texture (view).
- Parameters:
source (
GPUBuffer
) – A dict with fields: buffer, offset, bytes_per_row, rows_per_image.destination (
GPUTexture
) – A dict with fields: texture, mip_level, origin.copy_size (int) – The number of bytes to copy.
Note that the bytes_per_row must be a multiple of 256.
- copy_texture_to_buffer(source, destination, copy_size)¶
Copy the contents of a texture (view) to a buffer.
- Parameters:
source (
GPUTexture
) – A dict with fields: texture, mip_level, origin.destination (
GPUBuffer
) – A dict with fields: buffer, offset, bytes_per_row, rows_per_image.copy_size (int) – The number of bytes to copy.
Note that the bytes_per_row must be a multiple of 256.
- copy_texture_to_texture(source, destination, copy_size)¶
Copy the contents of a texture (view) to another texture (view).
- Parameters:
source (
GPUTexture
) – A dict with fields: texture, mip_level, origin.destination (
GPUTexture
) – A dict with fields: texture, mip_level, origin.copy_size (int) – The number of bytes to copy.
- finish(**parameters)¶
Finish recording. Returns a
GPUCommandBuffer
to submit to aGPUQueue
.- Parameters:
label (str) – A human readable label. Optional.
- resolve_query_set(query_set, first_query, query_count, destination, destination_offset)¶
TODO