From 9d328b77ccd2d1c971f85456aca43e9d2da0a8a9 Mon Sep 17 00:00:00 2001 From: Philip Rebohle Date: Fri, 7 Feb 2025 22:50:36 +0100 Subject: [PATCH] [d3d11] Forward DiscardResource calls to backend for images --- src/d3d11/d3d11_context.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/d3d11/d3d11_context.cpp b/src/d3d11/d3d11_context.cpp index b0579d00b..60d1d1aa3 100644 --- a/src/d3d11/d3d11_context.cpp +++ b/src/d3d11/d3d11_context.cpp @@ -127,7 +127,6 @@ namespace dxvk { if (!pResource) return; - // We don't support the Discard API for images D3D11_RESOURCE_DIMENSION resType = D3D11_RESOURCE_DIMENSION_UNKNOWN; pResource->GetType(&resType); @@ -135,9 +134,16 @@ namespace dxvk { DiscardBuffer(pResource); } else { auto texture = GetCommonTexture(pResource); + auto image = texture->GetImage(); for (uint32_t i = 0; i < texture->CountSubresources(); i++) DiscardTexture(pResource, i); + + if (image) { + EmitCs([cImage = std::move(image)] (DxvkContext* ctx) { + ctx->discardImage(cImage); + }); + } } }