Lines Matching defs:main

23         // For convenience, so we can test functions other than (and not called by) main.
86 const SkSL::FunctionDefinition* main = SkSL::Program_GetFunction(*program, "main");
87 REPORTER_ASSERT(r, main);
91 SkSL::ProgramToSkVM(*program, *main, &b, /*debugInfo=*/nullptr, /*uniforms=*/{}, &sig);
117 const SkSL::FunctionDefinition* main = SkSL::Program_GetFunction(*program, "main");
118 REPORTER_ASSERT(r, main);
121 SkSL::ProgramToSkVM(*program, *main, &b, /*debugInfo=*/nullptr, /*uniforms=*/{});
136 test(r, "void main(inout half4 color) { color.r = color.r + color.g; }", 0.25, 0.75, 0, 0, 1,
138 test(r, "void main(inout half4 color) { color += half4(1, 2, 3, 4); }", 4, 3, 2, 1, 5, 5, 5, 5);
139 test(r, "void main(inout half4 color) { half4 c = color; color += c; }", 0.25, 0.5, 0.75, 1,
141 test(r, "void main(inout half4 color) { color.r = half(int(color.r) + int(color.g)); }", 1, 3, 0, 0,
146 test(r, "void main(inout half4 color) { color.r = color.r - color.g; }", 1, 0.75, 0, 0, 0.25,
148 test(r, "void main(inout half4 color) { color -= half4(1, 2, 3, 4); }", 5, 5, 5, 5, 4, 3, 2, 1);
149 test(r, "void main(inout half4 color) { half4 c = color; color -= c; }", 4, 3, 2, 1,
151 test(r, "void main(inout half4 color) { color.x = -color.x; }", 4, 3, 2, 1, -4, 3, 2, 1);
152 test(r, "void main(inout half4 color) { color = -color; }", 4, 3, 2, 1, -4, -3, -2, -1);
153 test(r, "void main(inout half4 color) { color.r = half(int(color.r) - int(color.g)); }", 3, 1, 0, 0,
158 test(r, "void main(inout half4 color) { color.r = color.r * color.g; }", 2, 3, 0, 0, 6, 3, 0,
160 test(r, "void main(inout half4 color) { color *= half4(1, 2, 3, 4); }", 2, 3, 4, 5, 2, 6, 12,
162 test(r, "void main(inout half4 color) { half4 c = color; color *= c; }", 4, 3, 2, 1,
164 test(r, "void main(inout half4 color) { color.r = half(int(color.r) * int(color.g)); }", 3, -2, 0, 0,
169 test(r, "void main(inout half4 color) { color.r = color.r / color.g; }", 1, 2, 0, 0, 0.5, 2, 0,
171 test(r, "void main(inout half4 color) { color /= half4(1, 2, 3, 4); }", 12, 12, 12, 12, 12, 6,
173 test(r, "void main(inout half4 color) { half4 c = color; color /= c; }", 4, 3, 2, 1,
175 test(r, "void main(inout half4 color) { color.r = half(int(color.r) / int(color.g)); }", 8, -2, 0, 0,
180 test(r, "void main(inout half4 color) { if (color.r > color.g && color.g > color.b) "
182 test(r, "void main(inout half4 color) { if (color.r > color.g && color.g > color.b) "
184 test(r, "void main(inout half4 color) { if (color.r > color.g && color.g > color.b) "
187 "void main(inout half4 color) { global = 0; if (color.r > color.g && update()) "
190 "void main(inout half4 color) { global = 0; if (color.r > color.g && update()) "
195 test(r, "void main(inout half4 color) { if (color.r > color.g || color.g > color.b) "
197 test(r, "void main(inout half4 color) { if (color.r > color.g || color.g > color.b) "
199 test(r, "void main(inout half4 color) { if (color.r > color.g || color.g > color.b) "
202 "void main(inout half4 color) { global = 0; if (color.r > color.g || update()) "
205 "void main(inout half4 color) { global = 0; if (color.r > color.g || update()) "
216 test(r, "float main(float x) { float4x4 m = float4x4(x); return m[1][1] + m[1][2] + m[2][2]; }",
221 test(r, "float main(float x) {"
233 test(r, "float main(float4 v) { float2x2 m = float2x2(v); return m[0][1] + m[1][0]; }",
237 test(r, "float main(float4 v) {"
247 test(r, "float4x4 main(float4x4 m) { return m + m; }", in, expected);
249 test(r, "float4x4 main(float4x4 m) { return m + 3.0; }", in, expected);
250 test(r, "float4x4 main(float4x4 m) { return 3.0 + m; }", in, expected);
254 test(r, "float2x2 main(float2x2 m1, float2x2 m2) { return m2 - m1; }", in, expected);
256 test(r, "float4x4 main(float4x4 m) { return m - 3.0; }", in, expected);
258 test(r, "float4x4 main(float4x4 m) { return 3.0 - m; }", in, expected);
262 test(r, "float4x4 main(float4x4 m) { return m * 3.0; }", in, expected);
263 test(r, "float4x4 main(float4x4 m) { return 3.0 * m; }", in, expected);
265 test(r, "float4x4 main(float4x4 m) { return m / 2.0; }", in, expected);
267 test(r, "float4x4 main(float4x4 m) { return 1.0 / (m + 1); }", in, expected);
271 test(r, "float4x4 main(float4x4 m) { return -m; }", in, expected);
277 test(r, "float3 main(float3x3 m, float3 v) { return m * v; }", in, expected);
281 test(r, "float3 main(float3x3 m, float3 v) { return v * m; }", in, expected);
294 test(r, "float4x4 main(float4x4 m) { return m * float4x4(m[1], m[2], m[3], m[0]); }",
300 test(r, "void main(inout half4 color) { color.r = color.g > color.b ? color.g : color.b; }",
302 test(r, "void main(inout half4 color) { color.r = color.g > color.b ? color.g : color.b; }",
319 test(r, "float main(int x) { return float (x); }", (float*)input, (float*)expected);
320 test(r, "float2 main(int2 x) { return float2(x); }", (float*)input, (float*)expected);
326 test(r, "int main(float x) { return int (x); }", (float*)input, (float*)expected);
327 test(r, "int2 main(float2 x) { return int2(x); }", (float*)input, (float*)expected);
332 test(r, "float2 main(int x) { return float2(x); }", (float*)input, (float*)expected);
336 test(r, "void main(inout half4 color) { if (color.r > color.g) color.a = 1; }", 5, 3, 0, 0,
338 test(r, "void main(inout half4 color) { if (color.r > color.g) color.a = 1; }", 5, 5, 0, 0,
340 test(r, "void main(inout half4 color) { if (color.r > color.g) color.a = 1; }", 5, 6, 0, 0,
342 test(r, "void main(inout half4 color) { if (color.r < color.g) color.a = 1; }", 3, 5, 0, 0,
344 test(r, "void main(inout half4 color) { if (color.r < color.g) color.a = 1; }", 5, 5, 0, 0,
346 test(r, "void main(inout half4 color) { if (color.r < color.g) color.a = 1; }", 6, 5, 0, 0,
348 test(r, "void main(inout half4 color) { if (color.r >= color.g) color.a = 1; }", 5, 3, 0, 0,
350 test(r, "void main(inout half4 color) { if (color.r >= color.g) color.a = 1; }", 5, 5, 0, 0,
352 test(r, "void main(inout half4 color) { if (color.r >= color.g) color.a = 1; }", 5, 6, 0, 0,
354 test(r, "void main(inout half4 color) { if (color.r <= color.g) color.a = 1; }", 3, 5, 0, 0,
356 test(r, "void main(inout half4 color) { if (color.r <= color.g) color.a = 1; }", 5, 5, 0, 0,
358 test(r, "void main(inout half4 color) { if (color.r <= color.g) color.a = 1; }", 6, 5, 0, 0,
360 test(r, "void main(inout half4 color) { if (color.r == color.g) color.a = 1; }", 2, 2, 0, 0,
362 test(r, "void main(inout half4 color) { if (color.r == color.g) color.a = 1; }", 2, -2, 0, 0,
364 test(r, "void main(inout half4 color) { if (color.r != color.g) color.a = 1; }", 2, 2, 0, 0,
366 test(r, "void main(inout half4 color) { if (color.r != color.g) color.a = 1; }", 2, -2, 0, 0,
368 test(r, "void main(inout half4 color) { if (!(color.r == color.g)) color.a = 1; }", 2, 2, 0, 0,
370 test(r, "void main(inout half4 color) { if (!(color.r == color.g)) color.a = 1; }", 2, -2, 0, 0,
372 test(r, "void main(inout half4 color) { if (color.r == color.g) color.a = 1; else "
374 test(r, "void main(inout half4 color) { if (color.r == color.g) color.a = 1; else "
379 test(r, "void main(inout half4 color) { if (color.rg == color.ba) color.a = 1; }",
381 test(r, "void main(inout half4 color) { if (color.rg == color.ba) color.a = 1; }",
383 test(r, "void main(inout half4 color) { if (color.rg != color.ba) color.a = 1; }",
385 test(r, "void main(inout half4 color) { if (color.rg != color.ba) color.a = 1; }",
390 test(r, "void main(inout half4 color) { for (int i = 1; i <= 10; ++i) color.r += half(i); }",
394 "void main(inout half4 color) {"
402 "void main(inout half4 color) {"
415 test(r, "void main(inout half4 color) { color.r = ++color.g; }", 1, 2, 3, 4, 3, 3, 3, 4);
416 test(r, "void main(inout half4 color) { color.r = color.g++; }", 1, 2, 3, 4, 2, 3, 3, 4);
420 test(r, "void main(inout half4 color) { color = color.abgr; }", 1, 2, 3, 4, 4, 3, 2, 1);
421 test(r, "void main(inout half4 color) { color.rgb = half4(5, 6, 7, 8).bbg; }", 1, 2, 3, 4, 7, 7,
423 test(r, "void main(inout half4 color) { color.bgr = half3(5, 6, 7); }", 1, 2, 3, 4, 7, 6,
428 test(r, "int x; void main(inout half4 color) { x = 10; color.b = half(x); }", 1, 2, 3, 4, 1, 2,
430 test(r, "float4 x; void main(inout float4 color) { x = color * 2; color = x; }",
432 test(r, "float4 x; void main(inout float4 color) { x = float4(5, 6, 7, 8); color = x.wzyx; }",
434 test(r, "float4 x; void main(inout float4 color) { x.wzyx = float4(5, 6, 7, 8); color = x; }",
441 test(r, "float main(float x) { return x * x; }", &value1, &expected1);
444 test(r, "float2 main(float x, float y) { return float2(x * x, y * y); }", value2, expected2);
451 float main() { return make_point().y; }
461 float main() { return make_mtx()[1][0]; }
636 expect_failure(r, "void main(inout float x) { while (x < 1) { x++; } }");
637 expect_failure(r, "void main(inout float x) { do { x++; } while (x < 1); }");
646 void main(inout float x) { y = x; maybe_inc(); x = y; }
650 const SkSL::FunctionDefinition* main = SkSL::Program_GetFunction(*program, "main");
651 REPORTER_ASSERT(r, main);
654 SkSL::ProgramToSkVM(*program, *main, &b, /*debugInfo=*/nullptr, /*uniforms=*/{});
668 const char* src = "float main(float x, float y) { if (x < y) { return x; } return y; }";
672 const SkSL::FunctionDefinition* main = SkSL::Program_GetFunction(*program, "main");
673 REPORTER_ASSERT(r, main);
676 SkSL::ProgramToSkVM(*program, *main, &b, /*debugInfo=*/nullptr, /*uniforms=*/{});
692 "float main(float x) { return sub(sqr(x), x); }\n"
704 auto main = SkSL::Program_GetFunction(*program, "main");
711 REPORTER_ASSERT(r, main);
726 test_fn(main, 3.0f, 6.0f);
734 "void main(inout half4 color) { oneAlpha(color); }",
741 "void main(inout half4 color) {"
750 "void main(inout half4 color) { color.xywz = half4(1,2,3,4); }",
756 "void main(inout half4 color) { color.xywz.yxzw = half4(1,2,3,4); }",
762 void main(inout half4 color) {
775 test(r, "float main(float x) { return sin(x); }", value, expected);
776 test(r, "float main(float x) { return tan(x); }", value, expected);
779 test(r, "float main(float x) { return cos(x); }", value, expected);
782 test(r, "float main(float x) { return sqrt(x); }", value, expected);
785 test(r, "float main(float x) { return radians(x); }", value, expected);
789 test(r, "float2 main(float2 x) { return normalize(x); }", value, expected);
795 "void main(inout half4 color) { foo(); color.r = x; }",
803 test(r, "float main(float x) { return mix(-10, 10, x); }", &value, &expected);
805 test(r, "float main(float x) { return mix(-10, 10, x); }", &value, &expected);
807 test(r, "float main(float x) { return mix(-10, 10, x); }", &value, &expected);
811 test(r, "float4 main(float4 x, float4 y) { return mix(x, y, 0.5); }", valueVectors,
820 test(r, "float3 main(float3 x, float3 y) { return cross(x, y); }", args, expected);
830 test(r, "float2x2 main(float2x2 m) { return inverse(m); }", args, expt, false);
838 test(r, "float3x3 main(float3x3 m) { return inverse(m); }", args, expt, false);
847 test(r, "float4x4 main(float4x4 m) { return inverse(m); }", args, expt, false);
855 test(r, "float main(float2 x, float2 y) { return dot(x, y); }", args, &expected);
860 test(r, "float main(float3 x, float3 y) { return dot(x, y); }", args, &expected);
866 test(r, "float main(float4 x, float4 y) { return dot(x, y); }", args, &expected);
897 const char* src = "float main() { return externalSqrt(25); }";
905 const SkSL::FunctionDefinition* main = SkSL::Program_GetFunction(*program, "main");
908 SkSL::ProgramToSkVM(*program, *main, &b, /*debugInfo=*/nullptr, /*uniforms=*/{});
952 "float4 main() { return float4(table(2), table(-1), table(0.4), table(0.6)); }";
964 const SkSL::FunctionDefinition* main = SkSL::Program_GetFunction(*program, "main");
966 SkSL::ProgramToSkVM(*program, *main, &b, /*debugInfo=*/nullptr, /*uniforms=*/{});