mirror of
https://github.com/EduApps-CDG/OpenDX
synced 2024-12-30 09:45:37 +01:00
[d3d11] Remove functions to update mapped buffers
No longer relevant since staging images will no longer be backed by actual Vulkan images and dynamic images are not GPU-writable.
This commit is contained in:
parent
7d76262c52
commit
9f80d9f8b2
@ -378,9 +378,6 @@ namespace dxvk {
|
|||||||
dstTexture, &dstLayers, dstOffset,
|
dstTexture, &dstLayers, dstOffset,
|
||||||
srcTexture, &srcLayers, srcOffset,
|
srcTexture, &srcLayers, srcOffset,
|
||||||
srcExtent);
|
srcExtent);
|
||||||
|
|
||||||
if (dstTexture->CanUpdateMappedBufferEarly())
|
|
||||||
UpdateMappedBuffer(dstTexture, vk::pickSubresource(dstLayers, 0));
|
|
||||||
} else {
|
} else {
|
||||||
Logger::err(str::format(
|
Logger::err(str::format(
|
||||||
"D3D11: CopySubresourceRegion1: Incompatible resources",
|
"D3D11: CopySubresourceRegion1: Incompatible resources",
|
||||||
@ -445,11 +442,6 @@ namespace dxvk {
|
|||||||
dstTexture, &dstLayers, VkOffset3D(),
|
dstTexture, &dstLayers, VkOffset3D(),
|
||||||
srcTexture, &srcLayers, VkOffset3D(),
|
srcTexture, &srcLayers, VkOffset3D(),
|
||||||
srcTexture->MipLevelExtent(i));
|
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,
|
UpdateImage(dstTexture, &subresource,
|
||||||
offset, extent, std::move(stagingSlice));
|
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<DxvkImage> mappedImage = pTexture->GetImage();
|
|
||||||
Rc<DxvkBuffer> 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(
|
bool D3D11DeviceContext::TestRtvUavHazards(
|
||||||
UINT NumRTVs,
|
UINT NumRTVs,
|
||||||
ID3D11RenderTargetView* const* ppRTVs,
|
ID3D11RenderTargetView* const* ppRTVs,
|
||||||
|
@ -885,10 +885,6 @@ namespace dxvk {
|
|||||||
void RestoreUnorderedAccessViews(
|
void RestoreUnorderedAccessViews(
|
||||||
D3D11UnorderedAccessBindings& Bindings);
|
D3D11UnorderedAccessBindings& Bindings);
|
||||||
|
|
||||||
void UpdateMappedBuffer(
|
|
||||||
const D3D11CommonTexture* pTexture,
|
|
||||||
VkImageSubresource Subresource);
|
|
||||||
|
|
||||||
bool TestRtvUavHazards(
|
bool TestRtvUavHazards(
|
||||||
UINT NumRTVs,
|
UINT NumRTVs,
|
||||||
ID3D11RenderTargetView* const* ppRTVs,
|
ID3D11RenderTargetView* const* ppRTVs,
|
||||||
|
@ -416,8 +416,6 @@ namespace dxvk {
|
|||||||
pResource->Desc()->Format, pResource->GetFormatMode()).Format;
|
pResource->Desc()->Format, pResource->GetFormatMode()).Format;
|
||||||
|
|
||||||
auto formatInfo = imageFormatInfo(packedFormat);
|
auto formatInfo = imageFormatInfo(packedFormat);
|
||||||
auto subresource = pResource->GetSubresourceFromIndex(
|
|
||||||
formatInfo->aspectMask, Subresource);
|
|
||||||
void* mapPtr;
|
void* mapPtr;
|
||||||
|
|
||||||
if (mapMode == D3D11_COMMON_TEXTURE_MAP_MODE_DIRECT) {
|
if (mapMode == D3D11_COMMON_TEXTURE_MAP_MODE_DIRECT) {
|
||||||
@ -443,21 +441,8 @@ namespace dxvk {
|
|||||||
|
|
||||||
mapPtr = physSlice.mapPtr;
|
mapPtr = physSlice.mapPtr;
|
||||||
} else {
|
} else {
|
||||||
bool wait = MapType != D3D11_MAP_WRITE_NO_OVERWRITE;
|
bool wait = MapType != D3D11_MAP_WRITE_NO_OVERWRITE
|
||||||
|
|| mapMode == D3D11_COMMON_TEXTURE_MAP_MODE_BUFFER;
|
||||||
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;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Wait for mapped buffer to become available
|
// Wait for mapped buffer to become available
|
||||||
if (wait && !WaitForResource(mappedBuffer, MapType, MapFlags))
|
if (wait && !WaitForResource(mappedBuffer, MapType, MapFlags))
|
||||||
|
@ -223,20 +223,6 @@ namespace dxvk {
|
|||||||
return m_packedFormat;
|
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
|
* \brief Computes pixel offset into mapped buffer
|
||||||
*
|
*
|
||||||
|
Loading…
x
Reference in New Issue
Block a user