mirror of
https://github.com/scratchfoundation/bgfx.git
synced 2024-11-28 18:45:54 -05:00
D3D12: Fixed scissor.
This commit is contained in:
parent
093869941a
commit
2cb4a52b36
1 changed files with 34 additions and 1 deletions
|
@ -377,6 +377,9 @@ namespace bgfx { namespace d3d12
|
||||||
, IID_ID3D12Resource
|
, IID_ID3D12Resource
|
||||||
, (void**)&resource
|
, (void**)&resource
|
||||||
) );
|
) );
|
||||||
|
BX_WARN(NULL != resource, "CreateCommittedResource failed (size: %d). Out of memory?"
|
||||||
|
, _resourceDesc->Width
|
||||||
|
);
|
||||||
|
|
||||||
return resource;
|
return resource;
|
||||||
}
|
}
|
||||||
|
@ -4148,7 +4151,6 @@ data.NumQualityLevels = 0;
|
||||||
viewState.reset(_render, hmdEnabled);
|
viewState.reset(_render, hmdEnabled);
|
||||||
|
|
||||||
// bool wireframe = !!(_render->m_debug&BGFX_DEBUG_WIREFRAME);
|
// bool wireframe = !!(_render->m_debug&BGFX_DEBUG_WIREFRAME);
|
||||||
// bool scissorEnabled = false;
|
|
||||||
// setDebugWireframe(wireframe);
|
// setDebugWireframe(wireframe);
|
||||||
|
|
||||||
uint16_t currentSamplerStateIdx = invalidHandle;
|
uint16_t currentSamplerStateIdx = invalidHandle;
|
||||||
|
@ -4459,12 +4461,14 @@ data.NumQualityLevels = 0;
|
||||||
, uint8_t(draw.m_instanceDataStride/16)
|
, uint8_t(draw.m_instanceDataStride/16)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
uint16_t scissor = draw.m_scissor;
|
||||||
uint32_t bindHash = bx::hashMurmur2A(draw.m_bind, sizeof(draw.m_bind) );
|
uint32_t bindHash = bx::hashMurmur2A(draw.m_bind, sizeof(draw.m_bind) );
|
||||||
if (currentBindHash != bindHash
|
if (currentBindHash != bindHash
|
||||||
|| 0 != changedStencil
|
|| 0 != changedStencil
|
||||||
|| (hasFactor && blendFactor != draw.m_rgba)
|
|| (hasFactor && blendFactor != draw.m_rgba)
|
||||||
|| (0 != (BGFX_STATE_PT_MASK & changedFlags)
|
|| (0 != (BGFX_STATE_PT_MASK & changedFlags)
|
||||||
|| prim.m_toplogy != s_primInfo[primIndex].m_toplogy)
|
|| prim.m_toplogy != s_primInfo[primIndex].m_toplogy)
|
||||||
|
|| currentState.m_scissor != scissor
|
||||||
|| pso != currentPso)
|
|| pso != currentPso)
|
||||||
{
|
{
|
||||||
m_batch.flush(m_commandList);
|
m_batch.flush(m_commandList);
|
||||||
|
@ -4552,6 +4556,35 @@ data.NumQualityLevels = 0;
|
||||||
m_commandList->IASetPrimitiveTopology(prim.m_toplogy);
|
m_commandList->IASetPrimitiveTopology(prim.m_toplogy);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (currentState.m_scissor != scissor)
|
||||||
|
{
|
||||||
|
currentState.m_scissor = scissor;
|
||||||
|
|
||||||
|
if(UINT16_MAX == scissor)
|
||||||
|
{
|
||||||
|
if(viewHasScissor)
|
||||||
|
{
|
||||||
|
D3D12_RECT rc;
|
||||||
|
rc.left = viewScissorRect.m_x;
|
||||||
|
rc.top = viewScissorRect.m_y;
|
||||||
|
rc.right = viewScissorRect.m_x + viewScissorRect.m_width;
|
||||||
|
rc.bottom = viewScissorRect.m_y + viewScissorRect.m_height;
|
||||||
|
m_commandList->RSSetScissorRects(1, &rc);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Rect scissorRect;
|
||||||
|
scissorRect.intersect(viewScissorRect,_render->m_rectCache.m_cache[scissor]);
|
||||||
|
D3D12_RECT rc;
|
||||||
|
rc.left = scissorRect.m_x;
|
||||||
|
rc.top = scissorRect.m_y;
|
||||||
|
rc.right = scissorRect.m_x + scissorRect.m_width;
|
||||||
|
rc.bottom = scissorRect.m_y + scissorRect.m_height;
|
||||||
|
m_commandList->RSSetScissorRects(1, &rc);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (pso != currentPso)
|
if (pso != currentPso)
|
||||||
{
|
{
|
||||||
currentPso = pso;
|
currentPso = pso;
|
||||||
|
|
Loading…
Reference in a new issue