aboutsummaryrefslogtreecommitdiffstats
path: root/src/compiler/glsl/linker.cpp
diff options
context:
space:
mode:
authorCaio Marcelo de Oliveira Filho <[email protected]>2019-11-08 22:21:10 -0800
committerCaio Marcelo de Oliveira Filho <[email protected]>2019-11-11 10:58:40 -0800
commitd4a3b09c4bfd955dab92dbb27ab8bc273d18e649 (patch)
tree82cb9ce926227f57436aefd8c7d3e7e2dafe7e05 /src/compiler/glsl/linker.cpp
parentfce76ae7690e5a36f3744466d0e8df90e69bc80f (diff)
glsl: Check earlier for MaxTextureImageUnits and MaxImageUniforms
Currently the linker do all the work then check for the limits, which means num_textures and num_images in shader_info may have to store more than the limit. This breaks down now since shader_info was packed and doesn't expect to store larger invalid values. To fix this, pull the check before we set the counts in shader_info. Add necessary plumbing to make sure we bail once those errors are found. Fixes: 84a1a2578da ("compiler: pack shader_info from 160 bytes to 96 bytes") Reviewed-by: Timothy Arceri <[email protected]>
Diffstat (limited to 'src/compiler/glsl/linker.cpp')
-rw-r--r--src/compiler/glsl/linker.cpp15
1 files changed, 3 insertions, 12 deletions
diff --git a/src/compiler/glsl/linker.cpp b/src/compiler/glsl/linker.cpp
index d39c63ae743..977d91f5118 100644
--- a/src/compiler/glsl/linker.cpp
+++ b/src/compiler/glsl/linker.cpp
@@ -3336,12 +3336,6 @@ check_resources(struct gl_context *ctx, struct gl_shader_program *prog)
if (sh == NULL)
continue;
- if (sh->Program->info.num_textures >
- ctx->Const.Program[i].MaxTextureImageUnits) {
- linker_error(prog, "Too many %s shader texture samplers\n",
- _mesa_shader_stage_to_string(i));
- }
-
if (sh->num_uniform_components >
ctx->Const.Program[i].MaxUniformComponents) {
if (ctx->Const.GLSLSkipStrictMaxUniformLimitCheck) {
@@ -3473,12 +3467,6 @@ check_image_resources(struct gl_context *ctx, struct gl_shader_program *prog)
struct gl_linked_shader *sh = prog->_LinkedShaders[i];
if (sh) {
- if (sh->Program->info.num_images > ctx->Const.Program[i].MaxImageUniforms)
- linker_error(prog, "Too many %s shader image uniforms (%u > %u)\n",
- _mesa_shader_stage_to_string(i),
- sh->Program->info.num_images,
- ctx->Const.Program[i].MaxImageUniforms);
-
total_image_units += sh->Program->info.num_images;
total_shader_storage_blocks += sh->Program->info.num_ssbos;
@@ -4765,6 +4753,9 @@ link_and_validate_uniforms(struct gl_context *ctx,
update_array_sizes(prog);
link_assign_uniform_locations(prog, ctx);
+ if (prog->data->LinkStatus == LINKING_FAILURE)
+ return;
+
link_assign_atomic_counter_resources(ctx, prog);
link_calculate_subroutine_compat(prog);
check_resources(ctx, prog);