Index: src/gpu/glsl/GrGLSL.h |
diff --git a/src/gpu/glsl/GrGLSL.h b/src/gpu/glsl/GrGLSL.h |
index 6fc8f83c7a3ca1be80fada8a9ef72a12d923ca02..1fe23107d88cc283f3747e50c2f17b2a6414707e 100644 |
--- a/src/gpu/glsl/GrGLSL.h |
+++ b/src/gpu/glsl/GrGLSL.h |
@@ -37,9 +37,17 @@ enum GrGLSLGeneration { |
*/ |
k330_GrGLSLGeneration, |
/** |
+ * Desktop GLSL 4.00 |
+ */ |
+ k400_GrGLSLGeneration, |
+ /** |
* ES GLSL 3.10 only TODO Make GLSLCap objects to make this more granular |
*/ |
k310es_GrGLSLGeneration, |
+ /** |
+ * ES GLSL 3.20 |
+ */ |
+ k320es_GrGLSLGeneration, |
}; |
bool GrGLSLSupportsNamedFragmentShaderOutputs(GrGLSLGeneration); |
@@ -112,6 +120,20 @@ static inline const char* GrGLSLTypeString(GrSLType t) { |
} |
} |
+/** |
+ * Returns the minimum precision that can fully represent an int with the provided number of bits. |
+ */ |
+static inline GrSLPrecision GrGLSLIntMinPrecisionForNBits(int bits) { |
bsalomon
2016/02/12 20:58:17
If we're not using this can we remove it?
Chris Dalton
2016/02/12 21:01:50
Oops. Done.
|
+ SkASSERT(bits <= 32); |
+ if (bits <= 9) { // Lowp integers are spec'd to have at least 9 bits. |
+ return kLow_GrSLPrecision; |
+ } else if (bits <= 16) { |
+ return kMedium_GrSLPrecision; |
+ } else { |
+ return kHigh_GrSLPrecision; |
+ } |
+} |
+ |
/** A generic base-class representing a GLSL expression. |
* The instance can be a variable name, expression or vecN(0) or vecN(1). Does simple constant |
* folding with help of 1 and 0. |