This source file includes following definitions.
- shifted_domains
- main
#include "Halide.h"
#include <stdio.h>
#include "testing.h"
using namespace Halide;
int shifted_domains() {
    
    const Target target = get_jit_target_from_environment().with_feature(Target::OpenGL);
    int errors = 0;
    Func gradient("gradient");
    Var x("x"), y("y"), c("c");
    gradient(x, y, c) = cast<float>(x + y);
    gradient.bound(c, 0, 1);
    gradient.glsl(x, y, c);
    printf("Evaluating gradient from (0, 0) to (7, 7)\n");
    Buffer<float> result(8, 8, 1);
    gradient.realize(result, target);
    result.copy_to_host();
    if (!Testing::check_result<float>(result, 5e-5, [](int x, int y) { return float(x + y); }))
        errors++;
    Buffer<float> shifted(5, 7, 1);
    shifted.set_min(100, 50);
    printf("Evaluating gradient from (100, 50) to (104, 56)\n");
    gradient.realize(shifted, target);
    shifted.copy_to_host();
    if (!Testing::check_result<float>(shifted, 5e-5, [](int x, int y) { return float(x + y); }))
        errors++;
    
    shifted.set_min(-100, -50);
    printf("Evaluating gradient from (-100, -50) to (-96, -44)\n");
    gradient.realize(shifted, target);
    shifted.copy_to_host();
    if (!Testing::check_result<float>(shifted, 5e-5, [](int x, int y) { return float(x + y); }))
        errors++;
    return errors;
}
int main() {
    if (shifted_domains() != 0) {
        return 1;
    }
    printf("Success\n");
    return 0;
}