Module: Mesa Branch: master Commit: ad094433b4180ae5d9a33562a0982d399a0bb4bc URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=ad094433b4180ae5d9a33562a0982d399a0bb4bc
Author: Timothy Arceri <[email protected]> Date: Mon Feb 17 11:01:50 2020 +1100 glsl: add some error checks to the nir uniform linker These are optional for spirv but it shouldnt hurt to enable them. Reviewed-by: Alejandro PiƱeiro <[email protected]> Tested-by: Marge Bot <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/3992> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/3992> --- src/compiler/glsl/gl_nir_link_uniforms.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/compiler/glsl/gl_nir_link_uniforms.c b/src/compiler/glsl/gl_nir_link_uniforms.c index fc2de8753b1..375340026a0 100644 --- a/src/compiler/glsl/gl_nir_link_uniforms.c +++ b/src/compiler/glsl/gl_nir_link_uniforms.c @@ -802,6 +802,22 @@ gl_nir_link_uniforms(struct gl_context *ctx, return false; } + if (state.num_shader_samplers > + ctx->Const.Program[shader_type].MaxTextureImageUnits) { + linker_error(prog, "Too many %s shader texture samplers\n", + _mesa_shader_stage_to_string(shader_type)); + continue; + } + + if (state.num_shader_images > + ctx->Const.Program[shader_type].MaxImageUniforms) { + linker_error(prog, "Too many %s shader image uniforms (%u > %u)\n", + _mesa_shader_stage_to_string(shader_type), + state.num_shader_images, + ctx->Const.Program[shader_type].MaxImageUniforms); + continue; + } + sh->Program->SamplersUsed = state.shader_samplers_used; sh->shadow_samplers = state.shader_shadow_samplers; sh->Program->info.num_textures = state.num_shader_samplers; _______________________________________________ mesa-commit mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/mesa-commit
