mirror of
https://github.com/doitsujin/dxvk.git
synced 2025-02-22 07:54:15 +01:00
[d3d11] Implement image MAP_WRITE_DISCARD on immediate context
This commit is contained in:
parent
789e8db699
commit
ae67c026aa
@ -446,16 +446,22 @@ namespace dxvk {
|
|||||||
uint64_t sequenceNumber = pResource->GetSequenceNumber(Subresource);
|
uint64_t sequenceNumber = pResource->GetSequenceNumber(Subresource);
|
||||||
|
|
||||||
auto formatInfo = lookupFormatInfo(packedFormat);
|
auto formatInfo = lookupFormatInfo(packedFormat);
|
||||||
|
auto layout = pResource->GetSubresourceLayout(formatInfo->aspectMask, Subresource);
|
||||||
|
|
||||||
if (mapMode == D3D11_COMMON_TEXTURE_MAP_MODE_DIRECT) {
|
if (mapMode == D3D11_COMMON_TEXTURE_MAP_MODE_DIRECT) {
|
||||||
Rc<DxvkImage> mappedImage = pResource->GetImage();
|
Rc<DxvkImage> mappedImage = pResource->GetImage();
|
||||||
|
|
||||||
// Wait for the resource to become available. We do not
|
if (MapType == D3D11_MAP_WRITE_DISCARD) {
|
||||||
// support image renaming, so stall on DISCARD instead.
|
EmitCs([
|
||||||
if (MapType == D3D11_MAP_WRITE_DISCARD)
|
cImage = std::move(mappedImage),
|
||||||
MapFlags &= ~D3D11_MAP_FLAG_DO_NOT_WAIT;
|
cStorage = pResource->DiscardStorage()
|
||||||
|
] (DxvkContext* ctx) {
|
||||||
|
ctx->invalidateImage(cImage, Rc<DxvkResourceAllocation>(cStorage));
|
||||||
|
ctx->initImage(cImage, cImage->getAvailableSubresources(), VK_IMAGE_LAYOUT_PREINITIALIZED);
|
||||||
|
});
|
||||||
|
|
||||||
if (MapType != D3D11_MAP_WRITE_NO_OVERWRITE) {
|
ThrottleDiscard(layout.Size);
|
||||||
|
} else if (MapType != D3D11_MAP_WRITE_NO_OVERWRITE) {
|
||||||
if (!WaitForResource(*mappedImage, sequenceNumber, MapType, MapFlags))
|
if (!WaitForResource(*mappedImage, sequenceNumber, MapType, MapFlags))
|
||||||
return DXGI_ERROR_WAS_STILL_DRAWING;
|
return DXGI_ERROR_WAS_STILL_DRAWING;
|
||||||
}
|
}
|
||||||
@ -563,7 +569,6 @@ namespace dxvk {
|
|||||||
pResource->SetMapType(Subresource, MapType);
|
pResource->SetMapType(Subresource, MapType);
|
||||||
|
|
||||||
if (pMappedResource) {
|
if (pMappedResource) {
|
||||||
auto layout = pResource->GetSubresourceLayout(formatInfo->aspectMask, Subresource);
|
|
||||||
pMappedResource->pData = pResource->GetMapPtr(Subresource, layout.Offset);
|
pMappedResource->pData = pResource->GetMapPtr(Subresource, layout.Offset);
|
||||||
pMappedResource->RowPitch = layout.RowPitch;
|
pMappedResource->RowPitch = layout.RowPitch;
|
||||||
pMappedResource->DepthPitch = layout.DepthPitch;
|
pMappedResource->DepthPitch = layout.DepthPitch;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user