Commit 2709f40f by Xiaoxuan Liu Committed by Commit Bot

Skip updating viewport and scissor info if the same

If glViewport() or glScissor() is called with same info, skip updating viewport or scissor info and related dirty bits. Bug: angleproject:4487 Change-Id: I9a0f3eb0df789beb99447ebc98383f502fbc763d Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2105528 Commit-Queue: Geoff Lang <geofflang@chromium.org> Reviewed-by: 's avatarJamie Madill <jmadill@chromium.org> Reviewed-by: 's avatarGeoff Lang <geofflang@chromium.org>
parent 12a1c373
......@@ -1043,17 +1043,24 @@ void State::setMultisampling(bool enabled)
void State::setScissorTest(bool enabled)
{
mScissorTest = enabled;
mDirtyBits.set(DIRTY_BIT_SCISSOR_TEST_ENABLED);
if (mScissorTest != enabled)
{
mScissorTest = enabled;
mDirtyBits.set(DIRTY_BIT_SCISSOR_TEST_ENABLED);
}
}
void State::setScissorParams(GLint x, GLint y, GLsizei width, GLsizei height)
{
mScissor.x = x;
mScissor.y = y;
mScissor.width = width;
mScissor.height = height;
mDirtyBits.set(DIRTY_BIT_SCISSOR);
// Skip if same scissor info
if (mScissor.x != x || mScissor.y != y || mScissor.width != width || mScissor.height != height)
{
mScissor.x = x;
mScissor.y = y;
mScissor.width = width;
mScissor.height = height;
mDirtyBits.set(DIRTY_BIT_SCISSOR);
}
}
void State::setDither(bool enabled)
......@@ -1341,11 +1348,16 @@ void State::setFragmentShaderDerivativeHint(GLenum hint)
void State::setViewportParams(GLint x, GLint y, GLsizei width, GLsizei height)
{
mViewport.x = x;
mViewport.y = y;
mViewport.width = width;
mViewport.height = height;
mDirtyBits.set(DIRTY_BIT_VIEWPORT);
// Skip if same viewport info
if (mViewport.x != x || mViewport.y != y || mViewport.width != width ||
mViewport.height != height)
{
mViewport.x = x;
mViewport.y = y;
mViewport.width = width;
mViewport.height = height;
mDirtyBits.set(DIRTY_BIT_VIEWPORT);
}
}
void State::setActiveSampler(unsigned int active)
......
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