llvmpipe: move getting mask value out of depth code. (v2)
authorDave Airlie <airlied@redhat.com>
Thu, 19 Mar 2020 05:47:14 +0000 (15:47 +1000)
committerMarge Bot <eric+marge@anholt.net>
Wed, 6 May 2020 06:20:37 +0000 (06:20 +0000)
In order to add per-sample support to this code, the mask
value is needed not the value from the exec mask.

v2: update comment

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

src/gallium/drivers/llvmpipe/lp_bld_depth.c
src/gallium/drivers/llvmpipe/lp_bld_depth.h
src/gallium/drivers/llvmpipe/lp_state_fs.c

index 3e8b6936b01a8312480a4a0974b1888754cd04f2..5efbb3945a7823407130039891863952aac06dec 100644 (file)
@@ -654,7 +654,7 @@ lp_build_depth_stencil_load_swizzled(struct gallivm_state *gallivm,
  * \param type  the data type of the fragment depth/stencil values
  * \param format_desc  description of the depth/stencil surface
  * \param is_1d  whether this resource has only one dimension
- * \param mask  the alive/dead pixel mask for the quad (vector)
+ * \param mask_value the alive/dead pixel mask for the quad (vector)
  * \param z_fb  z values read from fb (with padding)
  * \param s_fb  s values read from fb (with padding)
  * \param loop_counter  the current loop iteration
@@ -668,7 +668,7 @@ lp_build_depth_stencil_write_swizzled(struct gallivm_state *gallivm,
                                       struct lp_type z_src_type,
                                       const struct util_format_description *format_desc,
                                       boolean is_1d,
-                                      struct lp_build_mask_context *mask,
+                                      LLVMValueRef mask_value,
                                       LLVMValueRef z_fb,
                                       LLVMValueRef s_fb,
                                       LLVMValueRef loop_counter,
@@ -680,7 +680,6 @@ lp_build_depth_stencil_write_swizzled(struct gallivm_state *gallivm,
    struct lp_build_context z_bld;
    LLVMValueRef shuffles[LP_MAX_VECTOR_LENGTH / 4];
    LLVMBuilderRef builder = gallivm->builder;
-   LLVMValueRef mask_value = NULL;
    LLVMValueRef zs_dst1, zs_dst2;
    LLVMValueRef zs_dst_ptr1, zs_dst_ptr2;
    LLVMValueRef depth_offset1, depth_offset2;
@@ -738,8 +737,7 @@ lp_build_depth_stencil_write_swizzled(struct gallivm_state *gallivm,
       s_value = LLVMBuildBitCast(builder, s_value, z_bld.vec_type, "");
    }
 
-   if (mask) {
-      mask_value = lp_build_mask_value(mask);
+   if (mask_value) {
       z_value = lp_build_select(&z_bld, mask_value, z_value, z_fb);
       if (format_desc->block.bits > 32) {
          s_fb = LLVMBuildBitCast(builder, s_fb, z_bld.vec_type, "");
index d169c896711475abac98e7b1767720f3057525f6..f0115daacc11553dbd003483b05fb340f7244337 100644 (file)
@@ -86,7 +86,7 @@ lp_build_depth_stencil_write_swizzled(struct gallivm_state *gallivm,
                                       struct lp_type z_src_type,
                                       const struct util_format_description *format_desc,
                                       boolean is_1d,
-                                      struct lp_build_mask_context *mask,
+                                      LLVMValueRef mask_value,
                                       LLVMValueRef z_fb,
                                       LLVMValueRef s_fb,
                                       LLVMValueRef loop_counter,
index 1b5ee26f275eed8dd4950247ea2e3ecf89801433..fc56468332f881ace14c85f1c8fb13c5a3184c87 100644 (file)
@@ -637,7 +637,7 @@ generate_fs_loop(struct gallivm_state *gallivm,
        */
       lp_build_depth_stencil_write_swizzled(gallivm, type,
                                             zs_format_desc, key->resource_1d,
-                                            &mask, z_fb, s_fb, loop_state.counter,
+                                            lp_build_mask_value(&mask), z_fb, s_fb, loop_state.counter,
                                             depth_ptr, depth_stride,
                                             z_value, s_value);
    }