Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 5063bf6b authored by Stephen Hines's avatar Stephen Hines Committed by Android (Google) Code Review
Browse files

Merge "Update RSTest_Compat for stride changes."

parents aa5d5b19 5d017708
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -39,6 +39,7 @@ public class UT_alloc extends UnitTest {
        typeBuilder.setX(X).setY(Y);
        Allocation A = Allocation.createTyped(RS, typeBuilder.create());
        s.bind_a(A);
        s.set_aRaw(A);

        typeBuilder = new Type.Builder(RS, Element.I32(RS));
        typeBuilder.setX(X).setY(Y).setFaces(true);
@@ -59,6 +60,7 @@ public class UT_alloc extends UnitTest {
        ScriptC_alloc s = new ScriptC_alloc(pRS);
        pRS.setMessageHandler(mRsMessage);
        initializeGlobals(pRS, s);
        s.forEach_root(s.get_aRaw());
        s.invoke_alloc_test();
        pRS.finish();
        waitForMessage();
+1 −1
Original line number Diff line number Diff line
@@ -37,7 +37,7 @@ public class UT_foreach extends UnitTest {
        s.set_dimY(Y);
        typeBuilder.setX(X).setY(Y);
        A = Allocation.createTyped(RS, typeBuilder.create());
        s.bind_a(A);
        s.set_aRaw(A);

        return;
    }
+1 −1
Original line number Diff line number Diff line
@@ -37,7 +37,7 @@ public class UT_foreach_bounds extends UnitTest {
        s.set_dimY(Y);
        typeBuilder.setX(X).setY(Y);
        A = Allocation.createTyped(RS, typeBuilder.create());
        s.bind_a(A);
        s.set_aRaw(A);
        s.set_s(s);
        s.set_ain(A);
        s.set_aout(A);
+1 −1
Original line number Diff line number Diff line
@@ -37,7 +37,7 @@ public class UT_noroot extends UnitTest {
        s.set_dimY(Y);
        typeBuilder.setX(X).setY(Y);
        A = Allocation.createTyped(RS, typeBuilder.create());
        s.bind_a(A);
        s.set_aRaw(A);

        return;
    }
+12 −14
Original line number Diff line number Diff line
@@ -5,39 +5,37 @@ int dimX;
int dimY;
int dimZ;

rs_allocation aRaw;
rs_allocation aFaces;
rs_allocation aLOD;
rs_allocation aFacesLOD;

void root(int *o, uint32_t x, uint32_t y) {
    *o = x + y * dimX;
}

static bool test_alloc_dims() {
    bool failed = false;
    int i, j;

    for (j = 0; j < dimY; j++) {
        for (i = 0; i < dimX; i++) {
            a[i + j * dimX] = i + j * dimX;
        }
    }

    rs_allocation alloc = rsGetAllocation(a);
    _RS_ASSERT(rsAllocationGetDimX(alloc) == dimX);
    _RS_ASSERT(rsAllocationGetDimY(alloc) == dimY);
    _RS_ASSERT(rsAllocationGetDimZ(alloc) == dimZ);
    _RS_ASSERT(rsAllocationGetDimX(aRaw) == dimX);
    _RS_ASSERT(rsAllocationGetDimY(aRaw) == dimY);
    _RS_ASSERT(rsAllocationGetDimZ(aRaw) == dimZ);

    // Test 2D addressing
    for (j = 0; j < dimY; j++) {
        for (i = 0; i < dimX; i++) {
            rsDebug("Verifying ", i + j * dimX);
            const void *p = rsGetElementAt(alloc, i, j);
            const void *p = rsGetElementAt(aRaw, i, j);
            int val = *(const int *)p;
            _RS_ASSERT(val == (i + j * dimX));
        }
    }

    // Test 1D addressing
    for (i = 0; i < dimX * dimY; i++) {
    for (i = 0; i < dimX; i++) {
        rsDebug("Verifying ", i);
        const void *p = rsGetElementAt(alloc, i);
        const void *p = rsGetElementAt(aRaw, i);
        int val = *(const int *)p;
        _RS_ASSERT(val == i);
    }
@@ -46,7 +44,7 @@ static bool test_alloc_dims() {
    for (j = 0; j < dimY; j++) {
        for (i = 0; i < dimX; i++) {
            rsDebug("Verifying ", i + j * dimX);
            const void *p = rsGetElementAt(alloc, i, j, 0);
            const void *p = rsGetElementAt(aRaw, i, j, 0);
            int val = *(const int *)p;
            _RS_ASSERT(val == (i + j * dimX));
        }
Loading