mirror of https://github.com/AxioDL/boo.git
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:
parent
f5afb028de
commit
532e58414c
|
@ -1072,26 +1072,29 @@ struct D3D11CommandQueue final : IGraphicsCommandQueue {
|
||||||
}
|
}
|
||||||
|
|
||||||
void setScissor(const SWindowRect& rect) override {
|
void setScissor(const SWindowRect& rect) override {
|
||||||
if (m_boundTarget) {
|
if (!m_boundTarget) {
|
||||||
int boundHeight = 0;
|
return;
|
||||||
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);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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;
|
std::unordered_map<D3D11TextureR*, std::pair<size_t, size_t>> m_texResizes;
|
||||||
|
|
Loading…
Reference in New Issue