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

Unified 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/sksl/SkSLGLSLCodeGenerator.h ('k') | src/sksl/SkSLMain.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/sksl/SkSLGLSLCodeGenerator.cpp
diff --git a/src/sksl/SkSLGLSLCodeGenerator.cpp b/src/sksl/SkSLGLSLCodeGenerator.cpp
index 58cf7d3c36360622f9510a3254bcf403b5c43ee4..45644e8cd10032c12a824826a0073d4505d703af 100644
--- a/src/sksl/SkSLGLSLCodeGenerator.cpp
+++ b/src/sksl/SkSLGLSLCodeGenerator.cpp
@@ -163,6 +163,18 @@ void GLSLCodeGenerator::writeFunctionCall(const FunctionCall& c) {
return;
}
}
+ if (fCaps.fMustForceNegatedAtanParamToFloat && c.fFunction.fName == "atan" &&
+ c.fArguments.size() == 2 && c.fArguments[1]->fKind == Expression::kPrefix_Kind) {
+ const PrefixExpression& p = (PrefixExpression&) *c.fArguments[1];
+ if (p.fOperator == Token::MINUS) {
+ this->write("atan(");
+ this->writeExpression(*c.fArguments[0], kSequence_Precedence);
+ this->write(", -1.0 * ");
+ this->writeExpression(*p.fOperand, kMultiplicative_Precedence);
+ this->write(")");
+ return;
+ }
+ }
this->write(c.fFunction.fName + "(");
const char* separator = "";
for (const auto& arg : c.fArguments) {
« 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