Move all ShaderBuilder files to GLSL
BUG=skia:
Review URL: https://codereview.chromium.org/1438003003
diff --git a/src/gpu/GrDefaultGeoProcFactory.cpp b/src/gpu/GrDefaultGeoProcFactory.cpp
index b1cedd2..6c73c36 100644
--- a/src/gpu/GrDefaultGeoProcFactory.cpp
+++ b/src/gpu/GrDefaultGeoProcFactory.cpp
@@ -10,7 +10,9 @@
#include "GrInvariantOutput.h"
#include "gl/GrGLGeometryProcessor.h"
#include "gl/GrGLUtil.h"
-#include "gl/builders/GrGLProgramBuilder.h"
+#include "glsl/GrGLSLFragmentShaderBuilder.h"
+#include "glsl/GrGLSLProgramBuilder.h"
+#include "glsl/GrGLSLVertexShaderBuilder.h"
/*
* The default Geometry Processor simply takes position and multiplies it by the uniform view
@@ -62,8 +64,8 @@
void onEmitCode(EmitArgs& args, GrGPArgs* gpArgs) override {
const DefaultGeoProc& gp = args.fGP.cast<DefaultGeoProc>();
GrGLSLGPBuilder* pb = args.fPB;
- GrGLVertexBuilder* vsBuilder = pb->getVertexShaderBuilder();
- GrGLFragmentBuilder* fs = args.fPB->getFragmentShaderBuilder();
+ GrGLSLVertexBuilder* vsBuilder = pb->getVertexShaderBuilder();
+ GrGLSLFragmentBuilder* fs = args.fPB->getFragmentShaderBuilder();
// emit attributes
vsBuilder->emitAttributes(gp);
@@ -105,7 +107,7 @@
fs->codeAppendf("%s = vec4(1);", args.fOutputCoverage);
} else {
const char* fragCoverage;
- fCoverageUniform = pb->addUniform(GrGLProgramBuilder::kFragment_Visibility,
+ fCoverageUniform = pb->addUniform(GrGLSLProgramBuilder::kFragment_Visibility,
kFloat_GrSLType,
kDefault_GrSLPrecision,
"Coverage",
diff --git a/src/gpu/GrFragmentProcessor.cpp b/src/gpu/GrFragmentProcessor.cpp
index ec5aaac..9b5677a 100644
--- a/src/gpu/GrFragmentProcessor.cpp
+++ b/src/gpu/GrFragmentProcessor.cpp
@@ -9,7 +9,8 @@
#include "GrFragmentProcessor.h"
#include "GrCoordTransform.h"
#include "gl/GrGLFragmentProcessor.h"
-#include "gl/builders/GrGLProgramBuilder.h"
+#include "glsl/GrGLSLFragmentShaderBuilder.h"
+#include "glsl/GrGLSLProgramBuilder.h"
#include "glsl/GrGLSLProgramDataManager.h"
#include "effects/GrConstColorProcessor.h"
#include "effects/GrXfermodeFragmentProcessor.h"
@@ -152,7 +153,7 @@
GLFP() {}
void emitCode(EmitArgs& args) override {
- GrGLFragmentBuilder* fsBuilder = args.fBuilder->getFragmentShaderBuilder();
+ GrGLSLFragmentBuilder* fsBuilder = args.fBuilder->getFragmentShaderBuilder();
this->emitChild(0, nullptr, args);
fsBuilder->codeAppendf("%s.rgb *= %s.rgb;", args.fOutputColor,
args.fInputColor);
@@ -225,7 +226,7 @@
GLFP() : fHaveSetColor(false) {}
void emitCode(EmitArgs& args) override {
const char* colorName;
- fColorUni = args.fBuilder->addUniform(GrGLProgramBuilder::kFragment_Visibility,
+ fColorUni = args.fBuilder->addUniform(GrGLSLProgramBuilder::kFragment_Visibility,
kVec4f_GrSLType, kDefault_GrSLPrecision,
"Color", &colorName);
this->emitChild(0, colorName, args);
diff --git a/src/gpu/GrOvalRenderer.cpp b/src/gpu/GrOvalRenderer.cpp
index 4f51c03..c5d807c 100644
--- a/src/gpu/GrOvalRenderer.cpp
+++ b/src/gpu/GrOvalRenderer.cpp
@@ -23,8 +23,10 @@
#include "effects/GrRRectEffect.h"
#include "gl/GrGLUtil.h"
#include "gl/GrGLGeometryProcessor.h"
-#include "gl/builders/GrGLProgramBuilder.h"
+#include "glsl/GrGLSLFragmentShaderBuilder.h"
+#include "glsl/GrGLSLProgramBuilder.h"
#include "glsl/GrGLSLProgramDataManager.h"
+#include "glsl/GrGLSLVertexShaderBuilder.h"
// TODO(joshualitt) - Break this file up during GrBatch post implementation cleanup
@@ -96,7 +98,7 @@
void onEmitCode(EmitArgs& args, GrGPArgs* gpArgs) override{
const CircleEdgeEffect& ce = args.fGP.cast<CircleEdgeEffect>();
GrGLSLGPBuilder* pb = args.fPB;
- GrGLVertexBuilder* vsBuilder = args.fPB->getVertexShaderBuilder();
+ GrGLSLVertexBuilder* vsBuilder = args.fPB->getVertexShaderBuilder();
// emit attributes
vsBuilder->emitAttributes(ce);
@@ -117,7 +119,7 @@
this->emitTransforms(args.fPB, gpArgs->fPositionVar, ce.inPosition()->fName,
ce.localMatrix(), args.fTransformsIn, args.fTransformsOut);
- GrGLFragmentBuilder* fsBuilder = args.fPB->getFragmentShaderBuilder();
+ GrGLSLFragmentBuilder* fsBuilder = args.fPB->getFragmentShaderBuilder();
fsBuilder->codeAppendf("float d = length(%s.xy);", v.fsIn());
fsBuilder->codeAppendf("float edgeAlpha = clamp(%s.z * (1.0 - d), 0.0, 1.0);", v.fsIn());
if (ce.isStroked()) {
@@ -244,7 +246,7 @@
void onEmitCode(EmitArgs& args, GrGPArgs* gpArgs) override{
const EllipseEdgeEffect& ee = args.fGP.cast<EllipseEdgeEffect>();
GrGLSLGPBuilder* pb = args.fPB;
- GrGLVertexBuilder* vsBuilder = args.fPB->getVertexShaderBuilder();
+ GrGLSLVertexBuilder* vsBuilder = args.fPB->getVertexShaderBuilder();
// emit attributes
vsBuilder->emitAttributes(ee);
@@ -272,7 +274,7 @@
ee.localMatrix(), args.fTransformsIn, args.fTransformsOut);
// for outer curve
- GrGLFragmentBuilder* fsBuilder = args.fPB->getFragmentShaderBuilder();
+ GrGLSLFragmentBuilder* fsBuilder = args.fPB->getFragmentShaderBuilder();
fsBuilder->codeAppendf("vec2 scaledOffset = %s*%s.xy;", ellipseOffsets.fsIn(),
ellipseRadii.fsIn());
fsBuilder->codeAppend("float test = dot(scaledOffset, scaledOffset) - 1.0;");
@@ -419,7 +421,7 @@
void onEmitCode(EmitArgs& args, GrGPArgs* gpArgs) override {
const DIEllipseEdgeEffect& ee = args.fGP.cast<DIEllipseEdgeEffect>();
GrGLSLGPBuilder* pb = args.fPB;
- GrGLVertexBuilder* vsBuilder = args.fPB->getVertexShaderBuilder();
+ GrGLSLVertexBuilder* vsBuilder = args.fPB->getVertexShaderBuilder();
// emit attributes
vsBuilder->emitAttributes(ee);
@@ -447,9 +449,9 @@
this->emitTransforms(args.fPB, gpArgs->fPositionVar, ee.inPosition()->fName,
args.fTransformsIn, args.fTransformsOut);
- GrGLFragmentBuilder* fsBuilder = args.fPB->getFragmentShaderBuilder();
+ GrGLSLFragmentBuilder* fsBuilder = args.fPB->getFragmentShaderBuilder();
SkAssertResult(fsBuilder->enableFeature(
- GrGLFragmentShaderBuilder::kStandardDerivatives_GLSLFeature));
+ GrGLSLFragmentShaderBuilder::kStandardDerivatives_GLSLFeature));
// for outer curve
fsBuilder->codeAppendf("vec2 scaledOffset = %s.xy;", offsets0.fsIn());
fsBuilder->codeAppend("float test = dot(scaledOffset, scaledOffset) - 1.0;");
diff --git a/src/gpu/GrPathProcessor.cpp b/src/gpu/GrPathProcessor.cpp
index 6a78568..b83172d 100644
--- a/src/gpu/GrPathProcessor.cpp
+++ b/src/gpu/GrPathProcessor.cpp
@@ -9,7 +9,9 @@
#include "gl/GrGLGpu.h"
#include "glsl/GrGLSLCaps.h"
+#include "glsl/GrGLSLFragmentShaderBuilder.h"
#include "glsl/GrGLSLProcessorTypes.h"
+#include "glsl/GrGLSLProgramBuilder.h"
class GrGLPathProcessor : public GrGLPrimitiveProcessor {
public:
@@ -24,7 +26,7 @@
void emitCode(EmitArgs& args) override {
GrGLSLGPBuilder* pb = args.fPB;
- GrGLFragmentBuilder* fs = args.fPB->getFragmentShaderBuilder();
+ GrGLSLFragmentBuilder* fs = args.fPB->getFragmentShaderBuilder();
const GrPathProcessor& pathProc = args.fGP.cast<GrPathProcessor>();
// emit transforms
@@ -33,7 +35,7 @@
// Setup uniform color
if (pathProc.opts().readsColor()) {
const char* stagedLocalVarName;
- fColorUniform = pb->addUniform(GrGLProgramBuilder::kFragment_Visibility,
+ fColorUniform = pb->addUniform(GrGLSLProgramBuilder::kFragment_Visibility,
kVec4f_GrSLType,
kDefault_GrSLPrecision,
"Color",
diff --git a/src/gpu/batches/GrAAConvexPathRenderer.cpp b/src/gpu/batches/GrAAConvexPathRenderer.cpp
index d30053b..f0f475e 100644
--- a/src/gpu/batches/GrAAConvexPathRenderer.cpp
+++ b/src/gpu/batches/GrAAConvexPathRenderer.cpp
@@ -26,7 +26,7 @@
#include "SkTraceEvent.h"
#include "batches/GrVertexBatch.h"
#include "gl/GrGLGeometryProcessor.h"
-#include "gl/builders/GrGLProgramBuilder.h"
+#include "glsl/GrGLSLProgramBuilder.h"
#include "glsl/GrGLSLProgramDataManager.h"
GrAAConvexPathRenderer::GrAAConvexPathRenderer() {
@@ -549,7 +549,7 @@
void onEmitCode(EmitArgs& args, GrGPArgs* gpArgs) override {
const QuadEdgeEffect& qe = args.fGP.cast<QuadEdgeEffect>();
GrGLSLGPBuilder* pb = args.fPB;
- GrGLVertexBuilder* vsBuilder = pb->getVertexShaderBuilder();
+ GrGLSLVertexBuilder* vsBuilder = pb->getVertexShaderBuilder();
// emit attributes
vsBuilder->emitAttributes(qe);
@@ -570,10 +570,10 @@
this->emitTransforms(args.fPB, gpArgs->fPositionVar, qe.inPosition()->fName,
qe.localMatrix(), args.fTransformsIn, args.fTransformsOut);
- GrGLFragmentBuilder* fsBuilder = args.fPB->getFragmentShaderBuilder();
+ GrGLSLFragmentBuilder* fsBuilder = args.fPB->getFragmentShaderBuilder();
SkAssertResult(fsBuilder->enableFeature(
- GrGLFragmentShaderBuilder::kStandardDerivatives_GLSLFeature));
+ GrGLSLFragmentShaderBuilder::kStandardDerivatives_GLSLFeature));
fsBuilder->codeAppendf("float edgeAlpha;");
// keep the derivative instructions outside the conditional
diff --git a/src/gpu/effects/GrBezierEffect.cpp b/src/gpu/effects/GrBezierEffect.cpp
index 1cf5e18..febf18f 100644
--- a/src/gpu/effects/GrBezierEffect.cpp
+++ b/src/gpu/effects/GrBezierEffect.cpp
@@ -10,7 +10,7 @@
#include "gl/GrGLFragmentProcessor.h"
#include "gl/GrGLGeometryProcessor.h"
#include "gl/GrGLUtil.h"
-#include "gl/builders/GrGLProgramBuilder.h"
+#include "glsl/GrGLSLProgramBuilder.h"
#include "glsl/GrGLSLProgramDataManager.h"
class GrGLConicEffect : public GrGLGeometryProcessor {
@@ -74,7 +74,7 @@
void GrGLConicEffect::onEmitCode(EmitArgs& args, GrGPArgs* gpArgs) {
GrGLSLGPBuilder* pb = args.fPB;
- GrGLVertexBuilder* vsBuilder = args.fPB->getVertexShaderBuilder();
+ GrGLSLVertexBuilder* vsBuilder = args.fPB->getVertexShaderBuilder();
const GrConicEffect& gp = args.fGP.cast<GrConicEffect>();
// emit attributes
@@ -96,13 +96,13 @@
this->emitTransforms(pb, gpArgs->fPositionVar, gp.inPosition()->fName, gp.localMatrix(),
args.fTransformsIn, args.fTransformsOut);
- GrGLFragmentBuilder* fsBuilder = args.fPB->getFragmentShaderBuilder();
+ GrGLSLFragmentBuilder* fsBuilder = args.fPB->getFragmentShaderBuilder();
fsBuilder->codeAppend("float edgeAlpha;");
switch (fEdgeType) {
case kHairlineAA_GrProcessorEdgeType: {
SkAssertResult(fsBuilder->enableFeature(
- GrGLFragmentShaderBuilder::kStandardDerivatives_GLSLFeature));
+ GrGLSLFragmentShaderBuilder::kStandardDerivatives_GLSLFeature));
fsBuilder->codeAppendf("vec3 dklmdx = dFdx(%s.xyz);", v.fsIn());
fsBuilder->codeAppendf("vec3 dklmdy = dFdy(%s.xyz);", v.fsIn());
fsBuilder->codeAppendf("float dfdx ="
@@ -124,7 +124,7 @@
}
case kFillAA_GrProcessorEdgeType: {
SkAssertResult(fsBuilder->enableFeature(
- GrGLFragmentShaderBuilder::kStandardDerivatives_GLSLFeature));
+ GrGLSLFragmentShaderBuilder::kStandardDerivatives_GLSLFeature));
fsBuilder->codeAppendf("vec3 dklmdx = dFdx(%s.xyz);", v.fsIn());
fsBuilder->codeAppendf("vec3 dklmdy = dFdy(%s.xyz);", v.fsIn());
fsBuilder->codeAppendf("float dfdx ="
@@ -156,7 +156,7 @@
// TODO should we really be doing this?
if (gp.coverageScale() != 0xff) {
const char* coverageScale;
- fCoverageScaleUniform = pb->addUniform(GrGLProgramBuilder::kFragment_Visibility,
+ fCoverageScaleUniform = pb->addUniform(GrGLSLProgramBuilder::kFragment_Visibility,
kFloat_GrSLType,
kDefault_GrSLPrecision,
"Coverage",
@@ -290,7 +290,7 @@
void GrGLQuadEffect::onEmitCode(EmitArgs& args, GrGPArgs* gpArgs) {
GrGLSLGPBuilder* pb = args.fPB;
- GrGLVertexBuilder* vsBuilder = args.fPB->getVertexShaderBuilder();
+ GrGLSLVertexBuilder* vsBuilder = args.fPB->getVertexShaderBuilder();
const GrQuadEffect& gp = args.fGP.cast<GrQuadEffect>();
// emit attributes
@@ -312,13 +312,13 @@
this->emitTransforms(pb, gpArgs->fPositionVar, gp.inPosition()->fName, gp.localMatrix(),
args.fTransformsIn, args.fTransformsOut);
- GrGLFragmentBuilder* fsBuilder = args.fPB->getFragmentShaderBuilder();
+ GrGLSLFragmentBuilder* fsBuilder = args.fPB->getFragmentShaderBuilder();
fsBuilder->codeAppendf("float edgeAlpha;");
switch (fEdgeType) {
case kHairlineAA_GrProcessorEdgeType: {
SkAssertResult(fsBuilder->enableFeature(
- GrGLFragmentShaderBuilder::kStandardDerivatives_GLSLFeature));
+ GrGLSLFragmentShaderBuilder::kStandardDerivatives_GLSLFeature));
fsBuilder->codeAppendf("vec2 duvdx = dFdx(%s.xy);", v.fsIn());
fsBuilder->codeAppendf("vec2 duvdy = dFdy(%s.xy);", v.fsIn());
fsBuilder->codeAppendf("vec2 gF = vec2(2.0 * %s.x * duvdx.x - duvdx.y,"
@@ -333,7 +333,7 @@
}
case kFillAA_GrProcessorEdgeType: {
SkAssertResult(fsBuilder->enableFeature(
- GrGLFragmentShaderBuilder::kStandardDerivatives_GLSLFeature));
+ GrGLSLFragmentShaderBuilder::kStandardDerivatives_GLSLFeature));
fsBuilder->codeAppendf("vec2 duvdx = dFdx(%s.xy);", v.fsIn());
fsBuilder->codeAppendf("vec2 duvdy = dFdy(%s.xy);", v.fsIn());
fsBuilder->codeAppendf("vec2 gF = vec2(2.0 * %s.x * duvdx.x - duvdx.y,"
@@ -357,7 +357,7 @@
if (0xff != gp.coverageScale()) {
const char* coverageScale;
- fCoverageScaleUniform = pb->addUniform(GrGLProgramBuilder::kFragment_Visibility,
+ fCoverageScaleUniform = pb->addUniform(GrGLSLProgramBuilder::kFragment_Visibility,
kFloat_GrSLType,
kDefault_GrSLPrecision,
"Coverage",
@@ -477,7 +477,7 @@
}
void GrGLCubicEffect::onEmitCode(EmitArgs& args, GrGPArgs* gpArgs) {
- GrGLVertexBuilder* vsBuilder = args.fPB->getVertexShaderBuilder();
+ GrGLSLVertexBuilder* vsBuilder = args.fPB->getVertexShaderBuilder();
const GrCubicEffect& gp = args.fGP.cast<GrCubicEffect>();
// emit attributes
@@ -500,7 +500,7 @@
this->emitTransforms(args.fPB, gpArgs->fPositionVar, gp.inPosition()->fName, args.fTransformsIn,
args.fTransformsOut);
- GrGLFragmentBuilder* fsBuilder = args.fPB->getFragmentShaderBuilder();
+ GrGLSLFragmentBuilder* fsBuilder = args.fPB->getFragmentShaderBuilder();
GrGLSLShaderVar edgeAlpha("edgeAlpha", kFloat_GrSLType, 0, kHigh_GrSLPrecision);
GrGLSLShaderVar dklmdx("dklmdx", kVec3f_GrSLType, 0, kHigh_GrSLPrecision);
@@ -523,7 +523,7 @@
switch (fEdgeType) {
case kHairlineAA_GrProcessorEdgeType: {
SkAssertResult(fsBuilder->enableFeature(
- GrGLFragmentShaderBuilder::kStandardDerivatives_GLSLFeature));
+ GrGLSLFragmentShaderBuilder::kStandardDerivatives_GLSLFeature));
fsBuilder->codeAppendf("%s = dFdx(%s.xyz);", dklmdx.c_str(), v.fsIn());
fsBuilder->codeAppendf("%s = dFdy(%s.xyz);", dklmdy.c_str(), v.fsIn());
fsBuilder->codeAppendf("%s = 3.0 * %s.x * %s.x * %s.x - %s.y * %s.z - %s.z * %s.y;",
@@ -549,7 +549,7 @@
}
case kFillAA_GrProcessorEdgeType: {
SkAssertResult(fsBuilder->enableFeature(
- GrGLFragmentShaderBuilder::kStandardDerivatives_GLSLFeature));
+ GrGLSLFragmentShaderBuilder::kStandardDerivatives_GLSLFeature));
fsBuilder->codeAppendf("%s = dFdx(%s.xyz);", dklmdx.c_str(), v.fsIn());
fsBuilder->codeAppendf("%s = dFdy(%s.xyz);", dklmdy.c_str(), v.fsIn());
fsBuilder->codeAppendf("%s ="
diff --git a/src/gpu/effects/GrBicubicEffect.cpp b/src/gpu/effects/GrBicubicEffect.cpp
index a6ed190..2857641 100644
--- a/src/gpu/effects/GrBicubicEffect.cpp
+++ b/src/gpu/effects/GrBicubicEffect.cpp
@@ -7,7 +7,8 @@
#include "GrBicubicEffect.h"
#include "GrInvariantOutput.h"
-#include "gl/builders/GrGLProgramBuilder.h"
+#include "glsl/GrGLSLFragmentShaderBuilder.h"
+#include "glsl/GrGLSLProgramBuilder.h"
#include "glsl/GrGLSLProgramDataManager.h"
#define DS(x) SkDoubleToScalar(x)
@@ -51,10 +52,10 @@
void GrGLBicubicEffect::emitCode(EmitArgs& args) {
const GrTextureDomain& domain = args.fFp.cast<GrBicubicEffect>().domain();
- fCoefficientsUni = args.fBuilder->addUniform(GrGLProgramBuilder::kFragment_Visibility,
+ fCoefficientsUni = args.fBuilder->addUniform(GrGLSLProgramBuilder::kFragment_Visibility,
kMat44f_GrSLType, kDefault_GrSLPrecision,
"Coefficients");
- fImageIncrementUni = args.fBuilder->addUniform(GrGLProgramBuilder::kFragment_Visibility,
+ fImageIncrementUni = args.fBuilder->addUniform(GrGLSLProgramBuilder::kFragment_Visibility,
kVec2f_GrSLType, kDefault_GrSLPrecision,
"ImageIncrement");
@@ -71,7 +72,7 @@
GrGLSLShaderVar("c2", kVec4f_GrSLType),
GrGLSLShaderVar("c3", kVec4f_GrSLType),
};
- GrGLFragmentBuilder* fsBuilder = args.fBuilder->getFragmentShaderBuilder();
+ GrGLSLFragmentBuilder* fsBuilder = args.fBuilder->getFragmentShaderBuilder();
SkString coords2D = fsBuilder->ensureFSCoords2D(args.fCoords, 0);
fsBuilder->emitFunction(kVec4f_GrSLType,
"cubicBlend",
diff --git a/src/gpu/effects/GrBitmapTextGeoProc.cpp b/src/gpu/effects/GrBitmapTextGeoProc.cpp
index c1a9dae..21dd5e7 100644
--- a/src/gpu/effects/GrBitmapTextGeoProc.cpp
+++ b/src/gpu/effects/GrBitmapTextGeoProc.cpp
@@ -11,8 +11,10 @@
#include "gl/GrGLFragmentProcessor.h"
#include "gl/GrGLTexture.h"
#include "gl/GrGLGeometryProcessor.h"
-#include "gl/builders/GrGLProgramBuilder.h"
+#include "glsl/GrGLSLFragmentShaderBuilder.h"
+#include "glsl/GrGLSLProgramBuilder.h"
#include "glsl/GrGLSLProgramDataManager.h"
+#include "glsl/GrGLSLVertexShaderBuilder.h"
class GrGLBitmapTextGeoProc : public GrGLGeometryProcessor {
public:
@@ -22,7 +24,7 @@
const GrBitmapTextGeoProc& cte = args.fGP.cast<GrBitmapTextGeoProc>();
GrGLSLGPBuilder* pb = args.fPB;
- GrGLVertexBuilder* vsBuilder = pb->getVertexShaderBuilder();
+ GrGLSLVertexBuilder* vsBuilder = pb->getVertexShaderBuilder();
// emit attributes
vsBuilder->emitAttributes(cte);
@@ -57,7 +59,7 @@
this->emitTransforms(args.fPB, gpArgs->fPositionVar, cte.inPosition()->fName,
cte.localMatrix(), args.fTransformsIn, args.fTransformsOut);
- GrGLFragmentBuilder* fsBuilder = pb->getFragmentShaderBuilder();
+ GrGLSLFragmentBuilder* fsBuilder = pb->getFragmentShaderBuilder();
if (cte.maskFormat() == kARGB_GrMaskFormat) {
fsBuilder->codeAppendf("%s = ", args.fOutputColor);
fsBuilder->appendTextureLookupAndModulate(args.fOutputColor,
diff --git a/src/gpu/effects/GrConfigConversionEffect.cpp b/src/gpu/effects/GrConfigConversionEffect.cpp
index 5f51f6a..160773d 100644
--- a/src/gpu/effects/GrConfigConversionEffect.cpp
+++ b/src/gpu/effects/GrConfigConversionEffect.cpp
@@ -12,7 +12,8 @@
#include "GrSimpleTextureEffect.h"
#include "SkMatrix.h"
#include "gl/GrGLFragmentProcessor.h"
-#include "gl/builders/GrGLProgramBuilder.h"
+#include "glsl/GrGLSLFragmentShaderBuilder.h"
+#include "glsl/GrGLSLProgramBuilder.h"
class GrGLConfigConversionEffect : public GrGLFragmentProcessor {
public:
@@ -29,7 +30,7 @@
SkString tmpDecl;
tmpVar.appendDecl(args.fBuilder->glslCaps(), &tmpDecl);
- GrGLFragmentBuilder* fsBuilder = args.fBuilder->getFragmentShaderBuilder();
+ GrGLSLFragmentBuilder* fsBuilder = args.fBuilder->getFragmentShaderBuilder();
fsBuilder->codeAppendf("%s;", tmpDecl.c_str());
@@ -142,7 +143,7 @@
///////////////////////////////////////////////////////////////////////////////
void GrConfigConversionEffect::onGetGLProcessorKey(const GrGLSLCaps& caps,
- GrProcessorKeyBuilder* b) const {
+ GrProcessorKeyBuilder* b) const {
GrGLConfigConversionEffect::GenKey(*this, caps, b);
}
diff --git a/src/gpu/effects/GrConstColorProcessor.cpp b/src/gpu/effects/GrConstColorProcessor.cpp
index a290b84..5440dd3 100644
--- a/src/gpu/effects/GrConstColorProcessor.cpp
+++ b/src/gpu/effects/GrConstColorProcessor.cpp
@@ -7,7 +7,8 @@
#include "effects/GrConstColorProcessor.h"
#include "gl/GrGLFragmentProcessor.h"
-#include "gl/builders/GrGLProgramBuilder.h"
+#include "glsl/GrGLSLFragmentShaderBuilder.h"
+#include "glsl/GrGLSLProgramBuilder.h"
#include "glsl/GrGLSLProgramDataManager.h"
class GLConstColorProcessor : public GrGLFragmentProcessor {
@@ -15,9 +16,9 @@
GLConstColorProcessor() : fPrevColor(GrColor_ILLEGAL) {}
void emitCode(EmitArgs& args) override {
- GrGLFragmentBuilder* fsBuilder = args.fBuilder->getFragmentShaderBuilder();
+ GrGLSLFragmentBuilder* fsBuilder = args.fBuilder->getFragmentShaderBuilder();
const char* colorUni;
- fColorUniform = args.fBuilder->addUniform(GrGLProgramBuilder::kFragment_Visibility,
+ fColorUniform = args.fBuilder->addUniform(GrGLSLProgramBuilder::kFragment_Visibility,
kVec4f_GrSLType, kMedium_GrSLPrecision, "constantColor",
&colorUni);
GrConstColorProcessor::InputMode mode = args.fFp.cast<GrConstColorProcessor>().inputMode();
diff --git a/src/gpu/effects/GrConvexPolyEffect.cpp b/src/gpu/effects/GrConvexPolyEffect.cpp
index 714c68a..c373b04 100644
--- a/src/gpu/effects/GrConvexPolyEffect.cpp
+++ b/src/gpu/effects/GrConvexPolyEffect.cpp
@@ -10,7 +10,8 @@
#include "SkPathPriv.h"
#include "gl/GrGLContext.h"
#include "gl/GrGLFragmentProcessor.h"
-#include "gl/builders/GrGLProgramBuilder.h"
+#include "glsl/GrGLSLFragmentShaderBuilder.h"
+#include "glsl/GrGLSLProgramBuilder.h"
#include "glsl/GrGLSLProgramDataManager.h"
//////////////////////////////////////////////////////////////////////////////
@@ -105,13 +106,13 @@
const char *rectName;
// The rect uniform's xyzw refer to (left + 0.5, top + 0.5, right - 0.5, bottom - 0.5),
// respectively.
- fRectUniform = args.fBuilder->addUniform(GrGLProgramBuilder::kFragment_Visibility,
+ fRectUniform = args.fBuilder->addUniform(GrGLSLProgramBuilder::kFragment_Visibility,
kVec4f_GrSLType,
kDefault_GrSLPrecision,
"rect",
&rectName);
- GrGLFragmentBuilder* fsBuilder = args.fBuilder->getFragmentShaderBuilder();
+ GrGLSLFragmentBuilder* fsBuilder = args.fBuilder->getFragmentShaderBuilder();
const char* fragmentPos = fsBuilder->fragmentPosition();
if (GrProcessorEdgeTypeIsAA(aare.getEdgeType())) {
// The amount of coverage removed in x and y by the edges is computed as a pair of negative
@@ -191,13 +192,13 @@
const GrConvexPolyEffect& cpe = args.fFp.cast<GrConvexPolyEffect>();
const char *edgeArrayName;
- fEdgeUniform = args.fBuilder->addUniformArray(GrGLProgramBuilder::kFragment_Visibility,
+ fEdgeUniform = args.fBuilder->addUniformArray(GrGLSLProgramBuilder::kFragment_Visibility,
kVec3f_GrSLType,
kDefault_GrSLPrecision,
"edges",
cpe.getEdgeCount(),
&edgeArrayName);
- GrGLFragmentBuilder* fsBuilder = args.fBuilder->getFragmentShaderBuilder();
+ GrGLSLFragmentBuilder* fsBuilder = args.fBuilder->getFragmentShaderBuilder();
fsBuilder->codeAppend("\t\tfloat alpha = 1.0;\n");
fsBuilder->codeAppend("\t\tfloat edge;\n");
const char* fragmentPos = fsBuilder->fragmentPosition();
@@ -304,7 +305,7 @@
}
void GrConvexPolyEffect::onGetGLProcessorKey(const GrGLSLCaps& caps,
- GrProcessorKeyBuilder* b) const {
+ GrProcessorKeyBuilder* b) const {
GrGLConvexPolyEffect::GenKey(*this, caps, b);
}
diff --git a/src/gpu/effects/GrConvolutionEffect.cpp b/src/gpu/effects/GrConvolutionEffect.cpp
index 96d1578..5367b27 100644
--- a/src/gpu/effects/GrConvolutionEffect.cpp
+++ b/src/gpu/effects/GrConvolutionEffect.cpp
@@ -8,7 +8,8 @@
#include "GrConvolutionEffect.h"
#include "gl/GrGLFragmentProcessor.h"
#include "gl/GrGLTexture.h"
-#include "gl/builders/GrGLProgramBuilder.h"
+#include "glsl/GrGLSLFragmentShaderBuilder.h"
+#include "glsl/GrGLSLProgramBuilder.h"
#include "glsl/GrGLSLProgramDataManager.h"
// For brevity
@@ -48,19 +49,19 @@
}
void GrGLConvolutionEffect::emitCode(EmitArgs& args) {
- fImageIncrementUni = args.fBuilder->addUniform(GrGLProgramBuilder::kFragment_Visibility,
+ fImageIncrementUni = args.fBuilder->addUniform(GrGLSLProgramBuilder::kFragment_Visibility,
kVec2f_GrSLType, kDefault_GrSLPrecision,
"ImageIncrement");
if (this->useBounds()) {
- fBoundsUni = args.fBuilder->addUniform(GrGLProgramBuilder::kFragment_Visibility,
+ fBoundsUni = args.fBuilder->addUniform(GrGLSLProgramBuilder::kFragment_Visibility,
kVec2f_GrSLType, kDefault_GrSLPrecision,
"Bounds");
}
- fKernelUni = args.fBuilder->addUniformArray(GrGLProgramBuilder::kFragment_Visibility,
+ fKernelUni = args.fBuilder->addUniformArray(GrGLSLProgramBuilder::kFragment_Visibility,
kFloat_GrSLType, kDefault_GrSLPrecision,
"Kernel", this->width());
- GrGLFragmentBuilder* fsBuilder = args.fBuilder->getFragmentShaderBuilder();
+ GrGLSLFragmentBuilder* fsBuilder = args.fBuilder->getFragmentShaderBuilder();
SkString coords2D = fsBuilder->ensureFSCoords2D(args.fCoords, 0);
fsBuilder->codeAppendf("\t\t%s = vec4(0, 0, 0, 0);\n", args.fOutputColor);
diff --git a/src/gpu/effects/GrCoverageSetOpXP.cpp b/src/gpu/effects/GrCoverageSetOpXP.cpp
index b3fe096..5c876d5 100644
--- a/src/gpu/effects/GrCoverageSetOpXP.cpp
+++ b/src/gpu/effects/GrCoverageSetOpXP.cpp
@@ -12,8 +12,8 @@
#include "GrProcessor.h"
#include "GrProcOptInfo.h"
#include "gl/GrGLXferProcessor.h"
-#include "gl/builders/GrGLFragmentShaderBuilder.h"
-#include "gl/builders/GrGLProgramBuilder.h"
+#include "glsl/GrGLSLProgramBuilder.h"
+#include "glsl/GrGLSLFragmentShaderBuilder.h"
class CoverageSetOpXP : public GrXferProcessor {
public:
@@ -72,7 +72,7 @@
private:
void emitOutputsForBlendState(const EmitArgs& args) override {
const CoverageSetOpXP& xp = args.fXP.cast<CoverageSetOpXP>();
- GrGLXPFragmentBuilder* fsBuilder = args.fPB->getFragmentShaderBuilder();
+ GrGLSLXPFragmentBuilder* fsBuilder = args.fPB->getFragmentShaderBuilder();
if (xp.invertCoverage()) {
fsBuilder->codeAppendf("%s = 1.0 - %s;", args.fOutputPrimary, args.fInputCoverage);
diff --git a/src/gpu/effects/GrCustomXfermode.cpp b/src/gpu/effects/GrCustomXfermode.cpp
index abcd9a5..574310c 100644
--- a/src/gpu/effects/GrCustomXfermode.cpp
+++ b/src/gpu/effects/GrCustomXfermode.cpp
@@ -20,8 +20,9 @@
#include "gl/GrGLSLBlend.h"
#include "gl/GrGLFragmentProcessor.h"
#include "gl/GrGLProgramDataManager.h"
-#include "gl/builders/GrGLProgramBuilder.h"
#include "glsl/GrGLSLCaps.h"
+#include "glsl/GrGLSLFragmentShaderBuilder.h"
+#include "glsl/GrGLSLProgramBuilder.h"
#include "glsl/GrGLSLProgramDataManager.h"
bool GrCustomXfermode::IsSupportedMode(SkXfermode::Mode mode) {
@@ -147,7 +148,7 @@
const CustomXP& xp = args.fXP.cast<CustomXP>();
SkASSERT(xp.hasHWBlendEquation());
- GrGLXPFragmentBuilder* fsBuilder = args.fPB->getFragmentShaderBuilder();
+ GrGLSLXPFragmentBuilder* fsBuilder = args.fPB->getFragmentShaderBuilder();
fsBuilder->enableAdvancedBlendEquationIfNeeded(xp.hwBlendEquation());
// Apply coverage by multiplying it into the src color before blending. Mixed samples will
@@ -165,7 +166,7 @@
const CustomXP& xp = proc.cast<CustomXP>();
SkASSERT(!xp.hasHWBlendEquation());
- GrGLXPFragmentBuilder* fsBuilder = pb->getFragmentShaderBuilder();
+ GrGLSLXPFragmentBuilder* fsBuilder = pb->getFragmentShaderBuilder();
GrGLSLBlend::AppendMode(fsBuilder, srcColor, dstColor, outColor, xp.mode());
}
diff --git a/src/gpu/effects/GrDashingEffect.cpp b/src/gpu/effects/GrDashingEffect.cpp
index b724082..3fa3014 100644
--- a/src/gpu/effects/GrDashingEffect.cpp
+++ b/src/gpu/effects/GrDashingEffect.cpp
@@ -23,8 +23,10 @@
#include "batches/GrVertexBatch.h"
#include "gl/GrGLGeometryProcessor.h"
#include "gl/GrGLFragmentProcessor.h"
-#include "gl/builders/GrGLProgramBuilder.h"
+#include "glsl/GrGLSLFragmentShaderBuilder.h"
+#include "glsl/GrGLSLProgramBuilder.h"
#include "glsl/GrGLSLProgramDataManager.h"
+#include "glsl/GrGLSLVertexShaderBuilder.h"
///////////////////////////////////////////////////////////////////////////////
@@ -851,7 +853,7 @@
void GLDashingCircleEffect::onEmitCode(EmitArgs& args, GrGPArgs* gpArgs) {
const DashingCircleEffect& dce = args.fGP.cast<DashingCircleEffect>();
GrGLSLGPBuilder* pb = args.fPB;
- GrGLVertexBuilder* vsBuilder = args.fPB->getVertexShaderBuilder();
+ GrGLSLVertexBuilder* vsBuilder = args.fPB->getVertexShaderBuilder();
// emit attributes
vsBuilder->emitAttributes(dce);
@@ -879,7 +881,7 @@
args.fTransformsIn, args.fTransformsOut);
// transforms all points so that we can compare them to our test circle
- GrGLFragmentBuilder* fsBuilder = args.fPB->getFragmentShaderBuilder();
+ GrGLSLFragmentBuilder* fsBuilder = args.fPB->getFragmentShaderBuilder();
fsBuilder->codeAppendf("float xShifted = %s.x - floor(%s.x / %s.z) * %s.z;",
dashParams.fsIn(), dashParams.fsIn(), dashParams.fsIn(),
dashParams.fsIn());
@@ -1056,7 +1058,7 @@
const DashingLineEffect& de = args.fGP.cast<DashingLineEffect>();
GrGLSLGPBuilder* pb = args.fPB;
- GrGLVertexBuilder* vsBuilder = args.fPB->getVertexShaderBuilder();
+ GrGLSLVertexBuilder* vsBuilder = args.fPB->getVertexShaderBuilder();
// emit attributes
vsBuilder->emitAttributes(de);
@@ -1086,7 +1088,7 @@
args.fTransformsIn, args.fTransformsOut);
// transforms all points so that we can compare them to our test rect
- GrGLFragmentBuilder* fsBuilder = args.fPB->getFragmentShaderBuilder();
+ GrGLSLFragmentBuilder* fsBuilder = args.fPB->getFragmentShaderBuilder();
fsBuilder->codeAppendf("float xShifted = %s.x - floor(%s.x / %s.z) * %s.z;",
inDashParams.fsIn(), inDashParams.fsIn(), inDashParams.fsIn(),
inDashParams.fsIn());
diff --git a/src/gpu/effects/GrDisableColorXP.cpp b/src/gpu/effects/GrDisableColorXP.cpp
index 0f3382f..963b0dd 100644
--- a/src/gpu/effects/GrDisableColorXP.cpp
+++ b/src/gpu/effects/GrDisableColorXP.cpp
@@ -8,8 +8,8 @@
#include "effects/GrDisableColorXP.h"
#include "GrProcessor.h"
#include "gl/GrGLXferProcessor.h"
-#include "gl/builders/GrGLFragmentShaderBuilder.h"
-#include "gl/builders/GrGLProgramBuilder.h"
+#include "glsl/GrGLSLFragmentShaderBuilder.h"
+#include "glsl/GrGLSLProgramBuilder.h"
#include "glsl/GrGLSLProgramDataManager.h"
/**
@@ -63,7 +63,7 @@
// This emit code should be empty. However, on the nexus 6 there is a driver bug where if
// you do not give gl_FragColor a value, the gl context is lost and we end up drawing
// nothing. So this fix just sets the gl_FragColor arbitrarily to 0.
- GrGLXPFragmentBuilder* fsBuilder = args.fPB->getFragmentShaderBuilder();
+ GrGLSLXPFragmentBuilder* fsBuilder = args.fPB->getFragmentShaderBuilder();
fsBuilder->codeAppendf("%s = vec4(0);", args.fOutputPrimary);
}
diff --git a/src/gpu/effects/GrDistanceFieldGeoProc.cpp b/src/gpu/effects/GrDistanceFieldGeoProc.cpp
index 41e1aea..90a0898 100644
--- a/src/gpu/effects/GrDistanceFieldGeoProc.cpp
+++ b/src/gpu/effects/GrDistanceFieldGeoProc.cpp
@@ -14,8 +14,10 @@
#include "gl/GrGLFragmentProcessor.h"
#include "gl/GrGLTexture.h"
#include "gl/GrGLGeometryProcessor.h"
-#include "gl/builders/GrGLProgramBuilder.h"
+#include "glsl/GrGLSLFragmentShaderBuilder.h"
+#include "glsl/GrGLSLProgramBuilder.h"
#include "glsl/GrGLSLProgramDataManager.h"
+#include "glsl/GrGLSLVertexShaderBuilder.h"
// Assuming a radius of a little less than the diagonal of the fragment
#define SK_DistanceFieldAAFactor "0.65"
@@ -34,11 +36,11 @@
const GrDistanceFieldA8TextGeoProc& dfTexEffect =
args.fGP.cast<GrDistanceFieldA8TextGeoProc>();
GrGLSLGPBuilder* pb = args.fPB;
- GrGLFragmentBuilder* fsBuilder = pb->getFragmentShaderBuilder();
+ GrGLSLFragmentBuilder* fsBuilder = pb->getFragmentShaderBuilder();
SkAssertResult(fsBuilder->enableFeature(
- GrGLFragmentShaderBuilder::kStandardDerivatives_GLSLFeature));
+ GrGLSLFragmentShaderBuilder::kStandardDerivatives_GLSLFeature));
- GrGLVertexBuilder* vsBuilder = pb->getVertexShaderBuilder();
+ GrGLSLVertexBuilder* vsBuilder = pb->getVertexShaderBuilder();
// emit attributes
vsBuilder->emitAttributes(dfTexEffect);
@@ -47,7 +49,7 @@
// adjust based on gamma
const char* distanceAdjustUniName = nullptr;
// width, height, 1/(3*width)
- fDistanceAdjustUni = pb->addUniform(GrGLProgramBuilder::kFragment_Visibility,
+ fDistanceAdjustUni = pb->addUniform(GrGLSLProgramBuilder::kFragment_Visibility,
kFloat_GrSLType, kDefault_GrSLPrecision,
"DistanceAdjust", &distanceAdjustUniName);
#endif
@@ -285,11 +287,11 @@
const GrDistanceFieldPathGeoProc& dfTexEffect = args.fGP.cast<GrDistanceFieldPathGeoProc>();
GrGLSLGPBuilder* pb = args.fPB;
- GrGLFragmentBuilder* fsBuilder = pb->getFragmentShaderBuilder();
+ GrGLSLFragmentBuilder* fsBuilder = pb->getFragmentShaderBuilder();
SkAssertResult(fsBuilder->enableFeature(
- GrGLFragmentShaderBuilder::kStandardDerivatives_GLSLFeature));
+ GrGLSLFragmentShaderBuilder::kStandardDerivatives_GLSLFeature));
- GrGLVertexBuilder* vsBuilder = pb->getVertexShaderBuilder();
+ GrGLSLVertexBuilder* vsBuilder = pb->getVertexShaderBuilder();
// emit attributes
vsBuilder->emitAttributes(dfTexEffect);
@@ -316,7 +318,7 @@
args.fTransformsIn, args.fTransformsOut);
const char* textureSizeUniName = nullptr;
- fTextureSizeUni = pb->addUniform(GrGLProgramBuilder::kFragment_Visibility,
+ fTextureSizeUni = pb->addUniform(GrGLSLProgramBuilder::kFragment_Visibility,
kVec2f_GrSLType, kDefault_GrSLPrecision,
"TextureSize", &textureSizeUniName);
@@ -501,7 +503,7 @@
args.fGP.cast<GrDistanceFieldLCDTextGeoProc>();
GrGLSLGPBuilder* pb = args.fPB;
- GrGLVertexBuilder* vsBuilder = pb->getVertexShaderBuilder();
+ GrGLSLVertexBuilder* vsBuilder = pb->getVertexShaderBuilder();
// emit attributes
vsBuilder->emitAttributes(dfTexEffect);
@@ -541,10 +543,10 @@
dfTexEffect.inTextureCoords()->fName);
// add frag shader code
- GrGLFragmentBuilder* fsBuilder = pb->getFragmentShaderBuilder();
+ GrGLSLFragmentBuilder* fsBuilder = pb->getFragmentShaderBuilder();
SkAssertResult(fsBuilder->enableFeature(
- GrGLFragmentShaderBuilder::kStandardDerivatives_GLSLFeature));
+ GrGLSLFragmentShaderBuilder::kStandardDerivatives_GLSLFeature));
// create LCD offset adjusted by inverse of transform
// Use highp to work around aliasing issues
@@ -595,7 +597,7 @@
// adjust width based on gamma
const char* distanceAdjustUniName = nullptr;
- fDistanceAdjustUni = pb->addUniform(GrGLProgramBuilder::kFragment_Visibility,
+ fDistanceAdjustUni = pb->addUniform(GrGLSLProgramBuilder::kFragment_Visibility,
kVec3f_GrSLType, kDefault_GrSLPrecision,
"DistanceAdjust", &distanceAdjustUniName);
fsBuilder->codeAppendf("distance -= %s;", distanceAdjustUniName);
diff --git a/src/gpu/effects/GrDitherEffect.cpp b/src/gpu/effects/GrDitherEffect.cpp
index bab0f32..fb02da5 100644
--- a/src/gpu/effects/GrDitherEffect.cpp
+++ b/src/gpu/effects/GrDitherEffect.cpp
@@ -10,7 +10,8 @@
#include "GrInvariantOutput.h"
#include "SkRect.h"
#include "gl/GrGLFragmentProcessor.h"
-#include "gl/builders/GrGLProgramBuilder.h"
+#include "glsl/GrGLSLFragmentShaderBuilder.h"
+#include "glsl/GrGLSLProgramBuilder.h"
//////////////////////////////////////////////////////////////////////////////
@@ -72,7 +73,7 @@
}
void GLDitherEffect::emitCode(EmitArgs& args) {
- GrGLFragmentBuilder* fsBuilder = args.fBuilder->getFragmentShaderBuilder();
+ GrGLSLFragmentBuilder* fsBuilder = args.fBuilder->getFragmentShaderBuilder();
// Generate a random number based on the fragment position. For this
// random number generator, we use the "GLSL rand" function
// that seems to be floating around on the internet. It works under
@@ -92,7 +93,7 @@
//////////////////////////////////////////////////////////////////////////////
void DitherEffect::onGetGLProcessorKey(const GrGLSLCaps& caps,
- GrProcessorKeyBuilder* b) const {
+ GrProcessorKeyBuilder* b) const {
GLDitherEffect::GenKey(*this, caps, b);
}
diff --git a/src/gpu/effects/GrMatrixConvolutionEffect.cpp b/src/gpu/effects/GrMatrixConvolutionEffect.cpp
index af09db5..358f808 100644
--- a/src/gpu/effects/GrMatrixConvolutionEffect.cpp
+++ b/src/gpu/effects/GrMatrixConvolutionEffect.cpp
@@ -65,7 +65,7 @@
int kWidth = fKernelSize.width();
int kHeight = fKernelSize.height();
- GrGLFragmentBuilder* fsBuilder = args.fBuilder->getFragmentShaderBuilder();
+ GrGLSLFragmentBuilder* fsBuilder = args.fBuilder->getFragmentShaderBuilder();
SkString coords2D = fsBuilder->ensureFSCoords2D(args.fCoords, 0);
fsBuilder->codeAppend("vec4 sum = vec4(0, 0, 0, 0);");
fsBuilder->codeAppendf("vec2 coord = %s - %s * %s;", coords2D.c_str(), kernelOffset,
@@ -74,7 +74,7 @@
for (int y = 0; y < kHeight; y++) {
for (int x = 0; x < kWidth; x++) {
- GrGLShaderBuilder::ShaderBlock block(fsBuilder);
+ GrGLSLShaderBuilder::ShaderBlock block(fsBuilder);
fsBuilder->codeAppendf("float k = %s[%d * %d + %d];", kernel, y, kWidth, x);
SkString coord;
coord.printf("coord + vec2(%d, %d) * %s", x, y, imgInc);
diff --git a/src/gpu/effects/GrOvalEffect.cpp b/src/gpu/effects/GrOvalEffect.cpp
index 1bc6589..d34edbb 100644
--- a/src/gpu/effects/GrOvalEffect.cpp
+++ b/src/gpu/effects/GrOvalEffect.cpp
@@ -11,7 +11,8 @@
#include "GrInvariantOutput.h"
#include "SkRect.h"
#include "gl/GrGLFragmentProcessor.h"
-#include "gl/builders/GrGLProgramBuilder.h"
+#include "glsl/GrGLSLFragmentShaderBuilder.h"
+#include "glsl/GrGLSLProgramBuilder.h"
#include "glsl/GrGLSLProgramDataManager.h"
//////////////////////////////////////////////////////////////////////////////
@@ -118,12 +119,12 @@
const char *circleName;
// The circle uniform is (center.x, center.y, radius + 0.5, 1 / (radius + 0.5)) for regular
// fills and (..., radius - 0.5, 1 / (radius - 0.5)) for inverse fills.
- fCircleUniform = args.fBuilder->addUniform(GrGLProgramBuilder::kFragment_Visibility,
+ fCircleUniform = args.fBuilder->addUniform(GrGLSLProgramBuilder::kFragment_Visibility,
kVec4f_GrSLType, kDefault_GrSLPrecision,
"circle",
&circleName);
- GrGLFragmentBuilder* fsBuilder = args.fBuilder->getFragmentShaderBuilder();
+ GrGLSLFragmentBuilder* fsBuilder = args.fBuilder->getFragmentShaderBuilder();
const char* fragmentPos = fsBuilder->fragmentPosition();
SkASSERT(kHairlineAA_GrProcessorEdgeType != ce.getEdgeType());
@@ -290,12 +291,12 @@
const char *ellipseName;
// The ellipse uniform is (center.x, center.y, 1 / rx^2, 1 / ry^2)
// The last two terms can underflow on mediump, so we use highp.
- fEllipseUniform = args.fBuilder->addUniform(GrGLProgramBuilder::kFragment_Visibility,
+ fEllipseUniform = args.fBuilder->addUniform(GrGLSLProgramBuilder::kFragment_Visibility,
kVec4f_GrSLType, kHigh_GrSLPrecision,
"ellipse",
&ellipseName);
- GrGLFragmentBuilder* fsBuilder = args.fBuilder->getFragmentShaderBuilder();
+ GrGLSLFragmentBuilder* fsBuilder = args.fBuilder->getFragmentShaderBuilder();
const char* fragmentPos = fsBuilder->fragmentPosition();
// d is the offset to the ellipse center
diff --git a/src/gpu/effects/GrPorterDuffXferProcessor.cpp b/src/gpu/effects/GrPorterDuffXferProcessor.cpp
index 2866380..650a1e7 100644
--- a/src/gpu/effects/GrPorterDuffXferProcessor.cpp
+++ b/src/gpu/effects/GrPorterDuffXferProcessor.cpp
@@ -15,8 +15,8 @@
#include "GrXferProcessor.h"
#include "gl/GrGLSLBlend.h"
#include "gl/GrGLXferProcessor.h"
-#include "gl/builders/GrGLFragmentShaderBuilder.h"
-#include "gl/builders/GrGLProgramBuilder.h"
+#include "glsl/GrGLSLFragmentShaderBuilder.h"
+#include "glsl/GrGLSLProgramBuilder.h"
#include "glsl/GrGLSLProgramDataManager.h"
/**
@@ -381,7 +381,8 @@
///////////////////////////////////////////////////////////////////////////////
-static void append_color_output(const PorterDuffXferProcessor& xp, GrGLXPFragmentBuilder* fsBuilder,
+static void append_color_output(const PorterDuffXferProcessor& xp,
+ GrGLSLXPFragmentBuilder* fsBuilder,
BlendFormula::OutputType outputType, const char* output,
const char* inColor, const char* inCoverage) {
switch (outputType) {
@@ -440,7 +441,7 @@
private:
void emitOutputsForBlendState(const EmitArgs& args) override {
const PorterDuffXferProcessor& xp = args.fXP.cast<PorterDuffXferProcessor>();
- GrGLXPFragmentBuilder* fsBuilder = args.fPB->getFragmentShaderBuilder();
+ GrGLSLXPFragmentBuilder* fsBuilder = args.fPB->getFragmentShaderBuilder();
BlendFormula blendFormula = xp.getBlendFormula();
if (blendFormula.hasSecondaryOutput()) {
@@ -546,7 +547,7 @@
void emitBlendCodeForDstRead(GrGLSLXPBuilder* pb, const char* srcColor, const char* dstColor,
const char* outColor, const GrXferProcessor& proc) override {
const ShaderPDXferProcessor& xp = proc.cast<ShaderPDXferProcessor>();
- GrGLXPFragmentBuilder* fsBuilder = pb->getFragmentShaderBuilder();
+ GrGLSLXPFragmentBuilder* fsBuilder = pb->getFragmentShaderBuilder();
GrGLSLBlend::AppendMode(fsBuilder, srcColor, dstColor, outColor, xp.getXfermode());
}
@@ -559,7 +560,7 @@
///////////////////////////////////////////////////////////////////////////////
void ShaderPDXferProcessor::onGetGLProcessorKey(const GrGLSLCaps&,
- GrProcessorKeyBuilder* b) const {
+ GrProcessorKeyBuilder* b) const {
GLShaderPDXferProcessor::GenKey(*this, b);
}
@@ -624,7 +625,7 @@
private:
void emitOutputsForBlendState(const EmitArgs& args) override {
- GrGLXPFragmentBuilder* fsBuilder = args.fPB->getFragmentShaderBuilder();
+ GrGLSLXPFragmentBuilder* fsBuilder = args.fPB->getFragmentShaderBuilder();
fsBuilder->codeAppendf("%s = %s * %s;", args.fOutputPrimary, args.fInputColor,
args.fInputCoverage);
}
diff --git a/src/gpu/effects/GrRRectEffect.cpp b/src/gpu/effects/GrRRectEffect.cpp
index aeab0e4..398edcc 100644
--- a/src/gpu/effects/GrRRectEffect.cpp
+++ b/src/gpu/effects/GrRRectEffect.cpp
@@ -13,7 +13,8 @@
#include "GrOvalEffect.h"
#include "SkRRect.h"
#include "gl/GrGLFragmentProcessor.h"
-#include "gl/builders/GrGLProgramBuilder.h"
+#include "glsl/GrGLSLFragmentShaderBuilder.h"
+#include "glsl/GrGLSLProgramBuilder.h"
#include "glsl/GrGLSLProgramDataManager.h"
// The effects defined here only handle rrect radii >= kRadiusMin.
@@ -155,16 +156,16 @@
// edges correspond to components x, y, z, and w, respectively. When a side of the rrect has
// only rectangular corners, that side's value corresponds to the rect edge's value outset by
// half a pixel.
- fInnerRectUniform = args.fBuilder->addUniform(GrGLProgramBuilder::kFragment_Visibility,
- kVec4f_GrSLType, kDefault_GrSLPrecision,
- "innerRect",
- &rectName);
- fRadiusPlusHalfUniform = args.fBuilder->addUniform(GrGLProgramBuilder::kFragment_Visibility,
- kFloat_GrSLType, kDefault_GrSLPrecision,
- "radiusPlusHalf",
- &radiusPlusHalfName);
+ fInnerRectUniform = args.fBuilder->addUniform(GrGLSLProgramBuilder::kFragment_Visibility,
+ kVec4f_GrSLType, kDefault_GrSLPrecision,
+ "innerRect",
+ &rectName);
+ fRadiusPlusHalfUniform = args.fBuilder->addUniform(GrGLSLProgramBuilder::kFragment_Visibility,
+ kFloat_GrSLType, kDefault_GrSLPrecision,
+ "radiusPlusHalf",
+ &radiusPlusHalfName);
- GrGLFragmentBuilder* fsBuilder = args.fBuilder->getFragmentShaderBuilder();
+ GrGLSLFragmentBuilder* fsBuilder = args.fBuilder->getFragmentShaderBuilder();
const char* fragmentPos = fsBuilder->fragmentPosition();
// At each quarter-circle corner we compute a vector that is the offset of the fragment position
// from the circle center. The vector is pinned in x and y to be in the quarter-plane relevant
@@ -364,7 +365,7 @@
////////////////////////////////////////////////////////////////////////////////////////////////////
void CircularRRectEffect::onGetGLProcessorKey(const GrGLSLCaps& caps,
- GrProcessorKeyBuilder* b) const {
+ GrProcessorKeyBuilder* b) const {
GLCircularRRectEffect::GenKey(*this, caps, b);
}
@@ -497,12 +498,12 @@
const EllipticalRRectEffect& erre = args.fFp.cast<EllipticalRRectEffect>();
const char *rectName;
// The inner rect is the rrect bounds inset by the x/y radii
- fInnerRectUniform = args.fBuilder->addUniform(GrGLProgramBuilder::kFragment_Visibility,
+ fInnerRectUniform = args.fBuilder->addUniform(GrGLSLProgramBuilder::kFragment_Visibility,
kVec4f_GrSLType, kDefault_GrSLPrecision,
"innerRect",
&rectName);
- GrGLFragmentBuilder* fsBuilder = args.fBuilder->getFragmentShaderBuilder();
+ GrGLSLFragmentBuilder* fsBuilder = args.fBuilder->getFragmentShaderBuilder();
const char* fragmentPos = fsBuilder->fragmentPosition();
// At each quarter-ellipse corner we compute a vector that is the offset of the fragment pos
// to the ellipse center. The vector is pinned in x and y to be in the quarter-plane relevant
@@ -522,10 +523,11 @@
switch (erre.getRRect().getType()) {
case SkRRect::kSimple_Type: {
const char *invRadiiXYSqdName;
- fInvRadiiSqdUniform = args.fBuilder->addUniform(GrGLProgramBuilder::kFragment_Visibility,
- kVec2f_GrSLType, kHigh_GrSLPrecision,
- "invRadiiXY",
- &invRadiiXYSqdName);
+ fInvRadiiSqdUniform = args.fBuilder->addUniform(
+ GrGLSLProgramBuilder::kFragment_Visibility,
+ kVec2f_GrSLType, kHigh_GrSLPrecision,
+ "invRadiiXY",
+ &invRadiiXYSqdName);
fsBuilder->codeAppend("\t\tvec2 dxy = max(max(dxy0, dxy1), 0.0);\n");
// Z is the x/y offsets divided by squared radii.
fsBuilder->codeAppendf("\t\tvec2 Z = dxy * %s;\n", invRadiiXYSqdName);
@@ -533,10 +535,11 @@
}
case SkRRect::kNinePatch_Type: {
const char *invRadiiLTRBSqdName;
- fInvRadiiSqdUniform = args.fBuilder->addUniform(GrGLProgramBuilder::kFragment_Visibility,
- kVec4f_GrSLType, kHigh_GrSLPrecision,
- "invRadiiLTRB",
- &invRadiiLTRBSqdName);
+ fInvRadiiSqdUniform = args.fBuilder->addUniform(
+ GrGLSLProgramBuilder::kFragment_Visibility,
+ kVec4f_GrSLType, kHigh_GrSLPrecision,
+ "invRadiiLTRB",
+ &invRadiiLTRBSqdName);
fsBuilder->codeAppend("\t\tvec2 dxy = max(max(dxy0, dxy1), 0.0);\n");
// Z is the x/y offsets divided by squared radii. We only care about the (at most) one
// corner where both the x and y offsets are positive, hence the maxes. (The inverse
@@ -613,7 +616,7 @@
////////////////////////////////////////////////////////////////////////////////////////////////////
void EllipticalRRectEffect::onGetGLProcessorKey(const GrGLSLCaps& caps,
- GrProcessorKeyBuilder* b) const {
+ GrProcessorKeyBuilder* b) const {
GLEllipticalRRectEffect::GenKey(*this, caps, b);
}
diff --git a/src/gpu/effects/GrSimpleTextureEffect.cpp b/src/gpu/effects/GrSimpleTextureEffect.cpp
index 89b3546..c1bc6df 100644
--- a/src/gpu/effects/GrSimpleTextureEffect.cpp
+++ b/src/gpu/effects/GrSimpleTextureEffect.cpp
@@ -11,14 +11,15 @@
#include "gl/GrGLCaps.h"
#include "gl/GrGLFragmentProcessor.h"
#include "gl/GrGLTexture.h"
-#include "gl/builders/GrGLProgramBuilder.h"
+#include "glsl/GrGLSLFragmentShaderBuilder.h"
+#include "glsl/GrGLSLProgramBuilder.h"
class GrGLSimpleTextureEffect : public GrGLFragmentProcessor {
public:
GrGLSimpleTextureEffect(const GrProcessor&) {}
virtual void emitCode(EmitArgs& args) override {
- GrGLFragmentBuilder* fsBuilder = args.fBuilder->getFragmentShaderBuilder();
+ GrGLSLFragmentBuilder* fsBuilder = args.fBuilder->getFragmentShaderBuilder();
fsBuilder->codeAppendf("\t%s = ", args.fOutputColor);
fsBuilder->appendTextureLookupAndModulate(args.fInputColor,
args.fSamplers[0],
@@ -38,7 +39,7 @@
}
void GrSimpleTextureEffect::onGetGLProcessorKey(const GrGLSLCaps& caps,
- GrProcessorKeyBuilder* b) const {
+ GrProcessorKeyBuilder* b) const {
GrGLSimpleTextureEffect::GenKey(*this, caps, b);
}
diff --git a/src/gpu/effects/GrTextureDomain.cpp b/src/gpu/effects/GrTextureDomain.cpp
index b6458dc..cd89a59 100644
--- a/src/gpu/effects/GrTextureDomain.cpp
+++ b/src/gpu/effects/GrTextureDomain.cpp
@@ -42,7 +42,7 @@
//////////////////////////////////////////////////////////////////////////////
-void GrTextureDomain::GLDomain::sampleTexture(GrGLShaderBuilder* builder,
+void GrTextureDomain::GLDomain::sampleTexture(GrGLSLShaderBuilder* builder,
const GrTextureDomain& textureDomain,
const char* outColor,
const SkString& inCoords,
@@ -86,7 +86,7 @@
}
case kDecal_Mode: {
// Add a block since we're going to declare variables.
- GrGLShaderBuilder::ShaderBlock block(builder);
+ GrGLSLShaderBuilder::ShaderBlock block(builder);
const char* domain = fDomainName.c_str();
if (!program->glslCaps()->canUseAnyFunctionInShader()) {
@@ -196,7 +196,7 @@
const GrTextureDomainEffect& textureDomainEffect = args.fFp.cast<GrTextureDomainEffect>();
const GrTextureDomain& domain = textureDomainEffect.textureDomain();
- GrGLFragmentBuilder* fsBuilder = args.fBuilder->getFragmentShaderBuilder();
+ GrGLSLFragmentBuilder* fsBuilder = args.fBuilder->getFragmentShaderBuilder();
SkString coords2D = fsBuilder->ensureFSCoords2D(args.fCoords, 0);
fGLDomain.sampleTexture(fsBuilder, domain, args.fOutputColor, coords2D, args.fSamplers[0],
args.fInputColor);
diff --git a/src/gpu/effects/GrTextureDomain.h b/src/gpu/effects/GrTextureDomain.h
index bbe988c..874cdbc 100644
--- a/src/gpu/effects/GrTextureDomain.h
+++ b/src/gpu/effects/GrTextureDomain.h
@@ -13,7 +13,7 @@
#include "glsl/GrGLSLProgramDataManager.h"
class GrGLProgramBuilder;
-class GrGLShaderBuilder;
+class GrGLSLShaderBuilder;
class GrInvariantOutput;
class GrGLSLTextureSampler;
struct SkRect;
@@ -113,7 +113,7 @@
* @param inModulateColor if non-nullptr the sampled color will be modulated with this
* expression before being written to outColor.
*/
- void sampleTexture(GrGLShaderBuilder* builder,
+ void sampleTexture(GrGLSLShaderBuilder* builder,
const GrTextureDomain& textureDomain,
const char* outColor,
const SkString& inCoords,
diff --git a/src/gpu/effects/GrXfermodeFragmentProcessor.cpp b/src/gpu/effects/GrXfermodeFragmentProcessor.cpp
index 73343e7..0dbb6eb 100644
--- a/src/gpu/effects/GrXfermodeFragmentProcessor.cpp
+++ b/src/gpu/effects/GrXfermodeFragmentProcessor.cpp
@@ -11,7 +11,8 @@
#include "effects/GrConstColorProcessor.h"
#include "gl/GrGLFragmentProcessor.h"
#include "gl/GrGLSLBlend.h"
-#include "gl/builders/GrGLProgramBuilder.h"
+#include "glsl/GrGLSLFragmentShaderBuilder.h"
+#include "glsl/GrGLSLProgramBuilder.h"
#include "SkGrPriv.h"
class ComposeTwoFragmentProcessor : public GrFragmentProcessor {
@@ -88,7 +89,7 @@
void GLComposeTwoFragmentProcessor::emitCode(EmitArgs& args) {
- GrGLFragmentBuilder* fsBuilder = args.fBuilder->getFragmentShaderBuilder();
+ GrGLSLFragmentBuilder* fsBuilder = args.fBuilder->getFragmentShaderBuilder();
const ComposeTwoFragmentProcessor& cs = args.fFp.cast<ComposeTwoFragmentProcessor>();
const char* inputColor = nullptr;
@@ -218,7 +219,7 @@
GLComposeOneFragmentProcessor(const GrProcessor& processor) {}
void emitCode(EmitArgs& args) override {
- GrGLFragmentBuilder* fsBuilder = args.fBuilder->getFragmentShaderBuilder();
+ GrGLSLFragmentBuilder* fsBuilder = args.fBuilder->getFragmentShaderBuilder();
SkXfermode::Mode mode = args.fFp.cast<ComposeOneFragmentProcessor>().mode();
ComposeOneFragmentProcessor::Child child =
args.fFp.cast<ComposeOneFragmentProcessor>().child();
diff --git a/src/gpu/effects/GrYUVtoRGBEffect.cpp b/src/gpu/effects/GrYUVtoRGBEffect.cpp
index 39a9743..daf1ca3 100644
--- a/src/gpu/effects/GrYUVtoRGBEffect.cpp
+++ b/src/gpu/effects/GrYUVtoRGBEffect.cpp
@@ -11,7 +11,8 @@
#include "GrInvariantOutput.h"
#include "GrProcessor.h"
#include "gl/GrGLFragmentProcessor.h"
-#include "gl/builders/GrGLProgramBuilder.h"
+#include "glsl/GrGLSLFragmentShaderBuilder.h"
+#include "glsl/GrGLSLProgramBuilder.h"
#include "glsl/GrGLSLProgramDataManager.h"
namespace {
@@ -63,12 +64,12 @@
GLProcessor(const GrProcessor&) {}
virtual void emitCode(EmitArgs& args) override {
- GrGLFragmentBuilder* fsBuilder = args.fBuilder->getFragmentShaderBuilder();
+ GrGLSLFragmentBuilder* fsBuilder = args.fBuilder->getFragmentShaderBuilder();
const char* yuvMatrix = nullptr;
- fMatrixUni = args.fBuilder->addUniform(GrGLProgramBuilder::kFragment_Visibility,
- kMat44f_GrSLType, kDefault_GrSLPrecision,
- "YUVMatrix", &yuvMatrix);
+ fMatrixUni = args.fBuilder->addUniform(GrGLSLProgramBuilder::kFragment_Visibility,
+ kMat44f_GrSLType, kDefault_GrSLPrecision,
+ "YUVMatrix", &yuvMatrix);
fsBuilder->codeAppendf("\t%s = vec4(\n\t\t", args.fOutputColor);
fsBuilder->appendTextureLookup(args.fSamplers[0], args.fCoords[0].c_str(),
args.fCoords[0].getType());
diff --git a/src/gpu/gl/GrGLFragmentProcessor.cpp b/src/gpu/gl/GrGLFragmentProcessor.cpp
index dcc6cb1..1d6f599 100644
--- a/src/gpu/gl/GrGLFragmentProcessor.cpp
+++ b/src/gpu/gl/GrGLFragmentProcessor.cpp
@@ -8,8 +8,8 @@
#include "GrGLFragmentProcessor.h"
#include "GrFragmentProcessor.h"
#include "GrProcessor.h"
-#include "builders/GrGLFragmentShaderBuilder.h"
-#include "builders/GrGLProgramBuilder.h"
+#include "glsl/GrGLSLFragmentShaderBuilder.h"
+#include "glsl/GrGLSLProgramBuilder.h"
void GrGLFragmentProcessor::setData(const GrGLSLProgramDataManager& pdman,
const GrFragmentProcessor& processor) {
@@ -28,7 +28,7 @@
SkString* outputColor, EmitArgs& args) {
SkASSERT(outputColor);
- GrGLFragmentBuilder* fb = args.fBuilder->getFragmentShaderBuilder();
+ GrGLSLFragmentBuilder* fb = args.fBuilder->getFragmentShaderBuilder();
outputColor->append(fb->getMangleString());
fb->codeAppendf("vec4 %s;", outputColor->c_str());
this->internalEmitChild(childIndex, inputColor, outputColor->c_str(), args);
@@ -36,7 +36,7 @@
void GrGLFragmentProcessor::internalEmitChild(int childIndex, const char* inputColor,
const char* outputColor, EmitArgs& args) {
- GrGLFragmentBuilder* fb = args.fBuilder->getFragmentShaderBuilder();
+ GrGLSLFragmentBuilder* fb = args.fBuilder->getFragmentShaderBuilder();
fb->onBeforeChildProcEmitCode(); // call first so mangleString is updated
diff --git a/src/gpu/gl/GrGLGeometryProcessor.cpp b/src/gpu/gl/GrGLGeometryProcessor.cpp
index c01e305..de4a5a3 100644
--- a/src/gpu/gl/GrGLGeometryProcessor.cpp
+++ b/src/gpu/gl/GrGLGeometryProcessor.cpp
@@ -7,11 +7,13 @@
#include "GrGLGeometryProcessor.h"
-#include "builders/GrGLProgramBuilder.h"
+#include "glsl/GrGLSLFragmentShaderBuilder.h"
#include "glsl/GrGLSLProcessorTypes.h"
+#include "glsl/GrGLSLProgramBuilder.h"
+#include "glsl/GrGLSLVertexShaderBuilder.h"
void GrGLGeometryProcessor::emitCode(EmitArgs& args) {
- GrGLVertexBuilder* vsBuilder = args.fPB->getVertexShaderBuilder();
+ GrGLSLVertexBuilder* vsBuilder = args.fPB->getVertexShaderBuilder();
GrGPArgs gpArgs;
this->onEmitCode(args, &gpArgs);
vsBuilder->transformToNormalizedDeviceSpace(gpArgs.fPositionVar);
@@ -23,7 +25,7 @@
const SkMatrix& localMatrix,
const TransformsIn& tin,
TransformsOut* tout) {
- GrGLVertexBuilder* vb = pb->getVertexShaderBuilder();
+ GrGLSLVertexBuilder* vb = pb->getVertexShaderBuilder();
tout->push_back_n(tin.count());
fInstalledTransforms.push_back_n(tin.count());
for (int i = 0; i < tin.count(); i++) {
@@ -45,7 +47,7 @@
const char* uniName;
fInstalledTransforms[i][t].fHandle =
- pb->addUniform(GrGLProgramBuilder::kVertex_Visibility,
+ pb->addUniform(GrGLSLProgramBuilder::kVertex_Visibility,
kMat33f_GrSLType, precision,
strUniName.c_str(),
&uniName).toIndex();
@@ -94,7 +96,7 @@
const char* localCoords,
const TransformsIn& tin,
TransformsOut* tout) {
- GrGLVertexBuilder* vb = pb->getVertexShaderBuilder();
+ GrGLSLVertexBuilder* vb = pb->getVertexShaderBuilder();
tout->push_back_n(tin.count());
for (int i = 0; i < tin.count(); i++) {
const ProcCoords& coordTransforms = tin[i];
@@ -122,7 +124,7 @@
void GrGLGeometryProcessor::setupPosition(GrGLSLGPBuilder* pb,
GrGPArgs* gpArgs,
const char* posName) {
- GrGLVertexBuilder* vsBuilder = pb->getVertexShaderBuilder();
+ GrGLSLVertexBuilder* vsBuilder = pb->getVertexShaderBuilder();
gpArgs->fPositionVar.set(kVec2f_GrSLType, "pos2");
vsBuilder->codeAppendf("vec2 %s = %s;", gpArgs->fPositionVar.c_str(), posName);
}
@@ -132,13 +134,13 @@
const char* posName,
const SkMatrix& mat,
UniformHandle* viewMatrixUniform) {
- GrGLVertexBuilder* vsBuilder = pb->getVertexShaderBuilder();
+ GrGLSLVertexBuilder* vsBuilder = pb->getVertexShaderBuilder();
if (mat.isIdentity()) {
gpArgs->fPositionVar.set(kVec2f_GrSLType, "pos2");
vsBuilder->codeAppendf("vec2 %s = %s;", gpArgs->fPositionVar.c_str(), posName);
} else {
const char* viewMatrixName;
- *viewMatrixUniform = pb->addUniform(GrGLProgramBuilder::kVertex_Visibility,
+ *viewMatrixUniform = pb->addUniform(GrGLSLProgramBuilder::kVertex_Visibility,
kMat33f_GrSLType, kHigh_GrSLPrecision,
"uViewM",
&viewMatrixName);
diff --git a/src/gpu/gl/GrGLPrimitiveProcessor.cpp b/src/gpu/gl/GrGLPrimitiveProcessor.cpp
index 35fa235..66d3892 100644
--- a/src/gpu/gl/GrGLPrimitiveProcessor.cpp
+++ b/src/gpu/gl/GrGLPrimitiveProcessor.cpp
@@ -7,7 +7,8 @@
#include "GrGLPrimitiveProcessor.h"
-#include "builders/GrGLProgramBuilder.h"
+#include "glsl/GrGLSLProgramBuilder.h"
+#include "glsl/GrGLSLFragmentShaderBuilder.h"
SkMatrix GrGLPrimitiveProcessor::GetTransformMatrix(const SkMatrix& localMatrix,
const GrCoordTransform& coordTransform) {
@@ -34,10 +35,10 @@
void GrGLPrimitiveProcessor::setupUniformColor(GrGLSLGPBuilder* pb,
const char* outputName,
UniformHandle* colorUniform) {
- GrGLFragmentBuilder* fs = pb->getFragmentShaderBuilder();
+ GrGLSLFragmentBuilder* fs = pb->getFragmentShaderBuilder();
SkASSERT(colorUniform);
const char* stagedLocalVarName;
- *colorUniform = pb->addUniform(GrGLProgramBuilder::kFragment_Visibility,
+ *colorUniform = pb->addUniform(GrGLSLProgramBuilder::kFragment_Visibility,
kVec4f_GrSLType,
kDefault_GrSLPrecision,
"Color",
diff --git a/src/gpu/gl/GrGLProgramDesc.cpp b/src/gpu/gl/GrGLProgramDesc.cpp
index 8ff2557..2255dbd 100644
--- a/src/gpu/gl/GrGLProgramDesc.cpp
+++ b/src/gpu/gl/GrGLProgramDesc.cpp
@@ -11,7 +11,7 @@
#include "GrGLGpu.h"
#include "GrPipeline.h"
#include "SkChecksum.h"
-#include "gl/builders/GrGLFragmentShaderBuilder.h"
+#include "glsl/GrGLSLFragmentShaderBuilder.h"
/**
* Do we need to either map r,g,b->a or a->r. configComponentMask indicates which channels are
@@ -146,7 +146,7 @@
if (pipeline.readsFragPosition()) {
header->fFragPosKey =
- GrGLFragmentShaderBuilder::KeyForFragmentPosition(pipeline.getRenderTarget());
+ GrGLSLFragmentShaderBuilder::KeyForFragmentPosition(pipeline.getRenderTarget());
} else {
header->fFragPosKey = 0;
}
diff --git a/src/gpu/gl/GrGLSLBlend.cpp b/src/gpu/gl/GrGLSLBlend.cpp
index 6a057c6..3c83068 100644
--- a/src/gpu/gl/GrGLSLBlend.cpp
+++ b/src/gpu/gl/GrGLSLBlend.cpp
@@ -5,13 +5,13 @@
* found in the LICENSE file.
*/
#include "GrGLSLBlend.h"
-#include "gl/builders/GrGLFragmentShaderBuilder.h"
+#include "glsl/GrGLSLFragmentShaderBuilder.h"
//////////////////////////////////////////////////////////////////////////////
// Advanced (non-coeff) blend helpers
//////////////////////////////////////////////////////////////////////////////
-static void hard_light(GrGLFragmentBuilder* fsBuilder,
+static void hard_light(GrGLSLFragmentBuilder* fsBuilder,
const char* final,
const char* src,
const char* dst) {
@@ -32,7 +32,7 @@
}
// Does one component of color-dodge
-static void color_dodge_component(GrGLFragmentBuilder* fsBuilder,
+static void color_dodge_component(GrGLSLFragmentBuilder* fsBuilder,
const char* final,
const char* src,
const char* dst,
@@ -56,7 +56,7 @@
}
// Does one component of color-burn
-static void color_burn_component(GrGLFragmentBuilder* fsBuilder,
+static void color_burn_component(GrGLSLFragmentBuilder* fsBuilder,
const char* final,
const char* src,
const char* dst,
@@ -77,7 +77,7 @@
}
// Does one component of soft-light. Caller should have already checked that dst alpha > 0.
-static void soft_light_component_pos_dst_alpha(GrGLFragmentBuilder* fsBuilder,
+static void soft_light_component_pos_dst_alpha(GrGLSLFragmentBuilder* fsBuilder,
const char* final,
const char* src,
const char* dst,
@@ -119,7 +119,7 @@
// hue and saturation of the first color, the luminosity of the second color, and the input
// alpha. It has this signature:
// vec3 set_luminance(vec3 hueSatColor, float alpha, vec3 lumColor).
-static void add_lum_function(GrGLFragmentBuilder* fsBuilder, SkString* setLumFunction) {
+static void add_lum_function(GrGLSLFragmentBuilder* fsBuilder, SkString* setLumFunction) {
// Emit a helper that gets the luminance of a color.
SkString getFunction;
GrGLSLShaderVar getLumArgs[] = {
@@ -164,7 +164,7 @@
// Adds a function that creates a color with the hue and luminosity of one input color and
// the saturation of another color. It will have this signature:
// float set_saturation(vec3 hueLumColor, vec3 satColor)
-static void add_sat_function(GrGLFragmentBuilder* fsBuilder, SkString* setSatFunction) {
+static void add_sat_function(GrGLSLFragmentBuilder* fsBuilder, SkString* setSatFunction) {
// Emit a helper that gets the saturation of a color
SkString getFunction;
GrGLSLShaderVar getSatArgs[] = { GrGLSLShaderVar("color", kVec3f_GrSLType) };
@@ -235,7 +235,7 @@
setSatFunction);
}
-static void emit_advanced_xfermode_code(GrGLFragmentBuilder* fsBuilder, const char* srcColor,
+static void emit_advanced_xfermode_code(GrGLSLFragmentBuilder* fsBuilder, const char* srcColor,
const char* dstColor, const char* outputColor,
SkXfermode::Mode mode) {
SkASSERT(srcColor);
@@ -368,7 +368,7 @@
// Porter-Duff blend helper
//////////////////////////////////////////////////////////////////////////////
-static bool append_porterduff_term(GrGLFragmentBuilder* fsBuilder, SkXfermode::Coeff coeff,
+static bool append_porterduff_term(GrGLSLFragmentBuilder* fsBuilder, SkXfermode::Coeff coeff,
const char* colorName, const char* srcColorName,
const char* dstColorName, bool hasPrevious) {
if (SkXfermode::kZero_Coeff == coeff) {
@@ -414,7 +414,7 @@
//////////////////////////////////////////////////////////////////////////////
-void GrGLSLBlend::AppendMode(GrGLFragmentBuilder* fsBuilder, const char* srcColor,
+void GrGLSLBlend::AppendMode(GrGLSLFragmentBuilder* fsBuilder, const char* srcColor,
const char* dstColor, const char* outColor,
SkXfermode::Mode mode) {
diff --git a/src/gpu/gl/GrGLSLBlend.h b/src/gpu/gl/GrGLSLBlend.h
index b763f45..25ae37b 100644
--- a/src/gpu/gl/GrGLSLBlend.h
+++ b/src/gpu/gl/GrGLSLBlend.h
@@ -10,14 +10,14 @@
#include "SkXfermode.h"
-class GrGLFragmentBuilder;
+class GrGLSLFragmentBuilder;
namespace GrGLSLBlend {
/*
* Appends GLSL code to fsBuilder that assigns a specified blend of the srcColor and dstColor
* variables to the outColor variable.
*/
- void AppendMode(GrGLFragmentBuilder* fsBuilder, const char* srcColor,
+ void AppendMode(GrGLSLFragmentBuilder* fsBuilder, const char* srcColor,
const char* dstColor, const char* outColor, SkXfermode::Mode mode);
};
diff --git a/src/gpu/gl/GrGLXferProcessor.cpp b/src/gpu/gl/GrGLXferProcessor.cpp
index 528d354..bf333bb 100644
--- a/src/gpu/gl/GrGLXferProcessor.cpp
+++ b/src/gpu/gl/GrGLXferProcessor.cpp
@@ -8,8 +8,8 @@
#include "gl/GrGLXferProcessor.h"
#include "GrXferProcessor.h"
-#include "gl/builders/GrGLFragmentShaderBuilder.h"
-#include "gl/builders/GrGLProgramBuilder.h"
+#include "glsl/GrGLSLFragmentShaderBuilder.h"
+#include "glsl/GrGLSLProgramBuilder.h"
#include "glsl/GrGLSLProgramDataManager.h"
void GrGLXferProcessor::emitCode(const EmitArgs& args) {
@@ -18,7 +18,7 @@
return;
}
- GrGLXPFragmentBuilder* fsBuilder = args.fPB->getFragmentShaderBuilder();
+ GrGLSLXPFragmentBuilder* fsBuilder = args.fPB->getFragmentShaderBuilder();
const char* dstColor = fsBuilder->dstColor();
if (args.fXP.getDstTexture()) {
@@ -35,12 +35,12 @@
const char* dstTopLeftName;
const char* dstCoordScaleName;
- fDstTopLeftUni = args.fPB->addUniform(GrGLProgramBuilder::kFragment_Visibility,
+ fDstTopLeftUni = args.fPB->addUniform(GrGLSLProgramBuilder::kFragment_Visibility,
kVec2f_GrSLType,
kDefault_GrSLPrecision,
"DstTextureUpperLeft",
&dstTopLeftName);
- fDstScaleUni = args.fPB->addUniform(GrGLProgramBuilder::kFragment_Visibility,
+ fDstScaleUni = args.fPB->addUniform(GrGLSLProgramBuilder::kFragment_Visibility,
kVec2f_GrSLType,
kDefault_GrSLPrecision,
"DstTextureCoordScale",
diff --git a/src/gpu/gl/builders/GrGLProgramBuilder.cpp b/src/gpu/gl/builders/GrGLProgramBuilder.cpp
index d336ff1..67ba083 100644
--- a/src/gpu/gl/builders/GrGLProgramBuilder.cpp
+++ b/src/gpu/gl/builders/GrGLProgramBuilder.cpp
@@ -356,7 +356,7 @@
}
}
-bool GrGLProgramBuilder::compileAndAttachShaders(GrGLShaderBuilder& shader,
+bool GrGLProgramBuilder::compileAndAttachShaders(GrGLSLShaderBuilder& shader,
GrGLuint programId,
GrGLenum type,
SkTDArray<GrGLuint>* shaderIds) {
@@ -442,11 +442,11 @@
const GrGLCaps& caps = this->gpu()->glCaps();
if (fFS.hasCustomColorOutput() && caps.bindFragDataLocationSupport()) {
GL_CALL(BindFragDataLocation(programID, 0,
- GrGLFragmentShaderBuilder::DeclaredColorOutputName()));
+ GrGLSLFragmentShaderBuilder::DeclaredColorOutputName()));
}
if (fFS.hasSecondaryOutput() && caps.glslCaps()->mustDeclareFragmentShaderOutput()) {
GL_CALL(BindFragDataLocationIndexed(programID, 0, 1,
- GrGLFragmentShaderBuilder::DeclaredSecondaryColorOutputName()));
+ GrGLSLFragmentShaderBuilder::DeclaredSecondaryColorOutputName()));
}
// handle NVPR separable varyings
diff --git a/src/gpu/gl/builders/GrGLProgramBuilder.h b/src/gpu/gl/builders/GrGLProgramBuilder.h
index c524f59..21724c1 100644
--- a/src/gpu/gl/builders/GrGLProgramBuilder.h
+++ b/src/gpu/gl/builders/GrGLProgramBuilder.h
@@ -18,12 +18,9 @@
class GrFragmentProcessor;
class GrGLContextInfo;
-class GrGLShaderBuilder;
+class GrGLSLShaderBuilder;
class GrGLSLCaps;
-// Enough precision to represent 1 / 2048 accurately in printf
-#define GR_SIGNIFICANT_POW2_DECIMAL_DIG 11
-
/**
* The below struct represent processors installed in programs.
*/
@@ -135,7 +132,7 @@
GrGLSLTextureSampler::TextureSamplerArray* outSamplers,
GrGLInstalledProc<Proc>*);
- bool compileAndAttachShaders(GrGLShaderBuilder& shader,
+ bool compileAndAttachShaders(GrGLSLShaderBuilder& shader,
GrGLuint programId,
GrGLenum type,
SkTDArray<GrGLuint>* shaderIds);
@@ -184,10 +181,10 @@
SkTArray<UniformHandle> fSamplerUniforms;
SeparableVaryingInfoArray fSeparableVaryingInfos;
- friend class GrGLShaderBuilder;
- friend class GrGLVertexBuilder;
- friend class GrGLFragmentShaderBuilder;
- friend class GrGLGeometryBuilder;
+ friend class GrGLSLShaderBuilder;
+ friend class GrGLSLVertexBuilder;
+ friend class GrGLSLFragmentShaderBuilder;
+ friend class GrGLSLGeometryBuilder;
typedef GrGLSLProgramBuilder INHERITED;
};
diff --git a/src/gpu/gl/builders/GrGLFragmentShaderBuilder.cpp b/src/gpu/glsl/GrGLSLFragmentShaderBuilder.cpp
similarity index 87%
rename from src/gpu/gl/builders/GrGLFragmentShaderBuilder.cpp
rename to src/gpu/glsl/GrGLSLFragmentShaderBuilder.cpp
index c464ffd..5a3e09d 100644
--- a/src/gpu/gl/builders/GrGLFragmentShaderBuilder.cpp
+++ b/src/gpu/glsl/GrGLSLFragmentShaderBuilder.cpp
@@ -5,13 +5,13 @@
* found in the LICENSE file.
*/
-#include "GrGLFragmentShaderBuilder.h"
+#include "GrGLSLFragmentShaderBuilder.h"
#include "GrRenderTarget.h"
#include "glsl/GrGLSL.h"
#include "glsl/GrGLSLCaps.h"
#include "glsl/GrGLSLProgramBuilder.h"
-const char* GrGLFragmentShaderBuilder::kDstTextureColorName = "_dstColor";
+const char* GrGLSLFragmentShaderBuilder::kDstTextureColorName = "_dstColor";
static const char* specific_layout_qualifier_name(GrBlendEquation equation) {
SkASSERT(GrBlendEquationIsAdvanced(equation));
@@ -54,8 +54,8 @@
kGrBlendEquationCnt - kFirstAdvancedGrBlendEquation);
}
-GrGLFragmentShaderBuilder::FragPosKey
-GrGLFragmentShaderBuilder::KeyForFragmentPosition(const GrRenderTarget* dst) {
+GrGLSLFragmentShaderBuilder::FragPosKey
+GrGLSLFragmentShaderBuilder::KeyForFragmentPosition(const GrRenderTarget* dst) {
if (kTopLeft_GrSurfaceOrigin == dst->origin()) {
return kTopLeftFragPosRead_FragPosKey;
} else {
@@ -63,8 +63,8 @@
}
}
-GrGLFragmentShaderBuilder::GrGLFragmentShaderBuilder(GrGLSLProgramBuilder* program,
- uint8_t fragPosKey)
+GrGLSLFragmentShaderBuilder::GrGLSLFragmentShaderBuilder(GrGLSLProgramBuilder* program,
+ uint8_t fragPosKey)
: INHERITED(program)
, fSetupFragPosition(false)
, fTopLeftFragPosRead(kTopLeftFragPosRead_FragPosKey == fragPosKey)
@@ -73,7 +73,7 @@
, fHasReadFragmentPosition(false) {
}
-bool GrGLFragmentShaderBuilder::enableFeature(GLSLFeature feature) {
+bool GrGLSLFragmentShaderBuilder::enableFeature(GLSLFeature feature) {
switch (feature) {
case kStandardDerivatives_GLSLFeature: {
if (!fProgramBuilder->glslCaps()->shaderDerivativeSupport()) {
@@ -91,8 +91,8 @@
}
}
-SkString GrGLFragmentShaderBuilder::ensureFSCoords2D(const GrGLSLTransformedCoordsArray& coords,
- int index) {
+SkString GrGLSLFragmentShaderBuilder::ensureFSCoords2D(const GrGLSLTransformedCoordsArray& coords,
+ int index) {
if (kVec3f_GrSLType != coords[index].getType()) {
SkASSERT(kVec2f_GrSLType == coords[index].getType());
return coords[index].getName();
@@ -107,7 +107,7 @@
return coords2D;
}
-const char* GrGLFragmentShaderBuilder::fragmentPosition() {
+const char* GrGLSLFragmentShaderBuilder::fragmentPosition() {
fHasReadFragmentPosition = true;
const GrGLSLCaps* glslCaps = fProgramBuilder->glslCaps();
@@ -160,12 +160,12 @@
}
}
-const char* GrGLFragmentShaderBuilder::dstColor() {
+const char* GrGLSLFragmentShaderBuilder::dstColor() {
fHasReadDstColor = true;
const GrGLSLCaps* glslCaps = fProgramBuilder->glslCaps();
if (glslCaps->fbFetchSupport()) {
- this->addFeature(1 << (GrGLFragmentShaderBuilder::kLastGLSLPrivateFeature + 1),
+ this->addFeature(1 << (GrGLSLFragmentShaderBuilder::kLastGLSLPrivateFeature + 1),
glslCaps->fbFetchExtensionString());
// Some versions of this extension string require declaring custom color output on ES 3.0+
@@ -181,7 +181,7 @@
}
}
-void GrGLFragmentShaderBuilder::enableAdvancedBlendEquationIfNeeded(GrBlendEquation equation) {
+void GrGLSLFragmentShaderBuilder::enableAdvancedBlendEquationIfNeeded(GrBlendEquation equation) {
SkASSERT(GrBlendEquationIsAdvanced(equation));
const GrGLSLCaps& caps = *fProgramBuilder->glslCaps();
@@ -198,7 +198,7 @@
}
}
-void GrGLFragmentShaderBuilder::enableCustomOutput() {
+void GrGLSLFragmentShaderBuilder::enableCustomOutput() {
if (!fHasCustomColorOutput) {
fHasCustomColorOutput = true;
fCustomColorOutputIndex = fOutputs.count();
@@ -208,7 +208,7 @@
}
}
-void GrGLFragmentShaderBuilder::enableSecondaryOutput() {
+void GrGLSLFragmentShaderBuilder::enableSecondaryOutput() {
SkASSERT(!fHasSecondaryOutput);
fHasSecondaryOutput = true;
const GrGLSLCaps& caps = *fProgramBuilder->glslCaps();
@@ -226,23 +226,23 @@
}
}
-const char* GrGLFragmentShaderBuilder::getPrimaryColorOutputName() const {
+const char* GrGLSLFragmentShaderBuilder::getPrimaryColorOutputName() const {
return fHasCustomColorOutput ? DeclaredColorOutputName() : "gl_FragColor";
}
-const char* GrGLFragmentShaderBuilder::getSecondaryColorOutputName() const {
+const char* GrGLSLFragmentShaderBuilder::getSecondaryColorOutputName() const {
const GrGLSLCaps& caps = *fProgramBuilder->glslCaps();
return caps.mustDeclareFragmentShaderOutput() ? DeclaredSecondaryColorOutputName()
: "gl_SecondaryFragColorEXT";
}
-void GrGLFragmentShaderBuilder::onFinalize() {
+void GrGLSLFragmentShaderBuilder::onFinalize() {
GrGLSLAppendDefaultFloatPrecisionDeclaration(kDefault_GrSLPrecision,
*fProgramBuilder->glslCaps(),
&this->precisionQualifier());
}
-void GrGLFragmentShaderBuilder::addVarying(GrGLSLVarying* v, GrSLPrecision fsPrec) {
+void GrGLSLFragmentShaderBuilder::addVarying(GrGLSLVarying* v, GrSLPrecision fsPrec) {
v->fFsIn = v->fVsOut;
if (v->fGsOut) {
v->fFsIn = v->fGsOut;
@@ -250,7 +250,7 @@
fInputs.push_back().set(v->fType, GrGLSLShaderVar::kVaryingIn_TypeModifier, v->fFsIn, fsPrec);
}
-void GrGLFragmentBuilder::onBeforeChildProcEmitCode() {
+void GrGLSLFragmentBuilder::onBeforeChildProcEmitCode() {
SkASSERT(fSubstageIndices.count() >= 1);
fSubstageIndices.push_back(0);
// second-to-last value in the fSubstageIndices stack is the index of the child proc
@@ -258,7 +258,7 @@
fMangleString.appendf("_c%d", fSubstageIndices[fSubstageIndices.count() - 2]);
}
-void GrGLFragmentBuilder::onAfterChildProcEmitCode() {
+void GrGLSLFragmentBuilder::onAfterChildProcEmitCode() {
SkASSERT(fSubstageIndices.count() >= 2);
fSubstageIndices.pop_back();
fSubstageIndices.back()++;
diff --git a/src/gpu/gl/builders/GrGLFragmentShaderBuilder.h b/src/gpu/glsl/GrGLSLFragmentShaderBuilder.h
similarity index 89%
rename from src/gpu/gl/builders/GrGLFragmentShaderBuilder.h
rename to src/gpu/glsl/GrGLSLFragmentShaderBuilder.h
index 16cc8cf..b98f702 100644
--- a/src/gpu/gl/builders/GrGLFragmentShaderBuilder.h
+++ b/src/gpu/glsl/GrGLSLFragmentShaderBuilder.h
@@ -5,10 +5,10 @@
* found in the LICENSE file.
*/
-#ifndef GrGLFragmentShaderBuilder_DEFINED
-#define GrGLFragmentShaderBuilder_DEFINED
+#ifndef GrGLSLFragmentShaderBuilder_DEFINED
+#define GrGLSLFragmentShaderBuilder_DEFINED
-#include "GrGLShaderBuilder.h"
+#include "GrGLSLShaderBuilder.h"
#include "glsl/GrGLSLProcessorTypes.h"
@@ -18,15 +18,15 @@
/*
* This base class encapsulates the functionality which the GP uses to build fragment shaders
*/
-class GrGLFragmentBuilder : public GrGLShaderBuilder {
+class GrGLSLFragmentBuilder : public GrGLSLShaderBuilder {
public:
- GrGLFragmentBuilder(GrGLSLProgramBuilder* program)
+ GrGLSLFragmentBuilder(GrGLSLProgramBuilder* program)
: INHERITED(program)
, fHasCustomColorOutput(false)
, fHasSecondaryOutput(false) {
fSubstageIndices.push_back(0);
}
- virtual ~GrGLFragmentBuilder() {}
+ virtual ~GrGLSLFragmentBuilder() {}
/**
* Use of these features may require a GLSL extension to be enabled. Shaders may not compile
* if code is added that uses one of these features without calling enableFeature()
@@ -93,7 +93,7 @@
friend class GrGLPathProcessor;
- typedef GrGLShaderBuilder INHERITED;
+ typedef GrGLSLShaderBuilder INHERITED;
};
/*
@@ -101,9 +101,9 @@
* this builder to create their shader. Because this is the only shader builder the FP sees, we
* just call it FPShaderBuilder
*/
-class GrGLXPFragmentBuilder : public GrGLFragmentBuilder {
+class GrGLSLXPFragmentBuilder : public GrGLSLFragmentBuilder {
public:
- GrGLXPFragmentBuilder(GrGLSLProgramBuilder* program) : INHERITED(program) {}
+ GrGLSLXPFragmentBuilder(GrGLSLProgramBuilder* program) : INHERITED(program) {}
/** Returns the variable name that holds the color of the destination pixel. This may be nullptr if
no effect advertised that it will read the destination. */
@@ -115,11 +115,11 @@
virtual void enableAdvancedBlendEquationIfNeeded(GrBlendEquation) = 0;
private:
- typedef GrGLFragmentBuilder INHERITED;
+ typedef GrGLSLFragmentBuilder INHERITED;
};
// TODO rename to Fragment Builder
-class GrGLFragmentShaderBuilder : public GrGLXPFragmentBuilder {
+class GrGLSLFragmentShaderBuilder : public GrGLSLXPFragmentBuilder {
public:
typedef uint8_t FragPosKey;
@@ -128,7 +128,7 @@
the key is 0. */
static FragPosKey KeyForFragmentPosition(const GrRenderTarget* dst);
- GrGLFragmentShaderBuilder(GrGLSLProgramBuilder* program, uint8_t fragPosKey);
+ GrGLSLFragmentShaderBuilder(GrGLSLProgramBuilder* program, uint8_t fragPosKey);
// true public interface, defined explicitly in the abstract interfaces above
bool enableFeature(GLSLFeature) override;
@@ -166,7 +166,7 @@
void onFinalize() override;
/**
- * Features that should only be enabled by GrGLFragmentShaderBuilder itself.
+ * Features that should only be enabled by GrGLSLFragmentShaderBuilder itself.
*/
enum GLSLPrivateFeature {
kFragCoordConventions_GLSLPrivateFeature = kLastGLSLFeature + 1,
@@ -195,7 +195,7 @@
friend class GrGLProgramBuilder;
- typedef GrGLXPFragmentBuilder INHERITED;
+ typedef GrGLSLXPFragmentBuilder INHERITED;
};
#endif
diff --git a/src/gpu/gl/builders/GrGLGeometryShaderBuilder.cpp b/src/gpu/glsl/GrGLSLGeometryShaderBuilder.cpp
similarity index 74%
rename from src/gpu/gl/builders/GrGLGeometryShaderBuilder.cpp
rename to src/gpu/glsl/GrGLSLGeometryShaderBuilder.cpp
index 420c513..275972b 100644
--- a/src/gpu/gl/builders/GrGLGeometryShaderBuilder.cpp
+++ b/src/gpu/glsl/GrGLSLGeometryShaderBuilder.cpp
@@ -5,16 +5,17 @@
* found in the LICENSE file.
*/
-#include "GrGLGeometryShaderBuilder.h"
-#include "GrGLProgramBuilder.h"
-#include "../GrGLGpu.h"
+#include "GrGLSLGeometryShaderBuilder.h"
+#include "GrGLSLProgramBuilder.h"
-GrGLGeometryBuilder::GrGLGeometryBuilder(GrGLSLProgramBuilder* program)
+GrGLSLGeometryBuilder::GrGLSLGeometryBuilder(GrGLSLProgramBuilder* program)
: INHERITED(program) {
}
-void GrGLGeometryBuilder::addVarying(const char* name, GrSLPrecision precision, GrGLSLVarying* v) {
+void GrGLSLGeometryBuilder::addVarying(const char* name,
+ GrSLPrecision precision,
+ GrGLSLVarying* v) {
// if we have a GS take each varying in as an array
// and output as non-array.
if (v->vsVarying()) {
diff --git a/src/gpu/gl/builders/GrGLGeometryShaderBuilder.h b/src/gpu/glsl/GrGLSLGeometryShaderBuilder.h
similarity index 60%
rename from src/gpu/gl/builders/GrGLGeometryShaderBuilder.h
rename to src/gpu/glsl/GrGLSLGeometryShaderBuilder.h
index e807646..ca24c79 100644
--- a/src/gpu/gl/builders/GrGLGeometryShaderBuilder.h
+++ b/src/gpu/glsl/GrGLSLGeometryShaderBuilder.h
@@ -5,16 +5,16 @@
* found in the LICENSE file.
*/
-#ifndef GrGLGeometryShaderBuilder_DEFINED
-#define GrGLGeometryShaderBuilder_DEFINED
+#ifndef GrGLSLGeometryShaderBuilder_DEFINED
+#define GrGLSLGeometryShaderBuilder_DEFINED
-#include "GrGLShaderBuilder.h"
+#include "GrGLSLShaderBuilder.h"
class GrGLSLVarying;
-class GrGLGeometryBuilder : public GrGLShaderBuilder {
+class GrGLSLGeometryBuilder : public GrGLSLShaderBuilder {
public:
- GrGLGeometryBuilder(GrGLSLProgramBuilder* program);
+ GrGLSLGeometryBuilder(GrGLSLProgramBuilder* program);
private:
/*
@@ -26,7 +26,7 @@
friend class GrGLProgramBuilder;
- typedef GrGLShaderBuilder INHERITED;
+ typedef GrGLSLShaderBuilder INHERITED;
};
#endif
diff --git a/src/gpu/glsl/GrGLSLProgramBuilder.h b/src/gpu/glsl/GrGLSLProgramBuilder.h
index f783a40..568fe8a 100644
--- a/src/gpu/glsl/GrGLSLProgramBuilder.h
+++ b/src/gpu/glsl/GrGLSLProgramBuilder.h
@@ -10,14 +10,17 @@
#include "GrGeometryProcessor.h"
#include "GrGpu.h"
-#include "gl/builders/GrGLFragmentShaderBuilder.h"
-#include "gl/builders/GrGLGeometryShaderBuilder.h"
-#include "gl/builders/GrGLVertexShaderBuilder.h"
+#include "glsl/GrGLSLFragmentShaderBuilder.h"
+#include "glsl/GrGLSLGeometryShaderBuilder.h"
#include "glsl/GrGLSLProgramDataManager.h"
+#include "glsl/GrGLSLVertexShaderBuilder.h"
class GrGLSLCaps;
class GrGLSLShaderVar;
+// Enough precision to represent 1 / 2048 accurately in printf
+#define GR_SIGNIFICANT_POW2_DECIMAL_DIG 11
+
class GrGLSLUniformBuilder {
public:
enum ShaderVisibility {
@@ -111,10 +114,10 @@
const char* fGsOut;
const char* fFsIn;
- friend class GrGLVertexBuilder;
- friend class GrGLGeometryBuilder;
- friend class GrGLXferBuilder;
- friend class GrGLFragmentShaderBuilder;
+ friend class GrGLSLVertexBuilder;
+ friend class GrGLSLGeometryBuilder;
+ friend class GrGLSLXferBuilder;
+ friend class GrGLSLFragmentShaderBuilder;
};
struct GrGLSLVertToFrag : public GrGLSLVarying {
@@ -163,8 +166,8 @@
GrSLPrecision fsPrecision = kDefault_GrSLPrecision) = 0;
// TODO rename getFragmentBuilder
- virtual GrGLFragmentBuilder* getFragmentShaderBuilder() = 0;
- virtual GrGLVertexBuilder* getVertexShaderBuilder() = 0;
+ virtual GrGLSLFragmentBuilder* getFragmentShaderBuilder() = 0;
+ virtual GrGLSLVertexBuilder* getVertexShaderBuilder() = 0;
/*
* *NOTE* NO MEMBERS ALLOWED, MULTIPLE INHERITANCE
@@ -175,7 +178,7 @@
/* a specializations for FPs. Lets the user add uniforms and FS code */
class GrGLSLFPBuilder : public virtual GrGLSLUniformBuilder {
public:
- virtual GrGLFragmentBuilder* getFragmentShaderBuilder() = 0;
+ virtual GrGLSLFragmentBuilder* getFragmentShaderBuilder() = 0;
/*
* *NOTE* NO MEMBERS ALLOWED, MULTIPLE INHERITANCE
@@ -185,7 +188,7 @@
/* a specializations for XPs. Lets the user add uniforms and FS code */
class GrGLSLXPBuilder : public virtual GrGLSLUniformBuilder {
public:
- virtual GrGLXPFragmentBuilder* getFragmentShaderBuilder() = 0;
+ virtual GrGLSLXPFragmentBuilder* getFragmentShaderBuilder() = 0;
/*
* *NOTE* NO MEMBERS ALLOWED, MULTIPLE INHERITANCE
@@ -198,8 +201,8 @@
public:
typedef GrGpu::DrawArgs DrawArgs;
- GrGLXPFragmentBuilder* getFragmentShaderBuilder() override { return &fFS; }
- GrGLVertexBuilder* getVertexShaderBuilder() override { return &fVS; }
+ GrGLSLXPFragmentBuilder* getFragmentShaderBuilder() override { return &fFS; }
+ GrGLSLVertexBuilder* getVertexShaderBuilder() override { return &fVS; }
// Handles for program uniforms (other than per-effect uniforms)
struct BuiltinUniformHandles {
@@ -240,9 +243,9 @@
// number of each input/output type in a single allocation block, used by many builders
static const int kVarsPerBlock;
- GrGLVertexBuilder fVS;
- GrGLGeometryBuilder fGS;
- GrGLFragmentShaderBuilder fFS;
+ GrGLSLVertexBuilder fVS;
+ GrGLSLGeometryBuilder fGS;
+ GrGLSLFragmentShaderBuilder fFS;
int fStageIndex;
BuiltinUniformHandles fUniformHandles;
@@ -252,10 +255,10 @@
private:
virtual void onAppendUniformDecls(ShaderVisibility visibility, SkString* out) const = 0;
- friend class GrGLShaderBuilder;
- friend class GrGLVertexBuilder;
- friend class GrGLFragmentShaderBuilder;
- friend class GrGLGeometryBuilder;
+ friend class GrGLSLShaderBuilder;
+ friend class GrGLSLVertexBuilder;
+ friend class GrGLSLFragmentShaderBuilder;
+ friend class GrGLSLGeometryBuilder;
};
#endif
diff --git a/src/gpu/gl/builders/GrGLShaderBuilder.cpp b/src/gpu/glsl/GrGLSLShaderBuilder.cpp
similarity index 77%
rename from src/gpu/gl/builders/GrGLShaderBuilder.cpp
rename to src/gpu/glsl/GrGLSLShaderBuilder.cpp
index ed5c3d4..d4d16fc 100644
--- a/src/gpu/gl/builders/GrGLShaderBuilder.cpp
+++ b/src/gpu/glsl/GrGLSLShaderBuilder.cpp
@@ -5,7 +5,7 @@
* found in the LICENSE file.
*/
-#include "GrGLShaderBuilder.h"
+#include "glsl/GrGLSLShaderBuilder.h"
#include "glsl/GrGLSLCaps.h"
#include "glsl/GrGLSLShaderVar.h"
#include "glsl/GrGLSLTextureSampler.h"
@@ -69,7 +69,7 @@
}
}
-GrGLShaderBuilder::GrGLShaderBuilder(GrGLSLProgramBuilder* program)
+GrGLSLShaderBuilder::GrGLSLShaderBuilder(GrGLSLProgramBuilder* program)
: fProgramBuilder(program)
, fInputs(GrGLSLProgramBuilder::kVarsPerBlock)
, fOutputs(GrGLSLProgramBuilder::kVarsPerBlock)
@@ -86,18 +86,18 @@
this->main() = "void main() {";
}
-void GrGLShaderBuilder::declAppend(const GrGLSLShaderVar& var) {
+void GrGLSLShaderBuilder::declAppend(const GrGLSLShaderVar& var) {
SkString tempDecl;
var.appendDecl(fProgramBuilder->glslCaps(), &tempDecl);
this->codeAppendf("%s;", tempDecl.c_str());
}
-void GrGLShaderBuilder::emitFunction(GrSLType returnType,
- const char* name,
- int argCnt,
- const GrGLSLShaderVar* args,
- const char* body,
- SkString* outName) {
+void GrGLSLShaderBuilder::emitFunction(GrSLType returnType,
+ const char* name,
+ int argCnt,
+ const GrGLSLShaderVar* args,
+ const char* body,
+ SkString* outName) {
this->functions().append(GrGLSLTypeString(returnType));
fProgramBuilder->nameVariable(outName, '\0', name);
this->functions().appendf(" %s", outName->c_str());
@@ -113,10 +113,10 @@
this->functions().append("}\n\n");
}
-void GrGLShaderBuilder::appendTextureLookup(SkString* out,
- const GrGLSLTextureSampler& sampler,
- const char* coordName,
- GrSLType varyingType) const {
+void GrGLSLShaderBuilder::appendTextureLookup(SkString* out,
+ const GrGLSLTextureSampler& sampler,
+ const char* coordName,
+ GrSLType varyingType) const {
append_texture_lookup(out,
fProgramBuilder->glslCaps(),
fProgramBuilder->getUniformCStr(sampler.fSamplerUniform),
@@ -126,42 +126,42 @@
varyingType);
}
-void GrGLShaderBuilder::appendTextureLookup(const GrGLSLTextureSampler& sampler,
- const char* coordName,
- GrSLType varyingType) {
+void GrGLSLShaderBuilder::appendTextureLookup(const GrGLSLTextureSampler& sampler,
+ const char* coordName,
+ GrSLType varyingType) {
this->appendTextureLookup(&this->code(), sampler, coordName, varyingType);
}
-void GrGLShaderBuilder::appendTextureLookupAndModulate(const char* modulation,
- const GrGLSLTextureSampler& sampler,
- const char* coordName,
- GrSLType varyingType) {
+void GrGLSLShaderBuilder::appendTextureLookupAndModulate(const char* modulation,
+ const GrGLSLTextureSampler& sampler,
+ const char* coordName,
+ GrSLType varyingType) {
SkString lookup;
this->appendTextureLookup(&lookup, sampler, coordName, varyingType);
this->codeAppend((GrGLSLExpr4(modulation) * GrGLSLExpr4(lookup)).c_str());
}
-void GrGLShaderBuilder::addFeature(uint32_t featureBit, const char* extensionName) {
+void GrGLSLShaderBuilder::addFeature(uint32_t featureBit, const char* extensionName) {
if (!(featureBit & fFeaturesAddedMask)) {
this->extensions().appendf("#extension %s: require\n", extensionName);
fFeaturesAddedMask |= featureBit;
}
}
-void GrGLShaderBuilder::appendDecls(const VarArray& vars, SkString* out) const {
+void GrGLSLShaderBuilder::appendDecls(const VarArray& vars, SkString* out) const {
for (int i = 0; i < vars.count(); ++i) {
vars[i].appendDecl(fProgramBuilder->glslCaps(), out);
out->append(";\n");
}
}
-void GrGLShaderBuilder::addLayoutQualifier(const char* param, InterfaceQualifier interface) {
+void GrGLSLShaderBuilder::addLayoutQualifier(const char* param, InterfaceQualifier interface) {
SkASSERT(fProgramBuilder->glslCaps()->generation() >= k330_GrGLSLGeneration ||
fProgramBuilder->glslCaps()->mustEnableAdvBlendEqs());
fLayoutParams[interface].push_back() = param;
}
-void GrGLShaderBuilder::compileAndAppendLayoutQualifiers() {
+void GrGLSLShaderBuilder::compileAndAppendLayoutQualifiers() {
static const char* interfaceQualifierNames[] = {
"out"
};
@@ -178,11 +178,11 @@
this->layoutQualifiers().appendf(") %s;\n", interfaceQualifierNames[interface]);
}
- GR_STATIC_ASSERT(0 == GrGLShaderBuilder::kOut_InterfaceQualifier);
+ GR_STATIC_ASSERT(0 == GrGLSLShaderBuilder::kOut_InterfaceQualifier);
GR_STATIC_ASSERT(SK_ARRAY_COUNT(interfaceQualifierNames) == kLastInterfaceQualifier + 1);
}
-void GrGLShaderBuilder::finalize(uint32_t visibility) {
+void GrGLSLShaderBuilder::finalize(uint32_t visibility) {
SkASSERT(!fFinalized);
this->versionDecl() = fProgramBuilder->glslCaps()->versionDeclString();
this->compileAndAppendLayoutQualifiers();
diff --git a/src/gpu/gl/builders/GrGLShaderBuilder.h b/src/gpu/glsl/GrGLSLShaderBuilder.h
similarity index 95%
rename from src/gpu/gl/builders/GrGLShaderBuilder.h
rename to src/gpu/glsl/GrGLSLShaderBuilder.h
index 2978db3..8927303 100644
--- a/src/gpu/gl/builders/GrGLShaderBuilder.h
+++ b/src/gpu/glsl/GrGLSLShaderBuilder.h
@@ -5,8 +5,8 @@
* found in the LICENSE file.
*/
-#ifndef GrGLShaderBuilder_DEFINED
-#define GrGLShaderBuilder_DEFINED
+#ifndef GrGLSLShaderBuilder_DEFINED
+#define GrGLSLShaderBuilder_DEFINED
#include "GrAllocator.h"
#include "glsl/GrGLSLShaderVar.h"
@@ -20,10 +20,10 @@
/**
base class for all shaders builders
*/
-class GrGLShaderBuilder {
+class GrGLSLShaderBuilder {
public:
- GrGLShaderBuilder(GrGLSLProgramBuilder* program);
- virtual ~GrGLShaderBuilder() {}
+ GrGLSLShaderBuilder(GrGLSLProgramBuilder* program);
+ virtual ~GrGLSLShaderBuilder() {}
void addInput(const GrGLSLShaderVar& input) { fInputs.push_back(input); }
void addOutput(const GrGLSLShaderVar& output) { fOutputs.push_back(output); }
@@ -109,7 +109,7 @@
*/
class ShaderBlock {
public:
- ShaderBlock(GrGLShaderBuilder* builder) : fBuilder(builder) {
+ ShaderBlock(GrGLSLShaderBuilder* builder) : fBuilder(builder) {
SkASSERT(builder);
fBuilder->codeAppend("{");
}
@@ -118,7 +118,7 @@
fBuilder->codeAppend("}");
}
private:
- GrGLShaderBuilder* fBuilder;
+ GrGLSLShaderBuilder* fBuilder;
};
protected:
diff --git a/src/gpu/glsl/GrGLSLTextureSampler.h b/src/gpu/glsl/GrGLSLTextureSampler.h
index 2de0431..a4fbf55 100644
--- a/src/gpu/glsl/GrGLSLTextureSampler.h
+++ b/src/gpu/glsl/GrGLSLTextureSampler.h
@@ -33,7 +33,7 @@
GrPixelConfig fConfig;
char fSwizzle[5];
- friend class GrGLShaderBuilder;
+ friend class GrGLSLShaderBuilder;
};
#endif
diff --git a/src/gpu/gl/builders/GrGLVertexShaderBuilder.cpp b/src/gpu/glsl/GrGLSLVertexShaderBuilder.cpp
similarity index 87%
rename from src/gpu/gl/builders/GrGLVertexShaderBuilder.cpp
rename to src/gpu/glsl/GrGLSLVertexShaderBuilder.cpp
index c4054e2..1f68d0e 100644
--- a/src/gpu/gl/builders/GrGLVertexShaderBuilder.cpp
+++ b/src/gpu/glsl/GrGLSLVertexShaderBuilder.cpp
@@ -5,15 +5,15 @@
* found in the LICENSE file.
*/
-#include "GrGLVertexShaderBuilder.h"
+#include "GrGLSLVertexShaderBuilder.h"
#include "glsl/GrGLSLProgramBuilder.h"
-GrGLVertexBuilder::GrGLVertexBuilder(GrGLSLProgramBuilder* program)
+GrGLSLVertexBuilder::GrGLSLVertexBuilder(GrGLSLProgramBuilder* program)
: INHERITED(program)
, fRtAdjustName(nullptr) {
}
-void GrGLVertexBuilder::addVarying(const char* name, GrSLPrecision precision, GrGLSLVarying* v) {
+void GrGLSLVertexBuilder::addVarying(const char* name, GrSLPrecision precision, GrGLSLVarying* v) {
fOutputs.push_back();
fOutputs.back().setType(v->fType);
fOutputs.back().setTypeModifier(GrGLSLShaderVar::kVaryingOut_TypeModifier);
@@ -22,7 +22,7 @@
v->fVsOut = fOutputs.back().getName().c_str();
}
-void GrGLVertexBuilder::emitAttributes(const GrGeometryProcessor& gp) {
+void GrGLSLVertexBuilder::emitAttributes(const GrGeometryProcessor& gp) {
int vaCount = gp.numAttribs();
for (int i = 0; i < vaCount; i++) {
this->addAttribute(&gp.getAttrib(i));
@@ -30,7 +30,7 @@
return;
}
-void GrGLVertexBuilder::transformToNormalizedDeviceSpace(const GrShaderVar& posVar) {
+void GrGLSLVertexBuilder::transformToNormalizedDeviceSpace(const GrShaderVar& posVar) {
SkASSERT(!fRtAdjustName);
GrSLPrecision precision = kDefault_GrSLPrecision;
@@ -72,7 +72,7 @@
this->codeAppend("gl_PointSize = 1.0;");
}
-bool GrGLVertexBuilder::addAttribute(const GrShaderVar& var) {
+bool GrGLSLVertexBuilder::addAttribute(const GrShaderVar& var) {
SkASSERT(GrShaderVar::kAttribute_TypeModifier == var.getTypeModifier());
for (int i = 0; i < fInputs.count(); ++i) {
const GrGLSLShaderVar& attr = fInputs[i];
diff --git a/src/gpu/gl/builders/GrGLVertexShaderBuilder.h b/src/gpu/glsl/GrGLSLVertexShaderBuilder.h
similarity index 81%
rename from src/gpu/gl/builders/GrGLVertexShaderBuilder.h
rename to src/gpu/glsl/GrGLSLVertexShaderBuilder.h
index 4662c40..92edd9a 100644
--- a/src/gpu/gl/builders/GrGLVertexShaderBuilder.h
+++ b/src/gpu/glsl/GrGLSLVertexShaderBuilder.h
@@ -5,17 +5,17 @@
* found in the LICENSE file.
*/
-#ifndef GrGLVertexShader_DEFINED
-#define GrGLVertexShader_DEFINED
+#ifndef GrGLSLVertexShader_DEFINED
+#define GrGLSLVertexShader_DEFINED
-#include "GrGLShaderBuilder.h"
+#include "GrGLSLShaderBuilder.h"
#include "GrGeometryProcessor.h"
class GrGLSLVarying;
-class GrGLVertexBuilder : public GrGLShaderBuilder {
+class GrGLSLVertexBuilder : public GrGLSLShaderBuilder {
public:
- GrGLVertexBuilder(GrGLSLProgramBuilder* program);
+ GrGLSLVertexBuilder(GrGLSLProgramBuilder* program);
void transformToNormalizedDeviceSpace(const GrShaderVar& posVar);
void emitAttributes(const GrGeometryProcessor& gp);
@@ -43,7 +43,7 @@
friend class GrGLProgramBuilder;
- typedef GrGLShaderBuilder INHERITED;
+ typedef GrGLSLShaderBuilder INHERITED;
};
#endif