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

BindingRequest allows externally allocated buffers to be bound at render time. More...

Public Member Functions

 HdBindingRequest (HdBinding::Type bindingType, TfToken const &name)
 A data binding, not backed by neither BufferArrayRange nor BufferResource. More...
 
 HdBindingRequest (HdBinding::Type bindingType, TfToken const &name, HdType dataType)
 A data binding, not backed by neither BufferArrayRange nor BufferResource. More...
 
 HdBindingRequest (HdBinding::Type bindingType, TfToken const &name, HdBufferResourceSharedPtr const &resource)
 A buffer resource binding. More...
 
 HdBindingRequest (HdBinding::Type type, TfToken const &name, HdBufferArrayRangeSharedPtr bar, bool interleave)
 A named struct binding. More...
 
Discriminators
bool IsResource () const
 Resource bingings have a single associated Hydra resource, but no buffer array. More...
 
bool IsBufferArray () const
 A buffer array binding has several buffers bundled together and each buffer will be bound individually and exposed as independent arrays in the shader. More...
 
bool IsInterleavedBufferArray () const
 Like BufferArray binding requests, struct bindings have several buffers, however they must be allocated into a single resource and interleaved. More...
 
bool IsTypeless () const
 This binding is typelss. More...
 
Accessors
TfToken const & GetName () const
 Returns the name of the binding point, if any; buffer arrays and structs need not be named. More...
 
HdBinding::Type GetBindingType () const
 Returns the HdBinding type of this request. More...
 
HdBufferResourceSharedPtr const & GetResource () const
 Returns the single resource associated with this binding request or null when IsResource() returns false. More...
 
int GetByteOffset () const
 Returns the resource or buffer array range offset, defaults to zero. More...
 
HdBufferArrayRangeSharedPtr const & GetBar () const
 Returns the buffer array range associated with this binding request or null when IsBufferArrqay() returns false. More...
 
HdType GetDataType () const
 Return the data type of this request. More...
 
Comparison
HD_API bool operator== (HdBindingRequest const &other) const
 
HD_API bool operator!= (HdBindingRequest const &other) const
 

Hash

HD_API size_t ComputeHash () const
 Returns the hash corresponding to this buffer request. More...
 
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 123 of file binding.h.

Constructor & Destructor Documentation

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 131 of file binding.h.

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

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

Definition at line 142 of file binding.h.

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 154 of file binding.h.

HdBindingRequest ( HdBinding::Type  type,
TfToken const &  name,
HdBufferArrayRangeSharedPtr  bar,
bool  interleave 
)
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 169 of file binding.h.

Member Function Documentation

HD_API size_t 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.

HdBufferArrayRangeSharedPtr const& GetBar ( ) const
inline

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

Definition at line 241 of file binding.h.

HdBinding::Type GetBindingType ( ) const
inline

Returns the HdBinding type of this request.

Definition at line 221 of file binding.h.

int GetByteOffset ( ) const
inline

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

Definition at line 230 of file binding.h.

HdType GetDataType ( ) const
inline

Return the data type of this request.

Definition at line 246 of file binding.h.

TfToken const& GetName ( ) const
inline

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

Definition at line 217 of file binding.h.

HdBufferResourceSharedPtr const& GetResource ( ) const
inline

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

Definition at line 226 of file binding.h.

bool 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 193 of file binding.h.

bool 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 201 of file binding.h.

bool IsResource ( ) const
inline

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

Definition at line 186 of file binding.h.

bool IsTypeless ( ) const
inline

This binding is typelss.

CodeGen only allocate location and skip emitting declarations and accessors.

Definition at line 207 of file binding.h.


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