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

Side by Side Diff: src/sksl/SkSLGLSLCodeGenerator.cpp

Issue 2413363002: added SkSL support for mustForceNegatedAtanParamToFloat cap (Closed)
Patch Set: updated comment again Created 4 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 | « src/sksl/SkSLGLSLCodeGenerator.h ('k') | src/sksl/SkSLMain.cpp » ('j') | 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 2016 Google Inc. 2 * Copyright 2016 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 "SkSLGLSLCodeGenerator.h" 8 #include "SkSLGLSLCodeGenerator.h"
9 9
10 #include "string.h" 10 #include "string.h"
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after
156 this->writeMinAbsHack(*c.fArguments[0], *c.fArguments[1]); 156 this->writeMinAbsHack(*c.fArguments[0], *c.fArguments[1]);
157 return; 157 return;
158 } 158 }
159 if (is_abs(*c.fArguments[1])) { 159 if (is_abs(*c.fArguments[1])) {
160 // note that this violates the GLSL left-to-right evaluation semanti cs. I doubt it will 160 // note that this violates the GLSL left-to-right evaluation semanti cs. I doubt it will
161 // ever end up mattering, but it's worth calling out. 161 // ever end up mattering, but it's worth calling out.
162 this->writeMinAbsHack(*c.fArguments[1], *c.fArguments[0]); 162 this->writeMinAbsHack(*c.fArguments[1], *c.fArguments[0]);
163 return; 163 return;
164 } 164 }
165 } 165 }
166 if (fCaps.fMustForceNegatedAtanParamToFloat && c.fFunction.fName == "atan" & &
167 c.fArguments.size() == 2 && c.fArguments[1]->fKind == Expression::kPrefi x_Kind) {
168 const PrefixExpression& p = (PrefixExpression&) *c.fArguments[1];
169 if (p.fOperator == Token::MINUS) {
170 this->write("atan(");
171 this->writeExpression(*c.fArguments[0], kSequence_Precedence);
172 this->write(", -1.0 * ");
173 this->writeExpression(*p.fOperand, kMultiplicative_Precedence);
174 this->write(")");
175 return;
176 }
177 }
166 this->write(c.fFunction.fName + "("); 178 this->write(c.fFunction.fName + "(");
167 const char* separator = ""; 179 const char* separator = "";
168 for (const auto& arg : c.fArguments) { 180 for (const auto& arg : c.fArguments) {
169 this->write(separator); 181 this->write(separator);
170 separator = ", "; 182 separator = ", ";
171 this->writeExpression(*arg, kSequence_Precedence); 183 this->writeExpression(*arg, kSequence_Precedence);
172 } 184 }
173 this->write(")"); 185 this->write(")");
174 } 186 }
175 187
(...skipping 457 matching lines...) Expand 10 before | Expand all | Expand 10 after
633 break; 645 break;
634 default: 646 default:
635 printf("%s\n", e->description().c_str()); 647 printf("%s\n", e->description().c_str());
636 ABORT("unsupported program element"); 648 ABORT("unsupported program element");
637 } 649 }
638 } 650 }
639 fOut = nullptr; 651 fOut = nullptr;
640 } 652 }
641 653
642 } 654 }
OLDNEW
« no previous file with comments | « src/sksl/SkSLGLSLCodeGenerator.h ('k') | src/sksl/SkSLMain.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698