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

Unified Diff: src/gpu/GrDefaultGeoProcFactory.cpp

Issue 1457543003: Add ShaderBuilders to EmitArgs and remove gettings from ProgBuilder. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years, 1 month 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/effects/gradients/SkTwoPointConicalGradient_gpu.cpp ('k') | src/gpu/GrFragmentProcessor.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/GrDefaultGeoProcFactory.cpp
diff --git a/src/gpu/GrDefaultGeoProcFactory.cpp b/src/gpu/GrDefaultGeoProcFactory.cpp
index e1da5d607040106a187df3609635e67e6e0c5f29..7b9213315d5cc869079b454dc02df01a4af69f73 100644
--- a/src/gpu/GrDefaultGeoProcFactory.cpp
+++ b/src/gpu/GrDefaultGeoProcFactory.cpp
@@ -64,47 +64,64 @@ public:
void onEmitCode(EmitArgs& args, GrGPArgs* gpArgs) override {
const DefaultGeoProc& gp = args.fGP.cast<DefaultGeoProc>();
GrGLSLGPBuilder* pb = args.fPB;
- GrGLSLVertexBuilder* vsBuilder = pb->getVertexShaderBuilder();
- GrGLSLFragmentBuilder* fs = args.fPB->getFragmentShaderBuilder();
+ GrGLSLVertexBuilder* vertBuilder = args.fVertBuilder;
+ GrGLSLFragmentBuilder* fragBuilder = args.fFragBuilder;
// emit attributes
- vsBuilder->emitAttributes(gp);
+ vertBuilder->emitAttributes(gp);
// Setup pass through color
if (!gp.colorIgnored()) {
if (gp.hasVertexColor()) {
pb->addPassThroughAttribute(gp.inColor(), args.fOutputColor);
} else {
- this->setupUniformColor(pb, args.fOutputColor, &fColorUniform);
+ this->setupUniformColor(pb, fragBuilder, args.fOutputColor, &fColorUniform);
}
}
// Setup position
- this->setupPosition(pb, gpArgs, gp.inPosition()->fName, gp.viewMatrix(),
+ this->setupPosition(pb,
+ vertBuilder,
+ gpArgs,
+ gp.inPosition()->fName,
+ gp.viewMatrix(),
&fViewMatrixUniform);
if (gp.hasExplicitLocalCoords()) {
// emit transforms with explicit local coords
- this->emitTransforms(pb, gpArgs->fPositionVar, gp.inLocalCoords()->fName,
- gp.localMatrix(), args.fTransformsIn, args.fTransformsOut);
+ this->emitTransforms(pb,
+ vertBuilder,
+ gpArgs->fPositionVar,
+ gp.inLocalCoords()->fName,
+ gp.localMatrix(),
+ args.fTransformsIn,
+ args.fTransformsOut);
} else if(gp.hasTransformedLocalCoords()) {
// transforms have already been applied to vertex attributes on the cpu
- this->emitTransforms(pb, gp.inLocalCoords()->fName,
- args.fTransformsIn, args.fTransformsOut);
+ this->emitTransforms(pb,
+ vertBuilder,
+ gp.inLocalCoords()->fName,
+ args.fTransformsIn,
+ args.fTransformsOut);
} else {
// emit transforms with position
- this->emitTransforms(pb, gpArgs->fPositionVar, gp.inPosition()->fName,
- gp.localMatrix(), args.fTransformsIn, args.fTransformsOut);
+ this->emitTransforms(pb,
+ vertBuilder,
+ gpArgs->fPositionVar,
+ gp.inPosition()->fName,
+ gp.localMatrix(),
+ args.fTransformsIn,
+ args.fTransformsOut);
}
// Setup coverage as pass through
if (!gp.coverageWillBeIgnored()) {
if (gp.hasVertexCoverage()) {
- fs->codeAppendf("float alpha = 1.0;");
+ fragBuilder->codeAppendf("float alpha = 1.0;");
args.fPB->addPassThroughAttribute(gp.inCoverage(), "alpha");
- fs->codeAppendf("%s = vec4(alpha);", args.fOutputCoverage);
+ fragBuilder->codeAppendf("%s = vec4(alpha);", args.fOutputCoverage);
} else if (gp.coverage() == 0xff) {
- fs->codeAppendf("%s = vec4(1);", args.fOutputCoverage);
+ fragBuilder->codeAppendf("%s = vec4(1);", args.fOutputCoverage);
} else {
const char* fragCoverage;
fCoverageUniform = pb->addUniform(GrGLSLProgramBuilder::kFragment_Visibility,
@@ -112,7 +129,7 @@ public:
kDefault_GrSLPrecision,
"Coverage",
&fragCoverage);
- fs->codeAppendf("%s = vec4(%s);", args.fOutputCoverage, fragCoverage);
+ fragBuilder->codeAppendf("%s = vec4(%s);", args.fOutputCoverage, fragCoverage);
}
}
}
« no previous file with comments | « src/effects/gradients/SkTwoPointConicalGradient_gpu.cpp ('k') | src/gpu/GrFragmentProcessor.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698