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

Unified Diff: src/gpu/GrDefaultGeoProcFactory.cpp

Issue 1490283004: Create GLSLUniformHandler class for gpu backend (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: clean up public api of uniformhandler Created 5 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/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 85339ea9b5fedc3a413f39bd6dc57f681fb12356..25da4dcae92724485c12dda7587ce23f6fb3c034 100644
--- a/src/gpu/GrDefaultGeoProcFactory.cpp
+++ b/src/gpu/GrDefaultGeoProcFactory.cpp
@@ -10,9 +10,9 @@
#include "GrInvariantOutput.h"
#include "glsl/GrGLSLFragmentShaderBuilder.h"
#include "glsl/GrGLSLGeometryProcessor.h"
-#include "glsl/GrGLSLProgramBuilder.h"
#include "glsl/GrGLSLVertexShaderBuilder.h"
#include "glsl/GrGLSLVarying.h"
+#include "glsl/GrGLSLUniformHandler.h"
#include "glsl/GrGLSLUtil.h"
/*
@@ -64,10 +64,10 @@ public:
void onEmitCode(EmitArgs& args, GrGPArgs* gpArgs) override {
const DefaultGeoProc& gp = args.fGP.cast<DefaultGeoProc>();
- GrGLSLGPBuilder* pb = args.fPB;
GrGLSLVertexBuilder* vertBuilder = args.fVertBuilder;
GrGLSLFragmentBuilder* fragBuilder = args.fFragBuilder;
GrGLSLVaryingHandler* varyingHandler = args.fVaryingHandler;
+ GrGLSLUniformHandler* uniformHandler = args.fUniformHandler;
// emit attributes
varyingHandler->emitAttributes(gp);
@@ -77,13 +77,14 @@ public:
if (gp.hasVertexColor()) {
varyingHandler->addPassThroughAttribute(gp.inColor(), args.fOutputColor);
} else {
- this->setupUniformColor(pb, fragBuilder, args.fOutputColor, &fColorUniform);
+ this->setupUniformColor(fragBuilder, uniformHandler, args.fOutputColor,
+ &fColorUniform);
}
}
// Setup position
- this->setupPosition(pb,
- vertBuilder,
+ this->setupPosition(vertBuilder,
+ uniformHandler,
gpArgs,
gp.inPosition()->fName,
gp.viewMatrix(),
@@ -91,9 +92,9 @@ public:
if (gp.hasExplicitLocalCoords()) {
// emit transforms with explicit local coords
- this->emitTransforms(pb,
- vertBuilder,
+ this->emitTransforms(vertBuilder,
varyingHandler,
+ uniformHandler,
gpArgs->fPositionVar,
gp.inLocalCoords()->fName,
gp.localMatrix(),
@@ -101,17 +102,16 @@ public:
args.fTransformsOut);
} else if(gp.hasTransformedLocalCoords()) {
// transforms have already been applied to vertex attributes on the cpu
- this->emitTransforms(pb,
- vertBuilder,
+ this->emitTransforms(vertBuilder,
varyingHandler,
gp.inLocalCoords()->fName,
args.fTransformsIn,
args.fTransformsOut);
} else {
// emit transforms with position
- this->emitTransforms(pb,
- vertBuilder,
+ this->emitTransforms(vertBuilder,
varyingHandler,
+ uniformHandler,
gpArgs->fPositionVar,
gp.inPosition()->fName,
gp.localMatrix(),
@@ -129,11 +129,12 @@ public:
fragBuilder->codeAppendf("%s = vec4(1);", args.fOutputCoverage);
} else {
const char* fragCoverage;
- fCoverageUniform = pb->addUniform(GrGLSLProgramBuilder::kFragment_Visibility,
- kFloat_GrSLType,
- kDefault_GrSLPrecision,
- "Coverage",
- &fragCoverage);
+ fCoverageUniform = uniformHandler->addUniform(
+ GrGLSLUniformHandler::kFragment_Visibility,
+ kFloat_GrSLType,
+ kDefault_GrSLPrecision,
+ "Coverage",
+ &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