aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/gpu/GrReducedClip.h
diff options
context:
space:
mode:
authorGravatar commit-bot@chromium.org <commit-bot@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81>2013-11-05 15:03:08 +0000
committerGravatar commit-bot@chromium.org <commit-bot@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81>2013-11-05 15:03:08 +0000
commitd3e5842db0cb169e10d6da1e62c94ba5cf182bb4 (patch)
tree7e77fc4e341c903abf829296e9bb2bc795508029 /src/gpu/GrReducedClip.h
parent12a23866fe18e800da1d361d000a359ea36696eb (diff)
Avoid re-rendering stencil clip for every draw with reducable clip stack
Fixes the cases where clip stack reduction would cause clip to be re-rendered to stencil for each draw call. This causes unneeded slowdown. Stencil cache would not be used because the clip stack generation id communicated by the clip stack element list would be invalid. This happended due to a) clip stack reduction creating new elements in the element list. b) purging logic removing the generation id, but reduction logic selecting already purged element, and thus the generation id, as the representative state of the clip. Cases of a) where reduction would flatten the stack to a single new element were fixed by assigning the generation id of the top-most element of the clip stack as the generation id of the new element. This is not strictly minimal, but enables more caching than using invalid id. Cases of a) where reduction would substitute a stack element with a new element the generation id of the substituted element is used. The b) part was fixed by removing the purging logic. It was not exactly correct, as the previously purged states were actually used. The purging was not used for anything. Changes SkClipStack API to highlight that invalid generation id is never returned by SkClipStack. Empty stacks are wide open. Changes the clients to reflect this. Fixes a crash when not passing anti-alias out parameter to GrReducedClip::ReduceClipStack. The crash is not exercised in the current code. Committed: http://code.google.com/p/skia/source/detail?r=12084 R=bsalomon@google.com, robertphillips@google.com Author: kkinnunen@nvidia.com Review URL: https://codereview.chromium.org/48593003 git-svn-id: http://skia.googlecode.com/svn/trunk@12127 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'src/gpu/GrReducedClip.h')
-rw-r--r--src/gpu/GrReducedClip.h4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/gpu/GrReducedClip.h b/src/gpu/GrReducedClip.h
index abfc244f20..0b79f2c7f5 100644
--- a/src/gpu/GrReducedClip.h
+++ b/src/gpu/GrReducedClip.h
@@ -20,7 +20,8 @@ enum InitialState {
/**
* This function takes a clip stack and a query rectangle and it produces a reduced set of
- * SkClipStack::Elements that are equivalent to applying the full stack to the rectangle. The
+ * SkClipStack::Elements that are equivalent to applying the full stack to the rectangle. The clip
+ * stack generation id that represents the list of elements is returned in resultGenID. The
* initial state of the query rectangle before the first clip element is applied is returned via
* initialState. Optionally, the caller can request a tighter bounds on the clip be returned via
* tighterBounds. If not NULL, tighterBounds will always be contained by queryBounds after return.
@@ -33,6 +34,7 @@ enum InitialState {
void ReduceClipStack(const SkClipStack& stack,
const SkIRect& queryBounds,
ElementList* result,
+ int32_t* resultGenID,
InitialState* initialState,
SkIRect* tighterBounds = NULL,
bool* requiresAA = NULL);