From 8fb16b88142faf45d993356ec36a96d20ca05aaf Mon Sep 17 00:00:00 2001 From: "Juan A. Suarez Romero" Date: Thu, 25 May 2023 09:57:47 +0200 Subject: [PATCH] v3d: enable NIR compact arrays Now that it is exposing GLSL 1.30, and we can read clipdistance arrays in the fragment shader, let's enable this capability. It fixes `spec@glsl-1.30@execution@clipping@fs-clip-distance-interpolated,Crash`. Reviewed-by: Iago Toral Quiroga Signed-off-by: Juan A. Suarez Romero Part-of: --- src/broadcom/ci/broadcom-rpi4-fails.txt | 1 - src/gallium/drivers/v3d/v3d_program.c | 12 ++++++++++++ src/gallium/drivers/v3d/v3d_screen.c | 1 + 3 files changed, 13 insertions(+), 1 deletion(-) diff --git a/src/broadcom/ci/broadcom-rpi4-fails.txt b/src/broadcom/ci/broadcom-rpi4-fails.txt index 667a170..43d15f1 100644 --- a/src/broadcom/ci/broadcom-rpi4-fails.txt +++ b/src/broadcom/ci/broadcom-rpi4-fails.txt @@ -402,7 +402,6 @@ spec@glsl-1.10@execution@glsl-vs-inline-explosion,Crash spec@glsl-1.20@compiler@invalid-vec4-array-to-vec3-array-conversion.vert,Fail spec@glsl-1.20@execution@clipping@vs-clip-vertex-primitives,Fail spec@glsl-1.20@execution@fs-underflow-mul-compare-zero,Fail -spec@glsl-1.30@execution@clipping@fs-clip-distance-interpolated,Crash spec@intel_performance_query@intel_performance_query-issue_2235,Fail spec@khr_texture_compression_astc@miptree-gles srgb-fp,Fail spec@khr_texture_compression_astc@miptree-gles srgb-fp@sRGB decode full precision,Fail diff --git a/src/gallium/drivers/v3d/v3d_program.c b/src/gallium/drivers/v3d/v3d_program.c index dac246b..1896c03 100644 --- a/src/gallium/drivers/v3d/v3d_program.c +++ b/src/gallium/drivers/v3d/v3d_program.c @@ -50,6 +50,18 @@ v3d_get_slot_for_driver_location(nir_shader *s, uint32_t driver_location) if (var->data.driver_location == driver_location) { return var->data.location; } + + /* For compact arrays, we have more than one location to + * check. + */ + if (var->data.compact) { + assert(glsl_type_is_array(var->type)); + for (int i = 0; i < DIV_ROUND_UP(glsl_array_size(var->type), 4); i++) { + if ((var->data.driver_location + i) == driver_location) { + return var->data.location; + } + } + } } return -1; diff --git a/src/gallium/drivers/v3d/v3d_screen.c b/src/gallium/drivers/v3d/v3d_screen.c index 6b90e66..2394426 100644 --- a/src/gallium/drivers/v3d/v3d_screen.c +++ b/src/gallium/drivers/v3d/v3d_screen.c @@ -149,6 +149,7 @@ v3d_screen_get_param(struct pipe_screen *pscreen, enum pipe_cap param) case PIPE_CAP_CONDITIONAL_RENDER: case PIPE_CAP_CONDITIONAL_RENDER_INVERTED: case PIPE_CAP_CUBE_MAP_ARRAY: + case PIPE_CAP_NIR_COMPACT_ARRAYS: return 1; case PIPE_CAP_POLYGON_OFFSET_CLAMP: -- 2.7.4