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:
parent
3fee20dfec
commit
fb88070888
@ -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(
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
Loading…
x
Reference in New Issue
Block a user