aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/gpu/GrClipMaskManager.h
diff options
context:
space:
mode:
authorGravatar commit-bot@chromium.org <commit-bot@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81>2013-11-01 15:24:20 +0000
committerGravatar commit-bot@chromium.org <commit-bot@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81>2013-11-01 15:24:20 +0000
commit679eb674fc064993d534df4d48a4ddaff4e33e06 (patch)
treed687e47c032e2b8f17693bdef8350035744586dd /src/gpu/GrClipMaskManager.h
parent5c8ee2539b9316b22416a991a1f560ef5cec7957 (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. 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@12084 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'src/gpu/GrClipMaskManager.h')
-rw-r--r--src/gpu/GrClipMaskManager.h9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/gpu/GrClipMaskManager.h b/src/gpu/GrClipMaskManager.h
index 015c801d54..f44a8e7b22 100644
--- a/src/gpu/GrClipMaskManager.h
+++ b/src/gpu/GrClipMaskManager.h
@@ -103,18 +103,19 @@ private:
GrClipMaskCache fAACache; // cache for the AA path
// Draws the clip into the stencil buffer
- bool createStencilClipMask(GrReducedClip::InitialState initialState,
+ bool createStencilClipMask(int32_t elementsGenID,
+ GrReducedClip::InitialState initialState,
const GrReducedClip::ElementList& elements,
const SkIRect& clipSpaceIBounds,
const SkIPoint& clipSpaceToStencilOffset);
// Creates an alpha mask of the clip. The mask is a rasterization of elements through the
// rect specified by clipSpaceIBounds.
- GrTexture* createAlphaClipMask(int32_t clipStackGenID,
+ GrTexture* createAlphaClipMask(int32_t elementsGenID,
GrReducedClip::InitialState initialState,
const GrReducedClip::ElementList& elements,
const SkIRect& clipSpaceIBounds);
// Similar to createAlphaClipMask but it rasterizes in SW and uploads to the result texture.
- GrTexture* createSoftwareClipMask(int32_t clipStackGenID,
+ GrTexture* createSoftwareClipMask(int32_t elementsGenID,
GrReducedClip::InitialState initialState,
const GrReducedClip::ElementList& elements,
const SkIRect& clipSpaceIBounds);
@@ -122,7 +123,7 @@ private:
// Gets a texture to use for the clip mask. If true is returned then a cached mask was found
// that already contains the rasterization of the clip stack, otherwise an uninitialized texture
// is returned. 'willUpload' is set when the alpha mask needs to be uploaded from the CPU.
- bool getMaskTexture(int32_t clipStackGenID,
+ bool getMaskTexture(int32_t elementsGenID,
const SkIRect& clipSpaceIBounds,
GrTexture** result,
bool willUpload);