Skip to content

Commit

Permalink
[d3d11] Forward DiscardResource calls to backend for images
Browse files Browse the repository at this point in the history
  • Loading branch information
doitsujin committed Feb 7, 2025
1 parent 3a29a4e commit 9d328b7
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/d3d11/d3d11_context.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -127,17 +127,23 @@ 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);

if (resType == D3D11_RESOURCE_DIMENSION_BUFFER) {
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);
});
}
}
}

Expand Down

0 comments on commit 9d328b7

Please sign in to comment.