From 73bc604128b541c982fc0490e577923430d0da71 Mon Sep 17 00:00:00 2001 From: Timothy Arceri Date: Thu, 26 Feb 2026 10:56:20 +1100 Subject: [PATCH] glsl: relax precision matching on unused uniforms ES MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 0886be09 ("glsl: Allow precision mismatch on dead data with GLSL ES 1.00") allowed precision mismatches on uniforms, however if you lower precision on 16-bit consts, then this error triggers instead. So here we relax the type matching and just make sure we match int vs float. Fixes: 0886be09 ("glsl: Allow precision mismatch on dead data with GLSL ES 1.00") Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/5337 Reviewed-by: Marek Olšák Part-of: --- src/amd/ci/radeonsi-mendocino-fails.txt | 1 - src/amd/ci/radeonsi-raven-fails.txt | 1 - src/amd/ci/radeonsi-stoney-fails.txt | 1 - src/amd/ci/radeonsi-vangogh-fails.txt | 1 - src/compiler/glsl/gl_nir_linker.c | 27 ++++++++++++++----- .../drivers/radeonsi/ci/gfx11-navi31-fail.csv | 2 -- .../radeonsi/ci/gfx12-gfx1200-fail.csv | 2 -- .../radeonsi/ci/gfx8-polaris11-fail.csv | 1 - .../drivers/radeonsi/ci/gfx9-raven-fail.csv | 1 - src/panfrost/ci/panfrost-g610-fails.txt | 1 - 10 files changed, 21 insertions(+), 17 deletions(-) diff --git a/src/amd/ci/radeonsi-mendocino-fails.txt b/src/amd/ci/radeonsi-mendocino-fails.txt index a553ed8162e..05449db8508 100644 --- a/src/amd/ci/radeonsi-mendocino-fails.txt +++ b/src/amd/ci/radeonsi-mendocino-fails.txt @@ -401,7 +401,6 @@ spec@egl 1.4@eglterminate then unbind context,Fail spec@egl_khr_surfaceless_context@viewport,Fail spec@egl_mesa_configless_context@basic,Fail spec@ext_external_objects@vk-ping-pong-single-sem,Crash -spec@glsl-es-1.00@linker@glsl-mismatched-uniform-precision-unused,Fail spec@glsl-es-3.00@execution@built-in-functions@fs-packhalf2x16,Fail spec@glsl-es-3.00@execution@built-in-functions@vs-packhalf2x16,Fail spec@khr_texture_compression_astc@miptree-gles srgb-fp,Fail diff --git a/src/amd/ci/radeonsi-raven-fails.txt b/src/amd/ci/radeonsi-raven-fails.txt index 3c1ab717225..c060697dd12 100644 --- a/src/amd/ci/radeonsi-raven-fails.txt +++ b/src/amd/ci/radeonsi-raven-fails.txt @@ -71,5 +71,4 @@ program@run kernel with max work item sizes,Fail # uprev Piglit in Mesa spec@ext_external_objects@vk-semaphores,Crash spec@ext_external_objects@vk-semaphores-2,Crash -spec@glsl-es-1.00@linker@glsl-mismatched-uniform-precision-unused,Fail diff --git a/src/amd/ci/radeonsi-stoney-fails.txt b/src/amd/ci/radeonsi-stoney-fails.txt index 51ea9af2a4e..96d76ec6c69 100644 --- a/src/amd/ci/radeonsi-stoney-fails.txt +++ b/src/amd/ci/radeonsi-stoney-fails.txt @@ -121,7 +121,6 @@ spec@ext_texture_srgb@texwrap formats-s3tc bordercolor-swizzled@GL_COMPRESSED_SR spec@ext_texture_srgb@texwrap formats-s3tc bordercolor-swizzled@GL_COMPRESSED_SRGB_S3TC_DXT1_EXT- swizzled- border color only,Fail spec@glsl-1.50@execution@geometry@tri-strip-ordering-with-prim-restart gl_triangle_strip_adjacency ffs,Fail spec@glsl-1.50@execution@geometry@tri-strip-ordering-with-prim-restart gl_triangle_strip_adjacency other,Fail -spec@glsl-es-1.00@linker@glsl-mismatched-uniform-precision-unused,Fail spec@glsl-es-3.00@execution@built-in-functions@fs-packhalf2x16,Fail spec@glsl-es-3.00@execution@built-in-functions@vs-packhalf2x16,Fail spec@khr_texture_compression_astc@miptree-gl srgb-fp,Fail diff --git a/src/amd/ci/radeonsi-vangogh-fails.txt b/src/amd/ci/radeonsi-vangogh-fails.txt index c34668a98a1..ad277730e22 100644 --- a/src/amd/ci/radeonsi-vangogh-fails.txt +++ b/src/amd/ci/radeonsi-vangogh-fails.txt @@ -14,7 +14,6 @@ spec@egl_khr_surfaceless_context@viewport,Fail spec@ext_external_objects@vk-image-display,Crash spec@ext_external_objects@vk-semaphores,Crash spec@ext_external_objects@vk-semaphores-2,Crash -spec@glsl-es-1.00@linker@glsl-mismatched-uniform-precision-unused,Fail spec@glsl-es-3.00@execution@built-in-functions@fs-packhalf2x16,Fail spec@glsl-es-3.00@execution@built-in-functions@vs-packhalf2x16,Fail spec@khr_texture_compression_astc@miptree-gles srgb-fp,Fail diff --git a/src/compiler/glsl/gl_nir_linker.c b/src/compiler/glsl/gl_nir_linker.c index 73a540ea616..4cc654763f6 100644 --- a/src/compiler/glsl/gl_nir_linker.c +++ b/src/compiler/glsl/gl_nir_linker.c @@ -1684,12 +1684,27 @@ cross_validate_globals(void *mem_ctx, const struct gl_constants *consts, existing->data.mode == nir_var_mem_ssbo && existing->data.from_ssbo_unsized_array && glsl_get_gl_type(var->type) == glsl_get_gl_type(existing->type))) { - linker_error(prog, "%s `%s' declared as type " - "`%s' and type `%s'\n", - gl_nir_mode_string(var), - var->name, glsl_get_type_name(var->type), - glsl_get_type_name(existing->type)); - return; + + /* Relax precision matching on unused uniforms for early ES shaders */ + if (prog->IsES && !var->interface_type && + !(existing->data.used && var->data.used) && + glsl_base_type_is_integer(glsl_get_gl_type(var->type)) == glsl_base_type_is_integer(glsl_get_gl_type(existing->type)) && + glsl_base_type_is_float(glsl_get_gl_type(var->type)) == glsl_base_type_is_float(glsl_get_gl_type(existing->type)) && + prog->GLSL_Version < 300) { + linker_warning(prog, "%s `%s' declared as type " + "`%s' and type `%s'\n", + gl_nir_mode_string(var), + var->name, glsl_get_type_name(var->type), + glsl_get_type_name(existing->type)); + + } else { + linker_error(prog, "%s `%s' declared as type " + "`%s' and type `%s'\n", + gl_nir_mode_string(var), + var->name, glsl_get_type_name(var->type), + glsl_get_type_name(existing->type)); + return; + } } } } diff --git a/src/gallium/drivers/radeonsi/ci/gfx11-navi31-fail.csv b/src/gallium/drivers/radeonsi/ci/gfx11-navi31-fail.csv index 114963fa289..741e4b7d072 100644 --- a/src/gallium/drivers/radeonsi/ci/gfx11-navi31-fail.csv +++ b/src/gallium/drivers/radeonsi/ci/gfx11-navi31-fail.csv @@ -24,8 +24,6 @@ spec@khr_texture_compression_astc@sliced-3d-miptree-gles srgb-fp@sRGB decode ful spec@!opengl 1.0@rasterpos,Fail spec@!opengl 1.0@rasterpos@glsl_vs_gs_linked,Fail spec@!opengl 1.0@rasterpos@glsl_vs_tes_linked,Fail -# This is caused by lowering mediump before linking: -spec@glsl-es-1.00@linker@glsl-mismatched-uniform-precision-unused,Fail # See Khronos issue 5587: the test expects one-dimensional (array) texture to work while # it's explicitely marked as non-supported by EXT_sparse_texture2. diff --git a/src/gallium/drivers/radeonsi/ci/gfx12-gfx1200-fail.csv b/src/gallium/drivers/radeonsi/ci/gfx12-gfx1200-fail.csv index 25f90aaf6b3..bdb07a61979 100644 --- a/src/gallium/drivers/radeonsi/ci/gfx12-gfx1200-fail.csv +++ b/src/gallium/drivers/radeonsi/ci/gfx12-gfx1200-fail.csv @@ -22,8 +22,6 @@ spec@oes_shader_io_blocks@compiler@layout-location-aliasing.vert,Fail spec@!opengl 1.0@rasterpos,Fail spec@!opengl 1.0@rasterpos@glsl_vs_gs_linked,Fail spec@!opengl 1.0@rasterpos@glsl_vs_tes_linked,Fail -# This is caused by lowering mediump before linking: -spec@glsl-es-1.00@linker@glsl-mismatched-uniform-precision-unused,Fail # glcts failures ## Test issue - https://github.com/KhronosGroup/VK-GL-CTS/issues/251 diff --git a/src/gallium/drivers/radeonsi/ci/gfx8-polaris11-fail.csv b/src/gallium/drivers/radeonsi/ci/gfx8-polaris11-fail.csv index 2f4828ce159..96aa9eee7d1 100644 --- a/src/gallium/drivers/radeonsi/ci/gfx8-polaris11-fail.csv +++ b/src/gallium/drivers/radeonsi/ci/gfx8-polaris11-fail.csv @@ -124,7 +124,6 @@ spec@ext_texture_srgb@texwrap formats-s3tc bordercolor-swizzled@GL_COMPRESSED_SR spec@ext_texture_srgb@texwrap formats-s3tc bordercolor-swizzled@GL_COMPRESSED_SRGB_S3TC_DXT1_EXT- swizzled- border color only,Fail spec@glsl-1.50@execution@geometry@tri-strip-ordering-with-prim-restart gl_triangle_strip_adjacency ffs,Fail spec@glsl-1.50@execution@geometry@tri-strip-ordering-with-prim-restart gl_triangle_strip_adjacency other,Fail -spec@glsl-es-1.00@linker@glsl-mismatched-uniform-precision-unused,Fail spec@glsl-es-3.00@execution@built-in-functions@fs-packhalf2x16,Fail spec@glsl-es-3.00@execution@built-in-functions@vs-packhalf2x16,Fail spec@khr_texture_compression_astc@miptree-gl srgb-fp,Fail diff --git a/src/gallium/drivers/radeonsi/ci/gfx9-raven-fail.csv b/src/gallium/drivers/radeonsi/ci/gfx9-raven-fail.csv index b6b352e0431..b028cf173f6 100644 --- a/src/gallium/drivers/radeonsi/ci/gfx9-raven-fail.csv +++ b/src/gallium/drivers/radeonsi/ci/gfx9-raven-fail.csv @@ -35,7 +35,6 @@ spec@glsl-4.00@compiler@built-in-functions@texturequerylod-sampler2darrayshadow. spec@glsl-4.00@compiler@built-in-functions@texturequerylod-sampler2dshadow.frag,Crash spec@glsl-4.00@compiler@built-in-functions@texturequerylod-samplercubearrayshadow.frag,Crash spec@glsl-4.00@compiler@built-in-functions@texturequerylod-samplercubeshadow.frag,Crash -spec@glsl-es-1.00@linker@glsl-mismatched-uniform-precision-unused,Fail spec@glsl-1.50@execution@geometry@tri-strip-ordering-with-prim-restart gl_triangle_strip_adjacency ffs,Fail spec@glsl-1.50@execution@geometry@tri-strip-ordering-with-prim-restart gl_triangle_strip_adjacency other,Fail spec@glsl-es-3.00@execution@built-in-functions@fs-packhalf2x16,Fail diff --git a/src/panfrost/ci/panfrost-g610-fails.txt b/src/panfrost/ci/panfrost-g610-fails.txt index 5dddf65ed7a..547e1f623cc 100644 --- a/src/panfrost/ci/panfrost-g610-fails.txt +++ b/src/panfrost/ci/panfrost-g610-fails.txt @@ -257,7 +257,6 @@ spec@glsl-1.30@execution@tex-miplevel-selection textureprojgradoffset 2d,Fail spec@glsl-1.30@execution@tex-miplevel-selection textureprojgradoffset 2d_projvec4,Fail spec@glsl-1.30@execution@tex-miplevel-selection textureprojgradoffset 2dshadow,Fail spec@glsl-1.30@execution@tex-miplevel-selection textureprojgradoffset 3d,Fail -spec@glsl-es-1.00@linker@glsl-mismatched-uniform-precision-unused,Fail spec@intel_blackhole_render@intel_blackhole-draw_gles2,Crash spec@intel_blackhole_render@intel_blackhole-draw_gles3,Crash spec@khr_texture_compression_astc@miptree-gles srgb-fp,Fail