mirror of
https://github.com/doitsujin/dxvk.git
synced 2025-01-30 11:52:11 +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,
|
||||
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<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(
|
||||
UINT NumRTVs,
|
||||
ID3D11RenderTargetView* const* ppRTVs,
|
||||
|
@ -885,10 +885,6 @@ namespace dxvk {
|
||||
void RestoreUnorderedAccessViews(
|
||||
D3D11UnorderedAccessBindings& Bindings);
|
||||
|
||||
void UpdateMappedBuffer(
|
||||
const D3D11CommonTexture* pTexture,
|
||||
VkImageSubresource Subresource);
|
||||
|
||||
bool TestRtvUavHazards(
|
||||
UINT NumRTVs,
|
||||
ID3D11RenderTargetView* const* ppRTVs,
|
||||
|
@ -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))
|
||||
|
@ -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
|
||||
*
|
||||
|
Loading…
x
Reference in New Issue
Block a user