D3D12HostDisplay: Fix incorrect resource state in DownloadTexture()

This commit is contained in:
Connor McLaughlin 2021-07-22 13:57:58 +10:00
parent 89a11519fb
commit e17c93ab04

View file

@ -123,7 +123,11 @@ bool D3D12HostDisplay::DownloadTexture(const void* texture_handle, HostDisplayPi
if (!m_readback_staging_texture.EnsureSize(width, height, texture->GetFormat(), false))
return false;
const D3D12_RESOURCE_STATES old_state = texture->GetState();
texture->TransitionToState(D3D12_RESOURCE_STATE_COPY_SOURCE);
m_readback_staging_texture.CopyFromTexture(texture->GetResource(), 0, x, y, 0, 0, width, height);
texture->TransitionToState(old_state);
return m_readback_staging_texture.ReadPixels(0, 0, width, height, out_data, out_data_stride);
}