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

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

Issue 1202293002: Move GLSL-specific routines/classes to separate glsl directory (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Rename GrGLGLSL.{cpp,h} Created 5 years, 6 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') | src/gpu/glsl/GrGLSLCaps.h » ('j') | 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
new file mode 100644
index 0000000000000000000000000000000000000000..c77b7fab20719f3042de5c9376948181ce665246
--- /dev/null
+++ b/src/gpu/glsl/GrGLSL.cpp
@@ -0,0 +1,35 @@
+/*
+ * Copyright 2011 Google Inc.
+ *
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+#include "GrGLSL.h"
+#include "SkString.h"
+
+bool GrGLSLSupportsNamedFragmentShaderOutputs(GrGLSLGeneration gen) {
+ switch (gen) {
+ case k110_GrGLSLGeneration:
+ return false;
+ case k130_GrGLSLGeneration:
+ case k140_GrGLSLGeneration:
+ case k150_GrGLSLGeneration:
+ case k330_GrGLSLGeneration:
+ case k310es_GrGLSLGeneration:
+ return true;
+ }
+ return false;
+}
+
+void GrGLSLMulVarBy4f(SkString* outAppend, const char* vec4VarName, const GrGLSLExpr4& mulFactor) {
+ if (mulFactor.isOnes()) {
+ *outAppend = SkString();
+ }
+
+ if (mulFactor.isZeros()) {
+ outAppend->appendf("%s = vec4(0);", vec4VarName);
+ } else {
+ outAppend->appendf("%s *= %s;", vec4VarName, mulFactor.c_str());
+ }
+}
« no previous file with comments | « src/gpu/glsl/GrGLSL.h ('k') | src/gpu/glsl/GrGLSLCaps.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698