All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
HgiGraphicsCmds Class Referenceabstract

A graphics API independent abstraction of graphics commands. More...

+ Inheritance diagram for HgiGraphicsCmds:

Public Member Functions

virtual HGI_API void PushDebugGroup (const char *label)=0
 Push a debug marker. More...
 
virtual HGI_API void PopDebugGroup ()=0
 Pop the last debug marker. More...
 
virtual HGI_API void SetViewport (GfVec4i const &vp)=0
 Set viewport [left, BOTTOM, width, height] - OpenGL coords. More...
 
virtual HGI_API void SetScissor (GfVec4i const &sc)=0
 Only pixels that lie within the scissor box are modified by drawing commands. More...
 
virtual HGI_API void BindPipeline (HgiGraphicsPipelineHandle pipeline)=0
 Bind a pipeline state object. More...
 
virtual HGI_API void BindResources (HgiResourceBindingsHandle resources)=0
 Bind resources such as textures and uniform buffers. More...
 
virtual HGI_API void SetConstantValues (HgiGraphicsPipelineHandle pipeline, HgiShaderStage stages, uint32_t bindIndex, uint32_t byteSize, const void *data)=0
 Set Push / Function constants. More...
 
virtual HGI_API void BindVertexBuffers (uint32_t firstBinding, HgiBufferHandleVector const &buffers, std::vector< uint32_t > const &byteOffsets)=0
 Binds the vertex buffer(s) that describe the vertex attributes. More...
 
virtual HGI_API void Draw (uint32_t vertexCount, uint32_t firstVertex, uint32_t instanceCount)=0
 Records a draw command that renders one or more instances of primitives using the number of vertices provided. More...
 
virtual HGI_API void DrawIndirect (HgiBufferHandle const &drawParameterBuffer, uint32_t drawBufferOffset, uint32_t drawCount, uint32_t stride)=0
 Records a multi-draw command that reads the draw parameters from a provided drawParameterBuffer. More...
 
virtual HGI_API void DrawIndexed (HgiBufferHandle const &indexBuffer, uint32_t indexCount, uint32_t indexBufferByteOffset, uint32_t vertexOffset, uint32_t instanceCount)=0
 Records a draw command that renders one or more instances of primitives using an indexBuffer starting from the base vertex. More...
 
virtual HGI_API void DrawIndexedIndirect (HgiBufferHandle const &indexBuffer, HgiBufferHandle const &drawParameterBuffer, uint32_t drawBufferOffset, uint32_t drawCount, uint32_t stride)=0
 Records a indexed multi-draw command that reads the draw parameters from a provided drawParameterBuffer, and indices from indexBuffer. More...
 
- Public Member Functions inherited from HgiCmds
HGI_API bool IsSubmitted () const
 Returns true if the HgiCmds object has been submitted to GPU. More...
 

Additional Inherited Members

- Protected Member Functions inherited from HgiCmds
virtual HGI_API bool _Submit (Hgi *hgi, HgiSubmitWaitType wait)
 
HGI_API void _SetSubmitted ()
 

Detailed Description

A graphics API independent abstraction of graphics commands.

HgiGraphicsCmds is a lightweight object that cannot be re-used after it has been submitted. A new cmds object should be acquired for each frame.

Definition at line 47 of file graphicsCmds.h.

Member Function Documentation

virtual HGI_API void BindPipeline ( HgiGraphicsPipelineHandle  pipeline)
pure virtual

Bind a pipeline state object.

Usually you call this right after calling CreateGraphicsCmds to set the graphics pipeline state. The resource bindings used when creating the pipeline must be compatible with the resources bound via BindResources().

Implemented in HgiGLGraphicsCmds, and HgiMetalGraphicsCmds.

virtual HGI_API void BindResources ( HgiResourceBindingsHandle  resources)
pure virtual

Bind resources such as textures and uniform buffers.

Usually you call this right after BindPipeline() and the resources bound must be compatible with the bound pipeline.

Implemented in HgiGLGraphicsCmds, and HgiMetalGraphicsCmds.

virtual HGI_API void BindVertexBuffers ( uint32_t  firstBinding,
HgiBufferHandleVector const &  buffers,
std::vector< uint32_t > const &  byteOffsets 
)
pure virtual

Binds the vertex buffer(s) that describe the vertex attributes.

firstBinding the first index to which buffers are bound (usually 0). byteOffsets offset to where the data of each buffer starts, in bytes. strides the size of a vertex in each of the buffers.

