llvmpipe: fix early depth + alpha2coverage + occlusion query interaction
authorMike Blumenkrantz <michael.blumenkrantz@gmail.com>
Wed, 9 Aug 2023 19:18:59 +0000 (15:18 -0400)
committerMarge Bot <emma+marge@anholt.net>
Thu, 10 Aug 2023 01:56:03 +0000 (01:56 +0000)
in this scenario, sample counting must happen before a2c, as a2c may eliminate
coverage if alpha is zero, leading to a sample count of zero

dEQP-VK.fragment_operations.early_fragment.sample_count_early_fragment_tests_depth_alpha_to_coverage_samples_4_maintenance5

cc: mesa-stable

Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24589>

src/gallium/drivers/llvmpipe/ci/llvmpipe-fails.txt
src/gallium/drivers/llvmpipe/lp_state_fs.c
src/gallium/drivers/virgl/ci/virpipe-gl-fails.txt

index eed59c5..4775382 100644 (file)
@@ -68,12 +68,6 @@ spec@arb_post_depth_coverage@arb_post_depth_coverage-multisampling,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
 
-# Query result
-#  Expected: 1536
-#  Observed: 768
-spec@arb_shader_image_load_store@early-z,Fail
-spec@arb_shader_image_load_store@early-z@occlusion query test/early-z pass,Fail
-
 spec@arb_shader_image_load_store@execution@image-array-out-of-bounds-access-load,Crash
 spec@arb_shader_image_load_store@execution@image-array-out-of-bounds-access-store,Crash
 
index 35b3dfb..78c3b25 100644 (file)
@@ -943,6 +943,12 @@ generate_fs_loop(struct gallivm_state *gallivm,
          lp_build_pointer_set(builder, z_fb_store, sample_loop_state.counter, z_fb);
          lp_build_pointer_set(builder, s_fb_store, sample_loop_state.counter, s_fb);
       }
+      if (key->occlusion_count && !(depth_mode & EARLY_DEPTH_TEST_INFERRED)) {
+         LLVMValueRef counter = lp_jit_thread_data_vis_counter(gallivm, thread_data_type, thread_data_ptr);
+         lp_build_name(counter, "counter");
+         lp_build_occlusion_count(gallivm, type,
+                                 key->multisample ? s_mask : lp_build_mask_value(&mask), counter);
+      }
    }
 
    if (key->multisample) {
@@ -1350,7 +1356,7 @@ generate_fs_loop(struct gallivm_state *gallivm,
                                             z_value, s_value);
    }
 
-   if (key->occlusion_count) {
+   if (key->occlusion_count && (!(depth_mode & EARLY_DEPTH_TEST) || (depth_mode & EARLY_DEPTH_TEST_INFERRED))) {
       LLVMValueRef counter = lp_jit_thread_data_vis_counter(gallivm, thread_data_type, thread_data_ptr);
       lp_build_name(counter, "counter");
 
index 3fcacbd..d13eb04 100644 (file)
@@ -285,8 +285,6 @@ spec@arb_program_interface_query@arb_program_interface_query-getprogramresourcei
 spec@arb_program_interface_query@arb_program_interface_query-getprogramresourceindex@'vs_input2[1][0]' on GL_PROGRAM_INPUT,Fail
 
 spec@arb_sample_shading@builtin-gl-sample-position 2,Fail
-spec@arb_shader_image_load_store@early-z,Fail
-spec@arb_shader_image_load_store@early-z@occlusion query test/early-z pass,Fail
 
 spec@arb_shader_image_load_store@layer,Fail
 spec@arb_shader_image_load_store@layer@image2DMS/layered binding test,Fail