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

Side by Side Diff: tests/SkSLGLSLTest.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/SkSLMain.cpp ('k') | 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 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 "SkSLCompiler.h" 8 #include "SkSLCompiler.h"
9 9
10 #include "Test.h" 10 #include "Test.h"
(...skipping 15 matching lines...) Expand all
26 } 26 }
27 } 27 }
28 28
29 static SkSL::GLCaps default_caps() { 29 static SkSL::GLCaps default_caps() {
30 return { 30 return {
31 400, 31 400,
32 SkSL::GLCaps::kGL_Standard, 32 SkSL::GLCaps::kGL_Standard,
33 false, // isCoreProfile 33 false, // isCoreProfile
34 false, // usesPrecisionModifiers; 34 false, // usesPrecisionModifiers;
35 false, // mustDeclareFragmentShaderOutput 35 false, // mustDeclareFragmentShaderOutput
36 true // canUseMinAndAbsTogether 36 true, // canUseMinAndAbsTogether
37 false // mustForceNegatedAtanParamToFloat
37 }; 38 };
38 } 39 }
39 40
40 DEF_TEST(SkSLHelloWorld, r) { 41 DEF_TEST(SkSLHelloWorld, r) {
41 test(r, 42 test(r,
42 "void main() { sk_FragColor = vec4(0.75); }", 43 "void main() { sk_FragColor = vec4(0.75); }",
43 default_caps(), 44 default_caps(),
44 "#version 400\n" 45 "#version 400\n"
45 "void main() {\n" 46 "void main() {\n"
46 " gl_FragColor = vec4(0.75);\n" 47 " gl_FragColor = vec4(0.75);\n"
(...skipping 261 matching lines...) Expand 10 before | Expand all | Expand 10 after
308 "#version 400\n" 309 "#version 400\n"
309 "void main() {\n" 310 "void main() {\n"
310 " float minAbsHackVar0;\n" 311 " float minAbsHackVar0;\n"
311 " float minAbsHackVar1;\n" 312 " float minAbsHackVar1;\n"
312 " float x = -5.0;\n" 313 " float x = -5.0;\n"
313 " x = ((minAbsHackVar0 = abs(x)) < (minAbsHackVar1 = 6.0) ? minAbsHa ckVar0 : " 314 " x = ((minAbsHackVar0 = abs(x)) < (minAbsHackVar1 = 6.0) ? minAbsHa ckVar0 : "
314 "minAbsHackVar1);\n" 315 "minAbsHackVar1);\n"
315 "}\n"); 316 "}\n");
316 } 317 }
317 318
319 DEF_TEST(SkSLNegatedAtan, r) {
320 test(r,
321 "void main() { vec2 x = vec2(1, 2); float y = atan(x.x, -(2 * x.y)); }" ,
322 default_caps(),
323 "#version 400\n"
324 "void main() {\n"
325 " vec2 x = vec2(1.0, 2.0);\n"
326 " float y = atan(x.x, -(2.0 * x.y));\n"
327 "}\n");
328 SkSL::GLCaps caps = default_caps();
329 caps.fMustForceNegatedAtanParamToFloat = true;
330 test(r,
331 "void main() { vec2 x = vec2(1, 2); float y = atan(x.x, -(2 * x.y)); }" ,
332 caps,
333 "#version 400\n"
334 "void main() {\n"
335 " vec2 x = vec2(1.0, 2.0);\n"
336 " float y = atan(x.x, -1.0 * (2.0 * x.y));\n"
337 "}\n");
338 }
339
318 DEF_TEST(SkSLModifiersDeclaration, r) { 340 DEF_TEST(SkSLModifiersDeclaration, r) {
319 test(r, 341 test(r,
320 "layout(blend_support_all_equations) out;" 342 "layout(blend_support_all_equations) out;"
321 "void main() { }", 343 "void main() { }",
322 default_caps(), 344 default_caps(),
323 "#version 400\n" 345 "#version 400\n"
324 "layout (blend_support_all_equations) out ;\n" 346 "layout (blend_support_all_equations) out ;\n"
325 "void main() {\n" 347 "void main() {\n"
326 "}\n"); 348 "}\n");
327 } 349 }
(...skipping 30 matching lines...) Expand all
358 test(r, 380 test(r,
359 "float test1[] = float[](1, 2, 3, 4);" 381 "float test1[] = float[](1, 2, 3, 4);"
360 "vec2 test2[] = vec2[](vec2(1, 2), vec2(3, 4));" 382 "vec2 test2[] = vec2[](vec2(1, 2), vec2(3, 4));"
361 "mat4 test3[] = mat4[]();", 383 "mat4 test3[] = mat4[]();",
362 default_caps(), 384 default_caps(),
363 "#version 400\n" 385 "#version 400\n"
364 "float test1[] = float[](1.0, 2.0, 3.0, 4.0);\n" 386 "float test1[] = float[](1.0, 2.0, 3.0, 4.0);\n"
365 "vec2 test2[] = vec2[](vec2(1.0, 2.0), vec2(3.0, 4.0));\n" 387 "vec2 test2[] = vec2[](vec2(1.0, 2.0), vec2(3.0, 4.0));\n"
366 "mat4 test3[] = mat4[]();\n"); 388 "mat4 test3[] = mat4[]();\n");
367 } 389 }
OLDNEW
« no previous file with comments | « src/sksl/SkSLMain.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698