diff options
author | Dave Airlie <[email protected]> | 2019-12-03 16:01:37 +1000 |
---|---|---|
committer | Dave Airlie <[email protected]> | 2020-04-27 12:35:24 +1000 |
commit | 024b5dfc1c3eb7255bbec975d57d4002458096bd (patch) | |
tree | 8464fd8931e477a42b96bb0abfe980f3f9c22ef6 /src/gallium/drivers/llvmpipe | |
parent | 65906d133130df5308b32c3fc92fb8690d231abc (diff) |
llvmpipe: enable stencil only formats. (v2)
This fixes two bugs, one in clearing and one in sign extensions
for S8 only types, and enables it for use.
These are useful for vulkan support later.
v2: move casting to same place as Z casting.
Reviewed-by: Roland Scheidegger <[email protected]>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4574>
Diffstat (limited to 'src/gallium/drivers/llvmpipe')
-rw-r--r-- | src/gallium/drivers/llvmpipe/lp_bld_depth.c | 6 | ||||
-rw-r--r-- | src/gallium/drivers/llvmpipe/lp_rast.c | 6 | ||||
-rw-r--r-- | src/gallium/drivers/llvmpipe/lp_screen.c | 5 |
3 files changed, 11 insertions, 6 deletions
diff --git a/src/gallium/drivers/llvmpipe/lp_bld_depth.c b/src/gallium/drivers/llvmpipe/lp_bld_depth.c index 63c2fb5d891..3e8b6936b01 100644 --- a/src/gallium/drivers/llvmpipe/lp_bld_depth.c +++ b/src/gallium/drivers/llvmpipe/lp_bld_depth.c @@ -599,6 +599,12 @@ lp_build_depth_stencil_load_swizzled(struct gallivm_state *gallivm, LLVMConstVector(shuffles, zs_type.length), ""); *s_fb = *z_fb; + if (format_desc->block.bits == 8) { + /* Extend stencil-only 8 bit values (S8_UINT) */ + *s_fb = LLVMBuildZExt(builder, *s_fb, + lp_build_int_vec_type(gallivm, z_src_type), ""); + } + if (format_desc->block.bits < z_src_type.width) { /* Extend destination ZS values (e.g., when reading from Z16_UNORM) */ *z_fb = LLVMBuildZExt(builder, *z_fb, diff --git a/src/gallium/drivers/llvmpipe/lp_rast.c b/src/gallium/drivers/llvmpipe/lp_rast.c index ad55ed7be79..3d335e2ad38 100644 --- a/src/gallium/drivers/llvmpipe/lp_rast.c +++ b/src/gallium/drivers/llvmpipe/lp_rast.c @@ -211,7 +211,11 @@ lp_rast_clear_zstencil(struct lp_rasterizer_task *task, switch (block_size) { case 1: assert(clear_mask == 0xff); - memset(dst, (uint8_t) clear_value, height * width); + for (i = 0; i < height; i++) { + uint8_t *row = (uint8_t *)dst; + memset(row, (uint8_t) clear_value, width); + dst += dst_stride; + } break; case 2: if (clear_mask == 0xffff) { diff --git a/src/gallium/drivers/llvmpipe/lp_screen.c b/src/gallium/drivers/llvmpipe/lp_screen.c index 9b691e819b1..d6ba3e32852 100644 --- a/src/gallium/drivers/llvmpipe/lp_screen.c +++ b/src/gallium/drivers/llvmpipe/lp_screen.c @@ -733,11 +733,6 @@ llvmpipe_is_format_supported( struct pipe_screen *_screen, if (format_desc->colorspace != UTIL_FORMAT_COLORSPACE_ZS) return false; - - /* TODO: Support stencil-only formats */ - if (format_desc->swizzle[0] == PIPE_SWIZZLE_NONE) { - return false; - } } if (format_desc->layout == UTIL_FORMAT_LAYOUT_ASTC || |