HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
HgiGL Class Referencefinal

#include <hgi.h>

+ Inheritance diagram for HgiGL:

Public Member Functions

HGIGL_API HgiGL ()
 
HGIGL_API ~HgiGL () override
 
HGIGL_API bool IsBackendSupported () const override
 
HGIGL_API HgiGraphicsCmdsUniquePtr CreateGraphicsCmds (HgiGraphicsCmdsDesc const &desc) override
 
HGIGL_API HgiBlitCmdsUniquePtr CreateBlitCmds () override
 
HGIGL_API HgiComputeCmdsUniquePtr CreateComputeCmds (HgiComputeCmdsDesc const &desc) override
 
HGIGL_API HgiTextureHandle CreateTexture (HgiTextureDesc const &desc) override
 
HGIGL_API void DestroyTexture (HgiTextureHandle *texHandle) override
 
HGIGL_API HgiTextureViewHandle CreateTextureView (HgiTextureViewDesc const &desc) override
 
HGIGL_API void DestroyTextureView (HgiTextureViewHandle *viewHandle) override
 
HGIGL_API HgiSamplerHandle CreateSampler (HgiSamplerDesc const &desc) override
 
HGIGL_API void DestroySampler (HgiSamplerHandle *smpHandle) override
 
HGIGL_API HgiBufferHandle CreateBuffer (HgiBufferDesc const &desc) override
 
HGIGL_API void DestroyBuffer (HgiBufferHandle *bufHandle) override
 
HGIGL_API HgiShaderFunctionHandle CreateShaderFunction (HgiShaderFunctionDesc const &desc) override
 
HGIGL_API void DestroyShaderFunction (HgiShaderFunctionHandle *shaderFunctionHandle) override
 
HGIGL_API HgiShaderProgramHandle CreateShaderProgram (HgiShaderProgramDesc const &desc) override
 
HGIGL_API void DestroyShaderProgram (HgiShaderProgramHandle *shaderProgramHandle) override
 
HGIGL_API HgiResourceBindingsHandle CreateResourceBindings (HgiResourceBindingsDesc const &desc) override
 
HGIGL_API void DestroyResourceBindings (HgiResourceBindingsHandle *resHandle) override
 
HGIGL_API HgiGraphicsPipelineHandle CreateGraphicsPipeline (HgiGraphicsPipelineDesc const &pipeDesc) override
 
HGIGL_API void DestroyGraphicsPipeline (HgiGraphicsPipelineHandle *pipeHandle) override
 
HGIGL_API HgiComputePipelineHandle CreateComputePipeline (HgiComputePipelineDesc const &pipeDesc) override
 
HGIGL_API void DestroyComputePipeline (HgiComputePipelineHandle *pipeHandle) override
 
HGIGL_API TfToken constGetAPIName () const override
 
HGIGL_API HgiGLCapabilities constGetCapabilities () const override
 
HGIGL_API
HgiIndirectCommandEncoder
GetIndirectCommandEncoder () const override
 
HGIGL_API void StartFrame () override
 
HGIGL_API void EndFrame () override
 
HGIGL_API HgiGLDeviceGetPrimaryDevice () const
 
More...
 
HGIGL_API HgiGLContextArenaHandle CreateContextArena ()
 
HGIGL_API void DestroyContextArena (HgiGLContextArenaHandle *arenaHandle)
 
HGIGL_API void SetContextArena (HgiGLContextArenaHandle const &arenaHandle)
 
- Public Member Functions inherited from Hgi
HGI_API Hgi ()
 
virtual HGI_API ~Hgi ()
 
HGI_API void SubmitCmds (HgiCmds *cmds, HgiSubmitWaitType wait=HgiSubmitWaitTypeNoWait)
 

Protected Member Functions

HGIGL_API bool _SubmitCmds (HgiCmds *cmds, HgiSubmitWaitType wait) override
 
- Protected Member Functions inherited from Hgi
HGI_API uint64_t GetUniqueId ()
 

Additional Inherited Members

- Static Public Member Functions inherited from Hgi
static HGI_API HgiGetPlatformDefaultHgi ()
 *** DEPRECATED *** Please use: CreatePlatformDefaultHgi More...
 
static HGI_API HgiUniquePtr CreatePlatformDefaultHgi ()
 
static HGI_API bool IsSupported ()
 

Detailed Description

OpenGL implementation of the Hydra Graphics Interface.

Context Management

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:

  1. The application has set up sharing amongst the various GL contexts. This ensures that any non-container resources created may be shared amongst the contexts. These shared resources may be safely deleted from any context in the share group.
  2. A context arena (see relevant API below) is used per GL context to manage container resources that can't be shared amongst GL contexts. Currently, HgiGL's support is limited to framebuffer objects.

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.

Definition at line 71 of file hgi.h.

Constructor & Destructor Documentation

HGIGL_API HgiGL::HgiGL ( )
HGIGL_API HgiGL::~HgiGL ( )
override

Member Function Documentation

HGIGL_API bool HgiGL::_SubmitCmds ( HgiCmds cmds,
HgiSubmitWaitType  wait 
)
overrideprotectedvirtual

Reimplemented from Hgi.

HGIGL_API HgiBlitCmdsUniquePtr HgiGL::CreateBlitCmds ( )
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.

HGIGL_API HgiBufferHandle HgiGL::CreateBuffer ( HgiBufferDesc const desc)
overridevirtual

Create a buffer in rendering backend. Thread safety: Creation must happen on main thread. See notes above.

Implements Hgi.

HGIGL_API HgiComputeCmdsUniquePtr HgiGL::CreateComputeCmds ( HgiComputeCmdsDesc const desc)
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.

