diff options
Diffstat (limited to 'src/gallium/drivers/zink/zink_clear.c')
-rw-r--r-- | src/gallium/drivers/zink/zink_clear.c | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/src/gallium/drivers/zink/zink_clear.c b/src/gallium/drivers/zink/zink_clear.c index 3975447e292..bdb9efad8f7 100644 --- a/src/gallium/drivers/zink/zink_clear.c +++ b/src/gallium/drivers/zink/zink_clear.c @@ -443,7 +443,15 @@ zink_clear_texture(struct pipe_context *pctx, flags |= PIPE_CLEAR_STENCIL; surf = create_clear_surface(pctx, pres, level, box); zink_blit_begin(ctx, ZINK_BLIT_SAVE_FB | ZINK_BLIT_SAVE_FS); - util_blitter_clear_depth_stencil(ctx->blitter, surf, flags, depth, stencil, box->x, box->y, box->width, box->height); + /* Vulkan requires depth to be in the range of [0.0, 1.0], while GL uses + * the viewport range of [-1.0, 1.0], creating a mismatch during u_blitter rendering; + * to account for this, de-convert depth back to GL for viewport transform: + + depth = (depth * 2) - 1 + + * this yields the correct result after the viewport has been clamped + */ + util_blitter_clear_depth_stencil(ctx->blitter, surf, flags, (depth * 2) - 1, stencil, box->x, box->y, box->width, box->height); } } /* this will never destroy the surface */ |