diff options
author | Dave Airlie <[email protected]> | 2020-03-11 08:23:10 +1000 |
---|---|---|
committer | Marge Bot <[email protected]> | 2020-05-06 06:20:37 +0000 |
commit | d2f488684ad398f5abffefb9b1424fcb1650a627 (patch) | |
tree | d2eb709bfc845f93f0dc4c5b75c6ec8555008ff3 | |
parent | 67ec1760eecbcb5c52992d9098a7e220f22c7d22 (diff) |
llvmpipe: change mask input to fragment shader to 64-bit.
In order to handle a 4xMSAA mask (16-bits per sample) increase
the fragment shader API to be 64-bit.
v2: drop pointless if (Roland)
Reviewed-by: Roland Scheidegger <[email protected]>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4122>
-rw-r--r-- | src/gallium/drivers/llvmpipe/lp_jit.h | 4 | ||||
-rw-r--r-- | src/gallium/drivers/llvmpipe/lp_rast.c | 4 | ||||
-rw-r--r-- | src/gallium/drivers/llvmpipe/lp_rast_priv.h | 2 | ||||
-rw-r--r-- | src/gallium/drivers/llvmpipe/lp_state_fs.c | 12 |
4 files changed, 14 insertions, 8 deletions
diff --git a/src/gallium/drivers/llvmpipe/lp_jit.h b/src/gallium/drivers/llvmpipe/lp_jit.h index 61f4b9b650b..dcfe274b6f4 100644 --- a/src/gallium/drivers/llvmpipe/lp_jit.h +++ b/src/gallium/drivers/llvmpipe/lp_jit.h @@ -286,7 +286,7 @@ enum { * @param dady shader input dady * @param color color buffer * @param depth depth buffer - * @param mask mask of visible pixels in block + * @param mask mask of visible pixels in block (16-bits per sample) * @param thread_data task thread data * @param stride color buffer row stride in bytes * @param depth_stride depth buffer row stride in bytes @@ -301,7 +301,7 @@ typedef void const void *dady, uint8_t **color, uint8_t *depth, - uint32_t mask, + uint64_t mask, struct lp_jit_thread_data *thread_data, unsigned *stride, unsigned depth_stride, diff --git a/src/gallium/drivers/llvmpipe/lp_rast.c b/src/gallium/drivers/llvmpipe/lp_rast.c index 5a6abd8de4d..c4c5053be78 100644 --- a/src/gallium/drivers/llvmpipe/lp_rast.c +++ b/src/gallium/drivers/llvmpipe/lp_rast.c @@ -374,7 +374,7 @@ lp_rast_shade_tile(struct lp_rasterizer_task *task, GET_DADY(inputs), color, depth, - 0xffff, + (uint64_t)0xffff, &task->thread_data, stride, depth_stride, @@ -482,7 +482,7 @@ lp_rast_shade_quads_mask(struct lp_rasterizer_task *task, GET_DADY(inputs), color, depth, - mask, + (uint64_t)mask, &task->thread_data, stride, depth_stride, diff --git a/src/gallium/drivers/llvmpipe/lp_rast_priv.h b/src/gallium/drivers/llvmpipe/lp_rast_priv.h index d4a3e48eff4..6c962ffdc52 100644 --- a/src/gallium/drivers/llvmpipe/lp_rast_priv.h +++ b/src/gallium/drivers/llvmpipe/lp_rast_priv.h @@ -275,7 +275,7 @@ lp_rast_shade_quads_all( struct lp_rasterizer_task *task, GET_DADY(inputs), color, depth, - 0xffff, + (uint64_t)0xffff, &task->thread_data, stride, depth_stride, diff --git a/src/gallium/drivers/llvmpipe/lp_state_fs.c b/src/gallium/drivers/llvmpipe/lp_state_fs.c index b6bc8c3a7c0..7014f6ddeb4 100644 --- a/src/gallium/drivers/llvmpipe/lp_state_fs.c +++ b/src/gallium/drivers/llvmpipe/lp_state_fs.c @@ -123,7 +123,8 @@ static LLVMValueRef generate_quad_mask(struct gallivm_state *gallivm, struct lp_type fs_type, unsigned first_quad, - LLVMValueRef mask_input) /* int32 */ + unsigned sample, + LLVMValueRef mask_input) /* int64 */ { LLVMBuilderRef builder = gallivm->builder; struct lp_type mask_type; @@ -162,6 +163,11 @@ generate_quad_mask(struct gallivm_state *gallivm, shift = 0; } + mask_input = LLVMBuildLShr(builder, mask_input, lp_build_const_int64(gallivm, 16 * sample), ""); + mask_input = LLVMBuildTrunc(builder, mask_input, + i32t, ""); + mask_input = LLVMBuildAnd(builder, mask_input, lp_build_const_int32(gallivm, 0xffff), ""); + mask_input = LLVMBuildLShr(builder, mask_input, LLVMConstInt(i32t, shift, 0), @@ -2538,7 +2544,7 @@ generate_fragment(struct llvmpipe_context *lp, arg_types[6] = LLVMPointerType(fs_elem_type, 0); /* dady */ arg_types[7] = LLVMPointerType(LLVMPointerType(blend_vec_type, 0), 0); /* color */ arg_types[8] = LLVMPointerType(int8_type, 0); /* depth */ - arg_types[9] = int32_type; /* mask_input */ + arg_types[9] = LLVMInt64TypeInContext(gallivm->context); /* mask_input */ arg_types[10] = variant->jit_thread_data_ptr_type; /* per thread data */ arg_types[11] = LLVMPointerType(int32_type, 0); /* stride */ arg_types[12] = int32_type; /* depth_stride */ @@ -2660,7 +2666,7 @@ generate_fragment(struct llvmpipe_context *lp, if (partial_mask) { mask = generate_quad_mask(gallivm, fs_type, - i*fs_type.length/4, mask_input); + i*fs_type.length/4, 0, mask_input); } else { mask = lp_build_const_int_vec(gallivm, fs_type, ~0); |