Loading...
Searching...
No Matches
HgiTexture Class Referenceabstract

Represents a graphics platform independent GPU texture resource. More...

#include <texture.h>

+ Inheritance diagram for HgiTexture:

Public Member Functions

HGI_API HgiTextureDesc const & GetDescriptor () const
 The descriptor describes the object.
 
virtual HGI_API size_t GetByteSizeOfResource () const =0
 Returns the byte size of the GPU texture.
 
virtual HGI_API uint64_t GetRawResource () const =0
 This function returns the handle to the Hgi backend's gpu resource, cast to a uint64_t.
 
virtual HGI_API void SubmitLayoutChange (HgiTextureUsage newLayout)=0
 This function initiates a layout change process on this texture resource.
 

Protected Member Functions

HGI_API HgiTexture (HgiTextureDesc const &desc)
 

Static Protected Member Functions

static HGI_API size_t _GetByteSizeOfResource (const HgiTextureDesc &descriptor)
 

Protected Attributes

HgiTextureDesc _descriptor
 

Detailed Description

Represents a graphics platform independent GPU texture resource.

Textures should be created via Hgi::CreateTexture.

Base class for Hgi textures. To the client (HdSt) texture resources are referred to via opaque, stateless handles (HgTextureHandle).

Definition at line 160 of file texture.h.

Member Function Documentation

◆ GetByteSizeOfResource()

virtual HGI_API size_t GetByteSizeOfResource ( ) const
pure virtual

Returns the byte size of the GPU texture.

This can be helpful if the application wishes to tally up memory usage.

Implemented in HgiGLTexture.

◆ GetDescriptor()

HGI_API HgiTextureDesc const & GetDescriptor ( ) const

The descriptor describes the object.

◆ GetRawResource()

virtual HGI_API uint64_t GetRawResource ( ) const
pure virtual

This function returns the handle to the Hgi backend's gpu resource, cast to a uint64_t.

Clients should avoid using this function and instead use Hgi base classes so that client code works with any Hgi platform. For transitioning code to Hgi, it can however we useful to directly access a platform's internal resource handles. There is no safety provided in using this. If you by accident pass a HgiMetal resource into an OpenGL call, bad things may happen. In OpenGL this returns the GLuint resource name. In Metal this returns the id<MTLTexture> as uint64_t. In Vulkan this returns the VkImage as uint64_t. In DX12 this returns the ID3D12Resource pointer as uint64_t.

Implemented in HgiGLTexture.

◆ SubmitLayoutChange()

virtual HGI_API void SubmitLayoutChange ( HgiTextureUsage  newLayout)
pure virtual

This function initiates a layout change process on this texture resource.

This feature is at the moment required explicitly by explicit APIs like Vulkan.

Implemented in HgiGLTexture.

Member Data Documentation

◆ _descriptor

HgiTextureDesc _descriptor
protected

Definition at line 203 of file texture.h.


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