1
0
mirror of https://github.com/doitsujin/dxvk.git synced 2025-03-14 04:29:15 +01:00

[d3d11] Implement copy flags for CopySubresourceRegion1 / UpdateSubresource1

This commit is contained in:
Philip Rebohle 2018-08-03 11:22:26 +02:00
parent 3fee20dfec
commit fb88070888
No known key found for this signature in database
GPG Key ID: C8CC613427A31C99
3 changed files with 42 additions and 28 deletions

View File

@ -68,7 +68,7 @@ namespace dxvk {
// We don't support the Discard API for images
if (resType == D3D11_RESOURCE_DIMENSION_BUFFER)
DiscardBuffer(reinterpret_cast<D3D11Buffer*>(pResource));
DiscardBuffer(static_cast<D3D11Buffer*>(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<D3D11Buffer*>(pDstResource)->GetBufferSlice();
auto srcBuffer = static_cast<D3D11Buffer*>(pSrcResource)->GetBufferSlice();
if (CopyFlags & D3D11_COPY_DISCARD)
DiscardBuffer(static_cast<D3D11Buffer*>(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<D3D11Buffer*>(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(

View File

@ -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;

View File

@ -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;