From ac11296dca7c7a594ff1b20bead87e1e161b4bef Mon Sep 17 00:00:00 2001 From: Mikko Rasa Date: Sat, 25 Aug 2012 00:47:01 +0300 Subject: [PATCH] Uniform handling fixes Initialize strides to zero, and return a location of -1 for uniforms in blocks. --- source/program.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/source/program.cpp b/source/program.cpp index 8892bcf1..ffcc4a6c 100644 --- a/source/program.cpp +++ b/source/program.cpp @@ -254,6 +254,8 @@ void Program::link() info.block = 0; info.name = name; info.size = size; + info.array_stride = 0; + info.matrix_stride = 0; info.type = type; uniforms_by_index[i] = &info; } @@ -373,14 +375,14 @@ int Program::get_uniform_location(const string &n) const add an offset. */ unsigned offset = lexical_cast(n.substr(open_bracket+1, n.size()-2-open_bracket)); i = uniforms.find(n.substr(0, open_bracket)+"[0]"); - if(i!=uniforms.end() && offsetsecond.size) + if(i!=uniforms.end() && !i->second.block && offsetsecond.size) return i->second.location+offset; } } return -1; } - return i->second.location; + return i->second.block ? -1 : i->second.location; } void Program::bind() const -- 2.45.2