HGIGL_API HgiComputePipelineHandle HgiGL::CreateComputePipeline ( HgiComputePipelineDesc const pipeDesc)
overridevirtual

Create a new compute pipeline state object. Thread safety: Creation must happen on main thread. See notes above.

Implements Hgi.

HGIGL_API HgiGLContextArenaHandle HgiGL::CreateContextArena ( )

Context arena API Please refer to "GL Context Management" for usage expectations.

Creates and return a context arena object handle.

HGIGL_API HgiGraphicsCmdsUniquePtr HgiGL::CreateGraphicsCmds ( HgiGraphicsCmdsDesc const desc)
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.

HGIGL_API HgiGraphicsPipelineHandle HgiGL::CreateGraphicsPipeline ( HgiGraphicsPipelineDesc const pipeDesc)
overridevirtual

Create a new graphics pipeline state object. Thread safety: Creation must happen on main thread. See notes above.

Implements Hgi.

HGIGL_API HgiResourceBindingsHandle HgiGL::CreateResourceBindings ( HgiResourceBindingsDesc const desc)
overridevirtual

Create a new resource binding object. Thread safety: Creation must happen on main thread. See notes above.

Implements Hgi.

HGIGL_API HgiSamplerHandle HgiGL::CreateSampler ( HgiSamplerDesc const desc)
overridevirtual

Create a sampler in rendering backend. Thread safety: Creation must happen on main thread. See notes above.

Implements Hgi.

HGIGL_API HgiShaderFunctionHandle HgiGL::CreateShaderFunction ( HgiShaderFunctionDesc const desc)
overridevirtual

Create a new shader function. Thread safety: Creation must happen on main thread. See notes above.

Implements Hgi.

HGIGL_API HgiShaderProgramHandle HgiGL::CreateShaderProgram ( HgiShaderProgramDesc const desc)
overridevirtual

Create a new shader program. Thread safety: Creation must happen on main thread. See notes above.

Implements Hgi.

HGIGL_API HgiTextureHandle HgiGL::CreateTexture ( HgiTextureDesc const desc)
overridevirtual

Create a texture in rendering backend. Thread safety: Creation must happen on main thread. See notes above.

Implements Hgi.

HGIGL_API HgiTextureViewHandle HgiGL::CreateTextureView ( HgiTextureViewDesc const desc)
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.

HGIGL_API void HgiGL::DestroyBuffer ( HgiBufferHandle bufHandle)
overridevirtual

Destroy a buffer in rendering backend. Thread safety: Destruction must happen on main thread. See notes above.

Implements Hgi.

HGIGL_API void HgiGL::DestroyComputePipeline ( HgiComputePipelineHandle pipeHandle)
overridevirtual

Destroy a compute pipeline state object. Thread safety: Destruction must happen on main thread. See notes above.

Implements Hgi.

HGIGL_API void HgiGL::DestroyContextArena ( HgiGLContextArenaHandle arenaHandle)

Destroy a context arena. Note: The context arena must be unset (by calling SetContextArena with an empty handle) prior to destruction.

HGIGL_API void HgiGL::DestroyGraphicsPipeline ( HgiGraphicsPipelineHandle pipeHandle)
overridevirtual

Destroy a graphics pipeline state object. Thread safety: Destruction must happen on main thread. See notes above.

Implements Hgi.

HGIGL_API void HgiGL::DestroyResourceBindings ( HgiResourceBindingsHandle resHandle)
overridevirtual

Destroy a resource binding object. Thread safety: Destruction must happen on main thread. See notes above.

Implements Hgi.

HGIGL_API void HgiGL::DestroySampler ( HgiSamplerHandle smpHandle)
overridevirtual

Destroy a sampler in rendering backend. Thread safety: Destruction must happen on main thread. See notes above.

Implements Hgi.

HGIGL_API void HgiGL::DestroyShaderFunction ( HgiShaderFunctionHandle shaderFunctionHandle)
overridevirtual

Destroy a shader function. Thread safety: Destruction must happen on main thread. See notes above.

Implements Hgi.

HGIGL_API void HgiGL::DestroyShaderProgram ( HgiShaderProgramHandle shaderProgramHandle)
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.

HGIGL_API void HgiGL::DestroyTexture ( HgiTextureHandle texHandle)
overridevirtual

Destroy a texture in rendering backend. Thread safety: Destruction must happen on main thread. See notes above.

Implements Hgi.

HGIGL_API void HgiGL::DestroyTextureView ( HgiTextureViewHandle viewHandle)
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.

HGIGL_API void HgiGL::EndFrame ( )
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.

HGIGL_API TfToken const& HgiGL::GetAPIName ( ) const
overridevirtual

Return the name of the api (e.g. "OpenGL"). Thread safety: This call is thread safe.

Implements Hgi.

HGIGL_API HgiGLCapabilities const* HgiGL::GetCapabilities ( ) const
overridevirtual

Returns the device-specific capabilities structure. Thread safety: This call is thread safe.

Implements Hgi.

HGIGL_API HgiIndirectCommandEncoder* HgiGL::GetIndirectCommandEncoder ( ) const
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* HgiGL::GetPrimaryDevice ( ) const



HGIGL_API bool HgiGL::IsBackendSupported ( ) const
overridevirtual

Virtual API

Implements Hgi.

HGIGL_API void HgiGL::SetContextArena ( HgiGLContextArenaHandle const arenaHandle)

Set the context arena to manage container resources (currently limited to framebuffer objects) for graphics commands submitted subsequently.

HGIGL_API void HgiGL::StartFrame ( )
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.


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