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

#include <binding.h>

Public Member Functions

 HdStBindingRequest ()=default
 
 HdStBindingRequest (HdStBinding::Type bindingType, TfToken const &name)
 
 HdStBindingRequest (HdStBinding::Type bindingType, TfToken const &name, HdType dataType)
 
 HdStBindingRequest (HdStBinding::Type bindingType, TfToken const &name, HdStBufferResourceSharedPtr const &resource)
 
 HdStBindingRequest (HdStBinding::Type type, TfToken const &name, HdBufferArrayRangeSharedPtr bar, bool interleave, bool writable=false, size_t arraySize=0, bool concatenateNames=false)
 
Discriminators
bool IsResource () const
 
bool IsBufferArray () const
 
bool IsInterleavedBufferArray () const
 
bool isWritable () const
 
bool IsTypeless () const
 
Accessors
TfToken constGetName () const
 
HdStBinding::Type GetBindingType () const
 Returns the HdStBinding type of this request. More...
 
HdStBufferResourceSharedPtr constGetResource () const
 
int GetByteOffset () const
 Returns the resource or buffer array range offset, defaults to zero. More...
 
HdBufferArrayRangeSharedPtr constGetBar () const
 
HdType GetDataType () const
 Return the data type of this request. More...
 
size_t GetArraySize () const
 Array size if request is for an array of structs. More...
 
bool ConcatenateNames () const
 
Comparison
HDST_API bool operator== (HdStBindingRequest const &other) const
 
HDST_API bool operator!= (HdStBindingRequest const &other) const
 

Hash

HDST_API size_t ComputeHash () const
 
template<class HashState >
void TfHashAppend (HashState &h, HdStBindingRequest const &br)
 

Detailed Description

BindingRequest allows externally allocated buffers to be bound at render time. The different modes of binding discussed below allow the caller a range of opt-in binding behaviors, from simply reserving a binding location so it can be managed from client code, to fully generating buffer accessor code at compile time (i.e. when using a BufferArrayRange or BufferResource).

This is a "request" because the caller makes a request before bindings are resolved. All requests are consulted and fulfilled during binding resolution.

Definition at line 126 of file binding.h.

Constructor & Destructor Documentation

HdStBindingRequest::HdStBindingRequest ( )
default
HdStBindingRequest::HdStBindingRequest ( HdStBinding::Type  bindingType,
TfToken const name 
)
inline

A data binding, not backed by neither BufferArrayRange nor BufferResource. This binding request simply generates named metadata (#define HD_HAS_foo 1, #define HD_foo_Binding)

Definition at line 134 of file binding.h.

HdStBindingRequest::HdStBindingRequest ( HdStBinding::Type  bindingType,
TfToken const name,
HdType  dataType 
)
inline

A data binding, not backed by neither BufferArrayRange nor BufferResource.

Definition at line 148 of file binding.h.

HdStBindingRequest::HdStBindingRequest ( HdStBinding::Type  bindingType,
TfToken const name,
HdStBufferResourceSharedPtr const resource 
)
inline

A buffer resource binding. Binds a given buffer resource to a specified name. The data type is set from the resource.

Definition at line 163 of file binding.h.

HdStBindingRequest::HdStBindingRequest ( HdStBinding::Type  type,
TfToken const name,
HdBufferArrayRangeSharedPtr  bar,
bool  interleave,
bool  writable = false,
size_t  arraySize = 0,
bool  concatenateNames = false 
)
inline

A named struct binding. From an interleaved BufferArray, an array of structs will be generated, consuming a single binding point. Note that all resources in the buffer array must have the same underlying identifier, hence must be interleaved and bindable as a single resource. Data types can be derived from each HdStBufferResource of bar.

Definition at line 181 of file binding.h.

Member Function Documentation

HDST_API size_t HdStBindingRequest::ComputeHash ( ) const

Returns the hash corresponding to this buffer request.

Note that this hash captures the structural state of the request, not the contents. For example, buffer array versions/reallocations will not affect hash, but changing the BAR pointer will.

bool HdStBindingRequest::ConcatenateNames ( ) const
inline

Returns whether the struct binding point and struct member names should be concatenated when codegen'ing the accessor.

Definition at line 279 of file binding.h.

size_t HdStBindingRequest::GetArraySize ( ) const
inline

Array size if request is for an array of structs.

Definition at line 273 of file binding.h.

HdBufferArrayRangeSharedPtr const& HdStBindingRequest::GetBar ( ) const
inline

Returns the buffer array range associated with this binding request or null when IsBufferArrqay() returns false.

Definition at line 263 of file binding.h.

HdStBinding::Type HdStBindingRequest::GetBindingType ( ) const
inline

Returns the HdStBinding type of this request.

Definition at line 243 of file binding.h.

int HdStBindingRequest::GetByteOffset ( ) const
inline

Returns the resource or buffer array range offset, defaults to zero.

Definition at line 252 of file binding.h.

HdType HdStBindingRequest::GetDataType ( ) const
inline

Return the data type of this request.

Definition at line 268 of file binding.h.

TfToken const& HdStBindingRequest::GetName ( ) const
inline

Returns the name of the binding point, if any; buffer arrays and structs need not be named.

Definition at line 239 of file binding.h.

HdStBufferResourceSharedPtr const& HdStBindingRequest::GetResource ( ) const
inline

Returns the single resource associated with this binding request or null when IsResource() returns false.

Definition at line 248 of file binding.h.

bool HdStBindingRequest::IsBufferArray ( ) const
inline

A buffer array binding has several buffers bundled together and each buffer will be bound individually and exposed as independent arrays in the shader.

Definition at line 209 of file binding.h.

bool HdStBindingRequest::IsInterleavedBufferArray ( ) const
inline

Like BufferArray binding requests, struct bindings have several buffers, however they must be allocated into a single resource and interleaved. This type of binding request is exposed in the shader an array of structs.

Definition at line 217 of file binding.h.

bool HdStBindingRequest::IsResource ( ) const
inline

Resource bingings have a single associated Hydra resource, but no buffer array.

Definition at line 202 of file binding.h.

bool HdStBindingRequest::IsTypeless ( ) const
inline

This binding is typelss. CodeGen only allocate location and skip emitting declarations and accessors.

Definition at line 229 of file binding.h.

bool HdStBindingRequest::isWritable ( ) const
inline

True when the resource is being bound so that it can be written to. This affects whether it will be declared 'const' or not.

Definition at line 223 of file binding.h.

HDST_API bool HdStBindingRequest::operator== ( HdStBindingRequest const other) const

Friends And Related Function Documentation

template<class HashState >
void TfHashAppend ( HashState &  h,
HdStBindingRequest const br 
)
friend

Returns the hash corresponding to this buffer request.

Note that this hash captures the structural state of the request, not the contents. For example, buffer array versions/reallocations will not affect hash, but changing the BAR pointer will.

Definition at line 306 of file binding.h.


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