mesa/st: fix number of ubos being declared in a shader

Previously the code used the total number of ubos being declared in the
linked program (so the ubos of all shaders combined), use the number
from the particular shader instead.
This fixes an assertion failure with piglit arb_uniform_buffer_object-maxblocks
seen in llvmpipe since 8a9f5ecdb1 as it now emits
code for each declared buffer, not just the ones actually used.

CC: "10.1 10.2" <mesa-stable@lists.freedesktop.org>
Reviewed-by: Brian Paul <brianp@vmware.com>
This commit is contained in:
Roland Scheidegger 2014-05-14 21:06:23 +02:00
parent 9c64cb80d2
commit 3e817e7e56
1 changed files with 5 additions and 3 deletions

View File

@ -325,6 +325,7 @@ public:
struct gl_context *ctx;
struct gl_program *prog;
struct gl_shader_program *shader_program;
struct gl_shader *shader;
struct gl_shader_compiler_options *options;
int next_temp;
@ -5096,11 +5097,11 @@ st_translate_program(
}
}
if (program->shader_program) {
unsigned num_ubos = program->shader_program->NumUniformBlocks;
if (program->shader) {
unsigned num_ubos = program->shader->NumUniformBlocks;
for (i = 0; i < num_ubos; i++) {
ureg_DECL_constant2D(t->ureg, 0, program->shader_program->UniformBlocks[i].UniformBufferSize / 4, i + 1);
ureg_DECL_constant2D(t->ureg, 0, program->shader->UniformBlocks[i].UniformBufferSize / 4, i + 1);
}
}
@ -5221,6 +5222,7 @@ get_mesa_program(struct gl_context *ctx,
v->ctx = ctx;
v->prog = prog;
v->shader_program = shader_program;
v->shader = shader;
v->options = options;
v->glsl_version = ctx->Const.GLSLVersion;
v->native_integers = ctx->Const.NativeIntegers;