Index: src/gpu/glsl/GrGLSLShaderVar.h |
diff --git a/src/gpu/glsl/GrGLSLShaderVar.h b/src/gpu/glsl/GrGLSLShaderVar.h |
index 1aedb916613384cc24f4fa6f9f8c67444ed72825..e26a75c0966794143980f48a66b7755f823bd806 100644 |
--- a/src/gpu/glsl/GrGLSLShaderVar.h |
+++ b/src/gpu/glsl/GrGLSLShaderVar.h |
@@ -73,7 +73,7 @@ public: |
const char* layoutQualifier = nullptr, |
bool useUniformFloatArrays = USE_UNIFORM_FLOAT_ARRAYS) { |
SkASSERT(kVoid_GrSLType != type); |
- SkASSERT(kDefault_GrSLPrecision == precision || GrSLTypeIsFloatType(type)); |
+ SkASSERT(kDefault_GrSLPrecision == precision || GrSLTypeIsNumeric(type)); |
INHERITED::set(type, name, typeModifier, precision); |
fLayoutQualifier = layoutQualifier; |
fUseUniformFloatArrays = useUniformFloatArrays; |
@@ -89,7 +89,7 @@ public: |
const char* layoutQualifier = nullptr, |
bool useUniformFloatArrays = USE_UNIFORM_FLOAT_ARRAYS) { |
SkASSERT(kVoid_GrSLType != type); |
- SkASSERT(kDefault_GrSLPrecision == precision || GrSLTypeIsFloatType(type)); |
+ SkASSERT(kDefault_GrSLPrecision == precision || GrSLTypeIsNumeric(type)); |
INHERITED::set(type, name, typeModifier, precision); |
fLayoutQualifier = layoutQualifier; |
fUseUniformFloatArrays = useUniformFloatArrays; |
@@ -106,7 +106,7 @@ public: |
const char* layoutQualifier = nullptr, |
bool useUniformFloatArrays = USE_UNIFORM_FLOAT_ARRAYS) { |
SkASSERT(kVoid_GrSLType != type); |
- SkASSERT(kDefault_GrSLPrecision == precision || GrSLTypeIsFloatType(type)); |
+ SkASSERT(kDefault_GrSLPrecision == precision || GrSLTypeIsNumeric(type)); |
INHERITED::set(type, name, typeModifier, precision, count); |
fLayoutQualifier = layoutQualifier; |
fUseUniformFloatArrays = useUniformFloatArrays; |
@@ -123,7 +123,7 @@ public: |
const char* layoutQualifier = nullptr, |
bool useUniformFloatArrays = USE_UNIFORM_FLOAT_ARRAYS) { |
SkASSERT(kVoid_GrSLType != type); |
- SkASSERT(kDefault_GrSLPrecision == precision || GrSLTypeIsFloatType(type)); |
+ SkASSERT(kDefault_GrSLPrecision == precision || GrSLTypeIsNumeric(type)); |
INHERITED::set(type, name, typeModifier, precision, count); |
fLayoutQualifier = layoutQualifier; |
fUseUniformFloatArrays = useUniformFloatArrays; |
@@ -140,16 +140,22 @@ public: |
* Write a declaration of this variable to out. |
*/ |
void appendDecl(const GrGLSLCaps* glslCaps, SkString* out) const { |
- SkASSERT(kDefault_GrSLPrecision == fPrecision || GrSLTypeIsFloatType(fType)); |
+ SkASSERT(kDefault_GrSLPrecision == fPrecision || GrSLTypeIsNumeric(fType)); |
if (!fLayoutQualifier.isEmpty()) { |
out->appendf("layout(%s) ", fLayoutQualifier.c_str()); |
} |
if (this->getTypeModifier() != kNone_TypeModifier) { |
- out->append(TypeModifierString(glslCaps, this->getTypeModifier())); |
- out->append(" "); |
+ if (GrSLTypeIsIntType(fType) && (this->getTypeModifier() == kVaryingIn_TypeModifier || |
+ this->getTypeModifier() == kVaryingOut_TypeModifier)) { |
+ out->append("flat "); |
+ } |
+ out->append(TypeModifierString(glslCaps, this->getTypeModifier())); |
+ out->append(" "); |
} |
- out->append(PrecisionString(glslCaps, fPrecision)); |
GrSLType effectiveType = this->getType(); |
+ if (effectiveType != kBool_GrSLType) { |
+ out->append(PrecisionString(glslCaps, fPrecision)); |
+ } |
if (this->isArray()) { |
if (this->isUnsizedArray()) { |
out->appendf("%s %s[]", |