Index: tests/SkSLGLSLTest.cpp |
diff --git a/tests/SkSLGLSLTest.cpp b/tests/SkSLGLSLTest.cpp |
index 38fce87e87faf46bf7608c99075d48598909b689..610ff2b5abf7c855ecf33d6ecd10e70dc5e43532 100644 |
--- a/tests/SkSLGLSLTest.cpp |
+++ b/tests/SkSLGLSLTest.cpp |
@@ -43,7 +43,7 @@ |
DEF_TEST(SkSLControl, r) { |
test(r, |
"void main() {" |
- "if (sqrt(2) > 5) { sk_FragColor = vec4(0.75); } else { discard; }" |
+ "if (1 + 2 + 3 > 5) { sk_FragColor = vec4(0.75); } else { discard; }" |
"int i = 0;" |
"while (i < 10) sk_FragColor *= 0.5;" |
"do { sk_FragColor += 0.01; } while (sk_FragColor.x < 0.7);" |
@@ -55,7 +55,7 @@ |
default_caps(), |
"#version 400\n" |
"void main() {\n" |
- " if (sqrt(2.0) > 5.0) {\n" |
+ " if ((1 + 2) + 3 > 5) {\n" |
" gl_FragColor = vec4(0.75);\n" |
" } else {\n" |
" discard;\n" |
@@ -104,7 +104,7 @@ |
"x = x + y * z * x * (y - z);" |
"y = x / y / z;" |
"z = (z / 2 % 3 << 4) >> 2 << 1;" |
- "bool b = (x > 4) == x < 2 || 2 >= sqrt(2) && y <= z;" |
+ "bool b = (x > 4) == x < 2 || 2 >= 5 && y <= z && 12 != 11;" |
"x += 12;" |
"x -= 12;" |
"x *= y /= z = 10;" |
@@ -126,7 +126,7 @@ |
" x = x + ((y * float(z)) * x) * (y - float(z));\n" |
" y = (x / y) / float(z);\n" |
" z = (((z / 2) % 3 << 4) >> 2) << 1;\n" |
- " bool b = x > 4.0 == x < 2.0 || 2.0 >= sqrt(2.0) && y <= float(z);\n" |
+ " bool b = x > 4.0 == x < 2.0 || (2 >= 5 && y <= float(z)) && 12 != 11;\n" |
" x += 12.0;\n" |
" x -= 12.0;\n" |
" x *= (y /= float(z = 10));\n" |
@@ -430,100 +430,3 @@ |
" float x = dFdx(1.0);\n" |
"}\n"); |
} |
- |
-DEF_TEST(SkSLConstantFolding, r) { |
- test(r, |
- "void main() {" |
- "float f_add = 32 + 2;" |
- "float f_sub = 32 - 2;" |
- "float f_mul = 32 * 2;" |
- "float f_div = 32 / 2;" |
- "float mixed = (12 > 2.0) ? (10 * 2 / 5 + 18 - 3) : 0;" |
- "int i_add = 32 + 2;" |
- "int i_sub = 32 - 2;" |
- "int i_mul = 32 * 2;" |
- "int i_div = 32 / 2;" |
- "int i_or = 12 | 6;" |
- "int i_and = 254 & 7;" |
- "int i_xor = 2 ^ 7;" |
- "int i_shl = 1 << 4;" |
- "int i_shr = 128 >> 2;" |
- "bool gt_it = 6 > 5;" |
- "bool gt_if = 6 > 6;" |
- "bool gt_ft = 6.0 > 5.0;" |
- "bool gt_ff = 6.0 > 6.0;" |
- "bool gte_it = 6 >= 6;" |
- "bool gte_if = 6 >= 7;" |
- "bool gte_ft = 6.0 >= 6.0;" |
- "bool gte_ff = 6.0 >= 7.0;" |
- "bool lte_it = 6 <= 6;" |
- "bool lte_if = 6 <= 5;" |
- "bool lte_ft = 6.0 <= 6.0;" |
- "bool lte_ff = 6.0 <= 5.0;" |
- "bool or_t = 1 == 1 || 2 == 8;" |
- "bool or_f = 1 > 1 || 2 == 8;" |
- "bool and_t = 1 == 1 && 2 <= 8;" |
- "bool and_f = 1 == 2 && 2 == 8;" |
- "bool xor_t = 1 == 1 ^^ 1 != 1;" |
- "bool xor_f = 1 == 1 ^^ 1 == 1;" |
- "int ternary = 10 > 5 ? 10 : 5;" |
- "}", |
- default_caps(), |
- "#version 400\n" |
- "void main() {\n" |
- " float f_add = 34.0;\n" |
- " float f_sub = 30.0;\n" |
- " float f_mul = 64.0;\n" |
- " float f_div = 16.0;\n" |
- " float mixed = 19.0;\n" |
- " int i_add = 34;\n" |
- " int i_sub = 30;\n" |
- " int i_mul = 64;\n" |
- " int i_div = 16;\n" |
- " int i_or = 14;\n" |
- " int i_and = 6;\n" |
- " int i_xor = 5;\n" |
- " int i_shl = 16;\n" |
- " int i_shr = 32;\n" |
- " bool gt_it = true;\n" |
- " bool gt_if = false;\n" |
- " bool gt_ft = true;\n" |
- " bool gt_ff = false;\n" |
- " bool gte_it = true;\n" |
- " bool gte_if = false;\n" |
- " bool gte_ft = true;\n" |
- " bool gte_ff = false;\n" |
- " bool lte_it = true;\n" |
- " bool lte_if = false;\n" |
- " bool lte_ft = true;\n" |
- " bool lte_ff = false;\n" |
- " bool or_t = true;\n" |
- " bool or_f = false;\n" |
- " bool and_t = true;\n" |
- " bool and_f = false;\n" |
- " bool xor_t = true;\n" |
- " bool xor_f = false;\n" |
- " int ternary = 10;\n" |
- "}\n"); |
-} |
- |
-DEF_TEST(SkSLStaticIf, r) { |
- test(r, |
- "void main() {" |
- "int x;" |
- "if (true) x = 1;" |
- "if (2 > 1) x = 2; else x = 3;" |
- "if (1 > 2) x = 4; else x = 5;" |
- "if (false) x = 6;" |
- "}", |
- default_caps(), |
- "#version 400\n" |
- "void main() {\n" |
- " int x;\n" |
- " x = 1;\n" |
- " x = 2;\n" |
- " x = 5;\n" |
- " {\n" |
- " }\n" |
- "}\n"); |
-} |