mirror of
https://github.com/bkaradzic/bgfx.git
synced 2026-02-19 13:32:59 +01:00
D3D12: Fixed resource state transition during blit.
This commit is contained in:
@@ -5083,13 +5083,28 @@ data.NumQualityLevels = 0;
|
||||
|
||||
void RendererContextD3D12::submitBlit(BlitState& _bs, uint16_t _view)
|
||||
{
|
||||
TextureHandle currentSrc = { kInvalidHandle };
|
||||
D3D12_RESOURCE_STATES state = D3D12_RESOURCE_STATES(UINT32_MAX);
|
||||
|
||||
while (_bs.hasItem(_view) )
|
||||
{
|
||||
const BlitItem& blit = _bs.advance();
|
||||
|
||||
const TextureD3D12& src = m_textures[blit.m_src.idx];
|
||||
TextureD3D12& src = m_textures[blit.m_src.idx];
|
||||
const TextureD3D12& dst = m_textures[blit.m_dst.idx];
|
||||
|
||||
if (currentSrc.idx != blit.m_src.idx)
|
||||
{
|
||||
if (D3D12_RESOURCE_STATES(UINT32_MAX) != state)
|
||||
{
|
||||
m_textures[currentSrc.idx].setState(m_commandList, state);
|
||||
}
|
||||
|
||||
currentSrc = blit.m_src;
|
||||
|
||||
state = src.setState(m_commandList, D3D12_RESOURCE_STATE_COPY_SOURCE);
|
||||
}
|
||||
|
||||
uint32_t srcWidth = bx::uint32_min(src.m_width, blit.m_srcX + blit.m_width) - blit.m_srcX;
|
||||
uint32_t srcHeight = bx::uint32_min(src.m_height, blit.m_srcY + blit.m_height) - blit.m_srcY;
|
||||
uint32_t srcDepth = bx::uint32_min(src.m_depth, blit.m_srcZ + blit.m_depth) - blit.m_srcZ;
|
||||
@@ -5158,6 +5173,12 @@ data.NumQualityLevels = 0;
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
if (isValid(currentSrc)
|
||||
&& D3D12_RESOURCE_STATES(UINT32_MAX) != state)
|
||||
{
|
||||
m_textures[currentSrc.idx].setState(m_commandList, state);
|
||||
}
|
||||
}
|
||||
|
||||
void RendererContextD3D12::submit(Frame* _render, ClearQuad& /*_clearQuad*/, TextVideoMemBlitter& _textVideoMemBlitter)
|
||||
|
||||
Reference in New Issue
Block a user