Merge GrGLSLShaderVar and GrShaderVar
GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=5087
Change-Id: Ib8943a1da1ea495554feaf5b0992b94fbb9539ab
Reviewed-on: https://skia-review.googlesource.com/5087
Commit-Queue: Brian Salomon <bsalomon@google.com>
Reviewed-by: Ethan Nicholas <ethannicholas@google.com>
diff --git a/src/gpu/glsl/GrGLSLBlend.cpp b/src/gpu/glsl/GrGLSLBlend.cpp
index da73b66..e9a9f50 100644
--- a/src/gpu/glsl/GrGLSLBlend.cpp
+++ b/src/gpu/glsl/GrGLSLBlend.cpp
@@ -124,8 +124,8 @@
static void add_lum_function(GrGLSLFragmentBuilder* fsBuilder, SkString* setLumFunction) {
// Emit a helper that gets the luminance of a color.
SkString getFunction;
- GrGLSLShaderVar getLumArgs[] = {
- GrGLSLShaderVar("color", kVec3f_GrSLType),
+ GrShaderVar getLumArgs[] = {
+ GrShaderVar("color", kVec3f_GrSLType),
};
SkString getLumBody("return dot(vec3(0.3, 0.59, 0.11), color);");
fsBuilder->emitFunction(kFloat_GrSLType,
@@ -135,10 +135,10 @@
&getFunction);
// Emit the set luminance function.
- GrGLSLShaderVar setLumArgs[] = {
- GrGLSLShaderVar("hueSat", kVec3f_GrSLType),
- GrGLSLShaderVar("alpha", kFloat_GrSLType),
- GrGLSLShaderVar("lumColor", kVec3f_GrSLType),
+ GrShaderVar setLumArgs[] = {
+ GrShaderVar("hueSat", kVec3f_GrSLType),
+ GrShaderVar("alpha", kFloat_GrSLType),
+ GrShaderVar("lumColor", kVec3f_GrSLType),
};
SkString setLumBody;
setLumBody.printf("float diff = %s(lumColor - hueSat);", getFunction.c_str());
@@ -169,7 +169,7 @@
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) };
+ GrShaderVar getSatArgs[] = { GrShaderVar("color", kVec3f_GrSLType) };
SkString getSatBody;
getSatBody.printf("return max(max(color.r, color.g), color.b) - "
"min(min(color.r, color.g), color.b);");
@@ -184,11 +184,11 @@
// problems on PowerVR drivers. So instead it returns a vec3 where r, g ,b are the
// adjusted min, mid, and max inputs, respectively.
SkString helperFunction;
- GrGLSLShaderVar helperArgs[] = {
- GrGLSLShaderVar("minComp", kFloat_GrSLType),
- GrGLSLShaderVar("midComp", kFloat_GrSLType),
- GrGLSLShaderVar("maxComp", kFloat_GrSLType),
- GrGLSLShaderVar("sat", kFloat_GrSLType),
+ GrShaderVar helperArgs[] = {
+ GrShaderVar("minComp", kFloat_GrSLType),
+ GrShaderVar("midComp", kFloat_GrSLType),
+ GrShaderVar("maxComp", kFloat_GrSLType),
+ GrShaderVar("sat", kFloat_GrSLType),
};
static const char kHelperBody[] = "if (minComp < maxComp) {"
"vec3 result;"
@@ -205,9 +205,9 @@
kHelperBody,
&helperFunction);
- GrGLSLShaderVar setSatArgs[] = {
- GrGLSLShaderVar("hueLumColor", kVec3f_GrSLType),
- GrGLSLShaderVar("satColor", kVec3f_GrSLType),
+ GrShaderVar setSatArgs[] = {
+ GrShaderVar("hueLumColor", kVec3f_GrSLType),
+ GrShaderVar("satColor", kVec3f_GrSLType),
};
const char* helpFunc = helperFunction.c_str();
SkString setSatBody;
diff --git a/src/gpu/glsl/GrGLSLFragmentShaderBuilder.cpp b/src/gpu/glsl/GrGLSLFragmentShaderBuilder.cpp
index a9493b8..46b1947 100644
--- a/src/gpu/glsl/GrGLSLFragmentShaderBuilder.cpp
+++ b/src/gpu/glsl/GrGLSLFragmentShaderBuilder.cpp
@@ -147,8 +147,8 @@
extension);
}
fInputs.push_back().set(kVec4f_GrSLType,
- GrGLSLShaderVar::kIn_TypeModifier,
"gl_FragCoord",
+ GrShaderVar::kIn_TypeModifier,
kDefault_GrSLPrecision,
"origin_upper_left");
fSetupFragPosition = true;
@@ -226,9 +226,8 @@
if (this->addFeature(1 << kSampleMaskOverrideCoverage_GLSLPrivateFeature,
"GL_NV_sample_mask_override_coverage")) {
// Redeclare gl_SampleMask with layout(override_coverage) if we haven't already.
- fOutputs.push_back().set(kInt_GrSLType, GrShaderVar::kOut_TypeModifier,
- "gl_SampleMask", 1, kHigh_GrSLPrecision,
- "override_coverage");
+ fOutputs.push_back().set(kInt_GrSLType, "gl_SampleMask", 1, GrShaderVar::kOut_TypeModifier,
+ kHigh_GrSLPrecision, "override_coverage");
}
this->codeAppendf("gl_SampleMask[0] = %s;", mask);
fHasInitializedSampleMask = true;
@@ -283,9 +282,8 @@
if (!fHasCustomColorOutput) {
fHasCustomColorOutput = true;
fCustomColorOutputIndex = fOutputs.count();
- fOutputs.push_back().set(kVec4f_GrSLType,
- GrGLSLShaderVar::kOut_TypeModifier,
- DeclaredColorOutputName());
+ fOutputs.push_back().set(kVec4f_GrSLType, DeclaredColorOutputName(),
+ GrShaderVar::kOut_TypeModifier);
fProgramBuilder->finalizeFragmentOutputColor(fOutputs.back());
}
}
@@ -303,8 +301,8 @@
// output. The condition also co-incides with the condition in whici GLES SL 2.0
// requires the built-in gl_SecondaryFragColorEXT, where as 3.0 requires a custom output.
if (caps.mustDeclareFragmentShaderOutput()) {
- fOutputs.push_back().set(kVec4f_GrSLType, GrGLSLShaderVar::kOut_TypeModifier,
- DeclaredSecondaryColorOutputName());
+ fOutputs.push_back().set(kVec4f_GrSLType, DeclaredSecondaryColorOutputName(),
+ GrShaderVar::kOut_TypeModifier);
fProgramBuilder->finalizeFragmentSecondaryColor(fOutputs.back());
}
}
diff --git a/src/gpu/glsl/GrGLSLFragmentShaderBuilder.h b/src/gpu/glsl/GrGLSLFragmentShaderBuilder.h
index bf8569c..f7d2323 100644
--- a/src/gpu/glsl/GrGLSLFragmentShaderBuilder.h
+++ b/src/gpu/glsl/GrGLSLFragmentShaderBuilder.h
@@ -8,8 +8,8 @@
#ifndef GrGLSLFragmentShaderBuilder_DEFINED
#define GrGLSLFragmentShaderBuilder_DEFINED
+#include "GrBlend.h"
#include "GrGLSLShaderBuilder.h"
-
#include "GrProcessor.h"
class GrRenderTarget;
diff --git a/src/gpu/glsl/GrGLSLProgramBuilder.cpp b/src/gpu/glsl/GrGLSLProgramBuilder.cpp
index 7dea0be..9da88de 100644
--- a/src/gpu/glsl/GrGLSLProgramBuilder.cpp
+++ b/src/gpu/glsl/GrGLSLProgramBuilder.cpp
@@ -9,6 +9,7 @@
#include "GrPipeline.h"
#include "GrTexturePriv.h"
+#include "glsl/GrGLSLCaps.h"
#include "glsl/GrGLSLFragmentProcessor.h"
#include "glsl/GrGLSLGeometryProcessor.h"
#include "glsl/GrGLSLVarying.h"
diff --git a/src/gpu/glsl/GrGLSLProgramBuilder.h b/src/gpu/glsl/GrGLSLProgramBuilder.h
index 7276144..6c1eb3b 100644
--- a/src/gpu/glsl/GrGLSLProgramBuilder.h
+++ b/src/gpu/glsl/GrGLSLProgramBuilder.h
@@ -20,8 +20,9 @@
#include "glsl/GrGLSLXferProcessor.h"
class GrGLSLCaps;
-class GrGLSLShaderVar;
+class GrShaderVar;
class GrGLSLVaryingHandler;
+class GrGLSLExpr4;
typedef SkSTArray<8, GrGLSLFragmentProcessor*, true> GrGLSLFragProcs;
@@ -43,7 +44,7 @@
typedef GrGLSLUniformHandler::SamplerHandle SamplerHandle;
- const GrGLSLShaderVar& samplerVariable(SamplerHandle handle) const {
+ const GrShaderVar& samplerVariable(SamplerHandle handle) const {
return this->uniformHandler()->samplerVariable(handle);
}
@@ -79,8 +80,8 @@
// Used for backend customization of the output color and secondary color variables from the
// fragment processor. Only used if the outputs are explicitly declared in the shaders
- virtual void finalizeFragmentOutputColor(GrGLSLShaderVar& outputColor) {}
- virtual void finalizeFragmentSecondaryColor(GrGLSLShaderVar& outputColor) {}
+ virtual void finalizeFragmentOutputColor(GrShaderVar& outputColor) {}
+ virtual void finalizeFragmentSecondaryColor(GrShaderVar& outputColor) {}
// number of each input/output type in a single allocation block, used by many builders
static const int kVarsPerBlock;
diff --git a/src/gpu/glsl/GrGLSLShaderBuilder.cpp b/src/gpu/glsl/GrGLSLShaderBuilder.cpp
index 2e79779..3836d6d 100644
--- a/src/gpu/glsl/GrGLSLShaderBuilder.cpp
+++ b/src/gpu/glsl/GrGLSLShaderBuilder.cpp
@@ -5,11 +5,11 @@
* found in the LICENSE file.
*/
+#include "GrShaderVar.h"
#include "GrSwizzle.h"
#include "glsl/GrGLSLShaderBuilder.h"
#include "glsl/GrGLSLCaps.h"
#include "glsl/GrGLSLColorSpaceXformHelper.h"
-#include "glsl/GrGLSLShaderVar.h"
#include "glsl/GrGLSLProgramBuilder.h"
GrGLSLShaderBuilder::GrGLSLShaderBuilder(GrGLSLProgramBuilder* program)
@@ -29,7 +29,7 @@
this->main() = "void main() {";
}
-void GrGLSLShaderBuilder::declAppend(const GrGLSLShaderVar& var) {
+void GrGLSLShaderBuilder::declAppend(const GrShaderVar& var) {
SkString tempDecl;
var.appendDecl(fProgramBuilder->glslCaps(), &tempDecl);
this->codeAppendf("%s;", tempDecl.c_str());
@@ -44,7 +44,7 @@
void GrGLSLShaderBuilder::emitFunction(GrSLType returnType,
const char* name,
int argCnt,
- const GrGLSLShaderVar* args,
+ const GrShaderVar* args,
const char* body,
SkString* outName) {
this->functions().append(GrGLSLTypeString(returnType));
@@ -73,7 +73,7 @@
const char* coordName,
GrSLType varyingType) const {
const GrGLSLCaps* glslCaps = fProgramBuilder->glslCaps();
- const GrGLSLShaderVar& sampler = fProgramBuilder->samplerVariable(samplerHandle);
+ const GrShaderVar& sampler = fProgramBuilder->samplerVariable(samplerHandle);
GrSLType samplerType = sampler.getType();
if (samplerType == kTexture2DRectSampler_GrSLType) {
if (varyingType == kVec2f_GrSLType) {
@@ -132,9 +132,9 @@
// Our color is (r, g, b, a), but we want to multiply (r, g, b, 1) by our matrix, then
// re-insert the original alpha. The supplied srcColor is likely to be of the form
// "texture(...)", and we don't want to evaluate that twice, so wrap everything in a function.
- static const GrGLSLShaderVar gColorGamutXformArgs[] = {
- GrGLSLShaderVar("color", kVec4f_GrSLType),
- GrGLSLShaderVar("xform", kMat44f_GrSLType),
+ static const GrShaderVar gColorGamutXformArgs[] = {
+ GrShaderVar("color", kVec4f_GrSLType),
+ GrShaderVar("xform", kMat44f_GrSLType),
};
SkString functionBody;
// Gamut xform, clamp to destination gamut
@@ -162,7 +162,7 @@
void GrGLSLShaderBuilder::appendTexelFetch(SkString* out,
SamplerHandle samplerHandle,
const char* coordExpr) const {
- const GrGLSLShaderVar& sampler = fProgramBuilder->samplerVariable(samplerHandle);
+ const GrShaderVar& sampler = fProgramBuilder->samplerVariable(samplerHandle);
SkASSERT(fProgramBuilder->glslCaps()->texelFetchSupport());
SkASSERT(GrSLTypeIsCombinedSamplerType(sampler.getType()));
diff --git a/src/gpu/glsl/GrGLSLShaderBuilder.h b/src/gpu/glsl/GrGLSLShaderBuilder.h
index 2ab0eec..17eb5a6 100644
--- a/src/gpu/glsl/GrGLSLShaderBuilder.h
+++ b/src/gpu/glsl/GrGLSLShaderBuilder.h
@@ -9,8 +9,8 @@
#define GrGLSLShaderBuilder_DEFINED
#include "GrAllocator.h"
+#include "GrShaderVar.h"
#include "glsl/GrGLSLUniformHandler.h"
-#include "glsl/GrGLSLShaderVar.h"
#include "SkTDArray.h"
#include <stdarg.h>
@@ -118,7 +118,7 @@
/**
* Appends a variable declaration to one of the shaders
*/
- void declAppend(const GrGLSLShaderVar& var);
+ void declAppend(const GrShaderVar& var);
/**
* Appends a precision qualifier followed by a space, if relevant for the GLSL version.
@@ -129,7 +129,7 @@
void emitFunction(GrSLType returnType,
const char* name,
int argCnt,
- const GrGLSLShaderVar* args,
+ const GrShaderVar* args,
const char* body,
SkString* outName);
@@ -161,7 +161,7 @@
};
protected:
- typedef GrTAllocator<GrGLSLShaderVar> VarArray;
+ typedef GrTAllocator<GrShaderVar> VarArray;
void appendDecls(const VarArray& vars, SkString* out) const;
/**
diff --git a/src/gpu/glsl/GrGLSLShaderVar.h b/src/gpu/glsl/GrGLSLShaderVar.h
deleted file mode 100644
index 74afed8..0000000
--- a/src/gpu/glsl/GrGLSLShaderVar.h
+++ /dev/null
@@ -1,242 +0,0 @@
-/*
- * Copyright 2011 Google Inc.
- *
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
- */
-
-#ifndef GrGLSLShaderVar_DEFINED
-#define GrGLSLShaderVar_DEFINED
-
-#include "GrShaderVar.h"
-#include "../glsl/GrGLSL.h"
-#include "../glsl/GrGLSLCaps.h"
-
-#define USE_UNIFORM_FLOAT_ARRAYS true
-
-/**
- * Represents a variable in a shader
- */
-class GrGLSLShaderVar : public GrShaderVar {
-public:
- /**
- * Defaults to a float with no precision specifier
- */
- GrGLSLShaderVar()
- : GrShaderVar()
- , fUseUniformFloatArrays(USE_UNIFORM_FLOAT_ARRAYS) {
- }
-
- GrGLSLShaderVar(const char* name, GrSLType type, int arrayCount = kNonArray,
- GrSLPrecision precision = kDefault_GrSLPrecision)
- : GrShaderVar(name, type, arrayCount, precision)
- , fUseUniformFloatArrays(USE_UNIFORM_FLOAT_ARRAYS) {
- SkASSERT(kVoid_GrSLType != type);
- fUseUniformFloatArrays = USE_UNIFORM_FLOAT_ARRAYS;
- }
-
- GrGLSLShaderVar(const char* name, GrSLType type, TypeModifier typeModifier,
- int arrayCount = kNonArray, GrSLPrecision precision = kDefault_GrSLPrecision)
- : GrShaderVar(name, type, typeModifier, arrayCount, precision)
- , fUseUniformFloatArrays(USE_UNIFORM_FLOAT_ARRAYS) {
- SkASSERT(kVoid_GrSLType != type);
- }
-
- GrGLSLShaderVar(const GrShaderVar& var)
- : GrShaderVar(var)
- , fUseUniformFloatArrays(USE_UNIFORM_FLOAT_ARRAYS) {
- SkASSERT(kVoid_GrSLType != var.getType());
- }
-
- GrGLSLShaderVar(const GrGLSLShaderVar& var)
- : GrShaderVar(var.c_str(), var.getType(), var.getTypeModifier(),
- var.getArrayCount(), var.getPrecision())
- , fUseUniformFloatArrays(var.fUseUniformFloatArrays)
- , fLayoutQualifier(var.fLayoutQualifier)
- , fExtraModifiers(var.fExtraModifiers) {
- SkASSERT(kVoid_GrSLType != var.getType());
- }
-
- /**
- * Values for array count that have special meaning. We allow 1-sized arrays.
- */
- enum {
- kNonArray = 0, // not an array
- kUnsizedArray = -1, // an unsized array (declared with [])
- };
-
- /**
- * Sets as a non-array.
- */
- void set(GrSLType type,
- TypeModifier typeModifier,
- const SkString& name,
- GrSLPrecision precision = kDefault_GrSLPrecision,
- const char* layoutQualifier = nullptr,
- const char* extraModifiers = nullptr,
- bool useUniformFloatArrays = USE_UNIFORM_FLOAT_ARRAYS) {
- SkASSERT(kVoid_GrSLType != type);
- SkASSERT(kDefault_GrSLPrecision == precision || GrSLTypeAcceptsPrecision(type));
- INHERITED::set(type, name, typeModifier, precision);
- fLayoutQualifier = layoutQualifier;
- if (extraModifiers) {
- fExtraModifiers.printf("%s ", extraModifiers);
- }
- fUseUniformFloatArrays = useUniformFloatArrays;
- }
-
- /**
- * Sets as a non-array.
- */
- void set(GrSLType type,
- TypeModifier typeModifier,
- const char* name,
- GrSLPrecision precision = kDefault_GrSLPrecision,
- const char* layoutQualifier = nullptr,
- const char* extraModifiers = nullptr,
- bool useUniformFloatArrays = USE_UNIFORM_FLOAT_ARRAYS) {
- SkASSERT(kVoid_GrSLType != type);
- SkASSERT(kDefault_GrSLPrecision == precision || GrSLTypeAcceptsPrecision(type));
- INHERITED::set(type, name, typeModifier, precision);
- fLayoutQualifier = layoutQualifier;
- if (extraModifiers) {
- fExtraModifiers.printf("%s ", extraModifiers);
- }
- fUseUniformFloatArrays = useUniformFloatArrays;
- }
-
- /**
- * Set all var options
- */
- void set(GrSLType type,
- TypeModifier typeModifier,
- const SkString& name,
- int count,
- GrSLPrecision precision = kDefault_GrSLPrecision,
- const char* layoutQualifier = nullptr,
- const char* extraModifiers = nullptr,
- bool useUniformFloatArrays = USE_UNIFORM_FLOAT_ARRAYS) {
- SkASSERT(kVoid_GrSLType != type);
- SkASSERT(kDefault_GrSLPrecision == precision || GrSLTypeAcceptsPrecision(type));
- INHERITED::set(type, name, typeModifier, precision, count);
- fLayoutQualifier = layoutQualifier;
- if (extraModifiers) {
- fExtraModifiers.printf("%s ", extraModifiers);
- }
- fUseUniformFloatArrays = useUniformFloatArrays;
- }
-
- /**
- * Set all var options
- */
- void set(GrSLType type,
- TypeModifier typeModifier,
- const char* name,
- int count,
- GrSLPrecision precision = kDefault_GrSLPrecision,
- const char* layoutQualifier = nullptr,
- const char* extraModifiers = nullptr,
- bool useUniformFloatArrays = USE_UNIFORM_FLOAT_ARRAYS) {
- SkASSERT(kVoid_GrSLType != type);
- SkASSERT(kDefault_GrSLPrecision == precision || GrSLTypeAcceptsPrecision(type));
- INHERITED::set(type, name, typeModifier, precision, count);
- fLayoutQualifier = layoutQualifier;
- if (extraModifiers) {
- fExtraModifiers.printf("%s ", extraModifiers);
- }
- fUseUniformFloatArrays = useUniformFloatArrays;
- }
-
- /**
- * Set the layout qualifier
- */
- void setLayoutQualifier(const char* layoutQualifier) {
- fLayoutQualifier = layoutQualifier;
- }
-
- void addModifier(const char* modifier) {
- if (modifier) {
- fExtraModifiers.appendf("%s ", modifier);
- }
- }
-
- /**
- * Write a declaration of this variable to out.
- */
- void appendDecl(const GrGLSLCaps* glslCaps, SkString* out) const {
- SkASSERT(kDefault_GrSLPrecision == fPrecision || GrSLTypeAcceptsPrecision(fType));
- if (!fLayoutQualifier.isEmpty()) {
- out->appendf("layout(%s) ", fLayoutQualifier.c_str());
- }
- out->append(fExtraModifiers);
- if (this->getTypeModifier() != kNone_TypeModifier) {
- out->append(TypeModifierString(glslCaps, this->getTypeModifier()));
- out->append(" ");
- }
- GrSLType effectiveType = this->getType();
- if (glslCaps->usesPrecisionModifiers() && GrSLTypeAcceptsPrecision(effectiveType)) {
- // Desktop GLSL has added precision qualifiers but they don't do anything.
- out->appendf("%s ", GrGLSLPrecisionString(fPrecision));
- }
- if (this->isArray()) {
- if (this->isUnsizedArray()) {
- out->appendf("%s %s[]",
- GrGLSLTypeString(effectiveType),
- this->getName().c_str());
- } else {
- SkASSERT(this->getArrayCount() > 0);
- out->appendf("%s %s[%d]",
- GrGLSLTypeString(effectiveType),
- this->getName().c_str(),
- this->getArrayCount());
- }
- } else {
- out->appendf("%s %s",
- GrGLSLTypeString(effectiveType),
- this->getName().c_str());
- }
- }
-
- void appendArrayAccess(int index, SkString* out) const {
- out->appendf("%s[%d]%s",
- this->getName().c_str(),
- index,
- fUseUniformFloatArrays ? "" : ".x");
- }
-
- void appendArrayAccess(const char* indexName, SkString* out) const {
- out->appendf("%s[%s]%s",
- this->getName().c_str(),
- indexName,
- fUseUniformFloatArrays ? "" : ".x");
- }
-
-private:
- static const char* TypeModifierString(const GrGLSLCaps* glslCaps, TypeModifier t) {
- switch (t) {
- case kNone_TypeModifier:
- return "";
- case kIn_TypeModifier:
- return "in";
- case kInOut_TypeModifier:
- return "inout";
- case kOut_TypeModifier:
- return "out";
- case kUniform_TypeModifier:
- return "uniform";
- }
- SkFAIL("Unknown shader variable type modifier.");
- return ""; // suppress warning
- }
-
- /// Work around driver bugs on some hardware that don't correctly
- /// support uniform float []
- bool fUseUniformFloatArrays;
-
- SkString fLayoutQualifier;
- SkString fExtraModifiers;
-
- typedef GrShaderVar INHERITED;
-};
-
-#endif
diff --git a/src/gpu/glsl/GrGLSLUniformHandler.h b/src/gpu/glsl/GrGLSLUniformHandler.h
index 657be6a..d49fbd4 100644
--- a/src/gpu/glsl/GrGLSLUniformHandler.h
+++ b/src/gpu/glsl/GrGLSLUniformHandler.h
@@ -9,7 +9,8 @@
#define GrGLSLUniformHandler_DEFINED
#include "GrGLSLProgramDataManager.h"
-#include "GrGLSLShaderVar.h"
+#include "GrShaderVar.h"
+#include "GrSwizzle.h"
class GrGLSLProgramBuilder;
@@ -46,7 +47,7 @@
outName);
}
- virtual const GrGLSLShaderVar& getUniformVariable(UniformHandle u) const = 0;
+ virtual const GrShaderVar& getUniformVariable(UniformHandle u) const = 0;
/**
* Shortcut for getUniformVariable(u).c_str()
@@ -60,7 +61,7 @@
GrGLSLProgramBuilder* fProgramBuilder;
private:
- virtual const GrGLSLShaderVar& samplerVariable(SamplerHandle) const = 0;
+ virtual const GrShaderVar& samplerVariable(SamplerHandle) const = 0;
virtual GrSwizzle samplerSwizzle(SamplerHandle) const = 0;
virtual SamplerHandle addSampler(uint32_t visibility, GrSwizzle, GrSLType, GrSLPrecision,
diff --git a/src/gpu/glsl/GrGLSLVarying.cpp b/src/gpu/glsl/GrGLSLVarying.cpp
index 4d9b61f..a3d5053 100644
--- a/src/gpu/glsl/GrGLSLVarying.cpp
+++ b/src/gpu/glsl/GrGLSLVarying.cpp
@@ -6,7 +6,7 @@
*/
#include "glsl/GrGLSLVarying.h"
-
+#include "glsl/GrGLSLCaps.h"
#include "glsl/GrGLSLProgramBuilder.h"
void GrGLSLVaryingHandler::addPassThroughAttribute(const GrGeometryProcessor::Attribute* input,
@@ -81,7 +81,7 @@
void GrGLSLVaryingHandler::addAttribute(const GrShaderVar& var) {
SkASSERT(GrShaderVar::kIn_TypeModifier == var.getTypeModifier());
for (int j = 0; j < fVertexInputs.count(); ++j) {
- const GrGLSLShaderVar& attr = fVertexInputs[j];
+ const GrShaderVar& attr = fVertexInputs[j];
// if attribute already added, don't add it again
if (attr.getName().equals(var.getName())) {
return;
@@ -111,23 +111,23 @@
const VaryingInfo& v = this->fVaryings[i];
const char* modifier = v.fIsFlat ? "flat" : fDefaultInterpolationModifier;
if (v.fVisibility & kVertex_GrShaderFlag) {
- fVertexOutputs.push_back().set(v.fType, GrShaderVar::kOut_TypeModifier, v.fVsOut,
+ fVertexOutputs.push_back().set(v.fType, v.fVsOut, GrShaderVar::kOut_TypeModifier,
v.fPrecision, nullptr, modifier);
if (v.fVisibility & kGeometry_GrShaderFlag) {
- fGeomInputs.push_back().set(v.fType, GrShaderVar::kIn_TypeModifier, v.fVsOut,
- GrShaderVar::kUnsizedArray, v.fPrecision, nullptr,
+ fGeomInputs.push_back().set(v.fType, v.fVsOut, GrShaderVar::kUnsizedArray,
+ GrShaderVar::kIn_TypeModifier, v.fPrecision, nullptr,
modifier);
}
}
if (v.fVisibility & kFragment_GrShaderFlag) {
const char* fsIn = v.fVsOut.c_str();
if (v.fVisibility & kGeometry_GrShaderFlag) {
- fGeomOutputs.push_back().set(v.fType, GrGLSLShaderVar::kOut_TypeModifier,
- v.fGsOut, v.fPrecision, nullptr, modifier);
+ fGeomOutputs.push_back().set(v.fType, v.fGsOut, GrShaderVar::kOut_TypeModifier,
+ v.fPrecision, nullptr, modifier);
fsIn = v.fGsOut.c_str();
}
- fFragInputs.push_back().set(v.fType, GrShaderVar::kIn_TypeModifier, fsIn,
- v.fPrecision, nullptr, modifier);
+ fFragInputs.push_back().set(v.fType, fsIn, GrShaderVar::kIn_TypeModifier, v.fPrecision,
+ nullptr, modifier);
}
}
this->onFinalize();
diff --git a/src/gpu/glsl/GrGLSLVarying.h b/src/gpu/glsl/GrGLSLVarying.h
index 5867361..e9378a8 100644
--- a/src/gpu/glsl/GrGLSLVarying.h
+++ b/src/gpu/glsl/GrGLSLVarying.h
@@ -10,9 +10,9 @@
#include "GrAllocator.h"
#include "GrGeometryProcessor.h"
+#include "GrShaderVar.h"
#include "GrTypesPriv.h"
#include "glsl/GrGLSLProgramDataManager.h"
-#include "glsl/GrGLSLShaderVar.h"
class GrGLSLProgramBuilder;
@@ -152,7 +152,7 @@
};
typedef GrTAllocator<VaryingInfo> VaryingList;
- typedef GrTAllocator<GrGLSLShaderVar> VarArray;
+ typedef GrTAllocator<GrShaderVar> VarArray;
typedef GrGLSLProgramDataManager::VaryingHandle VaryingHandle;
VaryingList fVaryings;
diff --git a/src/gpu/glsl/GrGLSLXferProcessor.cpp b/src/gpu/glsl/GrGLSLXferProcessor.cpp
index 0f7a3db..1f6db4c 100644
--- a/src/gpu/glsl/GrGLSLXferProcessor.cpp
+++ b/src/gpu/glsl/GrGLSLXferProcessor.cpp
@@ -8,6 +8,7 @@
#include "glsl/GrGLSLXferProcessor.h"
#include "GrXferProcessor.h"
+#include "glsl/GrGLSLCaps.h"
#include "glsl/GrGLSLFragmentShaderBuilder.h"
#include "glsl/GrGLSLProgramDataManager.h"
#include "glsl/GrGLSLUniformHandler.h"