llvmpipe: fix multisample occlusion queries.
authorDave Airlie <airlied@redhat.com>
Tue, 24 Mar 2020 02:54:52 +0000 (12:54 +1000)
committerMarge Bot <eric+marge@anholt.net>
Wed, 6 May 2020 06:20:38 +0000 (06:20 +0000)
This needs to check the per-sample mask inside the loop if
multisample is enabled.

Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4122>

src/gallium/drivers/llvmpipe/lp_state_fs.c

index 34ed257b5b0712b7b07034e0f34cbcaac8f67e4b..38973e6ceb127dc0d4cdbe2dd4769f26b65bd24f 100644 (file)
@@ -859,17 +859,18 @@ generate_fs_loop(struct gallivm_state *gallivm,
                                             z_value, s_value);
    }
 
-   if (key->multisample) {
-      /* store the sample mask for this loop */
-      LLVMBuildStore(builder, s_mask, s_mask_ptr);
-      lp_build_for_loop_end(&sample_loop_state);
-   }
-
    if (key->occlusion_count) {
       LLVMValueRef counter = lp_jit_thread_data_counter(gallivm, thread_data_ptr);
       lp_build_name(counter, "counter");
+
       lp_build_occlusion_count(gallivm, type,
-                               lp_build_mask_value(&mask), counter);
+                               key->multisample ? s_mask : lp_build_mask_value(&mask), counter);
+   }
+
+   if (key->multisample) {
+      /* store the sample mask for this loop */
+      LLVMBuildStore(builder, s_mask, s_mask_ptr);
+      lp_build_for_loop_end(&sample_loop_state);
    }
 
    mask_val = lp_build_mask_end(&mask);