From: Dave Airlie Date: Thu, 19 Mar 2020 05:47:14 +0000 (+1000) Subject: llvmpipe: move getting mask value out of depth code. (v2) X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=d297f2ecf1b14f573dc425fae192b1013d175493;p=mesa.git llvmpipe: move getting mask value out of depth code. (v2) 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 Part-of: --- diff --git a/src/gallium/drivers/llvmpipe/lp_bld_depth.c b/src/gallium/drivers/llvmpipe/lp_bld_depth.c index 3e8b6936b01..5efbb3945a7 100644 --- a/src/gallium/drivers/llvmpipe/lp_bld_depth.c +++ b/src/gallium/drivers/llvmpipe/lp_bld_depth.c @@ -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, ""); diff --git a/src/gallium/drivers/llvmpipe/lp_bld_depth.h b/src/gallium/drivers/llvmpipe/lp_bld_depth.h index d169c896711..f0115daacc1 100644 --- a/src/gallium/drivers/llvmpipe/lp_bld_depth.h +++ b/src/gallium/drivers/llvmpipe/lp_bld_depth.h @@ -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, diff --git a/src/gallium/drivers/llvmpipe/lp_state_fs.c b/src/gallium/drivers/llvmpipe/lp_state_fs.c index 1b5ee26f275..fc56468332f 100644 --- a/src/gallium/drivers/llvmpipe/lp_state_fs.c +++ b/src/gallium/drivers/llvmpipe/lp_state_fs.c @@ -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); }