commit-bot@chromium.org | be19b9e | 2013-06-14 17:26:54 +0000 | [diff] [blame] | 1 | /* |
| 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 | |
| 10 | const sampler_t gInSampler = CLK_NORMALIZED_COORDS_FALSE | |
| 11 | CLK_ADDRESS_CLAMP_TO_EDGE | |
| 12 | CLK_FILTER_NEAREST; |
| 13 | |
| 14 | __kernel void diff(read_only image2d_t baseline, read_only image2d_t test, __global int* result) { |
| 15 | int2 coord = (int2)(get_global_id(0), get_global_id(1)); |
| 16 | uint4 baselinePixel = read_imageui(baseline, gInSampler, coord); |
| 17 | uint4 testPixel = read_imageui(test, gInSampler, coord); |
| 18 | int4 pixelCompare = baselinePixel == testPixel; |
| 19 | if (baselinePixel.x != testPixel.x || |
| 20 | baselinePixel.y != testPixel.y || |
| 21 | baselinePixel.z != testPixel.z || |
| 22 | baselinePixel.w != testPixel.w) { |
| 23 | |
| 24 | atom_inc(result); |
| 25 | } |
| 26 | } |