Home | History | Annotate | Download | only in cts
      1 #pragma version(1)
      2 #pragma rs java_package_name(android.renderscript.cts)
      3 
      4 #include "shared.rsh"
      5 
      6 rs_allocation aSharedInt;
      7 rs_allocation aFailed;
      8 
      9 static bool failed[2] = { false, false };
     10 
     11 void __attribute__((kernel)) getSharedInt(uint32_t in, uint32_t x) {
     12     int v = rsGetElementAt_int(aSharedInt, 0);
     13     if (in != x) {
     14         rsDebug("Failed to read in on iteration: ", x);
     15         rsDebug("Read: ", in);
     16         failed[x] = true;
     17     }
     18     if (v != -5) {
     19         rsDebug("Failed to read -5 on iteration: ", x);
     20         rsDebug("Read: ", v);
     21         failed[x] = true;
     22     }
     23 }
     24 
     25 // Write out aFailed if either of our kernel instances read old data.
     26 void verify() {
     27     for (int i = 0; i < 2; i++) {
     28         if (failed[i]) {
     29             rsSetElementAt_int(aFailed, 1, 0);
     30         }
     31     }
     32 }
     33