Home | History | Annotate | Download | only in cts
      1 #pragma version(1)
      2 #pragma rs java_package_name(android.renderscript.cts)
      3 
      4 int gInt;
      5 static int sInt;
      6 
      7 rs_allocation aFailed;
      8 
      9 void test_read_global(int expected) {
     10     if (gInt != expected) {
     11         rsSetElementAt_uchar(aFailed, 1, 0);
     12     }
     13 }
     14 
     15 void test_read_static_global(int expected) {
     16     if (sInt != expected) {
     17         rsSetElementAt_uchar(aFailed, 1, 0);
     18     }
     19 }
     20 
     21 void test_write_global(int i) {
     22     gInt = i;
     23 }
     24 
     25 void test_write_static_global(int i) {
     26     sInt = i;
     27 }
     28 
     29 void __attribute__((kernel)) write_global(int ain, uint32_t x) {
     30     if (x == 0) {
     31         gInt = ain;
     32     }
     33 }
     34 
     35 void __attribute__((kernel)) write_static_global(int ain, uint32_t x) {
     36     if (x == 0) {
     37         sInt = ain;
     38     }
     39 }
     40 
     41 int __attribute__((kernel)) read_global(int ain, uint32_t x) {
     42     if (gInt != ain) {
     43         return 1;
     44     }
     45     return 0;
     46 }
     47 
     48 int __attribute__((kernel)) read_static_global(int ain, uint32_t x) {
     49     if (sInt != ain) {
     50         return 1;
     51     }
     52     return 0;
     53 }
     54