diff --git a/src/d3d11/d3d11_context.cpp b/src/d3d11/d3d11_context.cpp index 6c70ef4e..151756c0 100644 --- a/src/d3d11/d3d11_context.cpp +++ b/src/d3d11/d3d11_context.cpp @@ -68,7 +68,7 @@ namespace dxvk { // We don't support the Discard API for images if (resType == D3D11_RESOURCE_DIMENSION_BUFFER) - DiscardBuffer(reinterpret_cast(pResource)); + DiscardBuffer(static_cast(pResource)); } @@ -273,6 +273,22 @@ namespace dxvk { ID3D11Resource* pSrcResource, UINT SrcSubresource, const D3D11_BOX* pSrcBox) { + CopySubresourceRegion1( + pDstResource, DstSubresource, DstX, DstY, DstZ, + pSrcResource, SrcSubresource, pSrcBox, 0); + } + + + void STDMETHODCALLTYPE D3D11DeviceContext::CopySubresourceRegion1( + ID3D11Resource* pDstResource, + UINT DstSubresource, + UINT DstX, + UINT DstY, + UINT DstZ, + ID3D11Resource* pSrcResource, + UINT SrcSubresource, + const D3D11_BOX* pSrcBox, + UINT CopyFlags) { D3D11_RESOURCE_DIMENSION dstResourceDim = D3D11_RESOURCE_DIMENSION_UNKNOWN; D3D11_RESOURCE_DIMENSION srcResourceDim = D3D11_RESOURCE_DIMENSION_UNKNOWN; @@ -296,6 +312,9 @@ namespace dxvk { if (dstResourceDim == D3D11_RESOURCE_DIMENSION_BUFFER) { auto dstBuffer = static_cast(pDstResource)->GetBufferSlice(); auto srcBuffer = static_cast(pSrcResource)->GetBufferSlice(); + + if (CopyFlags & D3D11_COPY_DISCARD) + DiscardBuffer(static_cast(pDstResource)); VkDeviceSize dstOffset = DstX; VkDeviceSize srcOffset = 0; @@ -466,20 +485,6 @@ namespace dxvk { } - void STDMETHODCALLTYPE D3D11DeviceContext::CopySubresourceRegion1( - ID3D11Resource* pDstResource, - UINT DstSubresource, - UINT DstX, - UINT DstY, - UINT DstZ, - ID3D11Resource* pSrcResource, - UINT SrcSubresource, - const D3D11_BOX* pSrcBox, - UINT CopyFlags) { - CopySubresourceRegion(pDstResource, DstSubresource, DstX, DstY, DstZ, pSrcResource, SrcSubresource, pSrcBox); - } - - void STDMETHODCALLTYPE D3D11DeviceContext::CopyResource( ID3D11Resource* pDstResource, ID3D11Resource* pSrcResource) { @@ -823,6 +828,20 @@ namespace dxvk { const void* pSrcData, UINT SrcRowPitch, UINT SrcDepthPitch) { + UpdateSubresource1(pDstResource, + DstSubresource, pDstBox, pSrcData, + SrcRowPitch, SrcDepthPitch, 0); + } + + + void STDMETHODCALLTYPE D3D11DeviceContext::UpdateSubresource1( + ID3D11Resource* pDstResource, + UINT DstSubresource, + const D3D11_BOX* pDstBox, + const void* pSrcData, + UINT SrcRowPitch, + UINT SrcDepthPitch, + UINT CopyFlags) { // We need a different code path for buffers D3D11_RESOURCE_DIMENSION resourceType; pDstResource->GetType(&resourceType); @@ -830,6 +849,9 @@ namespace dxvk { if (resourceType == D3D11_RESOURCE_DIMENSION_BUFFER) { const auto bufferResource = static_cast(pDstResource); const auto bufferSlice = bufferResource->GetBufferSlice(); + + if (CopyFlags & D3D11_COPY_DISCARD) + DiscardBuffer(bufferResource); VkDeviceSize offset = bufferSlice.offset(); VkDeviceSize size = bufferSlice.length(); @@ -935,18 +957,6 @@ namespace dxvk { }); } } - - - void STDMETHODCALLTYPE D3D11DeviceContext::UpdateSubresource1( - ID3D11Resource* pDstResource, - UINT DstSubresource, - const D3D11_BOX* pDstBox, - const void* pSrcData, - UINT SrcRowPitch, - UINT SrcDepthPitch, - UINT CopyFlags) { - UpdateSubresource(pDstResource, DstSubresource, pDstBox, pSrcData, SrcRowPitch, SrcDepthPitch); - } void STDMETHODCALLTYPE D3D11DeviceContext::SetResourceMinLOD( diff --git a/src/d3d11/d3d11_device.cpp b/src/d3d11/d3d11_device.cpp index 91f0652c..19895d69 100644 --- a/src/d3d11/d3d11_device.cpp +++ b/src/d3d11/d3d11_device.cpp @@ -1604,7 +1604,7 @@ namespace dxvk { info->OutputMergerLogicOp = features.core.features.logicOp; info->UAVOnlyRenderingForcedSampleCount = FALSE; info->DiscardAPIsSeenByDriver = TRUE; - info->FlagsForUpdateAndCopySeenByDriver = FALSE; + info->FlagsForUpdateAndCopySeenByDriver = TRUE; info->ClearView = FALSE; info->CopyWithOverlap = FALSE; info->ConstantBufferPartialUpdate = TRUE; diff --git a/src/d3d11/d3d11_include.h b/src/d3d11/d3d11_include.h index 65a4df2c..3fcf7419 100644 --- a/src/d3d11/d3d11_include.h +++ b/src/d3d11/d3d11_include.h @@ -40,6 +40,10 @@ typedef enum D3D11_FORMAT_SUPPORT2 { D3D11_FORMAT_SUPPORT2_MULTIPLANE_OVERLAY = 0x4000 } D3D11_FORMAT_SUPPORT2; #ifndef __WINE__ +typedef enum D3D11_COPY_FLAGS { + D3D11_COPY_NO_OVERWRITE = 0x1, + D3D11_COPY_DISCARD = 0x2, +} D3D11_COPY_FLAGS; typedef struct D3D11_FEATURE_DATA_FORMAT_SUPPORT2 { DXGI_FORMAT InFormat; UINT OutFormatSupport2;