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

Commit 218b8984 authored by Android (Google) Code Review's avatar Android (Google) Code Review
Browse files

Merge change I718cd1f3

* changes:
  Element restructuring.  Add support for new basic Element types including the RS objects and vectors(2-4).  In theory this paves the way for maintaining type info for RS objects, passing elements for GLSL uiforms/attribs/varyings, and supporting nested structures.
parents ea84a555 718cd1f3
Loading
Loading
Loading
Loading
+15 −4
Original line number Diff line number Diff line
@@ -171,9 +171,10 @@ public class Allocation extends BaseObj {
    public Adapter1D createAdapter1D() {
        mRS.validate();
        int id = mRS.nAdapter1DCreate();
        if (id != 0) {
            mRS.nAdapter1DBindAllocation(id, mID);
        if(id == 0) {
            throw new IllegalStateException("allocation failed.");
        }
        mRS.nAdapter1DBindAllocation(id, mID);
        return new Adapter1D(id, mRS);
    }

@@ -213,9 +214,10 @@ public class Allocation extends BaseObj {
    public Adapter2D createAdapter2D() {
        mRS.validate();
        int id = mRS.nAdapter2DCreate();
        if (id != 0) {
            mRS.nAdapter2DBindAllocation(id, mID);
        if(id == 0) {
            throw new IllegalStateException("allocation failed.");
        }
        mRS.nAdapter2DBindAllocation(id, mID);
        return new Adapter2D(id, mRS);
    }

@@ -258,6 +260,9 @@ public class Allocation extends BaseObj {

        rs.validate();
        int id = rs.nAllocationCreateFromBitmap(dstFmt.mID, genMips, b);
        if(id == 0) {
            throw new IllegalStateException("Load failed.");
        }
        return new Allocation(id, rs, null);
    }

@@ -266,6 +271,9 @@ public class Allocation extends BaseObj {

        rs.validate();
        int id = rs.nAllocationCreateFromBitmapBoxed(dstFmt.mID, genMips, b);
        if(id == 0) {
            throw new IllegalStateException("Load failed.");
        }
        return new Allocation(id, rs, null);
    }

@@ -282,6 +290,9 @@ public class Allocation extends BaseObj {
            int allocationId = rs.nAllocationCreateFromAssetStream(dstFmt.mID, genMips,
                    asset);

            if(allocationId == 0) {
                throw new IllegalStateException("Load failed.");
            }
            return new Allocation(allocationId, rs, null);
        } catch (Exception e) {
            // Ignore
+1 −0
Original line number Diff line number Diff line
@@ -25,6 +25,7 @@ import android.util.Log;
class BaseObj {

    BaseObj(RenderScript rs) {
        rs.validate();
        mRS = rs;
        mID = 0;
        mDestroyed = false;
Loading