d3d12: fix clear_depth_stencil texture deref
authorItalo Nicola <italonicola@collabora.com>
Sun, 9 Jul 2023 22:47:43 +0000 (19:47 -0300)
committerMarge Bot <emma+marge@anholt.net>
Mon, 10 Jul 2023 15:23:06 +0000 (15:23 +0000)
Signed-off-by: Italo Nicola <italonicola@collabora.com>
Reviewed-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23735>

src/gallium/drivers/d3d12/d3d12_context.cpp

index 2964c17f8b06dfdcbfe4e8c4d22f1f041e8cf731..b90a870bbf4342afb323b5bcc3488b5899da4d3b 100644 (file)
@@ -2080,7 +2080,7 @@ d3d12_clear_depth_stencil(struct pipe_context *pctx,
    if (clear_flags & PIPE_CLEAR_STENCIL)
       flags |= D3D12_CLEAR_FLAG_STENCIL;
 
-   struct d3d12_resource *res = d3d12_resource(ctx->fb.zsbuf->texture);
+   struct d3d12_resource *res = d3d12_resource(psurf->texture);
    d3d12_transition_resource_state(ctx, res,
                                    D3D12_RESOURCE_STATE_DEPTH_WRITE,
                                    D3D12_TRANSITION_FLAG_INVALIDATE_BINDINGS);