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)
 
Discriminators
bool IsResource () const
 
bool IsBufferArray () const
 
bool IsInterleavedBufferArray () 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...
 
HD_API size_t ComputeHash () const
 

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 122 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 130 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 141 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 153 of file binding.h.

HdBindingRequest::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 168 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.

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

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

Returns the HdBinding type of this request.

Definition at line 220 of file binding.h.

int HdBindingRequest::GetByteOffset ( ) const
inline

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

Definition at line 229 of file binding.h.

HdType HdBindingRequest::GetDataType ( ) const
inline

Return the data type of this request.

Definition at line 245 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 216 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 225 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 192 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 200 of file binding.h.

bool HdBindingRequest::IsResource ( ) const
inline

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

Definition at line 185 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 206 of file binding.h.


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