Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(100)

Unified Diff: src/gpu/gl/GrGLProgram.h

Issue 679363002: Revert of Patch to remove constant attributes (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/gpu/effects/GrYUVtoRGBEffect.cpp ('k') | src/gpu/gl/GrGLProgram.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/gl/GrGLProgram.h
diff --git a/src/gpu/gl/GrGLProgram.h b/src/gpu/gl/GrGLProgram.h
index ca75e206f121bcd9c3badb90489de0cc431ca516..e8aef35f1decd9e26885dde35d303ada4d564b30 100644
--- a/src/gpu/gl/GrGLProgram.h
+++ b/src/gpu/gl/GrGLProgram.h
@@ -58,6 +58,27 @@
* The base class always has a vertex shader, only the NVPR variants may omit a vertex shader
*/
virtual bool hasVertexShader() const { return true; }
+
+ /**
+ * Some GL state that is relevant to programs is not stored per-program. In particular color
+ * and coverage attributes can be global state. This struct is read and updated by
+ * GrGLProgram::setColor and GrGLProgram::setCoverage to allow us to avoid setting this state
+ * redundantly.
+ */
+ struct SharedGLState {
+ GrColor fConstAttribColor;
+ int fConstAttribColorIndex;
+ GrColor fConstAttribCoverage;
+ int fConstAttribCoverageIndex;
+
+ SharedGLState() { this->invalidate(); }
+ void invalidate() {
+ fConstAttribColor = GrColor_ILLEGAL;
+ fConstAttribColorIndex = -1;
+ fConstAttribCoverage = GrColor_ILLEGAL;
+ fConstAttribCoverageIndex = -1;
+ }
+ };
/**
* The GrDrawState's view matrix along with the aspects of the render target determine the
@@ -131,7 +152,8 @@
*/
void setData(const GrOptDrawState&,
GrGpu::DrawType,
- const GrDeviceCoordTexture* dstCopy /* can be NULL*/);
+ const GrDeviceCoordTexture* dstCopy, // can be NULL
+ SharedGLState*);
protected:
typedef GrGLProgramDataManager::UniformHandle UniformHandle;
@@ -151,11 +173,11 @@
// Helper for setData(). Makes GL calls to specify the initial color when there is not
// per-vertex colors.
- void setColor(const GrOptDrawState&, GrColor color);
+ void setColor(const GrOptDrawState&, GrColor color, SharedGLState*);
// Helper for setData(). Makes GL calls to specify the initial coverage when there is not
// per-vertex coverages.
- void setCoverage(const GrOptDrawState&, GrColor coverage);
+ void setCoverage(const GrOptDrawState&, GrColor coverage, SharedGLState*);
// A templated helper to loop over effects, set the transforms(via subclass) and bind textures
void setFragmentData(const GrOptDrawState&);
« no previous file with comments | « src/gpu/effects/GrYUVtoRGBEffect.cpp ('k') | src/gpu/gl/GrGLProgram.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698