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,8 +768,18 @@ angle::Result GetVertexRangeInfo(const gl::Context *context, ...@@ -768,8 +768,18 @@ 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()) // If the scissor test isn't enabled, assume it has infinite size. Its intersection with the
// rect would be the rect itself.
//
// Note that on Vulkan, returning this (as opposed to a fixed max-int-sized rect) could lead to
// 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
// possible optimizations.
if (!glState.isScissorTestEnabled())
{ {
return rect;
}
gl::Rectangle clippedRect; gl::Rectangle clippedRect;
if (!gl::ClipRectangle(glState.getScissor(), rect, &clippedRect)) if (!gl::ClipRectangle(glState.getScissor(), rect, &clippedRect))
{ {
...@@ -782,16 +792,6 @@ gl::Rectangle ClipRectToScissor(const gl::State &glState, const gl::Rectangle &r ...@@ -782,16 +792,6 @@ gl::Rectangle ClipRectToScissor(const gl::State &glState, const gl::Rectangle &r
} }
return clippedRect; return clippedRect;
}
// If the scissor test isn't enabled, assume it has infinite size. Its intersection with the
// rect would be the rect itself.
//
// Note that on Vulkan, returning this (as opposed to a fixed max-int-sized rect) could lead to
// 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
// possible optimizations.
return rect;
} }
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