aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/gpu
diff options
context:
space:
mode:
authorGravatar egdaniel <egdaniel@google.com>2015-11-13 06:54:19 -0800
committerGravatar Commit bot <commit-bot@chromium.org>2015-11-13 06:54:19 -0800
commit64c4728c70001ed074fecf5c4e083781987b12e9 (patch)
tree9c46b7028d1d04b526cca0671deb88aa003fc8d6 /src/gpu
parent6b90df6b1c6ed843be3ac09605050605f9ec9150 (diff)
Make all GrFragmentProcessors GL independent.
TBR=bsalomon@google.com BUG=skia: Review URL: https://codereview.chromium.org/1434313002
Diffstat (limited to 'src/gpu')
-rw-r--r--src/gpu/GrDefaultGeoProcFactory.cpp4
-rw-r--r--src/gpu/GrFragmentProcessor.cpp18
-rw-r--r--src/gpu/GrOvalRenderer.cpp4
-rw-r--r--src/gpu/effects/GrBezierEffect.cpp10
-rw-r--r--src/gpu/effects/GrBicubicEffect.cpp6
-rw-r--r--src/gpu/effects/GrBicubicEffect.h4
-rw-r--r--src/gpu/effects/GrBitmapTextGeoProc.cpp3
-rw-r--r--src/gpu/effects/GrConfigConversionEffect.cpp8
-rw-r--r--src/gpu/effects/GrConfigConversionEffect.h2
-rw-r--r--src/gpu/effects/GrConstColorProcessor.cpp8
-rw-r--r--src/gpu/effects/GrConvexPolyEffect.cpp17
-rw-r--r--src/gpu/effects/GrConvexPolyEffect.h2
-rw-r--r--src/gpu/effects/GrConvolutionEffect.cpp9
-rw-r--r--src/gpu/effects/GrConvolutionEffect.h2
-rw-r--r--src/gpu/effects/GrCustomXfermode.cpp8
-rw-r--r--src/gpu/effects/GrDashingEffect.cpp2
-rw-r--r--src/gpu/effects/GrDistanceFieldGeoProc.cpp10
-rw-r--r--src/gpu/effects/GrDitherEffect.cpp10
-rw-r--r--src/gpu/effects/GrMatrixConvolutionEffect.cpp21
-rw-r--r--src/gpu/effects/GrMatrixConvolutionEffect.h2
-rw-r--r--src/gpu/effects/GrOvalEffect.cpp18
-rw-r--r--src/gpu/effects/GrPorterDuffXferProcessor.cpp2
-rw-r--r--src/gpu/effects/GrRRectEffect.cpp18
-rw-r--r--src/gpu/effects/GrSimpleTextureEffect.cpp10
-rw-r--r--src/gpu/effects/GrSimpleTextureEffect.h2
-rw-r--r--src/gpu/effects/GrTextureDomain.cpp9
-rw-r--r--src/gpu/effects/GrTextureDomain.h14
-rw-r--r--src/gpu/effects/GrXfermodeFragmentProcessor.cpp20
-rw-r--r--src/gpu/effects/GrYUVtoRGBEffect.cpp8
-rw-r--r--src/gpu/gl/GrGLGpuProgramCache.cpp2
-rw-r--r--src/gpu/gl/GrGLPathRendering.h4
-rw-r--r--src/gpu/gl/GrGLProgram.cpp2
-rw-r--r--src/gpu/gl/GrGLProgramDesc.cpp2
-rw-r--r--src/gpu/gl/GrGLUtil.cpp45
-rw-r--r--src/gpu/gl/GrGLUtil.h5
-rw-r--r--src/gpu/gl/builders/GrGLProgramBuilder.cpp9
-rw-r--r--src/gpu/gl/builders/GrGLProgramBuilder.h2
-rw-r--r--src/gpu/glsl/GrGLSLBlend.cpp (renamed from src/gpu/gl/GrGLSLBlend.cpp)0
-rw-r--r--src/gpu/glsl/GrGLSLBlend.h (renamed from src/gpu/gl/GrGLSLBlend.h)0
-rw-r--r--src/gpu/glsl/GrGLSLFragmentProcessor.cpp (renamed from src/gpu/gl/GrGLFragmentProcessor.cpp)14
-rw-r--r--src/gpu/glsl/GrGLSLFragmentProcessor.h (renamed from src/gpu/gl/GrGLFragmentProcessor.h)20
-rw-r--r--src/gpu/glsl/GrGLSLUtil.cpp52
-rw-r--r--src/gpu/glsl/GrGLSLUtil.h19
43 files changed, 222 insertions, 205 deletions
diff --git a/src/gpu/GrDefaultGeoProcFactory.cpp b/src/gpu/GrDefaultGeoProcFactory.cpp
index 6c73c361ca..4ce5b0d5fc 100644
--- a/src/gpu/GrDefaultGeoProcFactory.cpp
+++ b/src/gpu/GrDefaultGeoProcFactory.cpp
@@ -9,10 +9,10 @@
#include "GrInvariantOutput.h"
#include "gl/GrGLGeometryProcessor.h"
-#include "gl/GrGLUtil.h"
#include "glsl/GrGLSLFragmentShaderBuilder.h"
#include "glsl/GrGLSLProgramBuilder.h"
#include "glsl/GrGLSLVertexShaderBuilder.h"
+#include "glsl/GrGLSLUtil.h"
/*
* The default Geometry Processor simply takes position and multiplies it by the uniform view
@@ -140,7 +140,7 @@ public:
if (!dgp.viewMatrix().isIdentity() && !fViewMatrix.cheapEqualTo(dgp.viewMatrix())) {
fViewMatrix = dgp.viewMatrix();
float viewMatrix[3 * 3];
- GrGLGetMatrix<3>(viewMatrix, fViewMatrix);
+ GrGLSLGetMatrix<3>(viewMatrix, fViewMatrix);
pdman.setMatrix3f(fViewMatrixUniform, viewMatrix);
}
diff --git a/src/gpu/GrFragmentProcessor.cpp b/src/gpu/GrFragmentProcessor.cpp
index 9b5677ae8f..37416399b2 100644
--- a/src/gpu/GrFragmentProcessor.cpp
+++ b/src/gpu/GrFragmentProcessor.cpp
@@ -8,7 +8,7 @@
#include "GrFragmentProcessor.h"
#include "GrCoordTransform.h"
-#include "gl/GrGLFragmentProcessor.h"
+#include "glsl/GrGLSLFragmentProcessor.h"
#include "glsl/GrGLSLFragmentShaderBuilder.h"
#include "glsl/GrGLSLProgramBuilder.h"
#include "glsl/GrGLSLProgramDataManager.h"
@@ -50,8 +50,8 @@ bool GrFragmentProcessor::isEqual(const GrFragmentProcessor& that,
return true;
}
-GrGLFragmentProcessor* GrFragmentProcessor::createGLInstance() const {
- GrGLFragmentProcessor* glFragProc = this->onCreateGLInstance();
+GrGLSLFragmentProcessor* GrFragmentProcessor::createGLInstance() const {
+ GrGLSLFragmentProcessor* glFragProc = this->onCreateGLInstance();
glFragProc->fChildProcessors.push_back_n(fChildProcessors.count());
for (int i = 0; i < fChildProcessors.count(); ++i) {
glFragProc->fChildProcessors[i] = fChildProcessors[i]->createGLInstance();
@@ -147,8 +147,8 @@ const GrFragmentProcessor* GrFragmentProcessor::MulOutputByInputUnpremulColor(
const char* name() const override { return "Premultiply"; }
private:
- GrGLFragmentProcessor* onCreateGLInstance() const override {
- class GLFP : public GrGLFragmentProcessor {
+ GrGLSLFragmentProcessor* onCreateGLInstance() const override {
+ class GLFP : public GrGLSLFragmentProcessor {
public:
GLFP() {}
@@ -220,8 +220,8 @@ const GrFragmentProcessor* GrFragmentProcessor::OverrideInput(const GrFragmentPr
const char* name() const override { return "Replace Color"; }
- GrGLFragmentProcessor* onCreateGLInstance() const override {
- class GLFP : public GrGLFragmentProcessor {
+ GrGLSLFragmentProcessor* onCreateGLInstance() const override {
+ class GLFP : public GrGLSLFragmentProcessor {
public:
GLFP() : fHaveSetColor(false) {}
void emitCode(EmitArgs& args) override {
@@ -297,8 +297,8 @@ const GrFragmentProcessor* GrFragmentProcessor::RunInSeries(const GrFragmentProc
const char* name() const override { return "Series"; }
- GrGLFragmentProcessor* onCreateGLInstance() const override {
- class GLFP : public GrGLFragmentProcessor {
+ GrGLSLFragmentProcessor* onCreateGLInstance() const override {
+ class GLFP : public GrGLSLFragmentProcessor {
public:
GLFP() {}
void emitCode(EmitArgs& args) override {
diff --git a/src/gpu/GrOvalRenderer.cpp b/src/gpu/GrOvalRenderer.cpp
index c5d807c8e8..ec79a95e5d 100644
--- a/src/gpu/GrOvalRenderer.cpp
+++ b/src/gpu/GrOvalRenderer.cpp
@@ -21,12 +21,12 @@
#include "SkTLazy.h"
#include "batches/GrVertexBatch.h"
#include "effects/GrRRectEffect.h"
-#include "gl/GrGLUtil.h"
#include "gl/GrGLGeometryProcessor.h"
#include "glsl/GrGLSLFragmentShaderBuilder.h"
#include "glsl/GrGLSLProgramBuilder.h"
#include "glsl/GrGLSLProgramDataManager.h"
#include "glsl/GrGLSLVertexShaderBuilder.h"
+#include "glsl/GrGLSLUtil.h"
// TODO(joshualitt) - Break this file up during GrBatch post implementation cleanup
@@ -507,7 +507,7 @@ public:
if (!dee.viewMatrix().isIdentity() && !fViewMatrix.cheapEqualTo(dee.viewMatrix())) {
fViewMatrix = dee.viewMatrix();
float viewMatrix[3 * 3];
- GrGLGetMatrix<3>(viewMatrix, fViewMatrix);
+ GrGLSLGetMatrix<3>(viewMatrix, fViewMatrix);
pdman.setMatrix3f(fViewMatrixUniform, viewMatrix);
}
diff --git a/src/gpu/effects/GrBezierEffect.cpp b/src/gpu/effects/GrBezierEffect.cpp
index febf18fbd2..d57861d29a 100644
--- a/src/gpu/effects/GrBezierEffect.cpp
+++ b/src/gpu/effects/GrBezierEffect.cpp
@@ -7,11 +7,11 @@
#include "GrBezierEffect.h"
-#include "gl/GrGLFragmentProcessor.h"
#include "gl/GrGLGeometryProcessor.h"
-#include "gl/GrGLUtil.h"
+#include "glsl/GrGLSLFragmentProcessor.h"
#include "glsl/GrGLSLProgramBuilder.h"
#include "glsl/GrGLSLProgramDataManager.h"
+#include "glsl/GrGLSLUtil.h"
class GrGLConicEffect : public GrGLGeometryProcessor {
public:
@@ -30,7 +30,7 @@ public:
if (!ce.viewMatrix().isIdentity() && !fViewMatrix.cheapEqualTo(ce.viewMatrix())) {
fViewMatrix = ce.viewMatrix();
float viewMatrix[3 * 3];
- GrGLGetMatrix<3>(viewMatrix, fViewMatrix);
+ GrGLSLGetMatrix<3>(viewMatrix, fViewMatrix);
pdman.setMatrix3f(fViewMatrixUniform, viewMatrix);
}
@@ -246,7 +246,7 @@ public:
if (!qe.viewMatrix().isIdentity() && !fViewMatrix.cheapEqualTo(qe.viewMatrix())) {
fViewMatrix = qe.viewMatrix();
float viewMatrix[3 * 3];
- GrGLGetMatrix<3>(viewMatrix, fViewMatrix);
+ GrGLSLGetMatrix<3>(viewMatrix, fViewMatrix);
pdman.setMatrix3f(fViewMatrixUniform, viewMatrix);
}
@@ -448,7 +448,7 @@ public:
if (!ce.viewMatrix().isIdentity() && !fViewMatrix.cheapEqualTo(ce.viewMatrix())) {
fViewMatrix = ce.viewMatrix();
float viewMatrix[3 * 3];
- GrGLGetMatrix<3>(viewMatrix, fViewMatrix);
+ GrGLSLGetMatrix<3>(viewMatrix, fViewMatrix);
pdman.setMatrix3f(fViewMatrixUniform, viewMatrix);
}
diff --git a/src/gpu/effects/GrBicubicEffect.cpp b/src/gpu/effects/GrBicubicEffect.cpp
index 2857641edc..dedb92740f 100644
--- a/src/gpu/effects/GrBicubicEffect.cpp
+++ b/src/gpu/effects/GrBicubicEffect.cpp
@@ -21,7 +21,7 @@ const SkScalar GrBicubicEffect::gMitchellCoefficients[16] = {
};
-class GrGLBicubicEffect : public GrGLFragmentProcessor {
+class GrGLBicubicEffect : public GrGLSLFragmentProcessor {
public:
GrGLBicubicEffect(const GrProcessor&);
@@ -43,7 +43,7 @@ private:
UniformHandle fImageIncrementUni;
GrTextureDomain::GLDomain fDomain;
- typedef GrGLFragmentProcessor INHERITED;
+ typedef GrGLSLFragmentProcessor INHERITED;
};
GrGLBicubicEffect::GrGLBicubicEffect(const GrProcessor&) {
@@ -157,7 +157,7 @@ void GrBicubicEffect::onGetGLProcessorKey(const GrGLSLCaps& caps,
GrGLBicubicEffect::GenKey(*this, caps, b);
}
-GrGLFragmentProcessor* GrBicubicEffect::onCreateGLInstance() const {
+GrGLSLFragmentProcessor* GrBicubicEffect::onCreateGLInstance() const {
return new GrGLBicubicEffect(*this);
}
diff --git a/src/gpu/effects/GrBicubicEffect.h b/src/gpu/effects/GrBicubicEffect.h
index 5a54cc167d..67569d8855 100644
--- a/src/gpu/effects/GrBicubicEffect.h
+++ b/src/gpu/effects/GrBicubicEffect.h
@@ -10,7 +10,7 @@
#include "GrSingleTextureEffect.h"
#include "GrTextureDomain.h"
-#include "gl/GrGLFragmentProcessor.h"
+#include "glsl/GrGLSLFragmentProcessor.h"
class GrGLBicubicEffect;
class GrInvariantOutput;
@@ -87,7 +87,7 @@ private:
GrBicubicEffect(GrTexture*, const SkScalar coefficients[16], const SkMatrix &matrix,
const SkRect& domain);
- GrGLFragmentProcessor* onCreateGLInstance() const override;
+ GrGLSLFragmentProcessor* onCreateGLInstance() const override;
void onGetGLProcessorKey(const GrGLSLCaps&, GrProcessorKeyBuilder*) const override;
diff --git a/src/gpu/effects/GrBitmapTextGeoProc.cpp b/src/gpu/effects/GrBitmapTextGeoProc.cpp
index 21dd5e7265..7b179244a1 100644
--- a/src/gpu/effects/GrBitmapTextGeoProc.cpp
+++ b/src/gpu/effects/GrBitmapTextGeoProc.cpp
@@ -8,9 +8,8 @@
#include "GrBitmapTextGeoProc.h"
#include "GrInvariantOutput.h"
#include "GrTexture.h"
-#include "gl/GrGLFragmentProcessor.h"
-#include "gl/GrGLTexture.h"
#include "gl/GrGLGeometryProcessor.h"
+#include "glsl/GrGLSLFragmentProcessor.h"
#include "glsl/GrGLSLFragmentShaderBuilder.h"
#include "glsl/GrGLSLProgramBuilder.h"
#include "glsl/GrGLSLProgramDataManager.h"
diff --git a/src/gpu/effects/GrConfigConversionEffect.cpp b/src/gpu/effects/GrConfigConversionEffect.cpp
index 160773d81e..0273858a3b 100644
--- a/src/gpu/effects/GrConfigConversionEffect.cpp
+++ b/src/gpu/effects/GrConfigConversionEffect.cpp
@@ -11,11 +11,11 @@
#include "GrInvariantOutput.h"
#include "GrSimpleTextureEffect.h"
#include "SkMatrix.h"
-#include "gl/GrGLFragmentProcessor.h"
+#include "glsl/GrGLSLFragmentProcessor.h"
#include "glsl/GrGLSLFragmentShaderBuilder.h"
#include "glsl/GrGLSLProgramBuilder.h"
-class GrGLConfigConversionEffect : public GrGLFragmentProcessor {
+class GrGLConfigConversionEffect : public GrGLSLFragmentProcessor {
public:
GrGLConfigConversionEffect(const GrProcessor& processor) {
const GrConfigConversionEffect& configConversionEffect =
@@ -91,7 +91,7 @@ private:
bool fSwapRedAndBlue;
GrConfigConversionEffect::PMConversion fPMConversion;
- typedef GrGLFragmentProcessor INHERITED;
+ typedef GrGLSLFragmentProcessor INHERITED;
};
@@ -147,7 +147,7 @@ void GrConfigConversionEffect::onGetGLProcessorKey(const GrGLSLCaps& caps,
GrGLConfigConversionEffect::GenKey(*this, caps, b);
}
-GrGLFragmentProcessor* GrConfigConversionEffect::onCreateGLInstance() const {
+GrGLSLFragmentProcessor* GrConfigConversionEffect::onCreateGLInstance() const {
return new GrGLConfigConversionEffect(*this);
}
diff --git a/src/gpu/effects/GrConfigConversionEffect.h b/src/gpu/effects/GrConfigConversionEffect.h
index cf2fea3640..bf13afb01d 100644
--- a/src/gpu/effects/GrConfigConversionEffect.h
+++ b/src/gpu/effects/GrConfigConversionEffect.h
@@ -56,7 +56,7 @@ private:
PMConversion pmConversion,
const SkMatrix& matrix);
- GrGLFragmentProcessor* onCreateGLInstance() const override;
+ GrGLSLFragmentProcessor* onCreateGLInstance() const override;
void onGetGLProcessorKey(const GrGLSLCaps&, GrProcessorKeyBuilder*) const override;
diff --git a/src/gpu/effects/GrConstColorProcessor.cpp b/src/gpu/effects/GrConstColorProcessor.cpp
index 5440dd3125..09aa75dba0 100644
--- a/src/gpu/effects/GrConstColorProcessor.cpp
+++ b/src/gpu/effects/GrConstColorProcessor.cpp
@@ -6,12 +6,12 @@
*/
#include "effects/GrConstColorProcessor.h"
-#include "gl/GrGLFragmentProcessor.h"
+#include "glsl/GrGLSLFragmentProcessor.h"
#include "glsl/GrGLSLFragmentShaderBuilder.h"
#include "glsl/GrGLSLProgramBuilder.h"
#include "glsl/GrGLSLProgramDataManager.h"
-class GLConstColorProcessor : public GrGLFragmentProcessor {
+class GLConstColorProcessor : public GrGLSLFragmentProcessor {
public:
GLConstColorProcessor() : fPrevColor(GrColor_ILLEGAL) {}
@@ -63,7 +63,7 @@ private:
GrGLSLProgramDataManager::UniformHandle fColorUniform;
GrColor fPrevColor;
- typedef GrGLFragmentProcessor INHERITED;
+ typedef GrGLSLFragmentProcessor INHERITED;
};
///////////////////////////////////////////////////////////////////////////////
@@ -96,7 +96,7 @@ void GrConstColorProcessor::onGetGLProcessorKey(const GrGLSLCaps&, GrProcessorKe
b->add32(fMode);
}
-GrGLFragmentProcessor* GrConstColorProcessor::onCreateGLInstance() const {
+GrGLSLFragmentProcessor* GrConstColorProcessor::onCreateGLInstance() const {
return new GLConstColorProcessor;
}
diff --git a/src/gpu/effects/GrConvexPolyEffect.cpp b/src/gpu/effects/GrConvexPolyEffect.cpp
index c373b041fe..3beecb42b0 100644
--- a/src/gpu/effects/GrConvexPolyEffect.cpp
+++ b/src/gpu/effects/GrConvexPolyEffect.cpp
@@ -8,8 +8,7 @@
#include "GrConvexPolyEffect.h"
#include "GrInvariantOutput.h"
#include "SkPathPriv.h"
-#include "gl/GrGLContext.h"
-#include "gl/GrGLFragmentProcessor.h"
+#include "glsl/GrGLSLFragmentProcessor.h"
#include "glsl/GrGLSLFragmentShaderBuilder.h"
#include "glsl/GrGLSLProgramBuilder.h"
#include "glsl/GrGLSLProgramDataManager.h"
@@ -36,7 +35,7 @@ private:
this->setWillReadFragmentPosition();
}
- GrGLFragmentProcessor* onCreateGLInstance() const override;
+ GrGLSLFragmentProcessor* onCreateGLInstance() const override;
bool onIsEqual(const GrFragmentProcessor& other) const override {
const AARectEffect& aare = other.cast<AARectEffect>();
@@ -80,7 +79,7 @@ const GrFragmentProcessor* AARectEffect::TestCreate(GrProcessorTestData* d) {
//////////////////////////////////////////////////////////////////////////////
-class GLAARectEffect : public GrGLFragmentProcessor {
+class GLAARectEffect : public GrGLSLFragmentProcessor {
public:
GLAARectEffect(const GrProcessor&);
@@ -94,7 +93,7 @@ protected:
private:
GrGLSLProgramDataManager::UniformHandle fRectUniform;
SkRect fPrevRect;
- typedef GrGLFragmentProcessor INHERITED;
+ typedef GrGLSLFragmentProcessor INHERITED;
};
GLAARectEffect::GLAARectEffect(const GrProcessor& effect) {
@@ -161,13 +160,13 @@ void AARectEffect::onGetGLProcessorKey(const GrGLSLCaps& caps, GrProcessorKeyBui
GLAARectEffect::GenKey(*this, caps, b);
}
-GrGLFragmentProcessor* AARectEffect::onCreateGLInstance() const {
+GrGLSLFragmentProcessor* AARectEffect::onCreateGLInstance() const {
return new GLAARectEffect(*this);
}
//////////////////////////////////////////////////////////////////////////////
-class GrGLConvexPolyEffect : public GrGLFragmentProcessor {
+class GrGLConvexPolyEffect : public GrGLSLFragmentProcessor {
public:
GrGLConvexPolyEffect(const GrProcessor&);
@@ -181,7 +180,7 @@ protected:
private:
GrGLSLProgramDataManager::UniformHandle fEdgeUniform;
SkScalar fPrevEdges[3 * GrConvexPolyEffect::kMaxEdges];
- typedef GrGLFragmentProcessor INHERITED;
+ typedef GrGLSLFragmentProcessor INHERITED;
};
GrGLConvexPolyEffect::GrGLConvexPolyEffect(const GrProcessor&) {
@@ -309,7 +308,7 @@ void GrConvexPolyEffect::onGetGLProcessorKey(const GrGLSLCaps& caps,
GrGLConvexPolyEffect::GenKey(*this, caps, b);
}
-GrGLFragmentProcessor* GrConvexPolyEffect::onCreateGLInstance() const {
+GrGLSLFragmentProcessor* GrConvexPolyEffect::onCreateGLInstance() const {
return new GrGLConvexPolyEffect(*this);
}
diff --git a/src/gpu/effects/GrConvexPolyEffect.h b/src/gpu/effects/GrConvexPolyEffect.h
index 9e7f1542c2..6622ca38ff 100644
--- a/src/gpu/effects/GrConvexPolyEffect.h
+++ b/src/gpu/effects/GrConvexPolyEffect.h
@@ -72,7 +72,7 @@ public:
private:
GrConvexPolyEffect(GrPrimitiveEdgeType edgeType, int n, const SkScalar edges[]);
- GrGLFragmentProcessor* onCreateGLInstance() const override;
+ GrGLSLFragmentProcessor* onCreateGLInstance() const override;
void onGetGLProcessorKey(const GrGLSLCaps&, GrProcessorKeyBuilder*) const override;
diff --git a/src/gpu/effects/GrConvolutionEffect.cpp b/src/gpu/effects/GrConvolutionEffect.cpp
index 5367b27902..55b44b7f56 100644
--- a/src/gpu/effects/GrConvolutionEffect.cpp
+++ b/src/gpu/effects/GrConvolutionEffect.cpp
@@ -6,8 +6,7 @@
*/
#include "GrConvolutionEffect.h"
-#include "gl/GrGLFragmentProcessor.h"
-#include "gl/GrGLTexture.h"
+#include "glsl/GrGLSLFragmentProcessor.h"
#include "glsl/GrGLSLFragmentShaderBuilder.h"
#include "glsl/GrGLSLProgramBuilder.h"
#include "glsl/GrGLSLProgramDataManager.h"
@@ -15,7 +14,7 @@
// For brevity
typedef GrGLSLProgramDataManager::UniformHandle UniformHandle;
-class GrGLConvolutionEffect : public GrGLFragmentProcessor {
+class GrGLConvolutionEffect : public GrGLSLFragmentProcessor {
public:
GrGLConvolutionEffect(const GrProcessor&);
@@ -38,7 +37,7 @@ private:
UniformHandle fImageIncrementUni;
UniformHandle fBoundsUni;
- typedef GrGLFragmentProcessor INHERITED;
+ typedef GrGLSLFragmentProcessor INHERITED;
};
GrGLConvolutionEffect::GrGLConvolutionEffect(const GrProcessor& processor) {
@@ -200,7 +199,7 @@ void GrConvolutionEffect::onGetGLProcessorKey(const GrGLSLCaps& caps,
GrGLConvolutionEffect::GenKey(*this, caps, b);
}
-GrGLFragmentProcessor* GrConvolutionEffect::onCreateGLInstance() const {
+GrGLSLFragmentProcessor* GrConvolutionEffect::onCreateGLInstance() const {
return new GrGLConvolutionEffect(*this);
}
diff --git a/src/gpu/effects/GrConvolutionEffect.h b/src/gpu/effects/GrConvolutionEffect.h
index 9db173a8ca..0396415b6f 100644
--- a/src/gpu/effects/GrConvolutionEffect.h
+++ b/src/gpu/effects/GrConvolutionEffect.h
@@ -80,7 +80,7 @@ private:
bool useBounds,
float bounds[2]);
- GrGLFragmentProcessor* onCreateGLInstance() const override;
+ GrGLSLFragmentProcessor* onCreateGLInstance() const override;
void onGetGLProcessorKey(const GrGLSLCaps&, GrProcessorKeyBuilder*) const override;
diff --git a/src/gpu/effects/GrCustomXfermode.cpp b/src/gpu/effects/GrCustomXfermode.cpp
index 574310c49c..e54627c4e5 100644
--- a/src/gpu/effects/GrCustomXfermode.cpp
+++ b/src/gpu/effects/GrCustomXfermode.cpp
@@ -15,12 +15,10 @@
#include "GrTexture.h"
#include "GrTextureAccess.h"
#include "SkXfermode.h"
-#include "gl/GrGLCaps.h"
-#include "gl/GrGLGpu.h"
-#include "gl/GrGLSLBlend.h"
-#include "gl/GrGLFragmentProcessor.h"
-#include "gl/GrGLProgramDataManager.h"
+#include "gl/GrGLXferProcessor.h"
+#include "glsl/GrGLSLBlend.h"
#include "glsl/GrGLSLCaps.h"
+#include "glsl/GrGLSLFragmentProcessor.h"
#include "glsl/GrGLSLFragmentShaderBuilder.h"
#include "glsl/GrGLSLProgramBuilder.h"
#include "glsl/GrGLSLProgramDataManager.h"
diff --git a/src/gpu/effects/GrDashingEffect.cpp b/src/gpu/effects/GrDashingEffect.cpp
index 3fa3014a9d..612e976f86 100644
--- a/src/gpu/effects/GrDashingEffect.cpp
+++ b/src/gpu/effects/GrDashingEffect.cpp
@@ -22,7 +22,7 @@
#include "SkGr.h"
#include "batches/GrVertexBatch.h"
#include "gl/GrGLGeometryProcessor.h"
-#include "gl/GrGLFragmentProcessor.h"
+#include "glsl/GrGLSLFragmentProcessor.h"
#include "glsl/GrGLSLFragmentShaderBuilder.h"
#include "glsl/GrGLSLProgramBuilder.h"
#include "glsl/GrGLSLProgramDataManager.h"
diff --git a/src/gpu/effects/GrDistanceFieldGeoProc.cpp b/src/gpu/effects/GrDistanceFieldGeoProc.cpp
index 90a0898686..a43171a2af 100644
--- a/src/gpu/effects/GrDistanceFieldGeoProc.cpp
+++ b/src/gpu/effects/GrDistanceFieldGeoProc.cpp
@@ -11,13 +11,13 @@
#include "SkDistanceFieldGen.h"
-#include "gl/GrGLFragmentProcessor.h"
-#include "gl/GrGLTexture.h"
#include "gl/GrGLGeometryProcessor.h"
+#include "glsl/GrGLSLFragmentProcessor.h"
#include "glsl/GrGLSLFragmentShaderBuilder.h"
#include "glsl/GrGLSLProgramBuilder.h"
#include "glsl/GrGLSLProgramDataManager.h"
#include "glsl/GrGLSLVertexShaderBuilder.h"
+#include "glsl/GrGLSLUtil.h"
// Assuming a radius of a little less than the diagonal of the fragment
#define SK_DistanceFieldAAFactor "0.65"
@@ -160,7 +160,7 @@ public:
if (!dfa8gp.viewMatrix().isIdentity() && !fViewMatrix.cheapEqualTo(dfa8gp.viewMatrix())) {
fViewMatrix = dfa8gp.viewMatrix();
float viewMatrix[3 * 3];
- GrGLGetMatrix<3>(viewMatrix, fViewMatrix);
+ GrGLSLGetMatrix<3>(viewMatrix, fViewMatrix);
pdman.setMatrix3f(fViewMatrixUniform, viewMatrix);
}
@@ -390,7 +390,7 @@ public:
if (!dfpgp.viewMatrix().isIdentity() && !fViewMatrix.cheapEqualTo(dfpgp.viewMatrix())) {
fViewMatrix = dfpgp.viewMatrix();
float viewMatrix[3 * 3];
- GrGLGetMatrix<3>(viewMatrix, fViewMatrix);
+ GrGLSLGetMatrix<3>(viewMatrix, fViewMatrix);
pdman.setMatrix3f(fViewMatrixUniform, viewMatrix);
}
@@ -659,7 +659,7 @@ public:
if (!dflcd.viewMatrix().isIdentity() && !fViewMatrix.cheapEqualTo(dflcd.viewMatrix())) {
fViewMatrix = dflcd.viewMatrix();
float viewMatrix[3 * 3];
- GrGLGetMatrix<3>(viewMatrix, fViewMatrix);
+ GrGLSLGetMatrix<3>(viewMatrix, fViewMatrix);
pdman.setMatrix3f(fViewMatrixUniform, viewMatrix);
}
diff --git a/src/gpu/effects/GrDitherEffect.cpp b/src/gpu/effects/GrDitherEffect.cpp
index fb02da5544..692d873bf1 100644
--- a/src/gpu/effects/GrDitherEffect.cpp
+++ b/src/gpu/effects/GrDitherEffect.cpp
@@ -9,7 +9,7 @@
#include "GrFragmentProcessor.h"
#include "GrInvariantOutput.h"
#include "SkRect.h"
-#include "gl/GrGLFragmentProcessor.h"
+#include "glsl/GrGLSLFragmentProcessor.h"
#include "glsl/GrGLSLFragmentShaderBuilder.h"
#include "glsl/GrGLSLProgramBuilder.h"
@@ -31,7 +31,7 @@ private:
this->setWillReadFragmentPosition();
}
- GrGLFragmentProcessor* onCreateGLInstance() const override;
+ GrGLSLFragmentProcessor* onCreateGLInstance() const override;
void onGetGLProcessorKey(const GrGLSLCaps&, GrProcessorKeyBuilder*) const override;
@@ -59,14 +59,14 @@ const GrFragmentProcessor* DitherEffect::TestCreate(GrProcessorTestData*) {
//////////////////////////////////////////////////////////////////////////////
-class GLDitherEffect : public GrGLFragmentProcessor {
+class GLDitherEffect : public GrGLSLFragmentProcessor {
public:
GLDitherEffect(const GrProcessor&);
virtual void emitCode(EmitArgs& args) override;
private:
- typedef GrGLFragmentProcessor INHERITED;
+ typedef GrGLSLFragmentProcessor INHERITED;
};
GLDitherEffect::GLDitherEffect(const GrProcessor&) {
@@ -97,7 +97,7 @@ void DitherEffect::onGetGLProcessorKey(const GrGLSLCaps& caps,
GLDitherEffect::GenKey(*this, caps, b);
}
-GrGLFragmentProcessor* DitherEffect::onCreateGLInstance() const {
+GrGLSLFragmentProcessor* DitherEffect::onCreateGLInstance() const {
return new GLDitherEffect(*this);
}
diff --git a/src/gpu/effects/GrMatrixConvolutionEffect.cpp b/src/gpu/effects/GrMatrixConvolutionEffect.cpp
index 358f8082f2..98611f9ae0 100644
--- a/src/gpu/effects/GrMatrixConvolutionEffect.cpp
+++ b/src/gpu/effects/GrMatrixConvolutionEffect.cpp
@@ -5,12 +5,11 @@
* found in the LICENSE file.
*/
#include "GrMatrixConvolutionEffect.h"
-#include "gl/GrGLFragmentProcessor.h"
-#include "gl/GrGLTexture.h"
-#include "gl/builders/GrGLProgramBuilder.h"
+#include "glsl/GrGLSLFragmentProcessor.h"
+#include "glsl/GrGLSLProgramBuilder.h"
#include "glsl/GrGLSLProgramDataManager.h"
-class GrGLMatrixConvolutionEffect : public GrGLFragmentProcessor {
+class GrGLMatrixConvolutionEffect : public GrGLSLFragmentProcessor {
public:
GrGLMatrixConvolutionEffect(const GrProcessor&);
virtual void emitCode(EmitArgs&) override;
@@ -32,7 +31,7 @@ private:
UniformHandle fBiasUni;
GrTextureDomain::GLDomain fDomain;
- typedef GrGLFragmentProcessor INHERITED;
+ typedef GrGLSLFragmentProcessor INHERITED;
};
GrGLMatrixConvolutionEffect::GrGLMatrixConvolutionEffect(const GrProcessor& processor) {
@@ -43,18 +42,18 @@ GrGLMatrixConvolutionEffect::GrGLMatrixConvolutionEffect(const GrProcessor& proc
void GrGLMatrixConvolutionEffect::emitCode(EmitArgs& args) {
const GrTextureDomain& domain = args.fFp.cast<GrMatrixConvolutionEffect>().domain();
- fImageIncrementUni = args.fBuilder->addUniform(GrGLProgramBuilder::kFragment_Visibility,
+ fImageIncrementUni = args.fBuilder->addUniform(GrGLSLProgramBuilder::kFragment_Visibility,
kVec2f_GrSLType, kDefault_GrSLPrecision,
"ImageIncrement");
- fKernelUni = args.fBuilder->addUniformArray(GrGLProgramBuilder::kFragment_Visibility,
+ fKernelUni = args.fBuilder->addUniformArray(GrGLSLProgramBuilder::kFragment_Visibility,
kFloat_GrSLType, kDefault_GrSLPrecision,
"Kernel",
fKernelSize.width() * fKernelSize.height());
- fKernelOffsetUni = args.fBuilder->addUniform(GrGLProgramBuilder::kFragment_Visibility,
+ fKernelOffsetUni = args.fBuilder->addUniform(GrGLSLProgramBuilder::kFragment_Visibility,
kVec2f_GrSLType, kDefault_GrSLPrecision, "KernelOffset");
- fGainUni = args.fBuilder->addUniform(GrGLProgramBuilder::kFragment_Visibility,
+ fGainUni = args.fBuilder->addUniform(GrGLSLProgramBuilder::kFragment_Visibility,
kFloat_GrSLType, kDefault_GrSLPrecision, "Gain");
- fBiasUni = args.fBuilder->addUniform(GrGLProgramBuilder::kFragment_Visibility,
+ fBiasUni = args.fBuilder->addUniform(GrGLSLProgramBuilder::kFragment_Visibility,
kFloat_GrSLType, kDefault_GrSLPrecision, "Bias");
const char* kernelOffset = args.fBuilder->getUniformCStr(fKernelOffsetUni);
@@ -161,7 +160,7 @@ void GrMatrixConvolutionEffect::onGetGLProcessorKey(const GrGLSLCaps& caps,
GrGLMatrixConvolutionEffect::GenKey(*this, caps, b);
}
-GrGLFragmentProcessor* GrMatrixConvolutionEffect::onCreateGLInstance() const {
+GrGLSLFragmentProcessor* GrMatrixConvolutionEffect::onCreateGLInstance() const {
return new GrGLMatrixConvolutionEffect(*this);
}
diff --git a/src/gpu/effects/GrMatrixConvolutionEffect.h b/src/gpu/effects/GrMatrixConvolutionEffect.h
index 3f16edb0ec..6f6ca9d0ff 100644
--- a/src/gpu/effects/GrMatrixConvolutionEffect.h
+++ b/src/gpu/effects/GrMatrixConvolutionEffect.h
@@ -66,7 +66,7 @@ private:
GrTextureDomain::Mode tileMode,
bool convolveAlpha);
- GrGLFragmentProcessor* onCreateGLInstance() const override;
+ GrGLSLFragmentProcessor* onCreateGLInstance() const override;
void onGetGLProcessorKey(const GrGLSLCaps&, GrProcessorKeyBuilder*) const override;
diff --git a/src/gpu/effects/GrOvalEffect.cpp b/src/gpu/effects/GrOvalEffect.cpp
index d34edbb726..16e1c099dd 100644
--- a/src/gpu/effects/GrOvalEffect.cpp
+++ b/src/gpu/effects/GrOvalEffect.cpp
@@ -10,7 +10,7 @@
#include "GrFragmentProcessor.h"
#include "GrInvariantOutput.h"
#include "SkRect.h"
-#include "gl/GrGLFragmentProcessor.h"
+#include "glsl/GrGLSLFragmentProcessor.h"
#include "glsl/GrGLSLFragmentShaderBuilder.h"
#include "glsl/GrGLSLProgramBuilder.h"
#include "glsl/GrGLSLProgramDataManager.h"
@@ -33,7 +33,7 @@ public:
private:
CircleEffect(GrPrimitiveEdgeType, const SkPoint& center, SkScalar radius);
- GrGLFragmentProcessor* onCreateGLInstance() const override;
+ GrGLSLFragmentProcessor* onCreateGLInstance() const override;
void onGetGLProcessorKey(const GrGLSLCaps&, GrProcessorKeyBuilder*) const override;
@@ -91,7 +91,7 @@ const GrFragmentProcessor* CircleEffect::TestCreate(GrProcessorTestData* d) {
//////////////////////////////////////////////////////////////////////////////
-class GLCircleEffect : public GrGLFragmentProcessor {
+class GLCircleEffect : public GrGLSLFragmentProcessor {
public:
GLCircleEffect(const GrProcessor&);
@@ -107,7 +107,7 @@ private:
SkPoint fPrevCenter;
SkScalar fPrevRadius;
- typedef GrGLFragmentProcessor INHERITED;
+ typedef GrGLSLFragmentProcessor INHERITED;
};
GLCircleEffect::GLCircleEffect(const GrProcessor&) {
@@ -179,7 +179,7 @@ void CircleEffect::onGetGLProcessorKey(const GrGLSLCaps& caps,
GLCircleEffect::GenKey(*this, caps, b);
}
-GrGLFragmentProcessor* CircleEffect::onCreateGLInstance() const {
+GrGLSLFragmentProcessor* CircleEffect::onCreateGLInstance() const {
return new GLCircleEffect(*this);
}
@@ -202,7 +202,7 @@ public:
private:
EllipseEffect(GrPrimitiveEdgeType, const SkPoint& center, SkScalar rx, SkScalar ry);
- GrGLFragmentProcessor* onCreateGLInstance() const override;
+ GrGLSLFragmentProcessor* onCreateGLInstance() const override;
void onGetGLProcessorKey(const GrGLSLCaps&, GrProcessorKeyBuilder*) const override;
@@ -263,7 +263,7 @@ const GrFragmentProcessor* EllipseEffect::TestCreate(GrProcessorTestData* d) {
//////////////////////////////////////////////////////////////////////////////
-class GLEllipseEffect : public GrGLFragmentProcessor {
+class GLEllipseEffect : public GrGLSLFragmentProcessor {
public:
GLEllipseEffect(const GrProcessor&);
@@ -279,7 +279,7 @@ private:
SkPoint fPrevCenter;
SkVector fPrevRadii;
- typedef GrGLFragmentProcessor INHERITED;
+ typedef GrGLSLFragmentProcessor INHERITED;
};
GLEllipseEffect::GLEllipseEffect(const GrProcessor& effect) {
@@ -356,7 +356,7 @@ void EllipseEffect::onGetGLProcessorKey(const GrGLSLCaps& caps,
GLEllipseEffect::GenKey(*this, caps, b);
}
-GrGLFragmentProcessor* EllipseEffect::onCreateGLInstance() const {
+GrGLSLFragmentProcessor* EllipseEffect::onCreateGLInstance() const {
return new GLEllipseEffect(*this);
}
diff --git a/src/gpu/effects/GrPorterDuffXferProcessor.cpp b/src/gpu/effects/GrPorterDuffXferProcessor.cpp
index 650a1e7622..78d0f14d7b 100644
--- a/src/gpu/effects/GrPorterDuffXferProcessor.cpp
+++ b/src/gpu/effects/GrPorterDuffXferProcessor.cpp
@@ -13,8 +13,8 @@
#include "GrProcOptInfo.h"
#include "GrTypes.h"
#include "GrXferProcessor.h"
-#include "gl/GrGLSLBlend.h"
#include "gl/GrGLXferProcessor.h"
+#include "glsl/GrGLSLBlend.h"
#include "glsl/GrGLSLFragmentShaderBuilder.h"
#include "glsl/GrGLSLProgramBuilder.h"
#include "glsl/GrGLSLProgramDataManager.h"
diff --git a/src/gpu/effects/GrRRectEffect.cpp b/src/gpu/effects/GrRRectEffect.cpp
index 398edccb64..8b3b83dda8 100644
--- a/src/gpu/effects/GrRRectEffect.cpp
+++ b/src/gpu/effects/GrRRectEffect.cpp
@@ -12,7 +12,7 @@
#include "GrInvariantOutput.h"
#include "GrOvalEffect.h"
#include "SkRRect.h"
-#include "gl/GrGLFragmentProcessor.h"
+#include "glsl/GrGLSLFragmentProcessor.h"
#include "glsl/GrGLSLFragmentShaderBuilder.h"
#include "glsl/GrGLSLProgramBuilder.h"
#include "glsl/GrGLSLProgramDataManager.h"
@@ -60,7 +60,7 @@ public:
private:
CircularRRectEffect(GrPrimitiveEdgeType, uint32_t circularCornerFlags, const SkRRect&);
- GrGLFragmentProcessor* onCreateGLInstance() const override;
+ GrGLSLFragmentProcessor* onCreateGLInstance() const override;
void onGetGLProcessorKey(const GrGLSLCaps&, GrProcessorKeyBuilder*) const override;
@@ -126,7 +126,7 @@ const GrFragmentProcessor* CircularRRectEffect::TestCreate(GrProcessorTestData*
//////////////////////////////////////////////////////////////////////////////
-class GLCircularRRectEffect : public GrGLFragmentProcessor {
+class GLCircularRRectEffect : public GrGLSLFragmentProcessor {
public:
GLCircularRRectEffect(const GrProcessor&);
@@ -141,7 +141,7 @@ private:
GrGLSLProgramDataManager::UniformHandle fInnerRectUniform;
GrGLSLProgramDataManager::UniformHandle fRadiusPlusHalfUniform;
SkRRect fPrevRRect;
- typedef GrGLFragmentProcessor INHERITED;
+ typedef GrGLSLFragmentProcessor INHERITED;
};
GLCircularRRectEffect::GLCircularRRectEffect(const GrProcessor& ) {
@@ -369,7 +369,7 @@ void CircularRRectEffect::onGetGLProcessorKey(const GrGLSLCaps& caps,
GLCircularRRectEffect::GenKey(*this, caps, b);
}
-GrGLFragmentProcessor* CircularRRectEffect::onCreateGLInstance() const {
+GrGLSLFragmentProcessor* CircularRRectEffect::onCreateGLInstance() const {
return new GLCircularRRectEffect(*this);
}
@@ -390,7 +390,7 @@ public:
private:
EllipticalRRectEffect(GrPrimitiveEdgeType, const SkRRect&);
- GrGLFragmentProcessor* onCreateGLInstance() const override;
+ GrGLSLFragmentProcessor* onCreateGLInstance() const override;
void onGetGLProcessorKey(const GrGLSLCaps&, GrProcessorKeyBuilder*) const override;
@@ -472,7 +472,7 @@ const GrFragmentProcessor* EllipticalRRectEffect::TestCreate(GrProcessorTestData
//////////////////////////////////////////////////////////////////////////////
-class GLEllipticalRRectEffect : public GrGLFragmentProcessor {
+class GLEllipticalRRectEffect : public GrGLSLFragmentProcessor {
public:
GLEllipticalRRectEffect(const GrProcessor&);
@@ -487,7 +487,7 @@ private:
GrGLSLProgramDataManager::UniformHandle fInnerRectUniform;
GrGLSLProgramDataManager::UniformHandle fInvRadiiSqdUniform;
SkRRect fPrevRRect;
- typedef GrGLFragmentProcessor INHERITED;
+ typedef GrGLSLFragmentProcessor INHERITED;
};
GLEllipticalRRectEffect::GLEllipticalRRectEffect(const GrProcessor& effect) {
@@ -620,7 +620,7 @@ void EllipticalRRectEffect::onGetGLProcessorKey(const GrGLSLCaps& caps,
GLEllipticalRRectEffect::GenKey(*this, caps, b);
}
-GrGLFragmentProcessor* EllipticalRRectEffect::onCreateGLInstance() const {
+GrGLSLFragmentProcessor* EllipticalRRectEffect::onCreateGLInstance() const {
return new GLEllipticalRRectEffect(*this);
}
diff --git a/src/gpu/effects/GrSimpleTextureEffect.cpp b/src/gpu/effects/GrSimpleTextureEffect.cpp
index c1bc6dff30..0b03c99811 100644
--- a/src/gpu/effects/GrSimpleTextureEffect.cpp
+++ b/src/gpu/effects/GrSimpleTextureEffect.cpp
@@ -8,13 +8,11 @@
#include "GrSimpleTextureEffect.h"
#include "GrInvariantOutput.h"
#include "GrTexture.h"
-#include "gl/GrGLCaps.h"
-#include "gl/GrGLFragmentProcessor.h"
-#include "gl/GrGLTexture.h"
+#include "glsl/GrGLSLFragmentProcessor.h"
#include "glsl/GrGLSLFragmentShaderBuilder.h"
#include "glsl/GrGLSLProgramBuilder.h"
-class GrGLSimpleTextureEffect : public GrGLFragmentProcessor {
+class GrGLSimpleTextureEffect : public GrGLSLFragmentProcessor {
public:
GrGLSimpleTextureEffect(const GrProcessor&) {}
@@ -29,7 +27,7 @@ public:
}
private:
- typedef GrGLFragmentProcessor INHERITED;
+ typedef GrGLSLFragmentProcessor INHERITED;
};
///////////////////////////////////////////////////////////////////////////////
@@ -43,7 +41,7 @@ void GrSimpleTextureEffect::onGetGLProcessorKey(const GrGLSLCaps& caps,
GrGLSimpleTextureEffect::GenKey(*this, caps, b);
}
-GrGLFragmentProcessor* GrSimpleTextureEffect::onCreateGLInstance() const {
+GrGLSLFragmentProcessor* GrSimpleTextureEffect::onCreateGLInstance() const {
return new GrGLSimpleTextureEffect(*this);
}
diff --git a/src/gpu/effects/GrSimpleTextureEffect.h b/src/gpu/effects/GrSimpleTextureEffect.h
index 4e5b421f3e..e421162120 100644
--- a/src/gpu/effects/GrSimpleTextureEffect.h
+++ b/src/gpu/effects/GrSimpleTextureEffect.h
@@ -63,7 +63,7 @@ private:
this->initClassID<GrSimpleTextureEffect>();
}
- GrGLFragmentProcessor* onCreateGLInstance() const override;
+ GrGLSLFragmentProcessor* onCreateGLInstance() const override;
void onGetGLProcessorKey(const GrGLSLCaps&, GrProcessorKeyBuilder*) const override;
diff --git a/src/gpu/effects/GrTextureDomain.cpp b/src/gpu/effects/GrTextureDomain.cpp
index cd89a59ac8..42d6d70816 100644
--- a/src/gpu/effects/GrTextureDomain.cpp
+++ b/src/gpu/effects/GrTextureDomain.cpp
@@ -9,8 +9,7 @@
#include "GrInvariantOutput.h"
#include "GrSimpleTextureEffect.h"
#include "SkFloatingPoint.h"
-#include "gl/GrGLContext.h"
-#include "gl/GrGLFragmentProcessor.h"
+#include "glsl/GrGLSLFragmentProcessor.h"
#include "glsl/GrGLSLProgramBuilder.h"
#include "glsl/GrGLSLProgramDataManager.h"
#include "glsl/GrGLSLTextureSampler.h"
@@ -173,7 +172,7 @@ void GrTextureDomain::GLDomain::setData(const GrGLSLProgramDataManager& pdman,
//////////////////////////////////////////////////////////////////////////////
-class GrGLTextureDomainEffect : public GrGLFragmentProcessor {
+class GrGLTextureDomainEffect : public GrGLSLFragmentProcessor {
public:
GrGLTextureDomainEffect(const GrProcessor&);
@@ -186,7 +185,7 @@ protected:
private:
GrTextureDomain::GLDomain fGLDomain;
- typedef GrGLFragmentProcessor INHERITED;
+ typedef GrGLSLFragmentProcessor INHERITED;
};
GrGLTextureDomainEffect::GrGLTextureDomainEffect(const GrProcessor&) {
@@ -253,7 +252,7 @@ void GrTextureDomainEffect::onGetGLProcessorKey(const GrGLSLCaps& caps,
GrGLTextureDomainEffect::GenKey(*this, caps, b);
}
-GrGLFragmentProcessor* GrTextureDomainEffect::onCreateGLInstance() const {
+GrGLSLFragmentProcessor* GrTextureDomainEffect::onCreateGLInstance() const {
return new GrGLTextureDomainEffect(*this);
}
diff --git a/src/gpu/effects/GrTextureDomain.h b/src/gpu/effects/GrTextureDomain.h
index 874cdbc080..a215def4ea 100644
--- a/src/gpu/effects/GrTextureDomain.h
+++ b/src/gpu/effects/GrTextureDomain.h
@@ -9,7 +9,7 @@
#define GrTextureDomainEffect_DEFINED
#include "GrSingleTextureEffect.h"
-#include "gl/GrGLFragmentProcessor.h"
+#include "glsl/GrGLSLFragmentProcessor.h"
#include "glsl/GrGLSLProgramDataManager.h"
class GrGLProgramBuilder;
@@ -89,7 +89,7 @@ public:
}
/**
- * A GrGLFragmentProcessor subclass that corresponds to a GrProcessor subclass that uses
+ * A GrGLSLFragmentProcessor subclass that corresponds to a GrProcessor subclass that uses
* GrTextureDomain should include this helper. It generates the texture domain GLSL, produces
* the part of the effect key that reflects the texture domain code, and performs the uniform
* uploads necessary for texture domains.
@@ -104,8 +104,8 @@ public:
}
/**
- * Call this from GrGLFragmentProcessor::emitCode() to sample the texture W.R.T. the domain
- * and mode.
+ * Call this from GrGLSLFragmentProcessor::emitCode() to sample the texture W.R.T. the
+ * domain and mode.
*
* @param outcolor name of vec4 variable to hold the sampled color.
* @param inCoords name of vec2 variable containing the coords to be used with the domain.
@@ -121,7 +121,7 @@ public:
const char* inModulateColor = nullptr);
/**
- * Call this from GrGLFragmentProcessor::setData() to upload uniforms necessary for the
+ * Call this from GrGLSLFragmentProcessor::setData() to upload uniforms necessary for the
* texture domain. The rectangle is automatically adjusted to account for the texture's
* origin.
*/
@@ -133,7 +133,7 @@ public:
};
/**
- * GrGLFragmentProcessor::GenKey() must call this and include the returned value in it's
+ * GrGLSLFragmentProcessor::GenKey() must call this and include the returned value in it's
* computed key. The returned will be limited to the lower kDomainKeyBits bits.
*/
static uint32_t DomainKey(const GrTextureDomain& domain) {
@@ -187,7 +187,7 @@ private:
GrTextureParams::FilterMode,
GrCoordSet);
- GrGLFragmentProcessor* onCreateGLInstance() const override;
+ GrGLSLFragmentProcessor* onCreateGLInstance() const override;
void onGetGLProcessorKey(const GrGLSLCaps&, GrProcessorKeyBuilder*) const override;
diff --git a/src/gpu/effects/GrXfermodeFragmentProcessor.cpp b/src/gpu/effects/GrXfermodeFragmentProcessor.cpp
index 0dbb6eb534..a705df5e61 100644
--- a/src/gpu/effects/GrXfermodeFragmentProcessor.cpp
+++ b/src/gpu/effects/GrXfermodeFragmentProcessor.cpp
@@ -9,8 +9,8 @@
#include "GrFragmentProcessor.h"
#include "effects/GrConstColorProcessor.h"
-#include "gl/GrGLFragmentProcessor.h"
-#include "gl/GrGLSLBlend.h"
+#include "glsl/GrGLSLFragmentProcessor.h"
+#include "glsl/GrGLSLBlend.h"
#include "glsl/GrGLSLFragmentShaderBuilder.h"
#include "glsl/GrGLSLProgramBuilder.h"
#include "SkGrPriv.h"
@@ -46,7 +46,7 @@ protected:
}
private:
- GrGLFragmentProcessor* onCreateGLInstance() const override;
+ GrGLSLFragmentProcessor* onCreateGLInstance() const override;
SkXfermode::Mode fMode;
@@ -57,14 +57,14 @@ private:
/////////////////////////////////////////////////////////////////////
-class GLComposeTwoFragmentProcessor : public GrGLFragmentProcessor {
+class GLComposeTwoFragmentProcessor : public GrGLSLFragmentProcessor {
public:
GLComposeTwoFragmentProcessor(const GrProcessor& processor) {}
void emitCode(EmitArgs&) override;
private:
- typedef GrGLFragmentProcessor INHERITED;
+ typedef GrGLSLFragmentProcessor INHERITED;
};
/////////////////////////////////////////////////////////////////////
@@ -81,7 +81,7 @@ const GrFragmentProcessor* ComposeTwoFragmentProcessor::TestCreate(GrProcessorTe
return new ComposeTwoFragmentProcessor(fpA, fpB, mode);
}
-GrGLFragmentProcessor* ComposeTwoFragmentProcessor::onCreateGLInstance() const{
+GrGLSLFragmentProcessor* ComposeTwoFragmentProcessor::onCreateGLInstance() const{
return new GLComposeTwoFragmentProcessor(*this);
}
@@ -202,7 +202,7 @@ protected:
}
private:
- GrGLFragmentProcessor* onCreateGLInstance() const override;
+ GrGLSLFragmentProcessor* onCreateGLInstance() const override;
SkXfermode::Mode fMode;
Child fChild;
@@ -214,7 +214,7 @@ private:
//////////////////////////////////////////////////////////////////////////////
-class GLComposeOneFragmentProcessor : public GrGLFragmentProcessor {
+class GLComposeOneFragmentProcessor : public GrGLSLFragmentProcessor {
public:
GLComposeOneFragmentProcessor(const GrProcessor& processor) {}
@@ -244,7 +244,7 @@ public:
}
private:
- typedef GrGLFragmentProcessor INHERITED;
+ typedef GrGLSLFragmentProcessor INHERITED;
};
/////////////////////////////////////////////////////////////////////
@@ -264,7 +264,7 @@ const GrFragmentProcessor* ComposeOneFragmentProcessor::TestCreate(GrProcessorTe
return new ComposeOneFragmentProcessor(dst, mode, child);
}
-GrGLFragmentProcessor* ComposeOneFragmentProcessor::onCreateGLInstance() const {
+GrGLSLFragmentProcessor* ComposeOneFragmentProcessor::onCreateGLInstance() const {
return new GLComposeOneFragmentProcessor(*this);
}
diff --git a/src/gpu/effects/GrYUVtoRGBEffect.cpp b/src/gpu/effects/GrYUVtoRGBEffect.cpp
index daf1ca3796..e2825125e8 100644
--- a/src/gpu/effects/GrYUVtoRGBEffect.cpp
+++ b/src/gpu/effects/GrYUVtoRGBEffect.cpp
@@ -10,7 +10,7 @@
#include "GrCoordTransform.h"
#include "GrInvariantOutput.h"
#include "GrProcessor.h"
-#include "gl/GrGLFragmentProcessor.h"
+#include "glsl/GrGLSLFragmentProcessor.h"
#include "glsl/GrGLSLFragmentShaderBuilder.h"
#include "glsl/GrGLSLProgramBuilder.h"
#include "glsl/GrGLSLProgramDataManager.h"
@@ -52,7 +52,7 @@ public:
return fColorSpace;
}
- class GLProcessor : public GrGLFragmentProcessor {
+ class GLProcessor : public GrGLSLFragmentProcessor {
public:
static const float kJPEGConversionMatrix[16];
static const float kRec601ConversionMatrix[16];
@@ -102,7 +102,7 @@ public:
private:
GrGLSLProgramDataManager::UniformHandle fMatrixUni;
- typedef GrGLFragmentProcessor INHERITED;
+ typedef GrGLSLFragmentProcessor INHERITED;
};
private:
@@ -125,7 +125,7 @@ private:
this->addTextureAccess(&fVAccess);
}
- GrGLFragmentProcessor* onCreateGLInstance() const override { return new GLProcessor(*this); }
+ GrGLSLFragmentProcessor* onCreateGLInstance() const override { return new GLProcessor(*this); }
virtual void onGetGLProcessorKey(const GrGLSLCaps& caps,
GrProcessorKeyBuilder* b) const override {
diff --git a/src/gpu/gl/GrGLGpuProgramCache.cpp b/src/gpu/gl/GrGLGpuProgramCache.cpp
index 84794ac1cc..d5f2b9d23d 100644
--- a/src/gpu/gl/GrGLGpuProgramCache.cpp
+++ b/src/gpu/gl/GrGLGpuProgramCache.cpp
@@ -9,8 +9,8 @@
#include "builders/GrGLProgramBuilder.h"
#include "GrProcessor.h"
-#include "GrGLFragmentProcessor.h"
#include "GrGLPathRendering.h"
+#include "glsl/GrGLSLFragmentProcessor.h"
#include "glsl/GrGLSLProgramDataManager.h"
#include "SkRTConf.h"
#include "SkTSearch.h"
diff --git a/src/gpu/gl/GrGLPathRendering.h b/src/gpu/gl/GrGLPathRendering.h
index d61df2fe40..57209fddc1 100644
--- a/src/gpu/gl/GrGLPathRendering.h
+++ b/src/gpu/gl/GrGLPathRendering.h
@@ -11,8 +11,8 @@
#include "SkRefCnt.h"
#include "GrPathRendering.h"
#include "GrStencil.h"
-#include "gl/GrGLProgram.h"
#include "gl/GrGLTypes.h"
+#include "glsl/GrGLSLUtil.h"
class GrGLNameAllocator;
class GrGLGpu;
@@ -106,7 +106,7 @@ private:
0, 0, 1);
}
combined.preConcat(fViewMatrix);
- GrGLGetMatrix<Size>(destMatrix, combined);
+ GrGLSLGetMatrix<Size>(destMatrix, combined);
}
};
GrGLGpu* gpu();
diff --git a/src/gpu/gl/GrGLProgram.cpp b/src/gpu/gl/GrGLProgram.cpp
index 23e0df731c..d6e7facde6 100644
--- a/src/gpu/gl/GrGLProgram.cpp
+++ b/src/gpu/gl/GrGLProgram.cpp
@@ -17,7 +17,7 @@
#include "GrPathProcessor.h"
#include "GrPipeline.h"
#include "GrXferProcessor.h"
-#include "gl/GrGLFragmentProcessor.h"
+#include "glsl/GrGLSLFragmentProcessor.h"
#include "SkXfermode.h"
#define GL_CALL(X) GR_GL_CALL(fGpu->glInterface(), X)
diff --git a/src/gpu/gl/GrGLProgramDesc.cpp b/src/gpu/gl/GrGLProgramDesc.cpp
index 2255dbde51..7c482d57b8 100644
--- a/src/gpu/gl/GrGLProgramDesc.cpp
+++ b/src/gpu/gl/GrGLProgramDesc.cpp
@@ -6,11 +6,11 @@
*/
#include "GrGLProgramDesc.h"
-#include "GrGLFragmentProcessor.h"
#include "GrProcessor.h"
#include "GrGLGpu.h"
#include "GrPipeline.h"
#include "SkChecksum.h"
+#include "glsl/GrGLSLFragmentProcessor.h"
#include "glsl/GrGLSLFragmentShaderBuilder.h"
/**
diff --git a/src/gpu/gl/GrGLUtil.cpp b/src/gpu/gl/GrGLUtil.cpp
index 7f0713ed6a..71d54c35c0 100644
--- a/src/gpu/gl/GrGLUtil.cpp
+++ b/src/gpu/gl/GrGLUtil.cpp
@@ -306,51 +306,6 @@ GrGLRenderer GrGLGetRenderer(const GrGLInterface* gl) {
return GrGLGetRendererFromString((const char*) v);
}
-template<> void GrGLGetMatrix<3>(float* dest, const SkMatrix& src) {
- GR_STATIC_ASSERT(sizeof(float) == sizeof (GrGLfloat));
- // Col 0
- dest[0] = SkScalarToFloat(src[SkMatrix::kMScaleX]);
- dest[1] = SkScalarToFloat(src[SkMatrix::kMSkewY]);
- dest[2] = SkScalarToFloat(src[SkMatrix::kMPersp0]);
-
- // Col 1
- dest[3] = SkScalarToFloat(src[SkMatrix::kMSkewX]);
- dest[4] = SkScalarToFloat(src[SkMatrix::kMScaleY]);
- dest[5] = SkScalarToFloat(src[SkMatrix::kMPersp1]);
-
- // Col 2
- dest[6] = SkScalarToFloat(src[SkMatrix::kMTransX]);
- dest[7] = SkScalarToFloat(src[SkMatrix::kMTransY]);
- dest[8] = SkScalarToFloat(src[SkMatrix::kMPersp2]);
-}
-
-template<> void GrGLGetMatrix<4>(float* dest, const SkMatrix& src) {
- GR_STATIC_ASSERT(sizeof(float) == sizeof (GrGLfloat));
- // Col 0
- dest[0] = SkScalarToFloat(src[SkMatrix::kMScaleX]);
- dest[1] = SkScalarToFloat(src[SkMatrix::kMSkewY]);
- dest[2] = 0;
- dest[3] = SkScalarToFloat(src[SkMatrix::kMPersp0]);
-
- // Col 1
- dest[4] = SkScalarToFloat(src[SkMatrix::kMSkewX]);
- dest[5] = SkScalarToFloat(src[SkMatrix::kMScaleY]);
- dest[6] = 0;
- dest[7] = SkScalarToFloat(src[SkMatrix::kMPersp1]);
-
- // Col 2
- dest[8] = 0;
- dest[9] = 0;
- dest[10] = 1;
- dest[11] = 0;
-
- // Col 3
- dest[12] = SkScalarToFloat(src[SkMatrix::kMTransX]);
- dest[13] = SkScalarToFloat(src[SkMatrix::kMTransY]);
- dest[14] = 0;
- dest[15] = SkScalarToFloat(src[SkMatrix::kMPersp2]);
-}
-
GrGLenum GrToGLStencilFunc(GrStencilFunc basicFunc) {
static const GrGLenum gTable[] = {
GR_GL_ALWAYS, // kAlways_StencilFunc
diff --git a/src/gpu/gl/GrGLUtil.h b/src/gpu/gl/GrGLUtil.h
index dec784c977..70af3a36f4 100644
--- a/src/gpu/gl/GrGLUtil.h
+++ b/src/gpu/gl/GrGLUtil.h
@@ -138,11 +138,6 @@ void GrGLCheckErr(const GrGLInterface* gl,
void GrGLClearErr(const GrGLInterface* gl);
-/**
- * Helper for converting SkMatrix to a column-major GL float array
- */
-template<int MatrixSize> void GrGLGetMatrix(float* dest, const SkMatrix& src);
-
////////////////////////////////////////////////////////////////////////////////
/**
diff --git a/src/gpu/gl/builders/GrGLProgramBuilder.cpp b/src/gpu/gl/builders/GrGLProgramBuilder.cpp
index 67ba08339b..51f95237f6 100644
--- a/src/gpu/gl/builders/GrGLProgramBuilder.cpp
+++ b/src/gpu/gl/builders/GrGLProgramBuilder.cpp
@@ -13,7 +13,6 @@
#include "GrTexture.h"
#include "SkRTConf.h"
#include "SkTraceEvent.h"
-#include "gl/GrGLFragmentProcessor.h"
#include "gl/GrGLGeometryProcessor.h"
#include "gl/GrGLGpu.h"
#include "gl/GrGLProgram.h"
@@ -21,6 +20,7 @@
#include "gl/GrGLXferProcessor.h"
#include "gl/builders/GrGLShaderStringBuilder.h"
#include "glsl/GrGLSLCaps.h"
+#include "glsl/GrGLSLFragmentProcessor.h"
#include "glsl/GrGLSLProgramDataManager.h"
#include "glsl/GrGLSLTextureSampler.h"
@@ -259,7 +259,12 @@ void GrGLProgramBuilder::emitAndInstallProc(const GrFragmentProcessor& fp,
SkSTArray<4, GrGLSLTextureSampler> samplers(fp.numTextures());
this->emitSamplers(fp, &samplers, ifp);
- GrGLFragmentProcessor::EmitArgs args(this, fp, outColor, inColor, fOutCoords[index], samplers);
+ GrGLSLFragmentProcessor::EmitArgs args(this,
+ fp,
+ outColor,
+ inColor,
+ fOutCoords[index],
+ samplers);
ifp->fGLProc->emitCode(args);
// We have to check that effects and the code they emit are consistent, ie if an effect
diff --git a/src/gpu/gl/builders/GrGLProgramBuilder.h b/src/gpu/gl/builders/GrGLProgramBuilder.h
index 21724c19f2..cb49c348a4 100644
--- a/src/gpu/gl/builders/GrGLProgramBuilder.h
+++ b/src/gpu/gl/builders/GrGLProgramBuilder.h
@@ -32,7 +32,7 @@ struct GrGLInstalledProc {
typedef GrGLInstalledProc<GrGLPrimitiveProcessor> GrGLInstalledGeoProc;
typedef GrGLInstalledProc<GrGLXferProcessor> GrGLInstalledXferProc;
-typedef GrGLInstalledProc<GrGLFragmentProcessor> GrGLInstalledFragProc;
+typedef GrGLInstalledProc<GrGLSLFragmentProcessor> GrGLInstalledFragProc;
struct GrGLInstalledFragProcs : public SkRefCnt {
virtual ~GrGLInstalledFragProcs();
diff --git a/src/gpu/gl/GrGLSLBlend.cpp b/src/gpu/glsl/GrGLSLBlend.cpp
index 3c83068fc1..3c83068fc1 100644
--- a/src/gpu/gl/GrGLSLBlend.cpp
+++ b/src/gpu/glsl/GrGLSLBlend.cpp
diff --git a/src/gpu/gl/GrGLSLBlend.h b/src/gpu/glsl/GrGLSLBlend.h
index 25ae37b1c1..25ae37b1c1 100644
--- a/src/gpu/gl/GrGLSLBlend.h
+++ b/src/gpu/glsl/GrGLSLBlend.h
diff --git a/src/gpu/gl/GrGLFragmentProcessor.cpp b/src/gpu/glsl/GrGLSLFragmentProcessor.cpp
index 1d6f5992e4..5868043cbc 100644
--- a/src/gpu/gl/GrGLFragmentProcessor.cpp
+++ b/src/gpu/glsl/GrGLSLFragmentProcessor.cpp
@@ -5,14 +5,14 @@
* found in the LICENSE file.
*/
-#include "GrGLFragmentProcessor.h"
+#include "GrGLSLFragmentProcessor.h"
#include "GrFragmentProcessor.h"
#include "GrProcessor.h"
#include "glsl/GrGLSLFragmentShaderBuilder.h"
#include "glsl/GrGLSLProgramBuilder.h"
-void GrGLFragmentProcessor::setData(const GrGLSLProgramDataManager& pdman,
- const GrFragmentProcessor& processor) {
+void GrGLSLFragmentProcessor::setData(const GrGLSLProgramDataManager& pdman,
+ const GrFragmentProcessor& processor) {
this->onSetData(pdman, processor);
SkASSERT(fChildProcessors.count() == processor.numChildProcessors());
for (int i = 0; i < fChildProcessors.count(); ++i) {
@@ -20,11 +20,11 @@ void GrGLFragmentProcessor::setData(const GrGLSLProgramDataManager& pdman,
}
}
-void GrGLFragmentProcessor::emitChild(int childIndex, const char* inputColor, EmitArgs& args) {
+void GrGLSLFragmentProcessor::emitChild(int childIndex, const char* inputColor, EmitArgs& args) {
this->internalEmitChild(childIndex, inputColor, args.fOutputColor, args);
}
-void GrGLFragmentProcessor::emitChild(int childIndex, const char* inputColor,
+void GrGLSLFragmentProcessor::emitChild(int childIndex, const char* inputColor,
SkString* outputColor, EmitArgs& args) {
SkASSERT(outputColor);
@@ -34,8 +34,8 @@ void GrGLFragmentProcessor::emitChild(int childIndex, const char* inputColor,
this->internalEmitChild(childIndex, inputColor, outputColor->c_str(), args);
}
-void GrGLFragmentProcessor::internalEmitChild(int childIndex, const char* inputColor,
- const char* outputColor, EmitArgs& args) {
+void GrGLSLFragmentProcessor::internalEmitChild(int childIndex, const char* inputColor,
+ const char* outputColor, EmitArgs& args) {
GrGLSLFragmentBuilder* fb = args.fBuilder->getFragmentShaderBuilder();
fb->onBeforeChildProcEmitCode(); // call first so mangleString is updated
diff --git a/src/gpu/gl/GrGLFragmentProcessor.h b/src/gpu/glsl/GrGLSLFragmentProcessor.h
index 311612df7f..fa4f043ff7 100644
--- a/src/gpu/gl/GrGLFragmentProcessor.h
+++ b/src/gpu/glsl/GrGLSLFragmentProcessor.h
@@ -5,8 +5,8 @@
* found in the LICENSE file.
*/
-#ifndef GrGLFragmentProcessor_DEFINED
-#define GrGLFragmentProcessor_DEFINED
+#ifndef GrGLSLFragmentProcessor_DEFINED
+#define GrGLSLFragmentProcessor_DEFINED
#include "glsl/GrGLSLProcessorTypes.h"
#include "glsl/GrGLSLProgramDataManager.h"
@@ -17,11 +17,11 @@ class GrProcessorKeyBuilder;
class GrGLSLFPBuilder;
class GrGLSLCaps;
-class GrGLFragmentProcessor {
+class GrGLSLFragmentProcessor {
public:
- GrGLFragmentProcessor() {}
+ GrGLSLFragmentProcessor() {}
- virtual ~GrGLFragmentProcessor() {
+ virtual ~GrGLSLFragmentProcessor() {
for (int i = 0; i < fChildProcessors.count(); ++i) {
delete fChildProcessors[i];
}
@@ -78,7 +78,7 @@ public:
int numChildProcessors() const { return fChildProcessors.count(); }
- GrGLFragmentProcessor* childProcessor(int index) const {
+ GrGLSLFragmentProcessor* childProcessor(int index) const {
return fChildProcessors[index];
}
@@ -97,18 +97,18 @@ public:
void emitChild(int childIndex, const char* inputColor, EmitArgs& parentArgs);
protected:
- /** A GrGLFragmentProcessor instance can be reused with any GrFragmentProcessor that produces
+ /** A GrGLSLFragmentProcessor instance can be reused with any GrFragmentProcessor that produces
the same stage key; this function reads data from a GrFragmentProcessor and uploads any
uniform variables required by the shaders created in emitCode(). The GrFragmentProcessor
- parameter is guaranteed to be of the same type that created this GrGLFragmentProcessor and
- to have an identical processor key as the one that created this GrGLFragmentProcessor. */
+ parameter is guaranteed to be of the same type that created this GrGLSLFragmentProcessor and
+ to have an identical processor key as the one that created this GrGLSLFragmentProcessor. */
// TODO update this to pass in GrFragmentProcessor
virtual void onSetData(const GrGLSLProgramDataManager&, const GrProcessor&) {}
private:
void internalEmitChild(int, const char*, const char*, EmitArgs&);
- SkTArray<GrGLFragmentProcessor*, true> fChildProcessors;
+ SkTArray<GrGLSLFragmentProcessor*, true> fChildProcessors;
friend class GrFragmentProcessor;
};
diff --git a/src/gpu/glsl/GrGLSLUtil.cpp b/src/gpu/glsl/GrGLSLUtil.cpp
new file mode 100644
index 0000000000..5a333244b2
--- /dev/null
+++ b/src/gpu/glsl/GrGLSLUtil.cpp
@@ -0,0 +1,52 @@
+/*
+* Copyright 2015 Google Inc.
+*
+* Use of this source code is governed by a BSD-style license that can be
+* found in the LICENSE file.
+*/
+
+#include "GrGLSLUtil.h"
+#include "SkMatrix.h"
+
+template<> void GrGLSLGetMatrix<3>(float* dest, const SkMatrix& src) {
+ // Col 0
+ dest[0] = SkScalarToFloat(src[SkMatrix::kMScaleX]);
+ dest[1] = SkScalarToFloat(src[SkMatrix::kMSkewY]);
+ dest[2] = SkScalarToFloat(src[SkMatrix::kMPersp0]);
+
+ // Col 1
+ dest[3] = SkScalarToFloat(src[SkMatrix::kMSkewX]);
+ dest[4] = SkScalarToFloat(src[SkMatrix::kMScaleY]);
+ dest[5] = SkScalarToFloat(src[SkMatrix::kMPersp1]);
+
+ // Col 2
+ dest[6] = SkScalarToFloat(src[SkMatrix::kMTransX]);
+ dest[7] = SkScalarToFloat(src[SkMatrix::kMTransY]);
+ dest[8] = SkScalarToFloat(src[SkMatrix::kMPersp2]);
+}
+
+template<> void GrGLSLGetMatrix<4>(float* dest, const SkMatrix& src) {
+ // Col 0
+ dest[0] = SkScalarToFloat(src[SkMatrix::kMScaleX]);
+ dest[1] = SkScalarToFloat(src[SkMatrix::kMSkewY]);
+ dest[2] = 0;
+ dest[3] = SkScalarToFloat(src[SkMatrix::kMPersp0]);
+
+ // Col 1
+ dest[4] = SkScalarToFloat(src[SkMatrix::kMSkewX]);
+ dest[5] = SkScalarToFloat(src[SkMatrix::kMScaleY]);
+ dest[6] = 0;
+ dest[7] = SkScalarToFloat(src[SkMatrix::kMPersp1]);
+
+ // Col 2
+ dest[8] = 0;
+ dest[9] = 0;
+ dest[10] = 1;
+ dest[11] = 0;
+
+ // Col 3
+ dest[12] = SkScalarToFloat(src[SkMatrix::kMTransX]);
+ dest[13] = SkScalarToFloat(src[SkMatrix::kMTransY]);
+ dest[14] = 0;
+ dest[15] = SkScalarToFloat(src[SkMatrix::kMPersp2]);
+}
diff --git a/src/gpu/glsl/GrGLSLUtil.h b/src/gpu/glsl/GrGLSLUtil.h
new file mode 100644
index 0000000000..0d2b7e742f
--- /dev/null
+++ b/src/gpu/glsl/GrGLSLUtil.h
@@ -0,0 +1,19 @@
+/*
+* Copyright 2015 Google Inc.
+*
+* Use of this source code is governed by a BSD-style license that can be
+* found in the LICENSE file.
+*/
+
+#ifndef GrGLSLUtil_DEFINED
+#define GrGLSLUtil_DEFINED
+
+class SkMatrix;
+
+/**
+ * Helper for converting SkMatrix to a column-major float array. We assume that all GLSL backends
+ * use a column major representation for matrices.
+ */
+template<int MatrixSize> void GrGLSLGetMatrix(float* dest, const SkMatrix& src);
+
+#endif