summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEric Anholt <[email protected]>2018-12-27 19:37:13 -0800
committerEric Anholt <[email protected]>2019-01-27 08:30:03 -0800
commitc51d125d1851b76fbee5a0d99d81e92eac705939 (patch)
treef32e6b7205b7a75865c702c21d5a71af4cd9c5b9
parent8a0b0a8f3787803de6608cf124982edff634623c (diff)
v3d: Fix stencil sampling from a separate-stencil buffer.
When the sampler view is in sample-stencil mode, we need to return uint stencil values. To do that, fill in the format table to return R8I, and have the sampler view point at the separate stencil buffer. Fixes dEQP-GLES31.functional.stencil_texturing.format.depth32f_stencil8_2d
-rw-r--r--src/gallium/drivers/v3d/v3dx_format_table.c1
-rw-r--r--src/gallium/drivers/v3d/v3dx_state.c6
2 files changed, 7 insertions, 0 deletions
diff --git a/src/gallium/drivers/v3d/v3dx_format_table.c b/src/gallium/drivers/v3d/v3dx_format_table.c
index 80f0dc6513d..18a1a86fa66 100644
--- a/src/gallium/drivers/v3d/v3dx_format_table.c
+++ b/src/gallium/drivers/v3d/v3dx_format_table.c
@@ -153,6 +153,7 @@ static const struct v3d_format format_table[] = {
/* Pretend we support this, but it'll be separate Z32F depth and S8. */
FORMAT(Z32_FLOAT_S8X24_UINT, D32F, DEPTH_COMP32F, SWIZ_XXXX, 32, 1),
+ FORMAT(X32_S8X24_UINT, S8, R8UI, SWIZ_XXXX, 16, 1),
#else
FORMAT(S8_UINT_Z24_UNORM, ZS_DEPTH24_STENCIL8, DEPTH24_X8, SWIZ_XXXX, 32, 1),
FORMAT(X8Z24_UNORM, ZS_DEPTH24_STENCIL8, DEPTH24_X8, SWIZ_XXXX, 32, 1),
diff --git a/src/gallium/drivers/v3d/v3dx_state.c b/src/gallium/drivers/v3d/v3dx_state.c
index 47b7ad03cc3..9560d3f293b 100644
--- a/src/gallium/drivers/v3d/v3dx_state.c
+++ b/src/gallium/drivers/v3d/v3dx_state.c
@@ -774,6 +774,12 @@ v3d_create_sampler_view(struct pipe_context *pctx, struct pipe_resource *prsc,
so->base.reference.count = 1;
so->base.context = pctx;
+ if (rsc->separate_stencil &&
+ cso->format == PIPE_FORMAT_X32_S8X24_UINT) {
+ rsc = rsc->separate_stencil;
+ prsc = &rsc->base;
+ }
+
/* V3D still doesn't support sampling from raster textures, so we will
* have to copy to a temporary tiled texture.
*/