Commit 0f2747e9 by Jamie Madill Committed by Commit Bot

Vulkan: Clean up ClipRectToScissor.

Refactoring change only. Split off to make the main CL for deferring clears simpler. Bug: angleproject:4517 Change-Id: I5728a7dcf09de8952d5810061d1d8b135b625339 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2165630 Commit-Queue: Jamie Madill <jmadill@chromium.org> Commit-Queue: Tim Van Patten <timvp@google.com> Reviewed-by: 's avatarTim Van Patten <timvp@google.com>
parent 35e389cc
...@@ -768,22 +768,6 @@ angle::Result GetVertexRangeInfo(const gl::Context *context, ...@@ -768,22 +768,6 @@ angle::Result GetVertexRangeInfo(const gl::Context *context,
gl::Rectangle ClipRectToScissor(const gl::State &glState, const gl::Rectangle &rect, bool invertY) gl::Rectangle ClipRectToScissor(const gl::State &glState, const gl::Rectangle &rect, bool invertY)
{ {
if (glState.isScissorTestEnabled())
{
gl::Rectangle clippedRect;
if (!gl::ClipRectangle(glState.getScissor(), rect, &clippedRect))
{
return gl::Rectangle();
}
if (invertY)
{
clippedRect.y = rect.height - clippedRect.y - clippedRect.height;
}
return clippedRect;
}
// If the scissor test isn't enabled, assume it has infinite size. Its intersection with the // If the scissor test isn't enabled, assume it has infinite size. Its intersection with the
// rect would be the rect itself. // rect would be the rect itself.
// //
...@@ -791,7 +775,23 @@ gl::Rectangle ClipRectToScissor(const gl::State &glState, const gl::Rectangle &r ...@@ -791,7 +775,23 @@ gl::Rectangle ClipRectToScissor(const gl::State &glState, const gl::Rectangle &r
// unnecessary pipeline creations if two otherwise identical pipelines are used on framebuffers // unnecessary pipeline creations if two otherwise identical pipelines are used on framebuffers
// with different sizes. If such usage is observed in an application, we should investigate // with different sizes. If such usage is observed in an application, we should investigate
// possible optimizations. // possible optimizations.
return rect; if (!glState.isScissorTestEnabled())
{
return rect;
}
gl::Rectangle clippedRect;
if (!gl::ClipRectangle(glState.getScissor(), rect, &clippedRect))
{
return gl::Rectangle();
}
if (invertY)
{
clippedRect.y = rect.height - clippedRect.y - clippedRect.height;
}
return clippedRect;
} }
void ApplyFeatureOverrides(angle::FeatureSetBase *features, const egl::DisplayState &state) void ApplyFeatureOverrides(angle::FeatureSetBase *features, const egl::DisplayState &state)
......
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