mesa/src/compiler
Danylo Piliaiev f2b17dec12 nir/lower_samplers: Clamp out-of-bounds access to array of samplers
Section 5.11 (Out-of-Bounds Accesses) of the GLSL 4.60 spec says:

"In the subsections described above for array, vector, matrix and
 structure accesses, any out-of-bounds access produced undefined
 behavior.... Out-of-bounds reads return undefined values, which
 include values from other variables of the active program or zero."

Robustness extensions suggest to return zero on out-of-bounds
accesses, however it's not applicable to the arrays of samplers,
so just clamp the index.

Otherwise instr->sampler_index or instr->texture_index would be out
of bounds, and they are used as an index to arrays of driver state.

E.g. this fixes such dereference:
 if (options->lower_tex_packing[tex->sampler_index] !=
in nir_lower_tex.c

CC: <mesa-stable@lists.freedesktop.org>
Signed-off-by: Danylo Piliaiev <danylo.piliaiev@globallogic.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6428>
2020-09-22 09:06:52 +00:00
..
glsl glsl: Initialize ir_constant member const_elements in all constructors. 2020-09-21 18:29:46 -07:00
nir nir/lower_samplers: Clamp out-of-bounds access to array of samplers 2020-09-22 09:06:52 +00:00
spirv spirv: Plumb access qualifiers through from image types 2020-09-20 14:28:13 +00:00
Android.glsl.gen.mk Android: Fixes for Q and R 2020-07-15 20:49:24 +00:00
Android.glsl.mk android: glsl: build shader cache sources 2017-02-20 16:30:37 +00:00
Android.mk Android: glsl: add rules to generate ir_expression*.h header files 2016-09-06 15:58:55 +01:00
Android.nir.gen.mk nir: Add missing dependency in Android.nir.gen.mk 2019-08-19 09:53:18 +03:00
Android.nir.mk android: fix libmesa_nir build 2017-07-21 08:47:56 +03:00
builtin_type_macros.h nir/vtn: Add support for kernel images to SPIRV-to-NIR. 2020-08-31 21:17:39 +00:00
glsl_types.cpp glsl_type: Add packed to structure type comparison for hash map 2020-09-18 19:33:00 +00:00
glsl_types.h nir/glsl: Add an explicit_alignment field to glsl_type 2020-09-03 18:02:50 +00:00
Makefile.sources nir: Add a pass for lowering CL-style image ops to texture ops 2020-09-20 14:28:13 +00:00
meson.build spirv: add some tests for volatile/available/visible 2020-09-01 17:15:22 +00:00
nir_types.cpp nir/glsl: Add an explicit_alignment field to glsl_type 2020-09-03 18:02:50 +00:00
nir_types.h nir/glsl: Add an explicit_alignment field to glsl_type 2020-09-03 18:02:50 +00:00
SConscript spirv: Fix building with SCons 2018-03-30 14:33:03 -06:00
SConscript.glsl Move compiler.h and imports.h/c from src/mesa/main into src/util 2020-03-27 21:00:09 +00:00
SConscript.nir nir: mako all the intrinsics 2018-03-27 08:36:37 -04:00
SConscript.spirv spirv: Fix building with SCons 2018-03-30 14:33:03 -06:00
shader_enums.c compiler: add INTERP_MODE_COLOR for radeonsi 2020-09-02 23:03:00 -04:00
shader_enums.h compiler: add INTERP_MODE_COLOR for radeonsi 2020-09-02 23:03:00 -04:00
shader_info.h nir/vtn: Convert constant samplers to variables with data 2020-08-31 21:17:39 +00:00