nir/lower_io: make sure range is not 0

For samplers the type_size() callback can return 0, which triggers
a NIR validation error.
In this case set range to ~0 which means the range is unknown.

Acked-by: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36263>
This commit is contained in:
Pierre-Eric Pelloux-Prayer 2025-07-21 12:14:53 +02:00
parent 004f8aa2f4
commit 718fd47dde
16 changed files with 5 additions and 29 deletions

View file

@ -307,8 +307,12 @@ emit_load(struct lower_io_state *state,
const struct glsl_type *type = var->type;
if (array_index)
type = glsl_get_array_element(type);
unsigned var_size = state->type_size(type, var->data.bindless);
nir_intrinsic_set_range(load, var_size);
if (var_size)
nir_intrinsic_set_range(load, var_size);
else
nir_intrinsic_set_range(load, ~0);
}
if (mode == nir_var_shader_in || mode == nir_var_shader_out)

View file

@ -8,7 +8,6 @@ glx@glx-visuals-stencil -pixmap,Fail
glx@glx_arb_create_context_no_error@no error,Fail
glx@glx_ext_no_config_context@no fbconfig,Fail
spec@!opengl 1.1@line-smooth-stipple,Fail
spec@arb_bindless_texture@compiler@samplers@arith-bound-sampler-texture2d.frag,Crash
spec@arb_program_interface_query@arb_program_interface_query-getprogramresourceindex,Fail
spec@arb_program_interface_query@arb_program_interface_query-getprogramresourceindex@'vs_input2[1][0]' on GL_PROGRAM_INPUT,Fail
spec@arb_shader_texture_lod@execution@arb_shader_texture_lod-texgradcube,Fail

1 # LLVM 18.1.2
8 glx@glx_ext_no_config_context@no fbconfig,Fail
9 spec@!opengl 1.1@line-smooth-stipple,Fail
10 spec@arb_bindless_texture@compiler@samplers@arith-bound-sampler-texture2d.frag,Crash spec@arb_program_interface_query@arb_program_interface_query-getprogramresourceindex,Fail
spec@arb_program_interface_query@arb_program_interface_query-getprogramresourceindex,Fail
11 spec@arb_program_interface_query@arb_program_interface_query-getprogramresourceindex@'vs_input2[1][0]' on GL_PROGRAM_INPUT,Fail
12 spec@arb_shader_texture_lod@execution@arb_shader_texture_lod-texgradcube,Fail
13 spec@arb_shading_language_packing@execution@built-in-functions@fs-packhalf2x16,Fail

View file

@ -24,9 +24,6 @@ spec@khr_texture_compression_astc@sliced-3d-miptree-gles srgb-fp,Fail
spec@khr_texture_compression_astc@sliced-3d-miptree-gles srgb-fp@sRGB decode full precision,Fail
spec@oes_shader_io_blocks@compiler@layout-location-aliasing.vert,Fail
# error: nir_intrinsic_range(instr) != 0 (../src/compiler/nir/nir_validate.c:599)^M
spec@arb_bindless_texture@compiler@samplers@arith-bound-sampler-texture2d.frag,Crash
# glcts failures
KHR-GL46.sparse_texture2_tests.StandardPageSizesTestCase_texture_1d_array_r11f_g11f_b10f,Fail
KHR-GL46.sparse_texture2_tests.StandardPageSizesTestCase_texture_1d_array_r16,Fail

1 # piglit failures
24 spec@khr_texture_compression_astc@sliced-3d-miptree-gles srgb-fp@sRGB decode full precision,Fail
25 spec@oes_shader_io_blocks@compiler@layout-location-aliasing.vert,Fail
26 # error: nir_intrinsic_range(instr) != 0 (../src/compiler/nir/nir_validate.c:599)^M # glcts failures
spec@arb_bindless_texture@compiler@samplers@arith-bound-sampler-texture2d.frag,Crash
# glcts failures
KHR-GL46.sparse_texture2_tests.StandardPageSizesTestCase_texture_1d_array_r11f_g11f_b10f,Fail
27 KHR-GL46.sparse_texture2_tests.StandardPageSizesTestCase_texture_1d_array_r16,Fail KHR-GL46.sparse_texture2_tests.StandardPageSizesTestCase_texture_1d_array_r11f_g11f_b10f,Fail
28 KHR-GL46.sparse_texture2_tests.StandardPageSizesTestCase_texture_1d_array_r16_snorm,Fail KHR-GL46.sparse_texture2_tests.StandardPageSizesTestCase_texture_1d_array_r16,Fail
29 KHR-GL46.sparse_texture2_tests.StandardPageSizesTestCase_texture_1d_array_r16f,Fail KHR-GL46.sparse_texture2_tests.StandardPageSizesTestCase_texture_1d_array_r16_snorm,Fail

View file

@ -14,9 +14,6 @@ spec@!opengl 1.0@rasterpos@glsl_vs_tes_linked
# Random: ../src/util/hash_table.c:311: hash_table_search: Assertion `!key_pointer_is_reserved(ht, key)' failed.
spec@ext_image_dma_buf_import@ext_image_dma_buf_import-refcount-multithread
# Random: error: nir_intrinsic_range(instr) != 0 (../src/compiler/nir/nir_validate.c:599)
spec@arb_bindless_texture@compiler@samplers@arith-bound-sampler-texture2d.frag
# Random
# Mostly reported by "Some new flakes found:" and most of them never appear in the failures
KHR-GL46.geometry_shader.primitive_counter.triangles_to_line_strip_rp

Can't render this file because it contains an unexpected character in line 18 and column 22.

View file

@ -13,9 +13,6 @@ spec@!opengl 1.0@rasterpos@glsl_vs_tes_linked
# Random: ../src/util/hash_table.c:311: hash_table_search: Assertion `!key_pointer_is_reserved(ht, key)' failed.
spec@ext_image_dma_buf_import@ext_image_dma_buf_import-refcount-multithread
# Random: error: nir_intrinsic_range(instr) != 0 (../src/compiler/nir/nir_validate.c:599)
spec@arb_bindless_texture@compiler@samplers@arith-bound-sampler-texture2d.frag
# Random
# Mostly reported by "Some new flakes found:" and most of them never appear in the failures
KHR-GL46.geometry_shader.primitive_counter.lines_to_line_strip

Can't render this file because it contains an unexpected character in line 17 and column 22.

View file

@ -10,9 +10,6 @@ spec@!opengl 1.0@rasterpos@glsl_vs_tes_linked
# Random: ../src/util/hash_table.c:311: hash_table_search: Assertion `!key_pointer_is_reserved(ht, key)' failed.
spec@ext_image_dma_buf_import@ext_image_dma_buf_import-refcount-multithread
# Random: error: nir_intrinsic_range(instr) != 0 (../src/compiler/nir/nir_validate.c:599)
spec@arb_bindless_texture@compiler@samplers@arith-bound-sampler-texture2d.frag
# Random
# Mostly reported by "Some new flakes found:" and most of them never appear in the failures
KHR-GL46.ext_texture_shadow_lod.texture.samplercubearrayshadow_fragment

Can't render this file because it contains an unexpected character in line 14 and column 22.

View file

@ -36,7 +36,6 @@ spec@!opengl 3.2@gl-3.2-adj-prims cull-front pv-first,Fail
spec@!opengl 3.2@gl-3.2-adj-prims line cull-back pv-first,Fail
spec@!opengl 3.2@gl-3.2-adj-prims line cull-front pv-first,Fail
spec@!opengl 3.2@gl-3.2-adj-prims pv-first,Fail
spec@arb_bindless_texture@compiler@samplers@arith-bound-sampler-texture2d.frag,Crash
spec@arb_es2_compatibility@texwrap formats bordercolor-swizzled,Fail
spec@arb_es2_compatibility@texwrap formats bordercolor-swizzled@GL_RGB565- swizzled- border color only,Fail
spec@arb_program_interface_query@arb_program_interface_query-getprogramresourceindex,Fail

1 # piglit failures
36 spec@!opengl 3.2@gl-3.2-adj-prims line cull-back pv-first,Fail
37 spec@!opengl 3.2@gl-3.2-adj-prims line cull-front pv-first,Fail
38 spec@!opengl 3.2@gl-3.2-adj-prims pv-first,Fail
spec@arb_bindless_texture@compiler@samplers@arith-bound-sampler-texture2d.frag,Crash
39 spec@arb_es2_compatibility@texwrap formats bordercolor-swizzled,Fail
40 spec@arb_es2_compatibility@texwrap formats bordercolor-swizzled@GL_RGB565- swizzled- border color only,Fail
41 spec@arb_program_interface_query@arb_program_interface_query-getprogramresourceindex,Fail

