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

Unified Diff: src/gpu/effects/GrMatrixConvolutionEffect.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/gpu/effects/GrDitherEffect.cpp ('k') | src/gpu/effects/GrOvalEffect.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/effects/GrMatrixConvolutionEffect.cpp
diff --git a/src/gpu/effects/GrMatrixConvolutionEffect.cpp b/src/gpu/effects/GrMatrixConvolutionEffect.cpp
index 5fb694b0d752e1e975b5f508d4ff82b0f66427e8..8867ab9dba80a84229b019be6cec96697d330657 100644
--- a/src/gpu/effects/GrMatrixConvolutionEffect.cpp
+++ b/src/gpu/effects/GrMatrixConvolutionEffect.cpp
@@ -6,8 +6,9 @@
*/
#include "GrMatrixConvolutionEffect.h"
#include "glsl/GrGLSLFragmentProcessor.h"
-#include "glsl/GrGLSLProgramBuilder.h"
+#include "glsl/GrGLSLFragmentShaderBuilder.h"
#include "glsl/GrGLSLProgramDataManager.h"
+#include "glsl/GrGLSLUniformHandler.h"
class GrGLMatrixConvolutionEffect : public GrGLSLFragmentProcessor {
public:
@@ -42,25 +43,27 @@ GrGLMatrixConvolutionEffect::GrGLMatrixConvolutionEffect(const GrProcessor& proc
void GrGLMatrixConvolutionEffect::emitCode(EmitArgs& args) {
const GrTextureDomain& domain = args.fFp.cast<GrMatrixConvolutionEffect>().domain();
- fImageIncrementUni = args.fBuilder->addUniform(GrGLSLProgramBuilder::kFragment_Visibility,
- kVec2f_GrSLType, kDefault_GrSLPrecision,
- "ImageIncrement");
- fKernelUni = args.fBuilder->addUniformArray(GrGLSLProgramBuilder::kFragment_Visibility,
- kFloat_GrSLType, kDefault_GrSLPrecision,
- "Kernel",
- fKernelSize.width() * fKernelSize.height());
- fKernelOffsetUni = args.fBuilder->addUniform(GrGLSLProgramBuilder::kFragment_Visibility,
- kVec2f_GrSLType, kDefault_GrSLPrecision, "KernelOffset");
- fGainUni = args.fBuilder->addUniform(GrGLSLProgramBuilder::kFragment_Visibility,
- kFloat_GrSLType, kDefault_GrSLPrecision, "Gain");
- fBiasUni = args.fBuilder->addUniform(GrGLSLProgramBuilder::kFragment_Visibility,
- kFloat_GrSLType, kDefault_GrSLPrecision, "Bias");
+ GrGLSLUniformHandler* uniformHandler = args.fUniformHandler;
+ fImageIncrementUni = uniformHandler->addUniform(GrGLSLUniformHandler::kFragment_Visibility,
+ kVec2f_GrSLType, kDefault_GrSLPrecision,
+ "ImageIncrement");
+ fKernelUni = uniformHandler->addUniformArray(GrGLSLUniformHandler::kFragment_Visibility,
+ kFloat_GrSLType, kDefault_GrSLPrecision,
+ "Kernel",
+ fKernelSize.width() * fKernelSize.height());
+ fKernelOffsetUni = uniformHandler->addUniform(GrGLSLUniformHandler::kFragment_Visibility,
+ kVec2f_GrSLType, kDefault_GrSLPrecision,
+ "KernelOffset");
+ fGainUni = uniformHandler->addUniform(GrGLSLUniformHandler::kFragment_Visibility,
+ kFloat_GrSLType, kDefault_GrSLPrecision, "Gain");
+ fBiasUni = uniformHandler->addUniform(GrGLSLUniformHandler::kFragment_Visibility,
+ kFloat_GrSLType, kDefault_GrSLPrecision, "Bias");
- const char* kernelOffset = args.fBuilder->getUniformCStr(fKernelOffsetUni);
- const char* imgInc = args.fBuilder->getUniformCStr(fImageIncrementUni);
- const char* kernel = args.fBuilder->getUniformCStr(fKernelUni);
- const char* gain = args.fBuilder->getUniformCStr(fGainUni);
- const char* bias = args.fBuilder->getUniformCStr(fBiasUni);
+ const char* kernelOffset = uniformHandler->getUniformCStr(fKernelOffsetUni);
+ const char* imgInc = uniformHandler->getUniformCStr(fImageIncrementUni);
+ const char* kernel = uniformHandler->getUniformCStr(fKernelUni);
+ const char* gain = uniformHandler->getUniformCStr(fGainUni);
+ const char* bias = uniformHandler->getUniformCStr(fBiasUni);
int kWidth = fKernelSize.width();
int kHeight = fKernelSize.height();
@@ -77,6 +80,7 @@ void GrGLMatrixConvolutionEffect::emitCode(EmitArgs& args) {
SkString coord;
coord.printf("coord + vec2(%d, %d) * %s", x, y, imgInc);
fDomain.sampleTexture(fragBuilder,
+ uniformHandler,
args.fGLSLCaps,
domain,
"c",
@@ -95,6 +99,7 @@ void GrGLMatrixConvolutionEffect::emitCode(EmitArgs& args) {
args.fOutputColor, args.fOutputColor, args.fOutputColor);
} else {
fDomain.sampleTexture(fragBuilder,
+ uniformHandler,
args.fGLSLCaps,
domain,
"c",
« no previous file with comments | « src/gpu/effects/GrDitherEffect.cpp ('k') | src/gpu/effects/GrOvalEffect.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698