From 5767702aa5456b6f52273b9667aebc4ec02961e3 Mon Sep 17 00:00:00 2001 From: Mikko Rasa Date: Sat, 25 Aug 2012 22:28:05 +0300 Subject: [PATCH] Don't query array/matrix stride for uniforms which are not arrays/matrices --- source/program.cpp | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/source/program.cpp b/source/program.cpp index ffcc4a6c..a2688507 100644 --- a/source/program.cpp +++ b/source/program.cpp @@ -297,9 +297,12 @@ void Program::link() for(vector::iterator j=indices.begin(); j!=indices.end(); ++j) if(uniforms_by_index[*j]->size>1) indices2.push_back(*j); - glGetActiveUniformsiv(id, indices2.size(), &indices2[0], GL_UNIFORM_ARRAY_STRIDE, &values[0]); - for(unsigned j=0; jarray_stride = values[j]; + if(!indices2.empty()) + { + glGetActiveUniformsiv(id, indices2.size(), &indices2[0], GL_UNIFORM_ARRAY_STRIDE, &values[0]); + for(unsigned j=0; jarray_stride = values[j]; + } indices2.clear(); for(vector::iterator j=indices.begin(); j!=indices.end(); ++j) @@ -310,9 +313,12 @@ void Program::link() t==GL_FLOAT_MAT3x4 || t==GL_FLOAT_MAT4x2 || t==GL_FLOAT_MAT4x3) indices2.push_back(*j); } - glGetActiveUniformsiv(id, indices2.size(), &indices2[0], GL_UNIFORM_MATRIX_STRIDE, &values[0]); - for(unsigned j=0; jmatrix_stride = values[j]; + if(!indices2.empty()) + { + glGetActiveUniformsiv(id, indices2.size(), &indices2[0], GL_UNIFORM_MATRIX_STRIDE, &values[0]); + for(unsigned j=0; jmatrix_stride = values[j]; + } info.layout_hash = compute_layout_hash(info.uniforms); info.bind_point = info.layout_hash%BufferRange::get_n_uniform_buffer_bindings(); -- 2.45.2