View file

@ -27,7 +27,6 @@ spec@!opengl 3.2@gl-3.2-adj-prims line cull-back pv-first,Fail
spec@!opengl 3.2@gl-3.2-adj-prims line cull-front pv-first,Fail
spec@!opengl 3.2@gl-3.2-adj-prims pv-first,Fail
spec@arb_bindless_texture@compiler@images@arith-bound-image.frag,Crash
spec@arb_bindless_texture@compiler@samplers@arith-bound-sampler-texture2d.frag,Crash
spec@arb_es2_compatibility@texwrap formats bordercolor-swizzled,Fail
spec@arb_es2_compatibility@texwrap formats bordercolor-swizzled@GL_RGB565- swizzled- border color only,Fail
spec@arb_program_interface_query@arb_program_interface_query-getprogramresourceindex,Fail

1 # piglit failures
27 spec@!opengl 3.2@gl-3.2-adj-prims line cull-front pv-first,Fail
28 spec@!opengl 3.2@gl-3.2-adj-prims pv-first,Fail
29 spec@arb_bindless_texture@compiler@images@arith-bound-image.frag,Crash
spec@arb_bindless_texture@compiler@samplers@arith-bound-sampler-texture2d.frag,Crash
30 spec@arb_es2_compatibility@texwrap formats bordercolor-swizzled,Fail
31 spec@arb_es2_compatibility@texwrap formats bordercolor-swizzled@GL_RGB565- swizzled- border color only,Fail
32 spec@arb_program_interface_query@arb_program_interface_query-getprogramresourceindex,Fail

View file

@ -19,7 +19,6 @@ spec@arb_texture_query_lod@compiler@built-in-functions@texturequerylod-samplercu
spec@arb_texture_query_lod@compiler@built-in-functions@texturequerylod-samplercubeshadow.frag,Crash
spec@arb_uniform_buffer_object@referenced-by-shader,Fail
glx@glx_ext_no_config_context@no fbconfig,Fail
spec@arb_bindless_texture@compiler@samplers@arith-bound-sampler-texture2d.frag,Crash
spec@arb_program_interface_query@arb_program_interface_query-getprogramresourceindex,Fail
spec@arb_program_interface_query@arb_program_interface_query-getprogramresourceindex@'vs_input2[1][0]' on GL_PROGRAM_INPUT,Fail
spec@arb_shader_texture_lod@execution@arb_shader_texture_lod-texgradcube,Fail

1 # piglit failures
19 spec@arb_texture_query_lod@compiler@built-in-functions@texturequerylod-samplercubeshadow.frag,Crash
20 spec@arb_uniform_buffer_object@referenced-by-shader,Fail
21 glx@glx_ext_no_config_context@no fbconfig,Fail
spec@arb_bindless_texture@compiler@samplers@arith-bound-sampler-texture2d.frag,Crash
22 spec@arb_program_interface_query@arb_program_interface_query-getprogramresourceindex,Fail
23 spec@arb_program_interface_query@arb_program_interface_query-getprogramresourceindex@'vs_input2[1][0]' on GL_PROGRAM_INPUT,Fail
24 spec@arb_shader_texture_lod@execution@arb_shader_texture_lod-texgradcube,Fail

View file

@ -24,7 +24,6 @@ spec@!opengl 3.2@gl-3.2-adj-prims cull-front pv-last,Fail
spec@!opengl 3.2@gl-3.2-adj-prims line cull-back pv-last,Fail
spec@!opengl 3.2@gl-3.2-adj-prims line cull-front pv-last,Fail
spec@!opengl 3.2@gl-3.2-adj-prims pv-last,Fail
spec@arb_bindless_texture@compiler@samplers@arith-bound-sampler-texture2d.frag,Crash
spec@arb_program_interface_query@arb_program_interface_query-getprogramresourceindex,Fail
spec@arb_program_interface_query@arb_program_interface_query-getprogramresourceindex@'vs_input2[1][0]' on GL_PROGRAM_INPUT,Fail
spec@arb_shader_texture_lod@execution@arb_shader_texture_lod-texgradcube,Fail

1 # piglit failures
24 spec@!opengl 3.2@gl-3.2-adj-prims line cull-front pv-last,Fail
25 spec@!opengl 3.2@gl-3.2-adj-prims pv-last,Fail
26 spec@arb_bindless_texture@compiler@samplers@arith-bound-sampler-texture2d.frag,Crash spec@arb_program_interface_query@arb_program_interface_query-getprogramresourceindex,Fail
spec@arb_program_interface_query@arb_program_interface_query-getprogramresourceindex,Fail
27 spec@arb_program_interface_query@arb_program_interface_query-getprogramresourceindex@'vs_input2[1][0]' on GL_PROGRAM_INPUT,Fail
28 spec@arb_shader_texture_lod@execution@arb_shader_texture_lod-texgradcube,Fail
29 spec@arb_shading_language_packing@execution@built-in-functions@fs-packhalf2x16,Fail

View file

@ -15,7 +15,6 @@ glx@glx_arb_sync_control@swapbuffersmsc-return swap_interval 1,Fail
glx@glx-multi-window-single-context,Fail
glx@glx-multithread-texture,Crash
glx@glx-swap-pixmap-bad,Fail
spec@arb_bindless_texture@compiler@samplers@arith-bound-sampler-texture2d.frag,Crash
spec@arb_fragment_shader_interlock@arb_fragment_shader_interlock-image-load-store,Fail
spec@arb_gpu_shader_fp64@execution@arb_gpu_shader_fp64-tf-separate,Fail
spec@arb_sample_locations@test,Fail

View file

@ -8,8 +8,6 @@ glx@extension string sanity,Fail
# #6322
spec@arb_framebuffer_object@fbo-blit-scaled-linear,Fail
spec@arb_bindless_texture@compiler@samplers@arith-bound-sampler-texture2d.frag,Crash
spec@arb_gpu_shader_fp64@execution@arb_gpu_shader_fp64-tf-separate,Fail
spec@arb_program_interface_query@arb_program_interface_query-getprogramresourceindex,Fail
spec@arb_program_interface_query@arb_program_interface_query-getprogramresourceindex@'vs_input2[1][0]' on GL_PROGRAM_INPUT,Fail

View file

@ -8,8 +8,6 @@ glx@extension string sanity,Fail
# #6322
spec@arb_framebuffer_object@fbo-blit-scaled-linear,Fail
spec@arb_bindless_texture@compiler@samplers@arith-bound-sampler-texture2d.frag,Crash
spec@arb_gpu_shader_fp64@execution@arb_gpu_shader_fp64-tf-separate,Fail
spec@arb_program_interface_query@arb_program_interface_query-getprogramresourceindex,Fail
spec@arb_program_interface_query@arb_program_interface_query-getprogramresourceindex@'vs_input2[1][0]' on GL_PROGRAM_INPUT,Fail

View file

@ -8,8 +8,6 @@ glx@extension string sanity,Fail
# #6322
spec@arb_framebuffer_object@fbo-blit-scaled-linear,Fail
spec@arb_bindless_texture@compiler@samplers@arith-bound-sampler-texture2d.frag,Crash
spec@arb_gpu_shader_fp64@execution@arb_gpu_shader_fp64-tf-separate,Fail
spec@arb_program_interface_query@arb_program_interface_query-getprogramresourceindex,Fail
spec@arb_program_interface_query@arb_program_interface_query-getprogramresourceindex@'vs_input2[1][0]' on GL_PROGRAM_INPUT,Fail

View file

@ -8,8 +8,6 @@ glx@extension string sanity,Fail
# #6322
spec@arb_framebuffer_object@fbo-blit-scaled-linear,Fail
spec@arb_bindless_texture@compiler@samplers@arith-bound-sampler-texture2d.frag,Crash
spec@arb_gpu_shader_fp64@execution@arb_gpu_shader_fp64-tf-separate,Fail
spec@arb_program_interface_query@arb_program_interface_query-getprogramresourceindex,Fail
spec@arb_program_interface_query@arb_program_interface_query-getprogramresourceindex@'vs_input2[1][0]' on GL_PROGRAM_INPUT,Fail

View file

@ -8,8 +8,6 @@ glx@extension string sanity,Fail
# #6322
spec@arb_framebuffer_object@fbo-blit-scaled-linear,Fail
spec@arb_bindless_texture@compiler@samplers@arith-bound-sampler-texture2d.frag,Crash
spec@arb_gpu_shader_fp64@execution@arb_gpu_shader_fp64-tf-separate,Fail
spec@arb_sample_shading@ignore-centroid-qualifier 2,Fail
spec@arb_sample_shading@ignore-centroid-qualifier 4,Fail