1 #include "Halide.h"
2 #include <stdio.h>
3 
4 #include "testing.h"
5 
6 using namespace Halide;
7 
main()8 int main() {
9     // This test must be run with an OpenGL target.
10     const Target target = get_jit_target_from_environment().with_feature(Target::OpenGL);
11 
12     Func f;
13     Var x, y, c;
14     RDom r(0, 10);
15     f(x, y, c) = sum(cast<float>(r));
16     f.bound(c, 0, 3).glsl(x, y, c);
17 
18     Buffer<float> result = f.realize(100, 100, 3, target);
19 
20     if (!Testing::check_result<float>(result, [&](int x, int y, int c) { return 45; })) {
21         return 1;
22     }
23 
24     printf("Success!\n");
25 
26     return 0;
27 }
28