Implemented in HgiGLGraphicsCmds, and HgiMetalGraphicsCmds.

virtual HGI_API void Draw ( uint32_t  vertexCount,
uint32_t  firstVertex,
uint32_t  instanceCount 
)
pure virtual

Records a draw command that renders one or more instances of primitives using the number of vertices provided.

The 'primitive type' (eg. Lines, Triangles, etc) can be acquired from the bound HgiPipeline. vertexCount: The number of vertices to draw. firstVertex: The index of the first vertex to draw. instanceCount: Number of instances to draw.

Implemented in HgiGLGraphicsCmds, and HgiMetalGraphicsCmds.

virtual HGI_API void DrawIndexed ( HgiBufferHandle const &  indexBuffer,
uint32_t  indexCount,
uint32_t  indexBufferByteOffset,
uint32_t  vertexOffset,
uint32_t  instanceCount 
)
pure virtual

Records a draw command that renders one or more instances of primitives using an indexBuffer starting from the base vertex.

The 'primitive type' (eg. Lines, Triangles, etc) can be acquired from the bound HgiPipeline. indexCount: The number of indices in the index buffer (num vertices). indexBufferByteOffset: Byte offset within index buffer to start reading the indices from. vertexOffset: The value added to the vertex index before indexing into the vertex buffer (baseVertex). instanceCount: Number of instances to draw.

Implemented in HgiGLGraphicsCmds, and HgiMetalGraphicsCmds.

virtual HGI_API void DrawIndexedIndirect ( HgiBufferHandle const &  indexBuffer,
HgiBufferHandle const &  drawParameterBuffer,
uint32_t  drawBufferOffset,
uint32_t  drawCount,
uint32_t  stride 
)
pure virtual

Records a indexed multi-draw command that reads the draw parameters from a provided drawParameterBuffer, and indices from indexBuffer.

The 'primitive type' (eg. Lines, Triangles, etc) can be acquired from the bound HgiPipeline. drawParameterBuffer: an array of structures: drawBufferOffset: Byte offset where the draw parameters begin. drawCount: The number of draws to execute. stride: byte stride between successive sets of draw parameters.

Implemented in HgiGLGraphicsCmds, and HgiMetalGraphicsCmds.

virtual HGI_API void DrawIndirect ( HgiBufferHandle const &  drawParameterBuffer,
uint32_t  drawBufferOffset,
uint32_t  drawCount,
uint32_t  stride 
)
pure virtual

Records a multi-draw command that reads the draw parameters from a provided drawParameterBuffer.

The 'primitive type' (eg. Lines, Triangles, etc) can be acquired from the bound HgiPipeline. drawParameterBuffer: an array of structures: drawBufferOffset: Byte offset where the draw parameters begin. drawCount: The number of draws to execute. stride: byte stride between successive sets of draw parameters.

Implemented in HgiGLGraphicsCmds, and HgiMetalGraphicsCmds.

virtual HGI_API void PopDebugGroup ( )
pure virtual

Pop the last debug marker.

Implemented in HgiMetalGraphicsCmds, and HgiGLGraphicsCmds.

virtual HGI_API void PushDebugGroup ( const char *  label)
pure virtual

Push a debug marker.

Implemented in HgiMetalGraphicsCmds, and HgiGLGraphicsCmds.

virtual HGI_API void SetConstantValues ( HgiGraphicsPipelineHandle  pipeline,
HgiShaderStage  stages,
uint32_t  bindIndex,
uint32_t  byteSize,
const void *  data 
)
pure virtual

Set Push / Function constants.

pipeline is the pipeline that you are binding before the draw call. It contains the program used for the uniform buffer stages describes for what shader stage you are setting the push constant values for. Each stage can have its own (or none) binding and they must match what is described in the shader functions. bindIndex is the binding point index in the pipeline's shader to bind the data to. byteSize is the size of the data you are updating. data is the data you are copying into the push constants block.

Implemented in HgiGLGraphicsCmds, and HgiMetalGraphicsCmds.

virtual HGI_API void SetScissor ( GfVec4i const &  sc)
pure virtual

Only pixels that lie within the scissor box are modified by drawing commands.

Implemented in HgiGLGraphicsCmds, and HgiMetalGraphicsCmds.

virtual HGI_API void SetViewport ( GfVec4i const &  vp)
pure virtual

Set viewport [left, BOTTOM, width, height] - OpenGL coords.

Implemented in HgiGLGraphicsCmds, and HgiMetalGraphicsCmds.


The documentation for this class was generated from the following file: