HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
HdStTextureResourceHandle Class Reference

#include <textureResourceHandle.h>

Public Member Functions

HDST_API HdStTextureResourceHandle (HdStTextureResourceSharedPtr const &textureResource=nullptr)
 
virtual HDST_API ~HdStTextureResourceHandle ()
 
HDST_API
HdStTextureResourceSharedPtr
const
GetTextureResource () const
 
HDST_API void SetTextureResource (HdStTextureResourceSharedPtr const &textureResource)
 

Static Public Member Functions

static HDST_API
HdTextureResource::ID 
GetHandleKey (HdRenderIndex const *renderIndex, SdfPath const &textureHandleId)
 
static HDST_API bool IsIncompatibleTextureResource (HdStTextureResourceSharedPtr const &a, HdStTextureResourceSharedPtr const &b)
 

Detailed Description

HdStTextureResourceHandle is an indirect handle to a GL texture resource

This class provides a way for an HdStTextureResource to be registered for a specific scene path. This allows clients (e.g. shader code) to access the most recently registered texture resource without having to directly observe changes to upstream material, texture, or drawtarget texture resource changes.

The underlying HdStTextureResource instances are typically created outside of HdSt. They are obtained from the scene delegate and are registered with the resource registry via an HdTextureResource::ID which is also provided by the scene delegate.

Clients which use HdStTexture resources (e.g. shader code) get the underlying GL texture object and GL sampler object IDs from the texture resource.

So: HdStShaderCode has an array of texture descriptors holding HdStTextureResourceHandles. HdStShaderCode binds GL texture and sampler objects for the current set of underlying HdStTextureResource instances.

HdStTexture Bprim and HdStDrawTarget Sprim and HdStMaterial Sprim register HdStTextureResource instances with their scene delegate provided HdTextureResource::ID and also register their current HdStTextureResource instances with scene path locations using HdStTextureResourceHandles.

HdStMaterial Sprim can assign HdStTextureResourceHandles to HdStShaderCode to satisfy input texture scene path connections and allow HdStShaderCode to resolve GL texture and sampler objects during resource bind/unbind.

We then need to propagate dirtiness from HdTexture to HdMaterial only when an incompatible change is made to the texture resource binding, avoiding an expensive invalidation, e.g. for animated texture sources.

This class provides static helper methods to compute registry keys and to identify incompatible texture resource changes.

Definition at line 86 of file textureResourceHandle.h.

Constructor & Destructor Documentation

HDST_API HdStTextureResourceHandle::HdStTextureResourceHandle ( HdStTextureResourceSharedPtr const textureResource = nullptr)
virtual HDST_API HdStTextureResourceHandle::~HdStTextureResourceHandle ( )
virtual

Member Function Documentation

static HDST_API HdTextureResource::ID HdStTextureResourceHandle::GetHandleKey ( HdRenderIndex const renderIndex,
SdfPath const textureHandleId 
)
static
HDST_API HdStTextureResourceSharedPtr const& HdStTextureResourceHandle::GetTextureResource ( ) const
static HDST_API bool HdStTextureResourceHandle::IsIncompatibleTextureResource ( HdStTextureResourceSharedPtr const a,
HdStTextureResourceSharedPtr const b 
)
static
HDST_API void HdStTextureResourceHandle::SetTextureResource ( HdStTextureResourceSharedPtr const textureResource)

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