[d3d11] Do not re-upload mapped image if it was mapped for reading

This commit is contained in:
Philip Rebohle 2018-11-08 18:15:24 +01:00
parent 4d103aad5d
commit ab3ba776e0
No known key found for this signature in database
GPG Key ID: C8CC613427A31C99
2 changed files with 15 additions and 3 deletions

View File

@ -394,7 +394,7 @@ namespace dxvk {
auto subresource = pResource->GetSubresourceFromIndex(
formatInfo->aspectMask, Subresource);
pResource->SetMappedSubresource(subresource);
pResource->SetMappedSubresource(subresource, MapType);
if (pResource->GetMapMode() == D3D11_COMMON_TEXTURE_MAP_MODE_DIRECT) {
const VkImageType imageType = mappedImage->info().type;
@ -503,6 +503,9 @@ namespace dxvk {
void D3D11ImmediateContext::UnmapImage(
D3D11CommonTexture* pResource,
UINT Subresource) {
if (pResource->GetMapType() == D3D11_MAP_READ)
return;
if (pResource->GetMapMode() == D3D11_COMMON_TEXTURE_MAP_MODE_BUFFER) {
// Now that data has been written into the buffer,
// we need to copy its contents into the image

View File

@ -105,13 +105,21 @@ namespace dxvk {
VkImageSubresource GetMappedSubresource() const {
return m_mappedSubresource;
}
/**
* \brief Current map type
*/
D3D11_MAP GetMapType() const {
return m_mapType;
}
/**
* \brief Sets mapped subresource
* \param [in] subresource THe subresource
*/
void SetMappedSubresource(VkImageSubresource subresource) {
m_mappedSubresource = subresource;
void SetMappedSubresource(VkImageSubresource Subresource, D3D11_MAP MapType) {
m_mappedSubresource = Subresource;
m_mapType = MapType;
}
/**
@ -188,6 +196,7 @@ namespace dxvk {
VkImageSubresource m_mappedSubresource
= { VK_IMAGE_ASPECT_COLOR_BIT, 0, 0 };
D3D11_MAP m_mapType = D3D11_MAP_READ;
Rc<DxvkBuffer> CreateMappedBuffer() const;