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

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

Issue 1881513002: Add appendPrecisionModifier method to GrGLSLShaderBuilder (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 4 years, 8 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.cpp ('k') | no next file » | 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 a7d7479d3908c5d3dfdb2703972af12366a389da..9d162ecaa4b5f05f6808bbf9a7be342f32ff0fd1 100644
--- a/src/gpu/glsl/GrGLSLShaderVar.h
+++ b/src/gpu/glsl/GrGLSLShaderVar.h
@@ -174,8 +174,9 @@ public:
out->append(" ");
}
GrSLType effectiveType = this->getType();
- if (GrSLTypeAcceptsPrecision(effectiveType)) {
- out->append(PrecisionString(glslCaps, fPrecision));
+ 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()) {
@@ -210,23 +211,6 @@ public:
fUseUniformFloatArrays ? "" : ".x");
}
- static const char* PrecisionString(const GrGLSLCaps* glslCaps, GrSLPrecision p) {
- // Desktop GLSL has added precision qualifiers but they don't do anything.
- if (glslCaps->usesPrecisionModifiers()) {
- switch (p) {
- case kLow_GrSLPrecision:
- return "lowp ";
- case kMedium_GrSLPrecision:
- return "mediump ";
- case kHigh_GrSLPrecision:
- return "highp ";
- default:
- SkFAIL("Unexpected precision type.");
- }
- }
- return "";
- }
-
private:
static const char* TypeModifierString(const GrGLSLCaps* glslCaps, TypeModifier t) {
GrGLSLGeneration gen = glslCaps->generation();
« no previous file with comments | « src/gpu/glsl/GrGLSLShaderBuilder.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698