1 #pragma version(1) 2 #pragma rs java_package_name(android.renderscript.cts) 3 4 rs_allocation aFailed; 5 rs_allocation aOutput; 6 7 void set_output_void_int(void *out, uint32_t x, uint32_t y) { 8 int *out_int = (int *)out; 9 *out_int = x + y; 10 } 11 12 void __attribute__((kernel))check_output_int(const int in, uint32_t x, uint32_t y) 13 { 14 if (in != x + y) { 15 rsSetElementAt_int(aFailed, 1, 0); 16 } 17 } 18 19 void set_output_void_char(void *out, uint32_t x, uint32_t y) { 20 uchar *out_int = (uchar *)out; 21 *out_int = x + y; 22 } 23 24 void __attribute__((kernel))check_output_char(const uchar in, uint32_t x, uint32_t y) 25 { 26 if (in != x + y) { 27 rsSetElementAt_int(aFailed, 1, 0); 28 } 29 } 30 31 int __attribute__((kernel)) set_output_int(uint32_t x, uint32_t y) { 32 return x + y; 33 } 34 35 void copy_void_int(const void *in, uint32_t x, uint32_t y) 36 { 37 int *in_int = (int*) in; 38 rsSetElementAt_int(aOutput, *in_int, x, y); 39 } 40 41 uchar __attribute__((kernel)) set_output_char(uint32_t x, uint32_t y) { 42 return x + y; 43 } 44 45 void copy_void_char(const void *in, uint32_t x, uint32_t y) 46 { 47 uchar *in_uchar = (uchar*) in; 48 rsSetElementAt_uchar(aOutput, *in_uchar, x, y); 49 } 50