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

Commit 718cd1f3 authored by Jason Sams's avatar Jason Sams
Browse files

Element restructuring. Add support for new basic Element types including the...

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.

This will break some apps, checkings for other projects will follow to unbreak them.
parent ceedafac
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