GPURenderCommandsMixin
- class wgpu.GPURenderCommandsMixin
Bases:
objectMixin for classes that provide rendering commands.
- draw(vertex_count: int | None = None, instance_count: int = 1, first_vertex: int = 0, first_instance: int = 0) None
Run the render pipeline without an index buffer.
- Parameters:
vertex_count (int) – The number of vertices to draw.
instance_count (int) – The number of instances to draw. Default 1.
first_vertex (int) – The vertex offset. Default 0.
first_instance (int) – The instance offset. Default 0.
- draw_indexed(index_count: int | None = None, instance_count: int = 1, first_index: int = 0, base_vertex: int = 0, first_instance: int = 0) None
Run the render pipeline using an index buffer.
- Parameters:
index_count (int) – The number of indices to draw.
instance_count (int) – The number of instances to draw. Default 1.
first_index (int) – The index offset. Default 0.
base_vertex (int) – A number added to each index in the index buffer. Default 0.
first_instance (int) – The instance offset. Default 0.
Alignment: the indirect offset must be a multiple of 4.
- draw_indexed_indirect(indirect_buffer: GPUBuffer | None = None, indirect_offset: int | None = None) None
Like
draw_indexed(), but the function arguments are in a buffer.- Parameters:
indirect_buffer (
GPUBuffer) – The buffer that contains the arguments.indirect_offset (int) – The byte offset at which the arguments are.
- draw_indirect(indirect_buffer: GPUBuffer | None = None, indirect_offset: int | None = None) None
Like
draw(), but the function arguments are in a buffer.- Parameters:
indirect_buffer (
GPUBuffer) – The buffer that contains the arguments.indirect_offset (int) – The byte offset at which the arguments are.
Alignment: the indirect offset must be a multiple of 4.
- set_index_buffer(buffer: GPUBuffer | None = None, index_format: Literal['uint16', 'uint32'] | str | None = None, offset: int = 0, size: int | None = None) None
Set the index buffer for this render pass.
- Parameters:
buffer (
GPUBuffer) – The buffer that contains the indices.index_format (
GPUIndexFormat) – The format of the index data contained in buffer. If strip_index_format is given in the call to GPUDevice.create_render_pipeline(), it must match.offset (int) – The byte offset in the buffer. Default 0.
size (int) – The number of bytes to use. If zero, the remaining size (after offset) of the buffer is used.
- set_pipeline(pipeline: GPURenderPipeline | None = None) None
Set the pipeline for this render pass.
- Parameters:
pipeline (
GPURenderPipeline) – The pipeline to use.
- set_vertex_buffer(slot: int | None = None, buffer: GPUBuffer | None = None, offset: int = 0, size: int | None = None) None
Associate a vertex buffer with a bind slot.
- Parameters:
slot (int) – The binding slot for the vertex buffer.
buffer (
GPUBuffer) – The buffer that contains the vertex data.offset (int) – The byte offset in the buffer. Default 0.
size (int) – The number of bytes to use. If zero, the remaining size (after offset) of the buffer is used. Default 0.
Alignment: the offset must be a multiple of 4.