Move combining clip and cull optimization before linking
authorOleksii Bozhenko <oleksii.bozhenko@globallogic.com>
Wed, 1 Mar 2023 13:04:00 +0000 (15:04 +0200)
committerMarge Bot <emma+marge@anholt.net>
Wed, 22 Mar 2023 19:01:40 +0000 (19:01 +0000)
As far gl_nir_link_glsl fills xfb data we should do it after lowering clip and cull in order to get correct locations.

Fixes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/7152
Signed-off-by: Oleksii Bozhenko <oleksii.bozhenko@globallogic.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21625>

src/freedreno/ci/freedreno-a618-fails.txt
src/freedreno/ci/freedreno-a630-fails.txt
src/gallium/drivers/crocus/ci/crocus-hsw-fails.txt
src/intel/ci/iris-kbl-fails.txt
src/mesa/state_tracker/st_glsl_to_nir.cpp

index 0a01693..29ea0f2 100644 (file)
@@ -334,9 +334,6 @@ spec@arb_query_buffer_object@qbo@query-GL_TIME_ELAPSED-SYNC_CPU_READ_AFTER_CACHE
 spill-dEQP-VK.subgroups.ballot_broadcast.compute.subgroupbroadcast_bool,Fail
 spill-dEQP-VK.subgroups.ballot_broadcast.compute.subgroupbroadcast_bool_requiredsubgroupsize128,Fail
 
-# https://gitlab.freedesktop.org/mesa/mesa/-/issues/7152
-spec@ext_transform_feedback@builtin-varyings gl_culldistance,Fail
-
 # Failing (Color test failed) since wayland platform was enabled in arm builds
 wayland-dEQP-EGL.functional.wide_color.window_888_colorspace_default,Fail
 wayland-dEQP-EGL.functional.wide_color.window_fp16_default_colorspace,Fail
index f84045d..cb6b0cc 100644 (file)
@@ -337,9 +337,6 @@ spec@arb_query_buffer_object@qbo@query-GL_TIME_ELAPSED-SYNC_CPU_READ_AFTER_CACHE
 spec@arb_query_buffer_object@qbo@query-GL_TIME_ELAPSED-SYNC_CPU_READ_AFTER_CACHE_TEST-GL_UNSIGNED_INT,Fail
 spec@arb_query_buffer_object@qbo@query-GL_TIME_ELAPSED-SYNC_CPU_READ_AFTER_CACHE_TEST-GL_UNSIGNED_INT64_ARB,Fail
 
-# https://gitlab.freedesktop.org/mesa/mesa/-/issues/7152
-spec@ext_transform_feedback@builtin-varyings gl_culldistance,Fail
-
 # Excerpt:
 # Image comparison failed: reference = -0.000488281, expected = 0:0:0:0, result = 0:0:0:3
 # Image comparison failed: reference = 0, expected = 0:0:0:0, result = 0:0:0:3
index 545abdc..50935d9 100644 (file)
@@ -951,9 +951,6 @@ spec@nv_copy_image@nv_copy_image-formats --samples=8@Source: GL_RGBA8UI/Destinat
 spec@nv_copy_image@nv_copy_image-formats --samples=8@Source: GL_RGBA8_SNORM/Destination: GL_RG16I,Fail
 spec@nv_copy_image@nv_copy_image-formats --samples=8@Source: GL_RGBA8_SNORM/Destination: GL_RGBA8I,Fail
 
-# See issue #7152
-spec@ext_transform_feedback@builtin-varyings gl_culldistance,Fail
-
 # https://gitlab.freedesktop.org/mesa/mesa/-/issues/8348
 KHR-GL46.tessellation_shader.tessellation_control_to_tessellation_evaluation.gl_tessLevel,Fail
 KHR-GL46.tessellation_shader.tessellation_shader_tessellation.TES,Fail
index 04fdf73..741930c 100644 (file)
@@ -142,9 +142,6 @@ spec@khr_texture_compression_astc@sliced-3d-miptree-gl srgb-fp@sRGB decode full
 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
 
-# https://gitlab.freedesktop.org/mesa/mesa/-/issues/7152
-spec@ext_transform_feedback@builtin-varyings gl_culldistance,Fail
-
 spec@!opengl 1.1@line-smooth-coverage,Fail
 spec@!opengl 1.1@line-smooth-stipple,Fail
 
index 3a7b5e0..8fa0ae7 100644 (file)
@@ -775,6 +775,13 @@ st_link_nir(struct gl_context *ctx,
       nir_opt_access_options opt_access_options;
       opt_access_options.is_vulkan = false;
       NIR_PASS_V(nir, nir_opt_access, &opt_access_options);
+
+      /* Combine clip and cull outputs into one array and set:
+       * - shader_info::clip_distance_array_size
+       * - shader_info::cull_distance_array_size
+       */
+      if (!st->screen->get_param(st->screen, PIPE_CAP_CULL_DISTANCE_NOCOMBINE))
+         NIR_PASS_V(nir, nir_lower_clip_cull_distance_arrays);
    }
 
    if (shader_program->data->spirv) {
@@ -842,9 +849,6 @@ st_link_nir(struct gl_context *ctx,
       NIR_PASS_V(nir, nir_lower_system_values);
       NIR_PASS_V(nir, nir_lower_compute_system_values, NULL);
 
-      if (!st->screen->get_param(st->screen, PIPE_CAP_CULL_DISTANCE_NOCOMBINE))
-         NIR_PASS_V(nir, nir_lower_clip_cull_distance_arrays);
-
       if (i >= 1) {
          struct gl_program *prev_shader = linked_shader[i - 1]->Program;