Revert "[ VK/DX12] Bring setScissor on par with the other renderers (#2239)"

This reverts commit fbd7e9efd6.
This commit is contained in:
Бранимир Караџић 2020-08-22 09:10:49 -07:00
parent fbd7e9efd6
commit f20fd61e4f
2 changed files with 17 additions and 9 deletions

View File

@ -5893,7 +5893,7 @@ namespace bgfx { namespace d3d12
bool wasCompute = false; bool wasCompute = false;
bool viewHasScissor = false; bool viewHasScissor = false;
bool scissorEnabled = false; bool restoreScissor = false;
Rect viewScissorRect; Rect viewScissorRect;
viewScissorRect.clear(); viewScissorRect.clear();
@ -6033,6 +6033,7 @@ namespace bgfx { namespace d3d12
rc.right = viewScissorRect.m_x + viewScissorRect.m_width; rc.right = viewScissorRect.m_x + viewScissorRect.m_width;
rc.bottom = viewScissorRect.m_y + viewScissorRect.m_height; rc.bottom = viewScissorRect.m_y + viewScissorRect.m_height;
m_commandList->RSSetScissorRects(1, &rc); m_commandList->RSSetScissorRects(1, &rc);
restoreScissor = false;
Clear& clr = _render->m_view[view].m_clear; Clear& clr = _render->m_view[view].m_clear;
if (BGFX_CLEAR_NONE != clr.m_flags) if (BGFX_CLEAR_NONE != clr.m_flags)
@ -6529,9 +6530,10 @@ namespace bgfx { namespace d3d12
if (UINT16_MAX == scissor) if (UINT16_MAX == scissor)
{ {
scissorEnabled = viewHasScissor; if (restoreScissor
if (viewHasScissor) || viewHasScissor)
{ {
restoreScissor = false;
D3D12_RECT rc; D3D12_RECT rc;
rc.left = viewScissorRect.m_x; rc.left = viewScissorRect.m_x;
rc.top = viewScissorRect.m_y; rc.top = viewScissorRect.m_y;
@ -6542,11 +6544,14 @@ namespace bgfx { namespace d3d12
} }
else else
{ {
restoreScissor = true;
Rect scissorRect; Rect scissorRect;
scissorRect.setIntersect(viewScissorRect, _render->m_frameCache.m_rectCache.m_cache[scissor]); scissorRect.setIntersect(viewScissorRect, _render->m_frameCache.m_rectCache.m_cache[scissor]);
if (scissorRect.isZeroArea() )
{
continue;
}
scissorEnabled = true;
D3D12_RECT rc; D3D12_RECT rc;
rc.left = scissorRect.m_x; rc.left = scissorRect.m_x;
rc.top = scissorRect.m_y; rc.top = scissorRect.m_y;

View File

@ -5944,7 +5944,7 @@ VK_DESTROY
bool wasCompute = false; bool wasCompute = false;
bool viewHasScissor = false; bool viewHasScissor = false;
bool scissorEnabled = false; bool restoreScissor = false;
Rect viewScissorRect; Rect viewScissorRect;
viewScissorRect.clear(); viewScissorRect.clear();
@ -6097,6 +6097,8 @@ VK_DESTROY
rc.extent.height = viewScissorRect.m_height; rc.extent.height = viewScissorRect.m_height;
vkCmdSetScissor(m_commandBuffer, 0, 1, &rc); vkCmdSetScissor(m_commandBuffer, 0, 1, &rc);
restoreScissor = false;
Clear& clr = _render->m_view[view].m_clear; Clear& clr = _render->m_view[view].m_clear;
if (BGFX_CLEAR_NONE != clr.m_flags) if (BGFX_CLEAR_NONE != clr.m_flags)
{ {
@ -6394,9 +6396,10 @@ VK_DESTROY
if (UINT16_MAX == scissor) if (UINT16_MAX == scissor)
{ {
scissorEnabled = viewHasScissor; if (restoreScissor
if (viewHasScissor) || viewHasScissor)
{ {
restoreScissor = false;
VkRect2D rc; VkRect2D rc;
rc.offset.x = viewScissorRect.m_x; rc.offset.x = viewScissorRect.m_x;
rc.offset.y = viewScissorRect.m_y; rc.offset.y = viewScissorRect.m_y;
@ -6407,10 +6410,10 @@ VK_DESTROY
} }
else else
{ {
restoreScissor = true;
Rect scissorRect; Rect scissorRect;
scissorRect.setIntersect(viewScissorRect, _render->m_frameCache.m_rectCache.m_cache[scissor]); scissorRect.setIntersect(viewScissorRect, _render->m_frameCache.m_rectCache.m_cache[scissor]);
scissorEnabled = true;
VkRect2D rc; VkRect2D rc;
rc.offset.x = scissorRect.m_x; rc.offset.x = scissorRect.m_x;
rc.offset.y = scissorRect.m_y; rc.offset.y = scissorRect.m_y;