buffer(0),
dirty(0)
{
- for(vector<NamedUniform>::iterator i=uniforms.begin(); i!=uniforms.end(); ++i)
+ for(vector<TaggedUniform>::iterator i=uniforms.begin(); i!=uniforms.end(); ++i)
i->value = i->value->clone();
}
{
if(tied_program)
{
- for(vector<NamedUniform>::const_iterator i=other.uniforms.begin(); i!=other.uniforms.end(); ++i)
- validate_name(i->name);
+ for(vector<TaggedUniform>::const_iterator i=other.uniforms.begin(); i!=other.uniforms.end(); ++i)
+ validate_tag(i->tag);
}
uniforms = other.uniforms;
- for(vector<NamedUniform>::iterator i=uniforms.begin(); i!=uniforms.end(); ++i)
+ for(vector<TaggedUniform>::iterator i=uniforms.begin(); i!=uniforms.end(); ++i)
i->value = i->value->clone();
}
tied_program = other.tied_program;
uniforms = other.uniforms;
- for(vector<NamedUniform>::iterator i=uniforms.begin(); i!=uniforms.end(); ++i)
+ for(vector<TaggedUniform>::iterator i=uniforms.begin(); i!=uniforms.end(); ++i)
i->value = i->value->clone();
for(BlockMap::iterator i=blocks.begin(); i!=blocks.end(); ++i)
ProgramData::~ProgramData()
{
- for(vector<NamedUniform>::iterator i=uniforms.begin(); i!=uniforms.end(); ++i)
+ for(vector<TaggedUniform>::iterator i=uniforms.begin(); i!=uniforms.end(); ++i)
delete i->value;
for(BlockMap::iterator i=blocks.begin(); i!=blocks.end(); ++i)
{
delete buffer;
}
-void ProgramData::uniform(const string &name, Uniform *uni)
+void ProgramData::uniform(Tag tag, Uniform *uni)
{
try
{
- if(!validate_name(name))
+ if(!validate_tag(tag))
{
delete uni;
return;
throw;
}
- int i = find_uniform_index(name);
+ int i = find_uniform_index(tag);
if(i<0)
- return add_uniform(name, uni);
+ return add_uniform(tag, uni);
uniforms[i].replace_value(uni);
dirty |= 1<<i;
}
template<typename T, typename V>
-void ProgramData::uniform(const string &name, V value)
+void ProgramData::uniform(Tag tag, V value)
{
- if(!validate_name(name))
+ if(!validate_tag(tag))
return;
- int i = find_uniform_index(name);
+ int i = find_uniform_index(tag);
if(i<0)
- return add_uniform(name, new T(value));
+ return add_uniform(tag, new T(value));
if(T *uni = dynamic_cast<T *>(uniforms[i].value))
uni->set(value);
}
template<typename T, typename V>
-void ProgramData::uniform_array(const string &name, unsigned n, V value)
+void ProgramData::uniform_array(Tag tag, unsigned n, V value)
{
- if(!validate_name(name))
+ if(!validate_tag(tag))
return;
- int i = find_uniform_index(name);
+ int i = find_uniform_index(tag);
if(i<0)
- return add_uniform(name, new UniformArray<T>(n, value));
+ return add_uniform(tag, new UniformArray<T>(n, value));
UniformArray<T> *uni = dynamic_cast<UniformArray<T> *>(uniforms[i].value);
if(uni && n==uni->size())
dirty |= 1<<i;
}
-bool ProgramData::validate_name(const string &name) const
+bool ProgramData::validate_tag(Tag tag) const
{
#ifdef DEBUG
try
#endif
{
if(tied_program)
- tied_program->get_uniform_info(name);
- else if(name[name.size()-1]==']')
- throw invalid_argument("ProgramData::uniform");
+ tied_program->get_uniform_info(tag);
return true;
}
#ifdef DEBUG
catch(const exception &e)
{
- IO::print(IO::cerr, "Error while setting uniform %s: %s: %s\n", name, Debug::demangle(typeid(e).name()), e.what());
+ IO::print(IO::cerr, "Error while setting uniform %s: %s: %s\n", tag, Debug::demangle(typeid(e).name()), e.what());
return false;
}
#endif
}
-void ProgramData::add_uniform(const string &name, Uniform *uni)
+void ProgramData::add_uniform(Tag tag, Uniform *uni)
{
if(uniforms.size()>=MASK_BITS)
{
delete uni;
- throw too_many_uniforms(name);
+ throw too_many_uniforms(tag.str());
}
- vector<NamedUniform>::iterator j = lower_bound(uniforms.begin(), uniforms.end(), name, uniform_name_compare);
+ vector<TaggedUniform>::iterator j = lower_bound(uniforms.begin(), uniforms.end(), tag, uniform_tag_compare);
- NamedUniform nu;
- nu.name = name;
+ TaggedUniform nu;
+ nu.tag = tag;
nu.value = uni;
uniforms.insert(j, nu);
dirty = ALL_ONES;
}
-void ProgramData::uniform(const string &name, const Uniform &u)
+void ProgramData::uniform(Tag tag, const Uniform &u)
{
- uniform(name, u.clone());
+ uniform(tag, u.clone());
}
-void ProgramData::uniform(const string &name, int v)
+void ProgramData::uniform(Tag tag, int v)
{
- uniform<Uniform1i>(name, v);
+ uniform<Uniform1i>(tag, v);
}
-void ProgramData::uniform(const string &name, float v)
+void ProgramData::uniform(Tag tag, float v)
{
- uniform<Uniform1f>(name, v);
+ uniform<Uniform1f>(tag, v);
}
-void ProgramData::uniform(const string &name, int v0, int v1)
+void ProgramData::uniform(Tag tag, int v0, int v1)
{
int va[2] = { v0, v1 };
- uniform2(name, va);
+ uniform2(tag, va);
}
-void ProgramData::uniform(const string &name, float v0, float v1)
+void ProgramData::uniform(Tag tag, float v0, float v1)
{
float va[2] = { v0, v1 };
- uniform2(name, va);
+ uniform2(tag, va);
}
-void ProgramData::uniform2(const string &name, const int *v)
+void ProgramData::uniform2(Tag tag, const int *v)
{
- uniform<Uniform2i>(name, v);
+ uniform<Uniform2i>(tag, v);
}
-void ProgramData::uniform2(const string &name, const float *v)
+void ProgramData::uniform2(Tag tag, const float *v)
{
- uniform<Uniform2f>(name, v);
+ uniform<Uniform2f>(tag, v);
}
-void ProgramData::uniform(const string &name, int v0, int v1, int v2)
+void ProgramData::uniform(Tag tag, int v0, int v1, int v2)
{
int va[3] = { v0, v1, v2 };
- uniform3(name, va);
+ uniform3(tag, va);
}
-void ProgramData::uniform(const string &name, float v0, float v1, float v2)
+void ProgramData::uniform(Tag tag, float v0, float v1, float v2)
{
float va[3] = { v0, v1, v2 };
- uniform3(name, va);
+ uniform3(tag, va);
}
-void ProgramData::uniform(const string &name, const Vector3 &v)
+void ProgramData::uniform(Tag tag, const Vector3 &v)
{
- uniform(name, v.x, v.y, v.z);
+ uniform(tag, v.x, v.y, v.z);
}
-void ProgramData::uniform3(const string &name, const int *v)
+void ProgramData::uniform3(Tag tag, const int *v)
{
- uniform<Uniform3i>(name, v);
+ uniform<Uniform3i>(tag, v);
}
-void ProgramData::uniform3(const string &name, const float *v)
+void ProgramData::uniform3(Tag tag, const float *v)
{
- uniform<Uniform3f>(name, v);
+ uniform<Uniform3f>(tag, v);
}
-void ProgramData::uniform(const string &name, int v0, int v1, int v2, int v3)
+void ProgramData::uniform(Tag tag, int v0, int v1, int v2, int v3)
{
int va[4] = { v0, v1, v2, v3 };
- uniform4(name, va);
+ uniform4(tag, va);
}
-void ProgramData::uniform(const string &name, float v0, float v1, float v2, float v3)
+void ProgramData::uniform(Tag tag, float v0, float v1, float v2, float v3)
{
float va[4] = { v0, v1, v2, v3 };
- uniform4(name, va);
+ uniform4(tag, va);
}
-void ProgramData::uniform(const string &name, const Vector4 &v)
+void ProgramData::uniform(Tag tag, const Vector4 &v)
{
- uniform(name, v.x, v.y, v.z, v.w);
+ uniform(tag, v.x, v.y, v.z, v.w);
}
-void ProgramData::uniform(const string &name, const Color &c)
+void ProgramData::uniform(Tag tag, const Color &c)
{
- uniform(name, c.r, c.g, c.b, c.a);
+ uniform(tag, c.r, c.g, c.b, c.a);
}
-void ProgramData::uniform4(const string &name, const int *v)
+void ProgramData::uniform4(Tag tag, const int *v)
{
- uniform<Uniform4i>(name, v);
+ uniform<Uniform4i>(tag, v);
}
-void ProgramData::uniform4(const string &name, const float *v)
+void ProgramData::uniform4(Tag tag, const float *v)
{
- uniform<Uniform4f>(name, v);
+ uniform<Uniform4f>(tag, v);
}
-void ProgramData::uniform(const string &name, const LinAl::Matrix<float, 2, 2> &m)
+void ProgramData::uniform(Tag tag, const LinAl::Matrix<float, 2, 2> &m)
{
- uniform_matrix2(name, &m(0, 0));
+ uniform_matrix2(tag, &m(0, 0));
}
-void ProgramData::uniform_matrix2(const string &name, const float *v)
+void ProgramData::uniform_matrix2(Tag tag, const float *v)
{
- uniform<UniformMatrix2x2f>(name, v);
+ uniform<UniformMatrix2x2f>(tag, v);
}
-void ProgramData::uniform(const string &name, const LinAl::Matrix<float, 2, 3> &m)
+void ProgramData::uniform(Tag tag, const LinAl::Matrix<float, 2, 3> &m)
{
- uniform_matrix3x2(name, &m(0, 0));
+ uniform_matrix3x2(tag, &m(0, 0));
}
-void ProgramData::uniform_matrix3x2(const string &name, const float *v)
+void ProgramData::uniform_matrix3x2(Tag tag, const float *v)
{
- uniform<UniformMatrix3x2f>(name, v);
+ uniform<UniformMatrix3x2f>(tag, v);
}
-void ProgramData::uniform(const string &name, const LinAl::Matrix<float, 2, 4> &m)
+void ProgramData::uniform(Tag tag, const LinAl::Matrix<float, 2, 4> &m)
{
- uniform_matrix4x2(name, &m(0, 0));
+ uniform_matrix4x2(tag, &m(0, 0));
}
-void ProgramData::uniform_matrix4x2(const string &name, const float *v)
+void ProgramData::uniform_matrix4x2(Tag tag, const float *v)
{
- uniform<UniformMatrix4x2f>(name, v);
+ uniform<UniformMatrix4x2f>(tag, v);
}
-void ProgramData::uniform(const string &name, const LinAl::Matrix<float, 3, 2> &m)
+void ProgramData::uniform(Tag tag, const LinAl::Matrix<float, 3, 2> &m)
{
- uniform_matrix2x3(name, &m(0, 0));
+ uniform_matrix2x3(tag, &m(0, 0));
}
-void ProgramData::uniform_matrix2x3(const string &name, const float *v)
+void ProgramData::uniform_matrix2x3(Tag tag, const float *v)
{
- uniform<UniformMatrix2x3f>(name, v);
+ uniform<UniformMatrix2x3f>(tag, v);
}
-void ProgramData::uniform(const string &name, const LinAl::Matrix<float, 3, 3> &m)
+void ProgramData::uniform(Tag tag, const LinAl::Matrix<float, 3, 3> &m)
{
- uniform_matrix3(name, &m(0, 0));
+ uniform_matrix3(tag, &m(0, 0));
}
-void ProgramData::uniform_matrix3(const string &name, const float *v)
+void ProgramData::uniform_matrix3(Tag tag, const float *v)
{
- uniform<UniformMatrix3x3f>(name, v);
+ uniform<UniformMatrix3x3f>(tag, v);
}
-void ProgramData::uniform(const string &name, const LinAl::Matrix<float, 3, 4> &m)
+void ProgramData::uniform(Tag tag, const LinAl::Matrix<float, 3, 4> &m)
{
- uniform_matrix4x3(name, &m(0, 0));
+ uniform_matrix4x3(tag, &m(0, 0));
}
-void ProgramData::uniform_matrix4x3(const string &name, const float *v)
+void ProgramData::uniform_matrix4x3(Tag tag, const float *v)
{
- uniform<UniformMatrix4x3f>(name, v);
+ uniform<UniformMatrix4x3f>(tag, v);
}
-void ProgramData::uniform(const string &name, const LinAl::Matrix<float, 4, 2> &m)
+void ProgramData::uniform(Tag tag, const LinAl::Matrix<float, 4, 2> &m)
{
- uniform_matrix2x4(name, &m(0, 0));
+ uniform_matrix2x4(tag, &m(0, 0));
}
-void ProgramData::uniform_matrix2x4(const string &name, const float *v)
+void ProgramData::uniform_matrix2x4(Tag tag, const float *v)
{
- uniform<UniformMatrix2x4f>(name, v);
+ uniform<UniformMatrix2x4f>(tag, v);
}
-void ProgramData::uniform(const string &name, const LinAl::Matrix<float, 4, 3> &m)
+void ProgramData::uniform(Tag tag, const LinAl::Matrix<float, 4, 3> &m)
{
- uniform_matrix3x4(name, &m(0, 0));
+ uniform_matrix3x4(tag, &m(0, 0));
}
-void ProgramData::uniform_matrix3x4(const string &name, const float *v)
+void ProgramData::uniform_matrix3x4(Tag tag, const float *v)
{
- uniform<UniformMatrix3x4f>(name, v);
+ uniform<UniformMatrix3x4f>(tag, v);
}
-void ProgramData::uniform(const string &name, const Matrix &m)
+void ProgramData::uniform(Tag tag, const Matrix &m)
{
- uniform_matrix4(name, m.data());
+ uniform_matrix4(tag, m.data());
}
-void ProgramData::uniform_matrix4(const string &name, const float *v)
+void ProgramData::uniform_matrix4(Tag tag, const float *v)
{
- uniform<UniformMatrix4x4f>(name, v);
+ uniform<UniformMatrix4x4f>(tag, v);
}
-void ProgramData::uniform1_array(const string &name, unsigned n, const int *v)
+void ProgramData::uniform1_array(Tag tag, unsigned n, const int *v)
{
- uniform_array<Uniform1i>(name, n, v);
+ uniform_array<Uniform1i>(tag, n, v);
}
-void ProgramData::uniform1_array(const string &name, unsigned n, const float *v)
+void ProgramData::uniform1_array(Tag tag, unsigned n, const float *v)
{
- uniform_array<Uniform1f>(name, n, v);
+ uniform_array<Uniform1f>(tag, n, v);
}
-void ProgramData::uniform2_array(const string &name, unsigned n, const int *v)
+void ProgramData::uniform2_array(Tag tag, unsigned n, const int *v)
{
- uniform_array<Uniform2i>(name, n, v);
+ uniform_array<Uniform2i>(tag, n, v);
}
-void ProgramData::uniform2_array(const string &name, unsigned n, const float *v)
+void ProgramData::uniform2_array(Tag tag, unsigned n, const float *v)
{
- uniform_array<Uniform2f>(name, n, v);
+ uniform_array<Uniform2f>(tag, n, v);
}
-void ProgramData::uniform3_array(const string &name, unsigned n, const int *v)
+void ProgramData::uniform3_array(Tag tag, unsigned n, const int *v)
{
- uniform_array<Uniform3i>(name, n, v);
+ uniform_array<Uniform3i>(tag, n, v);
}
-void ProgramData::uniform3_array(const string &name, unsigned n, const float *v)
+void ProgramData::uniform3_array(Tag tag, unsigned n, const float *v)
{
- uniform_array<Uniform3f>(name, n, v);
+ uniform_array<Uniform3f>(tag, n, v);
}
-void ProgramData::uniform4_array(const string &name, unsigned n, const int *v)
+void ProgramData::uniform4_array(Tag tag, unsigned n, const int *v)
{
- uniform_array<Uniform4i>(name, n, v);
+ uniform_array<Uniform4i>(tag, n, v);
}
-void ProgramData::uniform4_array(const string &name, unsigned n, const float *v)
+void ProgramData::uniform4_array(Tag tag, unsigned n, const float *v)
{
- uniform_array<Uniform4f>(name, n, v);
+ uniform_array<Uniform4f>(tag, n, v);
}
-void ProgramData::uniform_matrix2_array(const string &name, unsigned n, const float *v)
+void ProgramData::uniform_matrix2_array(Tag tag, unsigned n, const float *v)
{
- uniform_array<UniformMatrix2x2f>(name, n, v);
+ uniform_array<UniformMatrix2x2f>(tag, n, v);
}
-void ProgramData::uniform_matrix3x2_array(const string &name, unsigned n, const float *v)
+void ProgramData::uniform_matrix3x2_array(Tag tag, unsigned n, const float *v)
{
- uniform_array<UniformMatrix3x2f>(name, n, v);
+ uniform_array<UniformMatrix3x2f>(tag, n, v);
}
-void ProgramData::uniform_matrix4x2_array(const string &name, unsigned n, const float *v)
+void ProgramData::uniform_matrix4x2_array(Tag tag, unsigned n, const float *v)
{
- uniform_array<UniformMatrix4x2f>(name, n, v);
+ uniform_array<UniformMatrix4x2f>(tag, n, v);
}
-void ProgramData::uniform_matrix2x3_array(const string &name, unsigned n, const float *v)
+void ProgramData::uniform_matrix2x3_array(Tag tag, unsigned n, const float *v)
{
- uniform_array<UniformMatrix2x3f>(name, n, v);
+ uniform_array<UniformMatrix2x3f>(tag, n, v);
}
-void ProgramData::uniform_matrix3_array(const string &name, unsigned n, const float *v)
+void ProgramData::uniform_matrix3_array(Tag tag, unsigned n, const float *v)
{
- uniform_array<UniformMatrix3x3f>(name, n, v);
+ uniform_array<UniformMatrix3x3f>(tag, n, v);
}
-void ProgramData::uniform_matrix4x3_array(const string &name, unsigned n, const float *v)
+void ProgramData::uniform_matrix4x3_array(Tag tag, unsigned n, const float *v)
{
- uniform_array<UniformMatrix4x3f>(name, n, v);
+ uniform_array<UniformMatrix4x3f>(tag, n, v);
}
-void ProgramData::uniform_matrix2x4_array(const string &name, unsigned n, const float *v)
+void ProgramData::uniform_matrix2x4_array(Tag tag, unsigned n, const float *v)
{
- uniform_array<UniformMatrix2x4f>(name, n, v);
+ uniform_array<UniformMatrix2x4f>(tag, n, v);
}
-void ProgramData::uniform_matrix3x4_array(const string &name, unsigned n, const float *v)
+void ProgramData::uniform_matrix3x4_array(Tag tag, unsigned n, const float *v)
{
- uniform_array<UniformMatrix3x4f>(name, n, v);
+ uniform_array<UniformMatrix3x4f>(tag, n, v);
}
-void ProgramData::uniform_matrix4_array(const string &name, unsigned n, const float *v)
+void ProgramData::uniform_matrix4_array(Tag tag, unsigned n, const float *v)
{
- uniform_array<UniformMatrix4x4f>(name, n, v);
+ uniform_array<UniformMatrix4x4f>(tag, n, v);
}
-void ProgramData::remove_uniform(const string &name)
+void ProgramData::remove_uniform(Tag tag)
{
- vector<NamedUniform>::const_iterator i = lower_bound(uniforms.begin(), uniforms.end(), name, uniform_name_compare);
- if(i==uniforms.end() || i->name!=name)
+ vector<TaggedUniform>::const_iterator i = lower_bound(uniforms.begin(), uniforms.end(), tag, uniform_tag_compare);
+ if(i==uniforms.end() || i->tag!=tag)
return;
delete i->value;
dirty = ALL_ONES;
}
-vector<string> ProgramData::get_uniform_names() const
+vector<Tag> ProgramData::get_uniform_tags() const
{
- vector<string> names;
- names.reserve(uniforms.size());
- for(vector<NamedUniform>::const_iterator i=uniforms.begin(); i!=uniforms.end(); ++i)
- names.push_back(i->name);
- return names;
+ vector<Tag> tags;
+ tags.reserve(uniforms.size());
+ for(vector<TaggedUniform>::const_iterator i=uniforms.begin(); i!=uniforms.end(); ++i)
+ tags.push_back(i->tag);
+ return tags;
}
-const Uniform &ProgramData::get_uniform(const string &name) const
+const Uniform &ProgramData::get_uniform(Tag tag) const
{
- int i = find_uniform_index(name);
+ int i = find_uniform_index(tag);
if(i<0)
- throw key_error(name);
+ throw key_error(tag);
return *uniforms[i].value;
}
-const Uniform *ProgramData::find_uniform(const string &name) const
+const Uniform *ProgramData::find_uniform(Tag tag) const
{
- int i = find_uniform_index(name);
+ int i = find_uniform_index(tag);
return (i>=0 ? uniforms[i].value : 0);
}
-bool ProgramData::uniform_name_compare(const NamedUniform &nu, const string &name)
+bool ProgramData::uniform_tag_compare(const TaggedUniform &tu, Tag tag)
{
- return nu.name<name;
+ return tu.tag<tag;
}
-int ProgramData::find_uniform_index(const string &name) const
+int ProgramData::find_uniform_index(Tag tag) const
{
- vector<NamedUniform>::const_iterator i = lower_bound(uniforms.begin(), uniforms.end(), name, uniform_name_compare);
- return ((i!=uniforms.end() && i->name==name) ? i-uniforms.begin() : -1);
+ vector<TaggedUniform>::const_iterator i = lower_bound(uniforms.begin(), uniforms.end(), tag, uniform_tag_compare);
+ return ((i!=uniforms.end() && i->tag==tag) ? i-uniforms.begin() : -1);
}
void ProgramData::update_block_uniform_indices(SharedBlock &block, const Program::UniformBlockInfo &info) const
block.used = 0;
for(unsigned i=0; i<info.uniforms.size(); ++i)
{
- int j = find_uniform_index(info.uniforms[i]->name);
+ int j = find_uniform_index(info.uniforms[i]->tag);
if(j>=0)
{
indices[i] = j;
}
-ProgramData::NamedUniform::NamedUniform():
+ProgramData::TaggedUniform::TaggedUniform():
value(0)
{ }
-void ProgramData::NamedUniform::replace_value(Uniform *v)
+void ProgramData::TaggedUniform::replace_value(Uniform *v)
{
/* UniformBlock does not copy the uniforms, so existing default blocks
will be left with stale pointers. This is not a problem as long as no
#include "datatype.h"
#include "matrix.h"
#include "program.h"
+#include "tag.h"
#include "vector.h"
namespace Msp {
ALL_ONES = static_cast<Mask>(-1)
};
- struct NamedUniform
+ struct TaggedUniform
{
- std::string name;
+ Tag tag;
Uniform *value;
- NamedUniform();
+ TaggedUniform();
- bool compare_name(const std::string &, unsigned) const;
void replace_value(Uniform *);
};
// XXX All these mutables are a bit silly, but I'm out of better ideas
const Program *tied_program;
- std::vector<NamedUniform> uniforms;
+ std::vector<TaggedUniform> uniforms;
mutable BlockMap blocks;
mutable ProgramMap programs;
mutable UniformBlock *last_block;
~ProgramData();
private:
- void uniform(const std::string &, Uniform *);
+ void uniform(Tag, Uniform *);
template<typename T, typename V>
- void uniform(const std::string &, V);
+ void uniform(Tag, V);
template<typename T, typename V>
- void uniform_array(const std::string &, unsigned, V);
- bool validate_name(const std::string &) const;
- void add_uniform(const std::string &, Uniform *);
+ void uniform_array(Tag, unsigned, V);
+ bool validate_tag(Tag) const;
+ void add_uniform(Tag, Uniform *);
public:
- void uniform(const std::string &, const Uniform &);
- void uniform(const std::string &, int);
- void uniform(const std::string &, float);
- void uniform(const std::string &, int, int);
- void uniform(const std::string &, float, float);
- void uniform2(const std::string &, const int *);
- void uniform2(const std::string &, const float *);
- void uniform(const std::string &, int, int, int);
- void uniform(const std::string &, float, float, float);
- void uniform(const std::string &, const Vector3 &);
- void uniform3(const std::string &, const int *);
- void uniform3(const std::string &, const float *);
- void uniform(const std::string &, int, int, int, int);
- void uniform(const std::string &, float, float, float, float);
- void uniform(const std::string &, const Vector4 &);
- void uniform(const std::string &, const Color &);
- void uniform4(const std::string &, const int *);
- void uniform4(const std::string &, const float *);
- void uniform(const std::string &, const LinAl::Matrix<float, 2, 2> &);
- void uniform_matrix2(const std::string &, const float *);
- void uniform(const std::string &, const LinAl::Matrix<float, 2, 3> &);
- void uniform_matrix3x2(const std::string &, const float *);
- void uniform(const std::string &, const LinAl::Matrix<float, 2, 4> &);
- void uniform_matrix4x2(const std::string &, const float *);
- void uniform(const std::string &, const LinAl::Matrix<float, 3, 2> &);
- void uniform_matrix2x3(const std::string &, const float *);
- void uniform(const std::string &, const LinAl::Matrix<float, 3, 3> &);
- void uniform_matrix3(const std::string &, const float *);
- void uniform(const std::string &, const LinAl::Matrix<float, 3, 4> &);
- void uniform_matrix4x3(const std::string &, const float *);
- void uniform(const std::string &, const LinAl::Matrix<float, 4, 2> &);
- void uniform_matrix2x4(const std::string &, const float *);
- void uniform(const std::string &, const LinAl::Matrix<float, 4, 3> &);
- void uniform_matrix3x4(const std::string &, const float *);
- void uniform(const std::string &, const Matrix &);
- void uniform_matrix4(const std::string &, const float *);
- void uniform1_array(const std::string &, unsigned, const int *);
- void uniform1_array(const std::string &, unsigned, const float *);
- void uniform2_array(const std::string &, unsigned, const int *);
- void uniform2_array(const std::string &, unsigned, const float *);
- void uniform3_array(const std::string &, unsigned, const int *);
- void uniform3_array(const std::string &, unsigned, const float *);
- void uniform4_array(const std::string &, unsigned, const int *);
- void uniform4_array(const std::string &, unsigned, const float *);
- void uniform_matrix2_array(const std::string &, unsigned, const float *);
- void uniform_matrix3x2_array(const std::string &, unsigned, const float *);
- void uniform_matrix4x2_array(const std::string &, unsigned, const float *);
- void uniform_matrix2x3_array(const std::string &, unsigned, const float *);
- void uniform_matrix3_array(const std::string &, unsigned, const float *);
- void uniform_matrix4x3_array(const std::string &, unsigned, const float *);
- void uniform_matrix2x4_array(const std::string &, unsigned, const float *);
- void uniform_matrix3x4_array(const std::string &, unsigned, const float *);
- void uniform_matrix4_array(const std::string &, unsigned, const float *);
- void remove_uniform(const std::string &);
-
- std::vector<std::string> get_uniform_names() const;
- const Uniform &get_uniform(const std::string &) const;
- const Uniform *find_uniform(const std::string &) const;
+ void uniform(Tag, const Uniform &);
+ void uniform(Tag, int);
+ void uniform(Tag, float);
+ void uniform(Tag, int, int);
+ void uniform(Tag, float, float);
+ void uniform2(Tag, const int *);
+ void uniform2(Tag, const float *);
+ void uniform(Tag, int, int, int);
+ void uniform(Tag, float, float, float);
+ void uniform(Tag, const Vector3 &);
+ void uniform3(Tag, const int *);
+ void uniform3(Tag, const float *);
+ void uniform(Tag, int, int, int, int);
+ void uniform(Tag, float, float, float, float);
+ void uniform(Tag, const Vector4 &);
+ void uniform(Tag, const Color &);
+ void uniform4(Tag, const int *);
+ void uniform4(Tag, const float *);
+ void uniform(Tag, const LinAl::Matrix<float, 2, 2> &);
+ void uniform_matrix2(Tag, const float *);
+ void uniform(Tag, const LinAl::Matrix<float, 2, 3> &);
+ void uniform_matrix3x2(Tag, const float *);
+ void uniform(Tag, const LinAl::Matrix<float, 2, 4> &);
+ void uniform_matrix4x2(Tag, const float *);
+ void uniform(Tag, const LinAl::Matrix<float, 3, 2> &);
+ void uniform_matrix2x3(Tag, const float *);
+ void uniform(Tag, const LinAl::Matrix<float, 3, 3> &);
+ void uniform_matrix3(Tag, const float *);
+ void uniform(Tag, const LinAl::Matrix<float, 3, 4> &);
+ void uniform_matrix4x3(Tag, const float *);
+ void uniform(Tag, const LinAl::Matrix<float, 4, 2> &);
+ void uniform_matrix2x4(Tag, const float *);
+ void uniform(Tag, const LinAl::Matrix<float, 4, 3> &);
+ void uniform_matrix3x4(Tag, const float *);
+ void uniform(Tag, const Matrix &);
+ void uniform_matrix4(Tag, const float *);
+ void uniform1_array(Tag, unsigned, const int *);
+ void uniform1_array(Tag, unsigned, const float *);
+ void uniform2_array(Tag, unsigned, const int *);
+ void uniform2_array(Tag, unsigned, const float *);
+ void uniform3_array(Tag, unsigned, const int *);
+ void uniform3_array(Tag, unsigned, const float *);
+ void uniform4_array(Tag, unsigned, const int *);
+ void uniform4_array(Tag, unsigned, const float *);
+ void uniform_matrix2_array(Tag, unsigned, const float *);
+ void uniform_matrix3x2_array(Tag, unsigned, const float *);
+ void uniform_matrix4x2_array(Tag, unsigned, const float *);
+ void uniform_matrix2x3_array(Tag, unsigned, const float *);
+ void uniform_matrix3_array(Tag, unsigned, const float *);
+ void uniform_matrix4x3_array(Tag, unsigned, const float *);
+ void uniform_matrix2x4_array(Tag, unsigned, const float *);
+ void uniform_matrix3x4_array(Tag, unsigned, const float *);
+ void uniform_matrix4_array(Tag, unsigned, const float *);
+ void remove_uniform(Tag);
+
+ std::vector<Tag> get_uniform_tags() const;
+ const Uniform &get_uniform(Tag) const;
+ const Uniform *find_uniform(Tag) const;
private:
- static bool uniform_name_compare(const NamedUniform &, const std::string &);
- int find_uniform_index(const std::string &) const;
+ static bool uniform_tag_compare(const TaggedUniform &, Tag);
+ int find_uniform_index(Tag) const;
void update_block_uniform_indices(SharedBlock &, const Program::UniformBlockInfo &) const;
void update_block(SharedBlock &, const Program::UniformBlockInfo &) const;
SharedBlock *get_shared_block(const Program::UniformBlockInfo &) const;