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

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

Issue 23754003: Isolate VertexBuilder from GrGLShaderBuilder (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Created 7 years, 4 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/GrSimpleTextureEffect.cpp ('k') | src/gpu/gl/GrGLProgram.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/gl/GrGLEffectMatrix.cpp
diff --git a/src/gpu/gl/GrGLEffectMatrix.cpp b/src/gpu/gl/GrGLEffectMatrix.cpp
index 19f99c0673421f06d41f5f9b019870c815e2aa2d..7530b5911a7b9e9f73e959c4169cff0aaa08629f 100644
--- a/src/gpu/gl/GrGLEffectMatrix.cpp
+++ b/src/gpu/gl/GrGLEffectMatrix.cpp
@@ -48,6 +48,9 @@ GrSLType GrGLEffectMatrix::emitCode(GrGLShaderBuilder* builder,
SkString* fsCoordName,
SkString* vsCoordName,
const char* suffix) {
+ GrGLShaderBuilder::VertexBuilder* vertexBuilder = builder->getVertexBuilder();
+ SkASSERT(NULL != vertexBuilder);
+
GrSLType varyingType = kVoid_GrSLType;
const char* uniName;
key &= kKeyMask;
@@ -96,17 +99,17 @@ GrSLType GrGLEffectMatrix::emitCode(GrGLShaderBuilder* builder,
}
const char* vsVaryingName;
const char* fsVaryingName;
- builder->addVarying(varyingType, varyingName, &vsVaryingName, &fsVaryingName);
+ vertexBuilder->addVarying(varyingType, varyingName, &vsVaryingName, &fsVaryingName);
const GrGLShaderVar* coords;
switch (fCoordsType) {
case GrEffect::kLocal_CoordsType:
SkASSERT(!(kPositionCoords_Flag & key));
- coords = &builder->localCoordsAttribute();
+ coords = &vertexBuilder->localCoordsAttribute();
break;
case GrEffect::kPosition_CoordsType:
- SkASSERT((kPositionCoords_Flag & key) || !builder->hasExplicitLocalCoords());
- coords = &builder->positionAttribute();
+ SkASSERT((kPositionCoords_Flag & key) || !vertexBuilder->hasExplicitLocalCoords());
+ coords = &vertexBuilder->positionAttribute();
break;
default:
coords = NULL; // prevents warning
@@ -116,21 +119,21 @@ GrSLType GrGLEffectMatrix::emitCode(GrGLShaderBuilder* builder,
switch (fUniType) {
case kVoid_GrSLType:
SkASSERT(kVec2f_GrSLType == varyingType);
- builder->vsCodeAppendf("\t%s = %s;\n", vsVaryingName, coords->c_str());
+ vertexBuilder->vsCodeAppendf("\t%s = %s;\n", vsVaryingName, coords->c_str());
break;
case kVec2f_GrSLType:
SkASSERT(kVec2f_GrSLType == varyingType);
- builder->vsCodeAppendf("\t%s = %s + %s;\n",
- vsVaryingName, uniName, coords->c_str());
+ vertexBuilder->vsCodeAppendf("\t%s = %s + %s;\n",
+ vsVaryingName, uniName, coords->c_str());
break;
case kMat33f_GrSLType: {
SkASSERT(kVec2f_GrSLType == varyingType || kVec3f_GrSLType == varyingType);
if (kVec2f_GrSLType == varyingType) {
- builder->vsCodeAppendf("\t%s = (%s * vec3(%s, 1)).xy;\n",
- vsVaryingName, uniName, coords->c_str());
+ vertexBuilder->vsCodeAppendf("\t%s = (%s * vec3(%s, 1)).xy;\n",
+ vsVaryingName, uniName, coords->c_str());
} else {
- builder->vsCodeAppendf("\t%s = %s * vec3(%s, 1);\n",
- vsVaryingName, uniName, coords->c_str());
+ vertexBuilder->vsCodeAppendf("\t%s = %s * vec3(%s, 1);\n",
+ vsVaryingName, uniName, coords->c_str());
}
break;
}
« no previous file with comments | « src/gpu/effects/GrSimpleTextureEffect.cpp ('k') | src/gpu/gl/GrGLProgram.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698