aboutsummaryrefslogtreecommitdiff
path: root/mesalib/src/glsl/linker.cpp
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2012-08-01 08:02:35 +0200
committermarha <marha@users.sourceforge.net>2012-08-01 08:02:35 +0200
commit49838240b7d4cff1ffed1bd91e495f6919061f90 (patch)
tree70bd36783cafbf991721b06134bafdd360ccbe06 /mesalib/src/glsl/linker.cpp
parentbd27b3d008b0abf9ae2edcb127302728808533e4 (diff)
downloadvcxsrv-49838240b7d4cff1ffed1bd91e495f6919061f90.tar.gz
vcxsrv-49838240b7d4cff1ffed1bd91e495f6919061f90.tar.bz2
vcxsrv-49838240b7d4cff1ffed1bd91e495f6919061f90.zip
git mesa update 1 Aug 2012
Diffstat (limited to 'mesalib/src/glsl/linker.cpp')
-rw-r--r--mesalib/src/glsl/linker.cpp34
1 files changed, 34 insertions, 0 deletions
diff --git a/mesalib/src/glsl/linker.cpp b/mesalib/src/glsl/linker.cpp
index bfdde4023..34ce13372 100644
--- a/mesalib/src/glsl/linker.cpp
+++ b/mesalib/src/glsl/linker.cpp
@@ -2324,6 +2324,12 @@ check_resources(struct gl_context *ctx, struct gl_shader_program *prog)
0 /* FINISHME: Geometry shaders. */
};
+ const unsigned max_uniform_blocks[MESA_SHADER_TYPES] = {
+ ctx->Const.VertexProgram.MaxUniformBlocks,
+ ctx->Const.FragmentProgram.MaxUniformBlocks,
+ ctx->Const.GeometryProgram.MaxUniformBlocks,
+ };
+
for (unsigned i = 0; i < MESA_SHADER_TYPES; i++) {
struct gl_shader *sh = prog->_LinkedShaders[i];
@@ -2348,6 +2354,34 @@ check_resources(struct gl_context *ctx, struct gl_shader_program *prog)
}
}
+ unsigned blocks[MESA_SHADER_TYPES] = {0};
+ unsigned total_uniform_blocks = 0;
+
+ for (unsigned i = 0; i < prog->NumUniformBlocks; i++) {
+ for (unsigned j = 0; j < MESA_SHADER_TYPES; j++) {
+ if (prog->UniformBlockStageIndex[j][i] != -1) {
+ blocks[j]++;
+ total_uniform_blocks++;
+ }
+ }
+
+ if (total_uniform_blocks > ctx->Const.MaxCombinedUniformBlocks) {
+ linker_error(prog, "Too many combined uniform blocks (%d/%d)",
+ prog->NumUniformBlocks,
+ ctx->Const.MaxCombinedUniformBlocks);
+ } else {
+ for (unsigned i = 0; i < MESA_SHADER_TYPES; i++) {
+ if (blocks[i] > max_uniform_blocks[i]) {
+ linker_error(prog, "Too many %s uniform blocks (%d/%d)",
+ shader_names[i],
+ blocks[i],
+ max_uniform_blocks[i]);
+ break;
+ }
+ }
+ }
+ }
+
return prog->LinkStatus;
}