aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar bsalomon <bsalomon@google.com>2014-12-09 10:04:14 -0800
committerGravatar Commit bot <commit-bot@chromium.org>2014-12-09 10:04:14 -0800
commitc0bd6484f621e4a1033be318b1947a5d32157c13 (patch)
treedbc194e9260822ca670afd9d5f1987d65afd58ea
parent17168df7798d0d12684f18df0556dc19e65b32e6 (diff)
Move shader precision out of GrShaderVar
-rw-r--r--include/gpu/GrCoordTransform.h8
-rw-r--r--include/gpu/GrShaderVar.h35
-rw-r--r--include/gpu/GrTypesPriv.h18
-rw-r--r--src/gpu/GrCoordTransform.cpp8
-rw-r--r--src/gpu/GrDrawTarget.cpp14
-rw-r--r--src/gpu/GrDrawTargetCaps.h6
-rw-r--r--src/gpu/effects/GrBezierEffect.cpp18
-rw-r--r--src/gpu/effects/GrConfigConversionEffect.cpp2
-rw-r--r--src/gpu/gl/GrGLCaps.cpp14
-rw-r--r--src/gpu/gl/GrGLProgramDesc.cpp4
-rw-r--r--src/gpu/gl/GrGLShaderVar.h20
-rw-r--r--src/gpu/gl/builders/GrGLFragmentShaderBuilder.cpp14
-rw-r--r--src/gpu/gl/builders/GrGLFragmentShaderBuilder.h2
-rw-r--r--src/gpu/gl/builders/GrGLProgramBuilder.cpp4
-rw-r--r--src/gpu/gl/builders/GrGLProgramBuilder.h4
15 files changed, 88 insertions, 83 deletions
diff --git a/include/gpu/GrCoordTransform.h b/include/gpu/GrCoordTransform.h
index b00c8a465a..775089cab8 100644
--- a/include/gpu/GrCoordTransform.h
+++ b/include/gpu/GrCoordTransform.h
@@ -72,7 +72,7 @@ public:
* Create a transformation that applies the matrix to a coord set.
*/
GrCoordTransform(GrCoordSet sourceCoords, const SkMatrix& m,
- GrShaderVar::Precision precision = GrShaderVar::kDefault_Precision) {
+ GrSLPrecision precision = kDefault_GrSLPrecision) {
SkDEBUGCODE(fInProcessor = false);
this->reset(sourceCoords, m, precision);
}
@@ -85,7 +85,7 @@ public:
void reset(GrCoordSet, const SkMatrix&, const GrTexture*);
void reset(GrCoordSet sourceCoords, const SkMatrix& m,
- GrShaderVar::Precision precision = GrShaderVar::kDefault_Precision);
+ GrSLPrecision precision = kDefault_GrSLPrecision);
GrCoordTransform& operator= (const GrCoordTransform& that) {
SkASSERT(!fInProcessor);
@@ -117,7 +117,7 @@ public:
GrCoordSet sourceCoords() const { return fSourceCoords; }
const SkMatrix& getMatrix() const { return fMatrix; }
bool reverseY() const { return fReverseY; }
- GrShaderVar::Precision precision() const { return fPrecision; }
+ GrSLPrecision precision() const { return fPrecision; }
/** Useful for effects that want to insert a texture matrix that is implied by the texture
dimensions */
@@ -132,7 +132,7 @@ private:
GrCoordSet fSourceCoords;
SkMatrix fMatrix;
bool fReverseY;
- GrShaderVar::Precision fPrecision;
+ GrSLPrecision fPrecision;
typedef SkNoncopyable INHERITED;
#ifdef SK_DEBUG
diff --git a/include/gpu/GrShaderVar.h b/include/gpu/GrShaderVar.h
index 05ae36aab8..3ef24b07b6 100644
--- a/include/gpu/GrShaderVar.h
+++ b/include/gpu/GrShaderVar.h
@@ -34,19 +34,6 @@ public:
kVaryingOut_TypeModifier
};
- enum Precision {
- kLow_Precision,
- kMedium_Precision,
- kHigh_Precision,
-
- // Default precision is medium. This is because on OpenGL ES 2 highp support is not
- // guaranteed. On (non-ES) OpenGL the specifiers have no effect on precision.
- kDefault_Precision = kMedium_Precision,
-
- kLast_Precision = kHigh_Precision
- };
- static const int kPrecisionCount = kLast_Precision + 1;
-
/**
* Defaults to a float with no precision specifier
*/
@@ -54,11 +41,11 @@ public:
: fType(kFloat_GrSLType)
, fTypeModifier(kNone_TypeModifier)
, fCount(kNonArray)
- , fPrecision(kDefault_Precision) {
+ , fPrecision(kDefault_GrSLPrecision) {
}
GrShaderVar(const SkString& name, GrSLType type, int arrayCount = kNonArray,
- Precision precision = kDefault_Precision)
+ GrSLPrecision precision = kDefault_GrSLPrecision)
: fType(type)
, fTypeModifier(kNone_TypeModifier)
, fName(name)
@@ -68,7 +55,7 @@ public:
}
GrShaderVar(const char* name, GrSLType type, int arrayCount = kNonArray,
- Precision precision = kDefault_Precision)
+ GrSLPrecision precision = kDefault_GrSLPrecision)
: fType(type)
, fTypeModifier(kNone_TypeModifier)
, fName(name)
@@ -78,7 +65,7 @@ public:
}
GrShaderVar(const char* name, GrSLType type, TypeModifier typeModifier,
- int arrayCount = kNonArray, Precision precision = kDefault_Precision)
+ int arrayCount = kNonArray, GrSLPrecision precision = kDefault_GrSLPrecision)
: fType(type)
, fTypeModifier(typeModifier)
, fName(name)
@@ -101,7 +88,7 @@ public:
void set(GrSLType type,
TypeModifier typeModifier,
const SkString& name,
- Precision precision = kDefault_Precision) {
+ GrSLPrecision precision = kDefault_GrSLPrecision) {
SkASSERT(kVoid_GrSLType != type);
fType = type;
fTypeModifier = typeModifier;
@@ -116,7 +103,7 @@ public:
void set(GrSLType type,
TypeModifier typeModifier,
const char* name,
- Precision precision = kDefault_Precision) {
+ GrSLPrecision precision = kDefault_GrSLPrecision) {
SkASSERT(kVoid_GrSLType != type);
fType = type;
fTypeModifier = typeModifier;
@@ -132,7 +119,7 @@ public:
TypeModifier typeModifier,
const SkString& name,
int count,
- Precision precision = kDefault_Precision) {
+ GrSLPrecision precision = kDefault_GrSLPrecision) {
SkASSERT(kVoid_GrSLType != type);
fType = type;
fTypeModifier = typeModifier;
@@ -148,7 +135,7 @@ public:
TypeModifier typeModifier,
const char* name,
int count,
- Precision precision = kDefault_Precision) {
+ GrSLPrecision precision = kDefault_GrSLPrecision) {
SkASSERT(kVoid_GrSLType != type);
fType = type;
fTypeModifier = typeModifier;
@@ -217,19 +204,19 @@ public:
/**
* Get the precision of the var
*/
- Precision getPrecision() const { return fPrecision; }
+ GrSLPrecision getPrecision() const { return fPrecision; }
/**
* Set the precision of the var
*/
- void setPrecision(Precision p) { fPrecision = p; }
+ void setPrecision(GrSLPrecision p) { fPrecision = p; }
protected:
GrSLType fType;
TypeModifier fTypeModifier;
SkString fName;
int fCount;
- Precision fPrecision;
+ GrSLPrecision fPrecision;
};
#endif
diff --git a/include/gpu/GrTypesPriv.h b/include/gpu/GrTypesPriv.h
index 83d85612b9..2a8d4c3255 100644
--- a/include/gpu/GrTypesPriv.h
+++ b/include/gpu/GrTypesPriv.h
@@ -39,6 +39,24 @@ enum GrShaderType {
static const int kGrShaderTypeCount = kLastkFragment_GrShaderType + 1;
/**
+ * Precisions of shader language variables. Not all shading languages support precisions or actually
+ * vary the internal precision based on the qualifiers.
+ */
+enum GrSLPrecision {
+ kLow_GrSLPrecision,
+ kMedium_GrSLPrecision,
+ kHigh_GrSLPrecision,
+
+ // Default precision is medium. This is because on OpenGL ES 2 highp support is not
+ // guaranteed. On (non-ES) OpenGL the specifiers have no effect on precision.
+ kDefault_GrSLPrecision = kMedium_GrSLPrecision,
+
+ kLast_GrSLPrecision = kHigh_GrSLPrecision
+};
+
+static const int kGrSLPrecisionCount = kLast_GrSLPrecision + 1;
+
+/**
* Gets the vector size of the SLType. Returns -1 for void, matrices, and samplers.
*/
static inline int GrSLTypeVectorCount(GrSLType type) {
diff --git a/src/gpu/GrCoordTransform.cpp b/src/gpu/GrCoordTransform.cpp
index 53285a27eb..5bb36fcf76 100644
--- a/src/gpu/GrCoordTransform.cpp
+++ b/src/gpu/GrCoordTransform.cpp
@@ -22,7 +22,7 @@ void GrCoordTransform::reset(GrCoordSet sourceCoords, const SkMatrix& m, const G
// increased. Our rule is that we want at least 4 subpixel values in the representation for
// coords between 0 to 1. Note that this still might not be enough when drawing with repeat
// or mirror-repeat modes but that case can be arbitrarily bad.
- fPrecision = GrShaderVar::kDefault_Precision;
+ fPrecision = kDefault_GrSLPrecision;
if (texture->getContext()) {
const GrDrawTargetCaps* caps = texture->getContext()->getGpu()->caps();
if (caps->floatPrecisionVaries()) {
@@ -36,10 +36,10 @@ void GrCoordTransform::reset(GrCoordSet sourceCoords, const SkMatrix& m, const G
if ((2 << info->fBits) / maxD > 4) {
break;
}
- if (GrShaderVar::kHigh_Precision == fPrecision) {
+ if (kHigh_GrSLPrecision == fPrecision) {
break;
}
- GrShaderVar::Precision nextP = static_cast<GrShaderVar::Precision>(fPrecision + 1);
+ GrSLPrecision nextP = static_cast<GrSLPrecision>(fPrecision + 1);
info = &caps->getFloatShaderPrecisionInfo(kFragment_GrShaderType, nextP);
if (!info->supported()) {
break;
@@ -52,7 +52,7 @@ void GrCoordTransform::reset(GrCoordSet sourceCoords, const SkMatrix& m, const G
void GrCoordTransform::reset(GrCoordSet sourceCoords,
const SkMatrix& m,
- GrShaderVar::Precision precision) {
+ GrSLPrecision precision) {
SkASSERT(!fInProcessor);
fSourceCoords = sourceCoords;
fMatrix = m;
diff --git a/src/gpu/GrDrawTarget.cpp b/src/gpu/GrDrawTarget.cpp
index ed54bf9514..0d6a388609 100644
--- a/src/gpu/GrDrawTarget.cpp
+++ b/src/gpu/GrDrawTarget.cpp
@@ -1046,7 +1046,7 @@ GrDrawTargetCaps& GrDrawTargetCaps::operator=(const GrDrawTargetCaps& other) {
fShaderPrecisionVaries = other.fShaderPrecisionVaries;
for (int s = 0; s < kGrShaderTypeCount; ++s) {
- for (int p = 0; p < GrShaderVar::kPrecisionCount; ++p) {
+ for (int p = 0; p < kGrSLPrecisionCount; ++p) {
fFloatPrecisions[s][p] = other.fFloatPrecisions[s][p];
}
}
@@ -1085,13 +1085,13 @@ static const char* shader_type_to_string(GrShaderType type) {
return "";
}
-static const char* precision_to_string(GrShaderVar::Precision p) {
+static const char* precision_to_string(GrSLPrecision p) {
switch (p) {
- case GrShaderVar::kLow_Precision:
+ case kLow_GrSLPrecision:
return "low";
- case GrShaderVar::kMedium_Precision:
+ case kMedium_GrSLPrecision:
return "medium";
- case GrShaderVar::kHigh_Precision:
+ case kHigh_GrSLPrecision:
return "high";
}
return "";
@@ -1177,9 +1177,9 @@ SkString GrDrawTargetCaps::dump() const {
for (int s = 0; s < kGrShaderTypeCount; ++s) {
GrShaderType shaderType = static_cast<GrShaderType>(s);
r.appendf("\t%s:\n", shader_type_to_string(shaderType));
- for (int p = 0; p < GrShaderVar::kPrecisionCount; ++p) {
+ for (int p = 0; p < kGrSLPrecisionCount; ++p) {
if (fFloatPrecisions[s][p].supported()) {
- GrShaderVar::Precision precision = static_cast<GrShaderVar::Precision>(p);
+ GrSLPrecision precision = static_cast<GrSLPrecision>(p);
r.appendf("\t\t%s: log_low: %d log_high: %d bits: %d\n",
precision_to_string(precision),
fFloatPrecisions[s][p].fLogRangeLow,
diff --git a/src/gpu/GrDrawTargetCaps.h b/src/gpu/GrDrawTargetCaps.h
index ae6a9ed749..1bd18b081e 100644
--- a/src/gpu/GrDrawTargetCaps.h
+++ b/src/gpu/GrDrawTargetCaps.h
@@ -22,7 +22,7 @@ public:
SK_DECLARE_INST_COUNT(GrDrawTargetCaps)
/** Info about shader variable precision within a given shader stage. That is, this info
- is relevant to a float (or vecNf) variable declared with a GrShaderVar::Precision
+ is relevant to a float (or vecNf) variable declared with a GrSLPrecision
in a given GrShaderType. The info here is hoisted from the OpenGL spec. */
struct PrecisionInfo {
PrecisionInfo() {
@@ -127,7 +127,7 @@ public:
* called.
*/
const PrecisionInfo& getFloatShaderPrecisionInfo(GrShaderType shaderType,
- GrShaderVar::Precision precision) const {
+ GrSLPrecision precision) const {
return fFloatPrecisions[shaderType][precision];
};
@@ -175,7 +175,7 @@ protected:
bool fConfigTextureSupport[kGrPixelConfigCnt];
bool fShaderPrecisionVaries;
- PrecisionInfo fFloatPrecisions[kGrShaderTypeCount][GrShaderVar::kPrecisionCount];
+ PrecisionInfo fFloatPrecisions[kGrShaderTypeCount][kGrSLPrecisionCount];
private:
static uint32_t CreateUniqueID();
diff --git a/src/gpu/effects/GrBezierEffect.cpp b/src/gpu/effects/GrBezierEffect.cpp
index ebbb8d7f88..5abd29324d 100644
--- a/src/gpu/effects/GrBezierEffect.cpp
+++ b/src/gpu/effects/GrBezierEffect.cpp
@@ -353,7 +353,7 @@ void GrGLCubicEffect::emitCode(const EmitArgs& args) {
const GrCubicEffect& gp = args.fGP.cast<GrCubicEffect>();
GrGLVertToFrag v(kVec4f_GrSLType);
- args.fPB->addVarying("CubicCoeffs", &v, GrGLShaderVar::kHigh_Precision);
+ args.fPB->addVarying("CubicCoeffs", &v, kHigh_GrSLPrecision);
vsBuilder->codeAppendf("%s = %s;", v.vsOut(), gp.inCubicCoeffs()->fName);
// setup coord outputs
@@ -366,14 +366,14 @@ void GrGLCubicEffect::emitCode(const EmitArgs& args) {
GrGLGPFragmentBuilder* fsBuilder = args.fPB->getFragmentShaderBuilder();
- GrGLShaderVar edgeAlpha("edgeAlpha", kFloat_GrSLType, 0, GrGLShaderVar::kHigh_Precision);
- GrGLShaderVar dklmdx("dklmdx", kVec3f_GrSLType, 0, GrGLShaderVar::kHigh_Precision);
- GrGLShaderVar dklmdy("dklmdy", kVec3f_GrSLType, 0, GrGLShaderVar::kHigh_Precision);
- GrGLShaderVar dfdx("dfdx", kFloat_GrSLType, 0, GrGLShaderVar::kHigh_Precision);
- GrGLShaderVar dfdy("dfdy", kFloat_GrSLType, 0, GrGLShaderVar::kHigh_Precision);
- GrGLShaderVar gF("gF", kVec2f_GrSLType, 0, GrGLShaderVar::kHigh_Precision);
- GrGLShaderVar gFM("gFM", kFloat_GrSLType, 0, GrGLShaderVar::kHigh_Precision);
- GrGLShaderVar func("func", kFloat_GrSLType, 0, GrGLShaderVar::kHigh_Precision);
+ GrGLShaderVar edgeAlpha("edgeAlpha", kFloat_GrSLType, 0, kHigh_GrSLPrecision);
+ GrGLShaderVar dklmdx("dklmdx", kVec3f_GrSLType, 0, kHigh_GrSLPrecision);
+ GrGLShaderVar dklmdy("dklmdy", kVec3f_GrSLType, 0, kHigh_GrSLPrecision);
+ GrGLShaderVar dfdx("dfdx", kFloat_GrSLType, 0, kHigh_GrSLPrecision);
+ GrGLShaderVar dfdy("dfdy", kFloat_GrSLType, 0, kHigh_GrSLPrecision);
+ GrGLShaderVar gF("gF", kVec2f_GrSLType, 0, kHigh_GrSLPrecision);
+ GrGLShaderVar gFM("gFM", kFloat_GrSLType, 0, kHigh_GrSLPrecision);
+ GrGLShaderVar func("func", kFloat_GrSLType, 0, kHigh_GrSLPrecision);
fsBuilder->declAppend(edgeAlpha);
fsBuilder->declAppend(dklmdx);
diff --git a/src/gpu/effects/GrConfigConversionEffect.cpp b/src/gpu/effects/GrConfigConversionEffect.cpp
index e146411e32..55ae54e9ae 100644
--- a/src/gpu/effects/GrConfigConversionEffect.cpp
+++ b/src/gpu/effects/GrConfigConversionEffect.cpp
@@ -29,7 +29,7 @@ public:
const TransformedCoordsArray& coords,
const TextureSamplerArray& samplers) SK_OVERRIDE {
// Using highp for GLES here in order to avoid some precision issues on specific GPUs.
- GrGLShaderVar tmpVar("tmpColor", kVec4f_GrSLType, 0, GrGLShaderVar::kHigh_Precision);
+ GrGLShaderVar tmpVar("tmpColor", kVec4f_GrSLType, 0, kHigh_GrSLPrecision);
SkString tmpDecl;
tmpVar.appendDecl(builder->ctxInfo(), &tmpDecl);
diff --git a/src/gpu/gl/GrGLCaps.cpp b/src/gpu/gl/GrGLCaps.cpp
index a510cb456b..79c99c224a 100644
--- a/src/gpu/gl/GrGLCaps.cpp
+++ b/src/gpu/gl/GrGLCaps.cpp
@@ -776,13 +776,13 @@ void GrGLCaps::initStencilFormats(const GrGLContextInfo& ctxInfo) {
fStencilVerifiedColorConfigs.push_back_n(fStencilFormats.count());
}
-static GrGLenum precision_to_gl_float_type(GrShaderVar::Precision p) {
+static GrGLenum precision_to_gl_float_type(GrSLPrecision p) {
switch (p) {
- case GrShaderVar::kLow_Precision:
+ case kLow_GrSLPrecision:
return GR_GL_LOW_FLOAT;
- case GrShaderVar::kMedium_Precision:
+ case kMedium_GrSLPrecision:
return GR_GL_MEDIUM_FLOAT;
- case GrShaderVar::kHigh_Precision:
+ case kHigh_GrSLPrecision:
return GR_GL_HIGH_FLOAT;
}
SkFAIL("Unknown precision.");
@@ -811,8 +811,8 @@ void GrGLCaps::initShaderPrecisionTable(const GrGLContextInfo& ctxInfo, const Gr
GrGLenum glShader = shader_type_to_gl_shader(shaderType);
PrecisionInfo* first = NULL;
fShaderPrecisionVaries = false;
- for (int p = 0; p < GrShaderVar::kPrecisionCount; ++p) {
- GrShaderVar::Precision precision = static_cast<GrShaderVar::Precision>(p);
+ for (int p = 0; p < kGrSLPrecisionCount; ++p) {
+ GrSLPrecision precision = static_cast<GrSLPrecision>(p);
GrGLenum glPrecision = precision_to_gl_float_type(precision);
GrGLint range[2];
GrGLint bits;
@@ -835,7 +835,7 @@ void GrGLCaps::initShaderPrecisionTable(const GrGLContextInfo& ctxInfo, const Gr
fShaderPrecisionVaries = false;
for (int s = 0; s < kGrShaderTypeCount; ++s) {
if (kGeometry_GrShaderType != s || fGeometryShaderSupport) {
- for (int p = 0; p < GrShaderVar::kPrecisionCount; ++p) {
+ for (int p = 0; p < kGrSLPrecisionCount; ++p) {
fFloatPrecisions[s][p].fLogRangeLow = 127;
fFloatPrecisions[s][p].fLogRangeHigh = 127;
fFloatPrecisions[s][p].fBits = 23;
diff --git a/src/gpu/gl/GrGLProgramDesc.cpp b/src/gpu/gl/GrGLProgramDesc.cpp
index 16de1eab22..068386c3aa 100644
--- a/src/gpu/gl/GrGLProgramDesc.cpp
+++ b/src/gpu/gl/GrGLProgramDesc.cpp
@@ -69,7 +69,7 @@ enum {
kTransformKeyBits = kMatrixTypeKeyBits + kPrecisionBits + 1,
};
-GR_STATIC_ASSERT(GrShaderVar::kHigh_Precision < (1 << kPrecisionBits));
+GR_STATIC_ASSERT(kHigh_GrSLPrecision < (1 << kPrecisionBits));
/**
* We specialize the vertex code for each of these matrix types.
@@ -95,7 +95,7 @@ static uint32_t gen_transform_key(const GrPendingFragmentStage& stage, bool useE
key |= kPositionCoords_Flag;
}
- GR_STATIC_ASSERT(GrShaderVar::kPrecisionCount <= (1 << kPrecisionBits));
+ GR_STATIC_ASSERT(kGrSLPrecisionCount <= (1 << kPrecisionBits));
key |= (coordTransform.precision() << kPrecisionShift);
key <<= kTransformKeyBits * t;
diff --git a/src/gpu/gl/GrGLShaderVar.h b/src/gpu/gl/GrGLShaderVar.h
index 7705c30db0..5d4d70025e 100644
--- a/src/gpu/gl/GrGLShaderVar.h
+++ b/src/gpu/gl/GrGLShaderVar.h
@@ -37,7 +37,7 @@ public:
}
GrGLShaderVar(const char* name, GrSLType type, int arrayCount = kNonArray,
- Precision precision = kDefault_Precision)
+ GrSLPrecision precision = kDefault_GrSLPrecision)
: GrShaderVar(name, type, arrayCount, precision)
, fOrigin(kDefault_Origin)
, fUseUniformFloatArrays(USE_UNIFORM_FLOAT_ARRAYS) {
@@ -47,7 +47,7 @@ public:
}
GrGLShaderVar(const char* name, GrSLType type, TypeModifier typeModifier,
- int arrayCount = kNonArray, Precision precision = kDefault_Precision)
+ int arrayCount = kNonArray, GrSLPrecision precision = kDefault_GrSLPrecision)
: GrShaderVar(name, type, typeModifier, arrayCount, precision)
, fOrigin(kDefault_Origin)
, fUseUniformFloatArrays(USE_UNIFORM_FLOAT_ARRAYS) {
@@ -83,7 +83,7 @@ public:
void set(GrSLType type,
TypeModifier typeModifier,
const SkString& name,
- Precision precision = kDefault_Precision,
+ GrSLPrecision precision = kDefault_GrSLPrecision,
Origin origin = kDefault_Origin,
bool useUniformFloatArrays = USE_UNIFORM_FLOAT_ARRAYS) {
SkASSERT(kVoid_GrSLType != type);
@@ -98,7 +98,7 @@ public:
void set(GrSLType type,
TypeModifier typeModifier,
const char* name,
- Precision precision = kDefault_Precision,
+ GrSLPrecision precision = kDefault_GrSLPrecision,
Origin origin = kDefault_Origin,
bool useUniformFloatArrays = USE_UNIFORM_FLOAT_ARRAYS) {
SkASSERT(kVoid_GrSLType != type);
@@ -114,7 +114,7 @@ public:
TypeModifier typeModifier,
const SkString& name,
int count,
- Precision precision = kDefault_Precision,
+ GrSLPrecision precision = kDefault_GrSLPrecision,
Origin origin = kDefault_Origin,
bool useUniformFloatArrays = USE_UNIFORM_FLOAT_ARRAYS) {
SkASSERT(kVoid_GrSLType != type);
@@ -130,7 +130,7 @@ public:
TypeModifier typeModifier,
const char* name,
int count,
- Precision precision = kDefault_Precision,
+ GrSLPrecision precision = kDefault_GrSLPrecision,
Origin origin = kDefault_Origin,
bool useUniformFloatArrays = USE_UNIFORM_FLOAT_ARRAYS) {
SkASSERT(kVoid_GrSLType != type);
@@ -197,15 +197,15 @@ public:
fUseUniformFloatArrays ? "" : ".x");
}
- static const char* PrecisionString(Precision p, GrGLStandard standard) {
+ static const char* PrecisionString(GrSLPrecision p, GrGLStandard standard) {
// Desktop GLSL has added precision qualifiers but they don't do anything.
if (kGLES_GrGLStandard == standard) {
switch (p) {
- case kLow_Precision:
+ case kLow_GrSLPrecision:
return "lowp ";
- case kMedium_Precision:
+ case kMedium_GrSLPrecision:
return "mediump ";
- case kHigh_Precision:
+ case kHigh_GrSLPrecision:
return "highp ";
default:
SkFAIL("Unexpected precision type.");
diff --git a/src/gpu/gl/builders/GrGLFragmentShaderBuilder.cpp b/src/gpu/gl/builders/GrGLFragmentShaderBuilder.cpp
index 56bc496532..6de5f696d0 100644
--- a/src/gpu/gl/builders/GrGLFragmentShaderBuilder.cpp
+++ b/src/gpu/gl/builders/GrGLFragmentShaderBuilder.cpp
@@ -16,19 +16,19 @@
const char* GrGLFragmentShaderBuilder::kDstCopyColorName = "_dstColor";
static const char* declared_color_output_name() { return "fsColorOut"; }
static const char* dual_source_output_name() { return "dualSourceOut"; }
-static void append_default_precision_qualifier(GrGLShaderVar::Precision p,
+static void append_default_precision_qualifier(GrSLPrecision p,
GrGLStandard standard,
SkString* str) {
// Desktop GLSL has added precision qualifiers but they don't do anything.
if (kGLES_GrGLStandard == standard) {
switch (p) {
- case GrGLShaderVar::kHigh_Precision:
+ case kHigh_GrSLPrecision:
str->append("precision highp float;\n");
break;
- case GrGLShaderVar::kMedium_Precision:
+ case kMedium_GrSLPrecision:
str->append("precision mediump float;\n");
break;
- case GrGLShaderVar::kLow_Precision:
+ case kLow_GrSLPrecision:
str->append("precision lowp float;\n");
break;
default:
@@ -131,7 +131,7 @@ const char* GrGLFragmentShaderBuilder::fragmentPosition() {
fInputs.push_back().set(kVec4f_GrSLType,
GrGLShaderVar::kIn_TypeModifier,
"gl_FragCoord",
- GrGLShaderVar::kDefault_Precision,
+ kDefault_GrSLPrecision,
GrGLShaderVar::kUpperLeft_Origin);
fSetupFragPosition = true;
}
@@ -306,7 +306,7 @@ bool GrGLFragmentShaderBuilder::compileAndAttachShaders(GrGLuint programId,
GrGpuGL* gpu = fProgramBuilder->gpu();
SkString fragShaderSrc(GrGetGLSLVersionDecl(gpu->ctxInfo()));
fragShaderSrc.append(fExtensions);
- append_default_precision_qualifier(GrShaderVar::kDefault_Precision,
+ append_default_precision_qualifier(kDefault_GrSLPrecision,
gpu->glStandard(),
&fragShaderSrc);
fProgramBuilder->appendUniformDecls(GrGLProgramBuilder::kFragment_Visibility, &fragShaderSrc);
@@ -342,7 +342,7 @@ void GrGLFragmentShaderBuilder::bindFragmentShaderLocations(GrGLuint programID)
}
}
-void GrGLFragmentShaderBuilder::addVarying(GrGLVarying* v, GrGLShaderVar::Precision fsPrec) {
+void GrGLFragmentShaderBuilder::addVarying(GrGLVarying* v, GrSLPrecision fsPrec) {
v->fFsIn = v->fVsOut;
if (v->fGsOut) {
v->fFsIn = v->fGsOut;
diff --git a/src/gpu/gl/builders/GrGLFragmentShaderBuilder.h b/src/gpu/gl/builders/GrGLFragmentShaderBuilder.h
index 226be518c3..03f0e7f7a6 100644
--- a/src/gpu/gl/builders/GrGLFragmentShaderBuilder.h
+++ b/src/gpu/gl/builders/GrGLFragmentShaderBuilder.h
@@ -117,7 +117,7 @@ private:
/*
* An internal call for GrGLProgramBuilder to use to add varyings to the vertex shader
*/
- void addVarying(GrGLVarying*, GrGLShaderVar::Precision);
+ void addVarying(GrGLVarying*, GrSLPrecision);
/**
* Features that should only be enabled by GrGLFragmentShaderBuilder itself.
diff --git a/src/gpu/gl/builders/GrGLProgramBuilder.cpp b/src/gpu/gl/builders/GrGLProgramBuilder.cpp
index 5ed566fa33..9ce3bb22a6 100644
--- a/src/gpu/gl/builders/GrGLProgramBuilder.cpp
+++ b/src/gpu/gl/builders/GrGLProgramBuilder.cpp
@@ -103,7 +103,7 @@ GrGLProgramBuilder::GrGLProgramBuilder(GrGpuGL* gpu, const GrOptDrawState& optSt
void GrGLProgramBuilder::addVarying(const char* name,
GrGLVarying* varying,
- GrGLShaderVar::Precision fsPrecision) {
+ GrSLPrecision fsPrecision) {
SkASSERT(varying);
if (varying->vsVarying()) {
fVS.addVarying(name, varying);
@@ -172,7 +172,7 @@ GrGLProgramDataManager::UniformHandle GrGLProgramBuilder::addUniformArray(uint32
// to use the default FS precision.
if ((kVertex_Visibility | kFragment_Visibility) == visibility) {
// the fragment and vertex precisions must match
- uni.fVariable.setPrecision(GrShaderVar::kDefault_Precision);
+ uni.fVariable.setPrecision(kDefault_GrSLPrecision);
}
if (outName) {
diff --git a/src/gpu/gl/builders/GrGLProgramBuilder.h b/src/gpu/gl/builders/GrGLProgramBuilder.h
index b7458b3e8f..7288b94af0 100644
--- a/src/gpu/gl/builders/GrGLProgramBuilder.h
+++ b/src/gpu/gl/builders/GrGLProgramBuilder.h
@@ -134,7 +134,7 @@ public:
*/
virtual void addVarying(const char* name,
GrGLVarying*,
- GrGLShaderVar::Precision fsPrecision=GrGLShaderVar::kDefault_Precision) = 0;
+ GrSLPrecision fsPrecision = kDefault_GrSLPrecision) = 0;
/*
* This call can be used by GP to pass an attribute through all shaders directly to 'output' in
@@ -218,7 +218,7 @@ public:
virtual void addVarying(
const char* name,
GrGLVarying*,
- GrGLShaderVar::Precision fsPrecision=GrGLShaderVar::kDefault_Precision) SK_OVERRIDE;
+ GrSLPrecision fsPrecision = kDefault_GrSLPrecision) SK_OVERRIDE;
virtual void addPassThroughAttribute(const GrGeometryProcessor::GrAttribute*,
const char* output) SK_OVERRIDE;