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

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

Issue 678073005: Patch to remove constant attributes (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: rebase 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/gl/GrGLProgram.h ('k') | src/gpu/gl/GrGLProgramDesc.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/gl/GrGLProgram.cpp
diff --git a/src/gpu/gl/GrGLProgram.cpp b/src/gpu/gl/GrGLProgram.cpp
index 2d9b569333a03c7ac11f13c9f8606074b9dcc677..bfa5f3cbc155e7f18581e361933653d40bdaf357 100644
--- a/src/gpu/gl/GrGLProgram.cpp
+++ b/src/gpu/gl/GrGLProgram.cpp
@@ -129,13 +129,12 @@ void GrGLProgram::bindTextures(const GrGLInstalledProc* ip, const GrProcessor& p
void GrGLProgram::setData(const GrOptDrawState& optState,
GrGpu::DrawType drawType,
- const GrDeviceCoordTexture* dstCopy,
- SharedGLState* sharedState) {
+ const GrDeviceCoordTexture* dstCopy) {
GrColor color = optState.getColor();
GrColor coverage = optState.getCoverageColor();
- this->setColor(optState, color, sharedState);
- this->setCoverage(optState, coverage, sharedState);
+ this->setColor(optState, color);
+ this->setCoverage(optState, coverage);
this->setMatrixAndRenderTargetHeight(drawType, optState);
if (dstCopy) {
@@ -201,80 +200,49 @@ void GrGLProgram::didSetData(GrGpu::DrawType drawType) {
SkASSERT(!GrGpu::IsPathRenderingDrawType(drawType));
}
-void GrGLProgram::setColor(const GrOptDrawState& optState,
- GrColor color,
- SharedGLState* sharedState) {
+void GrGLProgram::setColor(const GrOptDrawState& optState, GrColor color) {
const GrGLProgramDesc::KeyHeader& header = fDesc.getHeader();
- if (!optState.hasColorVertexAttribute()) {
- switch (header.fColorInput) {
- case GrGLProgramDesc::kAttribute_ColorInput:
- SkASSERT(-1 != header.fColorAttributeIndex);
- if (sharedState->fConstAttribColor != color ||
- sharedState->fConstAttribColorIndex != header.fColorAttributeIndex) {
- // OpenGL ES only supports the float varieties of glVertexAttrib
- GrGLfloat c[4];
- GrColorToRGBAFloat(color, c);
- GL_CALL(VertexAttrib4fv(header.fColorAttributeIndex, c));
- sharedState->fConstAttribColor = color;
- sharedState->fConstAttribColorIndex = header.fColorAttributeIndex;
- }
- break;
- case GrGLProgramDesc::kUniform_ColorInput:
- if (fColor != color && fBuiltinUniformHandles.fColorUni.isValid()) {
- // OpenGL ES doesn't support unsigned byte varieties of glUniform
- GrGLfloat c[4];
- GrColorToRGBAFloat(color, c);
- fProgramDataManager.set4fv(fBuiltinUniformHandles.fColorUni, 1, c);
- fColor = color;
- }
- sharedState->fConstAttribColorIndex = -1;
- break;
- case GrGLProgramDesc::kAllOnes_ColorInput:
- sharedState->fConstAttribColorIndex = -1;
- break;
- default:
- SkFAIL("Unexpected color type.");
- }
- } else {
- sharedState->fConstAttribColorIndex = -1;
+ switch (header.fColorInput) {
+ case GrGLProgramDesc::kAttribute_ColorInput:
+ // Attribute case is handled in GrGpuGL::setupGeometry
+ break;
+ case GrGLProgramDesc::kUniform_ColorInput:
+ if (fColor != color && fBuiltinUniformHandles.fColorUni.isValid()) {
+ // OpenGL ES doesn't support unsigned byte varieties of glUniform
+ GrGLfloat c[4];
+ GrColorToRGBAFloat(color, c);
+ fProgramDataManager.set4fv(fBuiltinUniformHandles.fColorUni, 1, c);
+ fColor = color;
+ }
+ break;
+ case GrGLProgramDesc::kAllOnes_ColorInput:
+ // Handled by shader creation
+ break;
+ default:
+ SkFAIL("Unexpected color type.");
}
}
-void GrGLProgram::setCoverage(const GrOptDrawState& optState,
- GrColor coverage,
- SharedGLState* sharedState) {
+void GrGLProgram::setCoverage(const GrOptDrawState& optState, GrColor coverage) {
const GrGLProgramDesc::KeyHeader& header = fDesc.getHeader();
- if (!optState.hasCoverageVertexAttribute()) {
- switch (header.fCoverageInput) {
- case GrGLProgramDesc::kAttribute_ColorInput:
- if (sharedState->fConstAttribCoverage != coverage ||
- sharedState->fConstAttribCoverageIndex != header.fCoverageAttributeIndex) {
- // OpenGL ES only supports the float varieties of glVertexAttrib
- GrGLfloat c[4];
- GrColorToRGBAFloat(coverage, c);
- GL_CALL(VertexAttrib4fv(header.fCoverageAttributeIndex, c));
- sharedState->fConstAttribCoverage = coverage;
- sharedState->fConstAttribCoverageIndex = header.fCoverageAttributeIndex;
- }
- break;
- case GrGLProgramDesc::kUniform_ColorInput:
- if (fCoverage != coverage) {
- // OpenGL ES doesn't support unsigned byte varieties of glUniform
- GrGLfloat c[4];
- GrColorToRGBAFloat(coverage, c);
- fProgramDataManager.set4fv(fBuiltinUniformHandles.fCoverageUni, 1, c);
- fCoverage = coverage;
- }
- sharedState->fConstAttribCoverageIndex = -1;
- break;
- case GrGLProgramDesc::kAllOnes_ColorInput:
- sharedState->fConstAttribCoverageIndex = -1;
- break;
- default:
- SkFAIL("Unexpected coverage type.");
- }
- } else {
- sharedState->fConstAttribCoverageIndex = -1;
+ switch (header.fCoverageInput) {
+ case GrGLProgramDesc::kAttribute_ColorInput:
+ // Attribute case is handled in GrGpuGL::setupGeometry
+ break;
+ case GrGLProgramDesc::kUniform_ColorInput:
+ if (fCoverage != coverage) {
+ // OpenGL ES doesn't support unsigned byte varieties of glUniform
+ GrGLfloat c[4];
+ GrColorToRGBAFloat(coverage, c);
+ fProgramDataManager.set4fv(fBuiltinUniformHandles.fCoverageUni, 1, c);
+ fCoverage = coverage;
+ }
+ break;
+ case GrGLProgramDesc::kAllOnes_ColorInput:
+ // Handled by shader creation
+ break;
+ default:
+ SkFAIL("Unexpected coverage type.");
}
}
« no previous file with comments | « src/gpu/gl/GrGLProgram.h ('k') | src/gpu/gl/GrGLProgramDesc.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698