Commit 2cedb58c by Jamie Madill Committed by Commit Bot

D3D11: Consolidate Scissor state application.

BUG=angleproject:2052 Change-Id: Ib6f55be3d71d083a87e845447f174a55413c8a2f Reviewed-on: https://chromium-review.googlesource.com/659398Reviewed-by: 's avatarGeoff Lang <geofflang@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
parent da7185fb
...@@ -1198,13 +1198,7 @@ gl::Error Blit11::copyTexture(const gl::Context *context, ...@@ -1198,13 +1198,7 @@ gl::Error Blit11::copyTexture(const gl::Context *context,
if (scissor) if (scissor)
{ {
D3D11_RECT scissorRect; stateManager->setSimpleScissorRect(*scissor);
scissorRect.left = scissor->x;
scissorRect.right = scissor->x + scissor->width;
scissorRect.top = scissor->y;
scissorRect.bottom = scissor->y + scissor->height;
deviceContext->RSSetScissorRects(1, &scissorRect);
stateManager->setRasterizerState(&mScissorEnabledRasterizerState); stateManager->setRasterizerState(&mScissorEnabledRasterizerState);
} }
else else
...@@ -1311,13 +1305,7 @@ gl::Error Blit11::copyDepth(const gl::Context *context, ...@@ -1311,13 +1305,7 @@ gl::Error Blit11::copyDepth(const gl::Context *context,
if (scissor) if (scissor)
{ {
D3D11_RECT scissorRect; stateManager->setSimpleScissorRect(*scissor);
scissorRect.left = scissor->x;
scissorRect.right = scissor->x + scissor->width;
scissorRect.top = scissor->y;
scissorRect.bottom = scissor->y + scissor->height;
deviceContext->RSSetScissorRects(1, &scissorRect);
stateManager->setRasterizerState(&mScissorEnabledRasterizerState); stateManager->setRasterizerState(&mScissorEnabledRasterizerState);
} }
else else
......
...@@ -822,7 +822,7 @@ gl::Error Clear11::clearFramebuffer(const gl::Context *context, ...@@ -822,7 +822,7 @@ gl::Error Clear11::clearFramebuffer(const gl::Context *context,
if (needScissoredClear) if (needScissoredClear)
{ {
ASSERT(i < scissorRects.size()); ASSERT(i < scissorRects.size());
deviceContext->RSSetScissorRects(1, &scissorRects[i]); stateManager->setScissorRectD3D(scissorRects[i]);
} }
// Draw the fullscreen quad. // Draw the fullscreen quad.
if (!hasLayeredLayout || isSideBySideFBO) if (!hasLayeredLayout || isSideBySideFBO)
......
...@@ -2144,6 +2144,22 @@ void StateManager11::setSimplePixelTextureAndSampler(const d3d11::SharedSRV &srv ...@@ -2144,6 +2144,22 @@ void StateManager11::setSimplePixelTextureAndSampler(const d3d11::SharedSRV &srv
mInternalDirtyBits.set(DIRTY_BIT_TEXTURE_AND_SAMPLER_STATE); mInternalDirtyBits.set(DIRTY_BIT_TEXTURE_AND_SAMPLER_STATE);
} }
void StateManager11::setSimpleScissorRect(const gl::Rectangle &glRect)
{
D3D11_RECT scissorRect;
scissorRect.left = glRect.x;
scissorRect.right = glRect.x + glRect.width;
scissorRect.top = glRect.y;
scissorRect.bottom = glRect.y + glRect.height;
setScissorRectD3D(scissorRect);
}
void StateManager11::setScissorRectD3D(const D3D11_RECT &d3dRect)
{
mRenderer->getDeviceContext()->RSSetScissorRects(1, &d3dRect);
mInternalDirtyBits.set(DIRTY_BIT_SCISSOR_STATE);
}
// For each Direct3D sampler of either the pixel or vertex stage, // For each Direct3D sampler of either the pixel or vertex stage,
// looks up the corresponding OpenGL texture image unit and texture type, // looks up the corresponding OpenGL texture image unit and texture type,
// and sets the texture and its addressing/filtering state (or NULL when inactive). // and sets the texture and its addressing/filtering state (or NULL when inactive).
......
...@@ -220,6 +220,8 @@ class StateManager11 final : angle::NonCopyable ...@@ -220,6 +220,8 @@ class StateManager11 final : angle::NonCopyable
void setSimpleViewport(int width, int height); void setSimpleViewport(int width, int height);
void setSimplePixelTextureAndSampler(const d3d11::SharedSRV &srv, void setSimplePixelTextureAndSampler(const d3d11::SharedSRV &srv,
const d3d11::SamplerState &samplerState); const d3d11::SamplerState &samplerState);
void setSimpleScissorRect(const gl::Rectangle &glRect);
void setScissorRectD3D(const D3D11_RECT &d3dRect);
// Not handled by an internal dirty bit because of the extra draw parameters. // Not handled by an internal dirty bit because of the extra draw parameters.
gl::Error applyVertexBuffer(const gl::Context *context, gl::Error applyVertexBuffer(const gl::Context *context,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment