blob: 1eed2a4216a0bfc8dc67dd2907c456bfa827aaba [file] [log] [blame]
commit-bot@chromium.orgbe19b9e2013-06-14 17:26:54 +00001/*
2 * Copyright 2013 Google Inc.
3 *
4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file.
6 */
7
8#pragma OPENCL_EXTENSION cl_khr_global_int32_base_atomics
9
10const sampler_t gInSampler = CLK_NORMALIZED_COORDS_FALSE |
11 CLK_ADDRESS_CLAMP_TO_EDGE |
12 CLK_FILTER_NEAREST;
13
zachr@google.com572b54d2013-06-28 16:27:33 +000014__kernel void diff(read_only image2d_t baseline, read_only image2d_t test,
15 __global int* result, __global int2* poi) {
commit-bot@chromium.orgbe19b9e2013-06-14 17:26:54 +000016 int2 coord = (int2)(get_global_id(0), get_global_id(1));
17 uint4 baselinePixel = read_imageui(baseline, gInSampler, coord);
18 uint4 testPixel = read_imageui(test, gInSampler, coord);
19 int4 pixelCompare = baselinePixel == testPixel;
20 if (baselinePixel.x != testPixel.x ||
21 baselinePixel.y != testPixel.y ||
22 baselinePixel.z != testPixel.z ||
23 baselinePixel.w != testPixel.w) {
24
zachr@google.com572b54d2013-06-28 16:27:33 +000025 int poiIndex = atomic_inc(result);
26 poi[poiIndex] = coord;
commit-bot@chromium.orgbe19b9e2013-06-14 17:26:54 +000027 }
28}