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

#include <binding.h>

Public Member Functions

 HdBindingRequest ()=default
 
 HdBindingRequest (HdBinding::Type bindingType, TfToken const &name)
 
 HdBindingRequest (HdBinding::Type bindingType, TfToken const &name, HdType dataType)
 
 HdBindingRequest (HdBinding::Type bindingType, TfToken const &name, HdBufferResourceSharedPtr const &resource)
 
 HdBindingRequest (HdBinding::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
 
HdBinding::Type GetBindingType () const
 Returns the HdBinding type of this request. More...
 
HdBufferResourceSharedPtr 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
HD_API bool operator== (HdBindingRequest const &other) const
 
HD_API bool operator!= (HdBindingRequest const &other) const
 

Hash

HD_API size_t ComputeHash () const
 
template<class HashState >
void TfHashAppend (HashState &h, HdBindingRequest 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 127 of file binding.h.

Constructor & Destructor Documentation

HdBindingRequest::HdBindingRequest ( )
default
HdBindingRequest::HdBindingRequest ( HdBinding::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 135 of file binding.h.

HdBindingRequest::HdBindingRequest ( HdBinding::Type  bindingType,
TfToken const name,
HdType  dataType 
)
inline

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

Definition at line 149 of file binding.h.

HdBindingRequest::HdBindingRequest ( HdBinding::Type  bindingType,
TfToken const name,
HdBufferResourceSharedPtr 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 164 of file binding.h.

HdBindingRequest::HdBindingRequest ( HdBinding::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 HdBufferResource of bar.

Definition at line 182 of file binding.h.

Member Function Documentation

HD_API size_t HdBindingRequest::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 HdBindingRequest::ConcatenateNames ( ) const
inline

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

Definition at line 280 of file binding.h.

size_t HdBindingRequest::GetArraySize ( ) const
inline

Array size if request is for an array of structs.

Definition at line 274 of file binding.h.

HdBufferArrayRangeSharedPtr const& HdBindingRequest::GetBar ( ) const
inline

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

Definition at line 264 of file binding.h.

HdBinding::Type HdBindingRequest::GetBindingType ( ) const
inline

Returns the HdBinding type of this request.

Definition at line 244 of file binding.h.

int HdBindingRequest::GetByteOffset ( ) const
inline

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

Definition at line 253 of file binding.h.

HdType HdBindingRequest::GetDataType ( ) const
inline

Return the data type of this request.

Definition at line 269 of file binding.h.

TfToken const& HdBindingRequest::GetName ( ) const
inline

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

Definition at line 240 of file binding.h.

HdBufferResourceSharedPtr const& HdBindingRequest::GetResource ( ) const
inline

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

Definition at line 249 of file binding.h.

bool HdBindingRequest::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 210 of file binding.h.

bool HdBindingRequest::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 218 of file binding.h.

bool HdBindingRequest::IsResource ( ) const
inline

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

Definition at line 203 of file binding.h.

bool HdBindingRequest::IsTypeless ( ) const
inline

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

Definition at line 230 of file binding.h.

bool HdBindingRequest::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 224 of file binding.h.

HD_API bool HdBindingRequest::operator== ( HdBindingRequest const other) const

Friends And Related Function Documentation

template<class HashState >
void TfHashAppend ( HashState &  h,
HdBindingRequest 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 307 of file binding.h.


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