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

Unified Diff: src/gpu/glsl/GrGLSL.cpp

Issue 1403373012: Make appending default precision be controled by GLSL (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: rebase Created 5 years, 2 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/GrGLSL.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/glsl/GrGLSL.cpp
diff --git a/src/gpu/glsl/GrGLSL.cpp b/src/gpu/glsl/GrGLSL.cpp
index c77b7fab20719f3042de5c9376948181ce665246..2de81ddd60efb85bbe1eefdf205454735910bbe0 100644
--- a/src/gpu/glsl/GrGLSL.cpp
+++ b/src/gpu/glsl/GrGLSL.cpp
@@ -6,6 +6,7 @@
*/
#include "GrGLSL.h"
+#include "GrGLSLCaps.h"
#include "SkString.h"
bool GrGLSLSupportsNamedFragmentShaderOutputs(GrGLSLGeneration gen) {
@@ -22,6 +23,26 @@ bool GrGLSLSupportsNamedFragmentShaderOutputs(GrGLSLGeneration gen) {
return false;
}
+void GrGLSLAppendDefaultFloatPrecisionDeclaration(GrSLPrecision p,
+ const GrGLSLCaps& glslCaps,
+ SkString* out) {
+ if (glslCaps.usesPrecisionModifiers()) {
+ switch (p) {
+ case kHigh_GrSLPrecision:
+ out->append("precision highp float;\n");
+ break;
+ case kMedium_GrSLPrecision:
+ out->append("precision mediump float;\n");
+ break;
+ case kLow_GrSLPrecision:
+ out->append("precision lowp float;\n");
+ break;
+ default:
+ SkFAIL("Unknown precision value.");
+ }
+ }
+}
+
void GrGLSLMulVarBy4f(SkString* outAppend, const char* vec4VarName, const GrGLSLExpr4& mulFactor) {
if (mulFactor.isOnes()) {
*outAppend = SkString();
« no previous file with comments | « src/gpu/glsl/GrGLSL.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698