Ion
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
uniformholder.cc
Go to the documentation of this file.
1 
18 #include "ion/gfx/uniformholder.h"
19 
21 
22 namespace ion {
23 namespace gfx {
24 
26  : is_enabled_(true), uniforms_(alloc) {}
27 
29 
30 size_t UniformHolder::GetUniformIndex(const std::string& name) const {
31  const size_t uniform_count = uniforms_.size();
32  for (size_t i = 0; i < uniform_count; ++i) {
33  const Uniform& u = uniforms_[i];
34  DCHECK(u.IsValid());
35  if (name ==
37  return i;
38  }
39  return base::kInvalidIndex;
40 }
41 
42 } // namespace gfx
43 } // namespace ion
UniformHolder(const base::AllocatorPtr &alloc)
The constructor is protected because this is a base class.
const size_t kInvalidIndex
kInvalidIndex is a size_t value that is very unlikely to be a valid index.
Definition: invalid.cc:23
#define DCHECK(expr)
Definition: logging.h:331
const ShaderInputRegistry & GetRegistry() const
Returns the ShaderInputRegistry the shader input is defined in.
Definition: shaderinput.h:63
A Uniform instance represents a uniform shader argument.
Definition: uniform.h:76
std::string name
Definition: printer.cc:324
size_t GetIndexInRegistry() const
Returns the index of the shader input within the registry.
Definition: shaderinput.h:67
virtual ~UniformHolder()
The destructor is protected because all base::Referent classes must have protected or private destruc...
bool IsValid() const
Returns true if this is a valid instance created by a ShaderInputRegistry.
Definition: shaderinput.h:59
size_t GetUniformIndex(const std::string &name) const
Returns the index of the uniform this with the given name, if it exists.
const base::AllocDeque< Spec< T > > & GetSpecs() const
Returns a vector of all Specs of type T added to this registry.