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

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

Issue 761563002: First step to moving vertex attributes to the geometryProcessor (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: adding test to ignore Created 6 years 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.cpp ('k') | src/gpu/gl/GrGpuGL.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/gl/GrGLProgramDesc.cpp
diff --git a/src/gpu/gl/GrGLProgramDesc.cpp b/src/gpu/gl/GrGLProgramDesc.cpp
index 6a2d38869219649a3754a840b2bd117fcf02979c..74f669f2e317a06ba616d582bcc2cf54f3993529 100644
--- a/src/gpu/gl/GrGLProgramDesc.cpp
+++ b/src/gpu/gl/GrGLProgramDesc.cpp
@@ -63,9 +63,9 @@ static bool swizzle_requires_alpha_remapping(const GrGLCaps& caps,
static uint32_t gen_attrib_key(const GrGeometryProcessor& proc) {
uint32_t key = 0;
- const GrGeometryProcessor::VertexAttribArray& vars = proc.getVertexAttribs();
+ const GrGeometryProcessor::VertexAttribArray& vars = proc.getAttribs();
int numAttributes = vars.count();
- SkASSERT(numAttributes <= 2);
+ SkASSERT(numAttributes <= GrGeometryProcessor::kMaxVertexAttribs);
for (int a = 0; a < numAttributes; ++a) {
uint32_t value = 1 << a;
key |= value;
@@ -206,11 +206,7 @@ bool GrGLProgramDescBuilder::Build(const GrOptDrawState& optState,
header->fUseNvpr = false;
}
- bool hasUniformColor = inputColorIsUsed &&
- (isPathRendering || !descInfo.hasColorVertexAttribute());
-
- bool hasUniformCoverage = inputCoverageIsUsed &&
- (isPathRendering || !descInfo.hasCoverageVertexAttribute());
+ bool hasUniformColor = inputColorIsUsed && (isPathRendering || !descInfo.fHasVertexColor);
if (!inputColorIsUsed) {
header->fColorInput = GrProgramDesc::kAllOnes_ColorInput;
@@ -221,12 +217,13 @@ bool GrGLProgramDescBuilder::Build(const GrOptDrawState& optState,
SkASSERT(!header->fUseNvpr);
}
- bool covIsSolidWhite = !descInfo.hasCoverageVertexAttribute() &&
- 0xffffffff == optState.getCoverageColor();
+ bool hasVertexCoverage = !isPathRendering && descInfo.fHasVertexCoverage;
+
+ bool covIsSolidWhite = !hasVertexCoverage && 0xffffffff == optState.getCoverageColor();
if (covIsSolidWhite || !inputCoverageIsUsed) {
header->fCoverageInput = GrProgramDesc::kAllOnes_ColorInput;
- } else if (hasUniformCoverage) {
+ } else if (!hasVertexCoverage) {
header->fCoverageInput = GrProgramDesc::kUniform_ColorInput;
} else {
header->fCoverageInput = GrProgramDesc::kAttribute_ColorInput;
@@ -255,31 +252,6 @@ bool GrGLProgramDescBuilder::Build(const GrOptDrawState& optState,
header->fFragPosKey = 0;
}
- // Record attribute indices
- header->fPositionAttributeIndex = descInfo.positionAttributeIndex();
- header->fLocalCoordAttributeIndex = descInfo.localCoordAttributeIndex();
-
- // For constant color and coverage we need an attribute with an index beyond those already set
- int availableAttributeIndex = optState.getVertexAttribCount();
- if (descInfo.hasColorVertexAttribute()) {
- header->fColorAttributeIndex = descInfo.colorVertexAttributeIndex();
- } else if (GrProgramDesc::kAttribute_ColorInput == header->fColorInput) {
- SkASSERT(availableAttributeIndex < GrDrawState::kMaxVertexAttribCnt);
- header->fColorAttributeIndex = availableAttributeIndex;
- availableAttributeIndex++;
- } else {
- header->fColorAttributeIndex = -1;
- }
-
- if (descInfo.hasCoverageVertexAttribute()) {
- header->fCoverageAttributeIndex = descInfo.coverageVertexAttributeIndex();
- } else if (GrProgramDesc::kAttribute_ColorInput == header->fCoverageInput) {
- SkASSERT(availableAttributeIndex < GrDrawState::kMaxVertexAttribCnt);
- header->fCoverageAttributeIndex = availableAttributeIndex;
- } else {
- header->fCoverageAttributeIndex = -1;
- }
-
header->fPrimaryOutputType = descInfo.fPrimaryOutputType;
header->fSecondaryOutputType = descInfo.fSecondaryOutputType;
« no previous file with comments | « src/gpu/gl/GrGLProgram.cpp ('k') | src/gpu/gl/GrGpuGL.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698