mirror of https://github.com/AxioDL/boo.git
D3D11: Invert conditional within setViewport()
Performs the same thing as the previous change, but applies it to setViewport() instead. This also allows unindenting all code within the function by one level.
This commit is contained in:
parent
532e58414c
commit
4605581d6f
|
@ -1045,23 +1045,27 @@ struct D3D11CommandQueue final : IGraphicsCommandQueue {
|
|||
}
|
||||
|
||||
void setViewport(const SWindowRect& rect, float znear, float zfar) override {
|
||||
if (m_boundTarget) {
|
||||
if (!m_boundTarget) {
|
||||
return;
|
||||
}
|
||||
|
||||
int boundHeight = 0;
|
||||
switch (m_boundTarget->type()) {
|
||||
case TextureType::Render: {
|
||||
D3D11TextureR* ctarget = m_boundTarget.cast<D3D11TextureR>();
|
||||
const auto* const ctarget = m_boundTarget.cast<D3D11TextureR>();
|
||||
boundHeight = ctarget->m_height;
|
||||
break;
|
||||
}
|
||||
case TextureType::CubeRender: {
|
||||
D3D11TextureCubeR* ctarget = m_boundTarget.cast<D3D11TextureCubeR>();
|
||||
const auto* const ctarget = m_boundTarget.cast<D3D11TextureCubeR>();
|
||||
boundHeight = ctarget->m_width;
|
||||
break;
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
D3D11_VIEWPORT vp = {FLOAT(rect.location[0]),
|
||||
|
||||
const D3D11_VIEWPORT vp = {FLOAT(rect.location[0]),
|
||||
FLOAT(boundHeight - rect.location[1] - rect.size[1]),
|
||||
FLOAT(rect.size[0]),
|
||||
FLOAT(rect.size[1]),
|
||||
|
@ -1069,7 +1073,6 @@ struct D3D11CommandQueue final : IGraphicsCommandQueue {
|
|||
1.f - znear};
|
||||
m_deferredCtx->RSSetViewports(1, &vp);
|
||||
}
|
||||
}
|
||||
|
||||
void setScissor(const SWindowRect& rect) override {
|
||||
if (!m_boundTarget) {
|
||||
|
|
Loading…
Reference in New Issue