|
OpenGL implementation of the Hydra Graphics Interface. More...
#include <hgi.h>
Public Member Functions | |
HGIGL_API bool | IsBackendSupported () const override |
HGIGL_API HgiGraphicsCmdsUniquePtr | CreateGraphicsCmds (HgiGraphicsCmdsDesc const &desc) override |
Returns a GraphicsCmds object (for temporary use) that is ready to record draw commands. | |
HGIGL_API HgiBlitCmdsUniquePtr | CreateBlitCmds () override |
Returns a BlitCmds object (for temporary use) that is ready to execute resource copy commands. | |
HGIGL_API HgiComputeCmdsUniquePtr | CreateComputeCmds (HgiComputeCmdsDesc const &desc) override |
Returns a ComputeCmds object (for temporary use) that is ready to record dispatch commands. | |
HGIGL_API HgiTextureHandle | CreateTexture (HgiTextureDesc const &desc) override |
Create a texture in rendering backend. | |
HGIGL_API void | DestroyTexture (HgiTextureHandle *texHandle) override |
Destroy a texture in rendering backend. | |
HGIGL_API HgiTextureViewHandle | CreateTextureView (HgiTextureViewDesc const &desc) override |
Create a texture view in rendering backend. | |
HGIGL_API void | DestroyTextureView (HgiTextureViewHandle *viewHandle) override |
Destroy a texture view in rendering backend. | |
HGIGL_API HgiSamplerHandle | CreateSampler (HgiSamplerDesc const &desc) override |
Create a sampler in rendering backend. | |
HGIGL_API void | DestroySampler (HgiSamplerHandle *smpHandle) override |
Destroy a sampler in rendering backend. | |
HGIGL_API HgiBufferHandle | CreateBuffer (HgiBufferDesc const &desc) override |
Create a buffer in rendering backend. | |
HGIGL_API void | DestroyBuffer (HgiBufferHandle *bufHandle) override |
Destroy a buffer in rendering backend. | |
HGIGL_API HgiShaderFunctionHandle | CreateShaderFunction (HgiShaderFunctionDesc const &desc) override |
Create a new shader function. | |
HGIGL_API void | DestroyShaderFunction (HgiShaderFunctionHandle *shaderFunctionHandle) override |
Destroy a shader function. | |
HGIGL_API HgiShaderProgramHandle | CreateShaderProgram (HgiShaderProgramDesc const &desc) override |
Create a new shader program. | |
HGIGL_API void | DestroyShaderProgram (HgiShaderProgramHandle *shaderProgramHandle) override |
Destroy a shader program. | |
HGIGL_API HgiResourceBindingsHandle | CreateResourceBindings (HgiResourceBindingsDesc const &desc) override |
Create a new resource binding object. | |
HGIGL_API void | DestroyResourceBindings (HgiResourceBindingsHandle *resHandle) override |
Destroy a resource binding object. | |
HGIGL_API HgiGraphicsPipelineHandle | CreateGraphicsPipeline (HgiGraphicsPipelineDesc const &pipeDesc) override |
Create a new graphics pipeline state object. | |
HGIGL_API void | DestroyGraphicsPipeline (HgiGraphicsPipelineHandle *pipeHandle) override |
Destroy a graphics pipeline state object. | |
HGIGL_API HgiComputePipelineHandle | CreateComputePipeline (HgiComputePipelineDesc const &pipeDesc) override |
Create a new compute pipeline state object. | |
HGIGL_API void | DestroyComputePipeline (HgiComputePipelineHandle *pipeHandle) override |
Destroy a compute pipeline state object. | |
HGIGL_API TfToken const & | GetAPIName () const override |
Return the name of the api (e.g. | |
HGIGL_API HgiGLCapabilities const * | GetCapabilities () const override |
Returns the device-specific capabilities structure. | |
HGIGL_API HgiIndirectCommandEncoder * | GetIndirectCommandEncoder () const override |
Returns the device-specific indirect command buffer encoder or nullptr if not supported. | |
HGIGL_API void | StartFrame () override |
Optionally called by client app at the start of a new rendering frame. | |
HGIGL_API void | EndFrame () override |
Optionally called at the end of a rendering frame. | |
HGIGL_API HgiGLDevice * | GetPrimaryDevice () const |
HGIGL_API HgiGLContextArenaHandle | CreateContextArena () |
HGIGL_API void | DestroyContextArena (HgiGLContextArenaHandle *arenaHandle) |
Destroy a context arena. | |
HGIGL_API void | SetContextArena (HgiGLContextArenaHandle const &arenaHandle) |
Set the context arena to manage container resources (currently limited to framebuffer objects) for graphics commands submitted subsequently. | |
Public Member Functions inherited from Hgi | |
HGI_API void | SubmitCmds (HgiCmds *cmds, HgiSubmitWaitType wait=HgiSubmitWaitTypeNoWait) |
Submit one HgiCmds objects. | |
virtual HGI_API bool | IsBackendSupported () const =0 |
Determine if Hgi instance can run on current hardware. | |
virtual HGI_API HgiGraphicsCmdsUniquePtr | CreateGraphicsCmds (HgiGraphicsCmdsDesc const &desc)=0 |
Returns a GraphicsCmds object (for temporary use) that is ready to record draw commands. | |
virtual HGI_API HgiBlitCmdsUniquePtr | CreateBlitCmds ()=0 |
Returns a BlitCmds object (for temporary use) that is ready to execute resource copy commands. | |
virtual HGI_API HgiComputeCmdsUniquePtr | CreateComputeCmds (HgiComputeCmdsDesc const &desc)=0 |
Returns a ComputeCmds object (for temporary use) that is ready to record dispatch commands. | |
virtual HGI_API HgiTextureHandle | CreateTexture (HgiTextureDesc const &desc)=0 |
Create a texture in rendering backend. | |
virtual HGI_API void | DestroyTexture (HgiTextureHandle *texHandle)=0 |
Destroy a texture in rendering backend. | |
virtual HGI_API HgiTextureViewHandle | CreateTextureView (HgiTextureViewDesc const &desc)=0 |
Create a texture view in rendering backend. | |
virtual HGI_API void | DestroyTextureView (HgiTextureViewHandle *viewHandle)=0 |
Destroy a texture view in rendering backend. | |
virtual HGI_API HgiSamplerHandle | CreateSampler (HgiSamplerDesc const &desc)=0 |
Create a sampler in rendering backend. | |
virtual HGI_API void | DestroySampler (HgiSamplerHandle *smpHandle)=0 |
Destroy a sampler in rendering backend. | |
virtual HGI_API HgiBufferHandle | CreateBuffer (HgiBufferDesc const &desc)=0 |
Create a buffer in rendering backend. | |
virtual HGI_API void | DestroyBuffer (HgiBufferHandle *bufHandle)=0 |
Destroy a buffer in rendering backend. | |
virtual HGI_API HgiShaderFunctionHandle | CreateShaderFunction (HgiShaderFunctionDesc const &desc)=0 |
Create a new shader function. | |
virtual HGI_API void | DestroyShaderFunction (HgiShaderFunctionHandle *shaderFunctionHandle)=0 |
Destroy a shader function. | |
virtual HGI_API HgiShaderProgramHandle | CreateShaderProgram (HgiShaderProgramDesc const &desc)=0 |
Create a new shader program. | |
virtual HGI_API void | DestroyShaderProgram (HgiShaderProgramHandle *shaderProgramHandle)=0 |
Destroy a shader program. | |
virtual HGI_API HgiResourceBindingsHandle | CreateResourceBindings (HgiResourceBindingsDesc const &desc)=0 |
Create a new resource binding object. | |
virtual HGI_API void | DestroyResourceBindings (HgiResourceBindingsHandle *resHandle)=0 |
Destroy a resource binding object. | |
virtual HGI_API HgiGraphicsPipelineHandle | CreateGraphicsPipeline (HgiGraphicsPipelineDesc const &pipeDesc)=0 |
Create a new graphics pipeline state object. | |
virtual HGI_API void | DestroyGraphicsPipeline (HgiGraphicsPipelineHandle *pipeHandle)=0 |
Destroy a graphics pipeline state object. | |
virtual HGI_API HgiComputePipelineHandle | CreateComputePipeline (HgiComputePipelineDesc const &pipeDesc)=0 |
Create a new compute pipeline state object. | |
virtual HGI_API void | DestroyComputePipeline (HgiComputePipelineHandle *pipeHandle)=0 |
Destroy a compute pipeline state object. | |
virtual HGI_API TfToken const & | GetAPIName () const =0 |
Return the name of the api (e.g. | |
virtual HGI_API HgiCapabilities const * | GetCapabilities () const =0 |
Returns the device-specific capabilities structure. | |
virtual HGI_API HgiIndirectCommandEncoder * | GetIndirectCommandEncoder () const =0 |
Returns the device-specific indirect command buffer encoder or nullptr if not supported. | |
virtual HGI_API void | StartFrame ()=0 |
Optionally called by client app at the start of a new rendering frame. | |
virtual HGI_API void | EndFrame ()=0 |
Optionally called at the end of a rendering frame. | |
Protected Member Functions | |
HGIGL_API bool | _SubmitCmds (HgiCmds *cmds, HgiSubmitWaitType wait) override |
Protected Member Functions inherited from Hgi | |
HGI_API uint64_t | GetUniqueId () |
virtual HGI_API bool | _SubmitCmds (HgiCmds *cmds, HgiSubmitWaitType wait) |
Additional Inherited Members | |
Static Public Member Functions inherited from Hgi | |
static HGI_API Hgi * | GetPlatformDefaultHgi () |
*** DEPRECATED *** Please use: CreatePlatformDefaultHgi | |
static HGI_API HgiUniquePtr | CreatePlatformDefaultHgi () |
Helper function to return a Hgi object for the current platform. | |
static HGI_API HgiUniquePtr | CreateNamedHgi (const TfToken &hgiToken) |
Helper function to return a Hgi object of choice supported by current platform and build configuration. | |
static HGI_API bool | IsSupported (const TfToken &hgiToken=TfToken()) |
Constructs a temporary Hgi object and calls the object's IsBackendSupported() function. | |
OpenGL implementation of the Hydra Graphics Interface.
HgiGL expects any GL context(s) to be externally managed. When HgiGL is constructed and during any of its resource create / destroy calls and during command recording operations, it expects that an OpenGL context is valid and current.
When an application uses the same HgiGL instance from multiple GL contexts, the expectations are that:
In the absence of an application provided context arena, the default arena is used with the implied expectation that the same GL context is valid and current for the lifetime of the HgiGL instance.
|
overrideprotectedvirtual |
Reimplemented from Hgi.
|
overridevirtual |
Returns a BlitCmds object (for temporary use) that is ready to execute resource copy commands.
BlitCmds is a lightweight object that should be re-acquired each frame (don't hold onto it after EndEncoding). Thread safety: Each Hgi backend must ensure that a Cmds object can be created on the main thread, recorded into (exclusively) by one secondary thread and be submitted on the main thread. See notes above.
Implements Hgi.
|
overridevirtual |
Create a buffer in rendering backend.
Thread safety: Creation must happen on main thread. See notes above.
Implements Hgi.
|
overridevirtual |
Returns a ComputeCmds object (for temporary use) that is ready to record dispatch commands.
ComputeCmds is a lightweight object that should be re-acquired each frame (don't hold onto it after EndEncoding). Thread safety: Each Hgi backend must ensure that a Cmds object can be created on the main thread, recorded into (exclusively) by one secondary thread and be submitted on the main thread. See notes above.
Implements Hgi.
|
overridevirtual |
Create a new compute pipeline state object.
Thread safety: Creation must happen on main thread. See notes above.
Implements Hgi.
HGIGL_API HgiGLContextArenaHandle CreateContextArena | ( | ) |
Context arena API Please refer to "GL Context Management" for usage expectations.
Creates and return a context arena object handle.
|
overridevirtual |
Returns a GraphicsCmds object (for temporary use) that is ready to record draw commands.
GraphicsCmds is a lightweight object that should be re-acquired each frame (don't hold onto it after EndEncoding). Thread safety: Each Hgi backend must ensure that a Cmds object can be created on the main thread, recorded into (exclusively) by one secondary thread and be submitted on the main thread. See notes above.
Implements Hgi.
|
overridevirtual |
Create a new graphics pipeline state object.
Thread safety: Creation must happen on main thread. See notes above.
Implements Hgi.
|
overridevirtual |
Create a new resource binding object.
Thread safety: Creation must happen on main thread. See notes above.
Implements Hgi.
|
overridevirtual |
Create a sampler in rendering backend.
Thread safety: Creation must happen on main thread. See notes above.
Implements Hgi.
|
overridevirtual |
Create a new shader function.
Thread safety: Creation must happen on main thread. See notes above.
Implements Hgi.
|
overridevirtual |
Create a new shader program.
Thread safety: Creation must happen on main thread. See notes above.
Implements Hgi.
|
overridevirtual |
Create a texture in rendering backend.
Thread safety: Creation must happen on main thread. See notes above.
Implements Hgi.
|
overridevirtual |
Create a texture view in rendering backend.
A texture view aliases another texture's data. It is the responsibility of the client to ensure that the sourceTexture is not destroyed while the texture view is in use. Thread safety: Creation must happen on main thread. See notes above.
Implements Hgi.
|
overridevirtual |
Destroy a buffer in rendering backend.
Thread safety: Destruction must happen on main thread. See notes above.
Implements Hgi.
|
overridevirtual |
Destroy a compute pipeline state object.
Thread safety: Destruction must happen on main thread. See notes above.
Implements Hgi.
HGIGL_API void DestroyContextArena | ( | HgiGLContextArenaHandle * | arenaHandle | ) |
Destroy a context arena.
Note: The context arena must be unset (by calling SetContextArena with an empty handle) prior to destruction.
|
overridevirtual |
Destroy a graphics pipeline state object.
Thread safety: Destruction must happen on main thread. See notes above.
Implements Hgi.
|
overridevirtual |
Destroy a resource binding object.
Thread safety: Destruction must happen on main thread. See notes above.
Implements Hgi.
|
overridevirtual |
Destroy a sampler in rendering backend.
Thread safety: Destruction must happen on main thread. See notes above.
Implements Hgi.
|
overridevirtual |
Destroy a shader function.
Thread safety: Destruction must happen on main thread. See notes above.
Implements Hgi.
|
overridevirtual |
Destroy a shader program.
Note that this does NOT automatically destroy the shader functions in the program since shader functions may be used by more than one program. Thread safety: Destruction must happen on main thread. See notes above.
Implements Hgi.
|
overridevirtual |
Destroy a texture in rendering backend.
Thread safety: Destruction must happen on main thread. See notes above.
Implements Hgi.
|
overridevirtual |
Destroy a texture view in rendering backend.
This will destroy the view's texture, but not the sourceTexture that was aliased by the view. The sourceTexture data remains unchanged. Thread safety: Destruction must happen on main thread. See notes above.
Implements Hgi.
|
overridevirtual |
Optionally called at the end of a rendering frame.
Please read the comments in StartFrame. Thread safety: Not thread safe. Should be called on the main thread.
Implements Hgi.
|
overridevirtual |
Return the name of the api (e.g.
"OpenGL"). Thread safety: This call is thread safe.
Implements Hgi.
|
overridevirtual |
Returns the device-specific capabilities structure.
Thread safety: This call is thread safe.
Implements Hgi.
|
overridevirtual |
Returns the device-specific indirect command buffer encoder or nullptr if not supported.
Thread safety: This call is thread safe.
Implements Hgi.
HGIGL_API HgiGLDevice * GetPrimaryDevice | ( | ) | const |
|
overridevirtual |
HGIGL_API void SetContextArena | ( | HgiGLContextArenaHandle const & | arenaHandle | ) |
Set the context arena to manage container resources (currently limited to framebuffer objects) for graphics commands submitted subsequently.
|
overridevirtual |
Optionally called by client app at the start of a new rendering frame.
We can't rely on StartFrame for anything important, because it is up to the external client to (optionally) call this and they may never do. Hydra doesn't have a clearly defined start or end frame. This can be helpful to insert GPU frame debug markers. Thread safety: Not thread safe. Should be called on the main thread.
Implements Hgi.