D3D11: Invert conditional within setScissor()

Turns the condition into a guard clause, which allows unindenting all of
the code within the function by one level.
This commit is contained in:
Lioncash 2019-08-24 18:42:37 -04:00
parent f5afb028de
commit 532e58414c
1 changed files with 22 additions and 19 deletions

View File

@ -1072,26 +1072,29 @@ struct D3D11CommandQueue final : IGraphicsCommandQueue {
}
void setScissor(const SWindowRect& rect) override {
if (m_boundTarget) {
int boundHeight = 0;
switch (m_boundTarget->type()) {
case TextureType::Render: {
const auto* const ctarget = m_boundTarget.cast<D3D11TextureR>();
boundHeight = ctarget->m_height;
break;
}
case TextureType::CubeRender: {
const auto* const ctarget = m_boundTarget.cast<D3D11TextureCubeR>();
boundHeight = ctarget->m_width;
break;
}
default:
break;
}
const D3D11_RECT d3drect = {LONG(rect.location[0]), LONG(boundHeight - rect.location[1] - rect.size[1]),
LONG(rect.location[0] + rect.size[0]), LONG(boundHeight - rect.location[1])};
m_deferredCtx->RSSetScissorRects(1, &d3drect);
if (!m_boundTarget) {
return;
}
int boundHeight = 0;
switch (m_boundTarget->type()) {
case TextureType::Render: {
const auto* const ctarget = m_boundTarget.cast<D3D11TextureR>();
boundHeight = ctarget->m_height;
break;
}
case TextureType::CubeRender: {
const auto* const ctarget = m_boundTarget.cast<D3D11TextureCubeR>();
boundHeight = ctarget->m_width;
break;
}
default:
break;
}
const D3D11_RECT d3drect = {LONG(rect.location[0]), LONG(boundHeight - rect.location[1] - rect.size[1]),
LONG(rect.location[0] + rect.size[0]), LONG(boundHeight - rect.location[1])};
m_deferredCtx->RSSetScissorRects(1, &d3drect);
}
std::unordered_map<D3D11TextureR*, std::pair<size_t, size_t>> m_texResizes;