diff options
author | 2015-05-19 07:15:28 -0700 | |
---|---|---|
committer | 2015-05-19 07:15:28 -0700 | |
commit | d3a560fa80bfb3e2d2e989f951bb3b1c52316654 (patch) | |
tree | 6702bf0af4281910271596fe9b11316902194d79 /src/gpu/GrGeometryProcessor.h | |
parent | cbfe91d82500f4ae8c3ff7bd74b3021a4b89fd84 (diff) |
Revert of Preliminary attempt to remove batch tracker (patchset #3 id:40001 of https://codereview.chromium.org/1139723004/)
Reason for revert:
breaking bots
Original issue's description:
> Preliminary attempt to remove batch tracker
>
> BUG=skia:
>
> Committed: https://skia.googlesource.com/skia/+/cbfe91d82500f4ae8c3ff7bd74b3021a4b89fd84
TBR=robertphillips@google.com,joshualitt@chromium.org
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
BUG=skia:
Review URL: https://codereview.chromium.org/1132323003
Diffstat (limited to 'src/gpu/GrGeometryProcessor.h')
-rw-r--r-- | src/gpu/GrGeometryProcessor.h | 32 |
1 files changed, 29 insertions, 3 deletions
diff --git a/src/gpu/GrGeometryProcessor.h b/src/gpu/GrGeometryProcessor.h index 9c55359af5..eee286b20d 100644 --- a/src/gpu/GrGeometryProcessor.h +++ b/src/gpu/GrGeometryProcessor.h @@ -26,9 +26,6 @@ public: bool willUseGeoShader() const { return fWillUseGeoShader; } - // TODO delete when paths are in batch - void initBatchTracker(GrBatchTracker*, const GrPipelineInfo&) const override {} - // TODO delete this when paths are in batch bool canMakeEqual(const GrBatchTracker& mine, const GrPrimitiveProcessor& that, @@ -46,6 +43,35 @@ public: } protected: + /* + * An optional simple helper function to determine by what means the GrGeometryProcessor should + * use to provide color. If we are given an override color(ie the given overridecolor is NOT + * GrColor_ILLEGAL) then we must always emit that color(currently overrides are only supported + * via uniform, but with deferred Geometry we could use attributes). Otherwise, if our color is + * ignored then we should not emit a color. Lastly, if we don't have vertex colors then we must + * emit a color via uniform + * TODO this function changes quite a bit with deferred geometry. There the GrGeometryProcessor + * can upload a new color via attribute if needed. + */ + static GrGPInput GetColorInputType(GrColor* color, GrColor primitiveColor, + const GrPipelineInfo& init, + bool hasVertexColor) { + if (init.fColorIgnored) { + *color = GrColor_ILLEGAL; + return kIgnored_GrGPInput; + } else if (GrColor_ILLEGAL != init.fOverrideColor) { + *color = init.fOverrideColor; + return kUniform_GrGPInput; + } + + *color = primitiveColor; + if (hasVertexColor) { + return kAttribute_GrGPInput; + } else { + return kUniform_GrGPInput; + } + } + /** * Subclasses call this from their constructor to register vertex attributes. Attributes * will be padded to the nearest 4 bytes for performance reasons. |