diff --git a/src/d3d11/d3d11_context.cpp b/src/d3d11/d3d11_context.cpp index 7f2c9270..81b4e624 100644 --- a/src/d3d11/d3d11_context.cpp +++ b/src/d3d11/d3d11_context.cpp @@ -378,9 +378,6 @@ namespace dxvk { dstTexture, &dstLayers, dstOffset, srcTexture, &srcLayers, srcOffset, srcExtent); - - if (dstTexture->CanUpdateMappedBufferEarly()) - UpdateMappedBuffer(dstTexture, vk::pickSubresource(dstLayers, 0)); } else { Logger::err(str::format( "D3D11: CopySubresourceRegion1: Incompatible resources", @@ -445,11 +442,6 @@ namespace dxvk { dstTexture, &dstLayers, VkOffset3D(), srcTexture, &srcLayers, VkOffset3D(), srcTexture->MipLevelExtent(i)); - - if (dstTexture->CanUpdateMappedBufferEarly()) { - for (uint32_t j = 0; j < dstDesc->ArraySize; j++) - UpdateMappedBuffer(dstTexture, { dstLayers.aspectMask, i, j }); - } } } } @@ -1037,9 +1029,6 @@ namespace dxvk { UpdateImage(dstTexture, &subresource, offset, extent, std::move(stagingSlice)); - - if (dstTexture->CanUpdateMappedBufferEarly()) - UpdateMappedBuffer(dstTexture, subresource); } } @@ -4178,46 +4167,6 @@ namespace dxvk { } - void D3D11DeviceContext::UpdateMappedBuffer( - const D3D11CommonTexture* pTexture, - VkImageSubresource Subresource) { - UINT SubresourceIndex = D3D11CalcSubresource( - Subresource.mipLevel, Subresource.arrayLayer, - pTexture->Desc()->MipLevels); - - Rc mappedImage = pTexture->GetImage(); - Rc mappedBuffer = pTexture->GetMappedBuffer(SubresourceIndex); - - VkFormat packedFormat = m_parent->LookupPackedFormat( - pTexture->Desc()->Format, pTexture->GetFormatMode()).Format; - - VkExtent3D levelExtent = mappedImage->mipLevelExtent(Subresource.mipLevel); - - EmitCs([ - cImageBuffer = std::move(mappedBuffer), - cImage = std::move(mappedImage), - cSubresources = vk::makeSubresourceLayers(Subresource), - cLevelExtent = levelExtent, - cPackedFormat = packedFormat - ] (DxvkContext* ctx) { - if (cSubresources.aspectMask != (VK_IMAGE_ASPECT_DEPTH_BIT | VK_IMAGE_ASPECT_STENCIL_BIT)) { - ctx->copyImageToBuffer(cImageBuffer, 0, 0, 0, - cImage, cSubresources, VkOffset3D { 0, 0, 0 }, - cLevelExtent); - } else { - ctx->copyDepthStencilImageToPackedBuffer( - cImageBuffer, 0, - VkOffset2D { 0, 0 }, - VkExtent2D { cLevelExtent.width, cLevelExtent.height }, - cImage, cSubresources, - VkOffset2D { 0, 0 }, - VkExtent2D { cLevelExtent.width, cLevelExtent.height }, - cPackedFormat); - } - }); - } - - bool D3D11DeviceContext::TestRtvUavHazards( UINT NumRTVs, ID3D11RenderTargetView* const* ppRTVs, diff --git a/src/d3d11/d3d11_context.h b/src/d3d11/d3d11_context.h index f00af29b..920bc67c 100644 --- a/src/d3d11/d3d11_context.h +++ b/src/d3d11/d3d11_context.h @@ -885,10 +885,6 @@ namespace dxvk { void RestoreUnorderedAccessViews( D3D11UnorderedAccessBindings& Bindings); - void UpdateMappedBuffer( - const D3D11CommonTexture* pTexture, - VkImageSubresource Subresource); - bool TestRtvUavHazards( UINT NumRTVs, ID3D11RenderTargetView* const* ppRTVs, diff --git a/src/d3d11/d3d11_context_imm.cpp b/src/d3d11/d3d11_context_imm.cpp index 974835ed..fbfaca9e 100644 --- a/src/d3d11/d3d11_context_imm.cpp +++ b/src/d3d11/d3d11_context_imm.cpp @@ -416,8 +416,6 @@ namespace dxvk { pResource->Desc()->Format, pResource->GetFormatMode()).Format; auto formatInfo = imageFormatInfo(packedFormat); - auto subresource = pResource->GetSubresourceFromIndex( - formatInfo->aspectMask, Subresource); void* mapPtr; if (mapMode == D3D11_COMMON_TEXTURE_MAP_MODE_DIRECT) { @@ -443,21 +441,8 @@ namespace dxvk { mapPtr = physSlice.mapPtr; } else { - bool wait = MapType != D3D11_MAP_WRITE_NO_OVERWRITE; - - if (mapMode == D3D11_COMMON_TEXTURE_MAP_MODE_BUFFER) { - // When using any map mode which requires the image contents - // to be preserved, and if the GPU has write access to the - // image, copy the current image contents into the buffer. - if (pResource->Desc()->Usage == D3D11_USAGE_STAGING - && !pResource->CanUpdateMappedBufferEarly()) { - UpdateMappedBuffer(pResource, subresource); - MapFlags &= ~D3D11_MAP_FLAG_DO_NOT_WAIT; - } - - // Need to wait for any previous upload to finish anyway - wait = true; - } + bool wait = MapType != D3D11_MAP_WRITE_NO_OVERWRITE + || mapMode == D3D11_COMMON_TEXTURE_MAP_MODE_BUFFER; // Wait for mapped buffer to become available if (wait && !WaitForResource(mappedBuffer, MapType, MapFlags)) diff --git a/src/d3d11/d3d11_texture.h b/src/d3d11/d3d11_texture.h index f88f84be..80901a85 100644 --- a/src/d3d11/d3d11_texture.h +++ b/src/d3d11/d3d11_texture.h @@ -223,20 +223,6 @@ namespace dxvk { return m_packedFormat; } - /** - * \brief Checks whether we can update the mapped buffer early - * - * For images which are mapped through a buffer and that are - * only used for transfer operations, we can update the mapped - * buffer right after performing those transfers to avoid stalls. - * \returns \c true if the mapped buffer can be updated early - */ - bool CanUpdateMappedBufferEarly() const { - return m_mapMode == D3D11_COMMON_TEXTURE_MAP_MODE_BUFFER - && (m_desc.BindFlags & ~D3D11_BIND_SHADER_RESOURCE) == 0 - && (m_desc.Usage == D3D11_USAGE_STAGING); - } - /** * \brief Computes pixel offset into mapped buffer *