24 #ifndef PXR_IMAGING_GLF_BINDING_MAP_H 25 #define PXR_IMAGING_GLF_BINDING_MAP_H 30 #include "pxr/imaging/glf/api.h" 31 #include "pxr/imaging/garch/glApi.h" 37 #include "pxr/base/tf/hashmap.h" 39 PXR_NAMESPACE_OPEN_SCOPE
44 typedef TfHashMap<TfToken, int, TfToken::HashFunctor> BindingMap;
47 : _samplerBindingBaseIndex(0)
48 , _uniformBindingBaseIndex(0)
52 int GetSamplerUnit(std::string
const &name);
54 int GetSamplerUnit(
TfToken const & name);
59 int GetAttributeIndex(std::string
const & name);
61 int GetAttributeIndex(
TfToken const & name);
64 int GetUniformBinding(std::string
const & name);
66 int GetUniformBinding(
TfToken const & name);
69 bool HasUniformBinding(std::string
const & name)
const;
71 bool HasUniformBinding(
TfToken const & name)
const;
73 int GetNumSamplerBindings()
const {
74 return (
int)_samplerBindings.size();
77 void ClearAttribBindings() {
78 _attribBindings.clear();
91 void ResetSamplerBindings(
int baseIndex) {
92 _samplerBindings.clear();
93 _samplerBindingBaseIndex = baseIndex;
96 void ResetUniformBindings(
int baseIndex) {
97 _uniformBindings.clear();
98 _uniformBindingBaseIndex = baseIndex;
103 void AddAttribBinding(
TfToken const &name,
int location) {
104 _attribBindings[name] = location;
107 BindingMap
const &GetAttributeBindings()
const {
108 return _attribBindings;
112 void AssignSamplerUnitsToProgram(GLuint program);
115 void AssignUniformBindingsToProgram(GLuint program);
118 void AddCustomBindings(GLuint program);
124 void _AddActiveAttributeBindings(GLuint program);
125 void _AddActiveUniformBindings(GLuint program);
126 void _AddActiveUniformBlockBindings(GLuint program);
128 BindingMap _attribBindings;
129 BindingMap _samplerBindings;
130 BindingMap _uniformBindings;
132 int _samplerBindingBaseIndex;
133 int _uniformBindingBaseIndex;
137 PXR_NAMESPACE_CLOSE_SCOPE
139 #endif // PXR_IMAGING_GLF_BINDING_MAP_H
Definitions of basic string utilities in tf.
Enable a concrete base class for use with TfRefPtr.
Token for efficient comparison, assignment, and hashing of known strings.
Enable a concrete base class for use with TfWeakPtr.
TfToken class for efficient string referencing and hashing, plus conversions to and from stl string c...