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

Side by Side Diff: src/gpu/gl/GrGLSL.cpp

Issue 659313004: bug fix for glsl identity string (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 6 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 unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2011 Google Inc. 2 * Copyright 2011 Google Inc.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 #include "GrGLSL.h" 8 #include "GrGLSL.h"
9 #include "GrGLShaderVar.h" 9 #include "GrGLShaderVar.h"
10 #include "SkString.h" 10 #include "SkString.h"
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
69 if (info.caps()->isCoreProfile()) { 69 if (info.caps()->isCoreProfile()) {
70 return "#version 150\n"; 70 return "#version 150\n";
71 } else { 71 } else {
72 return "#version 150 compatibility\n"; 72 return "#version 150 compatibility\n";
73 } 73 }
74 case k330_GrGLSLGeneration: 74 case k330_GrGLSLGeneration:
75 if (kGLES_GrGLStandard == info.standard()) { 75 if (kGLES_GrGLStandard == info.standard()) {
76 return "#version 300 es\n"; 76 return "#version 300 es\n";
77 } else { 77 } else {
78 SkASSERT(kGL_GrGLStandard == info.standard()); 78 SkASSERT(kGL_GrGLStandard == info.standard());
79 return "#version 330 compatibility\n"; 79 if (info.caps()->isCoreProfile()) {
80 return "#version 330\n";
81 } else {
82 return "#version 330 compatibility\n";
83 }
80 } 84 }
81 case k310es_GrGLSLGeneration: 85 case k310es_GrGLSLGeneration:
82 SkASSERT(kGLES_GrGLStandard == info.standard()); 86 SkASSERT(kGLES_GrGLStandard == info.standard());
83 return "#version 310 es\n"; 87 return "#version 310 es\n";
84 default: 88 default:
85 SkFAIL("Unknown GL version."); 89 SkFAIL("Unknown GL version.");
86 return ""; // suppress warning 90 return ""; // suppress warning
87 } 91 }
88 } 92 }
89 93
90 void GrGLSLMulVarBy4f(SkString* outAppend, const char* vec4VarName, const GrGLSL Expr4& mulFactor) { 94 void GrGLSLMulVarBy4f(SkString* outAppend, const char* vec4VarName, const GrGLSL Expr4& mulFactor) {
91 if (mulFactor.isOnes()) { 95 if (mulFactor.isOnes()) {
92 *outAppend = SkString(); 96 *outAppend = SkString();
93 } 97 }
94 98
95 if (mulFactor.isZeros()) { 99 if (mulFactor.isZeros()) {
96 outAppend->appendf("%s = vec4(0);", vec4VarName); 100 outAppend->appendf("%s = vec4(0);", vec4VarName);
97 } else { 101 } else {
98 outAppend->appendf("%s *= %s;", vec4VarName, mulFactor.c_str()); 102 outAppend->appendf("%s *= %s;", vec4VarName, mulFactor.c_str());
99 } 103 }
100 } 104 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698