Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1036)

Unified Diff: src/gpu/glsl/GrGLSLShaderVar.h

Issue 1673093002: Use noperspective interpolation for 2D draws (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: fName -> fVsOut Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/gpu/glsl/GrGLSLShaderBuilder.h ('k') | src/gpu/glsl/GrGLSLVarying.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/glsl/GrGLSLShaderVar.h
diff --git a/src/gpu/glsl/GrGLSLShaderVar.h b/src/gpu/glsl/GrGLSLShaderVar.h
index e26a75c0966794143980f48a66b7755f823bd806..bdd36f3763fa4c9e3c33ba158c50d94337526435 100644
--- a/src/gpu/glsl/GrGLSLShaderVar.h
+++ b/src/gpu/glsl/GrGLSLShaderVar.h
@@ -51,7 +51,9 @@ public:
GrGLSLShaderVar(const GrGLSLShaderVar& var)
: GrShaderVar(var.c_str(), var.getType(), var.getTypeModifier(),
var.getArrayCount(), var.getPrecision())
- , fUseUniformFloatArrays(var.fUseUniformFloatArrays) {
+ , fUseUniformFloatArrays(var.fUseUniformFloatArrays)
+ , fLayoutQualifier(var.fLayoutQualifier)
+ , fExtraModifiers(var.fExtraModifiers) {
SkASSERT(kVoid_GrSLType != var.getType());
}
@@ -71,11 +73,15 @@ public:
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 || GrSLTypeIsNumeric(type));
INHERITED::set(type, name, typeModifier, precision);
fLayoutQualifier = layoutQualifier;
+ if (extraModifiers) {
+ fExtraModifiers.printf("%s ", extraModifiers);
+ }
fUseUniformFloatArrays = useUniformFloatArrays;
}
@@ -87,11 +93,15 @@ public:
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 || GrSLTypeIsNumeric(type));
INHERITED::set(type, name, typeModifier, precision);
fLayoutQualifier = layoutQualifier;
+ if (extraModifiers) {
+ fExtraModifiers.printf("%s ", extraModifiers);
+ }
fUseUniformFloatArrays = useUniformFloatArrays;
}
@@ -104,11 +114,15 @@ public:
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 || GrSLTypeIsNumeric(type));
INHERITED::set(type, name, typeModifier, precision, count);
fLayoutQualifier = layoutQualifier;
+ if (extraModifiers) {
+ fExtraModifiers.printf("%s ", extraModifiers);
+ }
fUseUniformFloatArrays = useUniformFloatArrays;
}
@@ -121,11 +135,15 @@ public:
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 || GrSLTypeIsNumeric(type));
INHERITED::set(type, name, typeModifier, precision, count);
fLayoutQualifier = layoutQualifier;
+ if (extraModifiers) {
+ fExtraModifiers.printf("%s ", extraModifiers);
+ }
fUseUniformFloatArrays = useUniformFloatArrays;
}
@@ -136,6 +154,12 @@ public:
fLayoutQualifier = layoutQualifier;
}
+ void addModifier(const char* modifier) {
+ if (modifier) {
+ fExtraModifiers.appendf("%s ", modifier);
+ }
+ }
+
/**
* Write a declaration of this variable to out.
*/
@@ -144,11 +168,8 @@ public:
if (!fLayoutQualifier.isEmpty()) {
out->appendf("layout(%s) ", fLayoutQualifier.c_str());
}
+ out->append(fExtraModifiers);
if (this->getTypeModifier() != kNone_TypeModifier) {
- if (GrSLTypeIsIntType(fType) && (this->getTypeModifier() == kVaryingIn_TypeModifier ||
- this->getTypeModifier() == kVaryingOut_TypeModifier)) {
- out->append("flat ");
- }
out->append(TypeModifierString(glslCaps, this->getTypeModifier()));
out->append(" ");
}
@@ -234,9 +255,10 @@ private:
/// Work around driver bugs on some hardware that don't correctly
/// support uniform float []
- bool fUseUniformFloatArrays;
+ bool fUseUniformFloatArrays;
- SkString fLayoutQualifier;
+ SkString fLayoutQualifier;
+ SkString fExtraModifiers;
typedef GrShaderVar INHERITED;
};
« no previous file with comments | « src/gpu/glsl/GrGLSLShaderBuilder.h ('k') | src/gpu/glsl/GrGLSLVarying.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698