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

Commit 9bee51c4 authored by Jason Sams's avatar Jason Sams
Browse files

Remove useless slot from ProgramVertex. Optimize GL state setup.

parent 9d1a3149
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -38,8 +38,8 @@ public class ProgramVertex extends BaseObj {
        mID = 0;
    }

    public void bindAllocation(int slot, MatrixAllocation va) {
        mRS.nProgramVertexBindAllocation(mID, slot, va.mAlloc.mID);
    public void bindAllocation(MatrixAllocation va) {
        mRS.nProgramVertexBindAllocation(mID, va.mAlloc.mID);
    }


+1 −2
Original line number Diff line number Diff line
@@ -164,9 +164,8 @@ public class RenderScript {
    native void nProgramFragmentDestroy(int pgm);

    native void nProgramVertexDestroy(int pv);
    native void nProgramVertexBindAllocation(int pv, int slot, int mID);
    native void nProgramVertexBindAllocation(int pv, int mID);
    native void nProgramVertexBegin(int inID, int outID);
    native void nProgramVertexSetType(int slot, int mID);
    native void nProgramVertexSetTextureMatrixEnable(boolean enable);
    native void nProgramVertexAddLight(int id);
    native int  nProgramVertexCreate();
+3 −12
Original line number Diff line number Diff line
@@ -909,19 +909,11 @@ nProgramVertexBegin(JNIEnv *_env, jobject _this, jint in, jint out)
}

static void
nProgramVertexBindAllocation(JNIEnv *_env, jobject _this, jint vpv, jint slot, jint a)
nProgramVertexBindAllocation(JNIEnv *_env, jobject _this, jint vpv, jint a)
{
    RsContext con = (RsContext)(_env->GetIntField(_this, gContextId));
    LOG_API("nProgramVertexBindAllocation, con(%p), vpf(%p), slot(%i), a(%p)", con, (RsProgramVertex)vpv, slot, (RsAllocation)a);
    rsProgramVertexBindAllocation((RsProgramFragment)vpv, slot, (RsAllocation)a);
}

static void
nProgramVertexSetType(JNIEnv *_env, jobject _this, jint slot, jint t)
{
    RsContext con = (RsContext)(_env->GetIntField(_this, gContextId));
    LOG_API("nProgramVertexSetType, con(%p), vpf(%p), slot(%i), a(%p)", con, (RsProgramVertex)vpv, slot, (RsType)t);
    rsProgramVertexSetType(slot, (RsType)t);
    rsProgramVertexBindAllocation((RsProgramFragment)vpv, (RsAllocation)a);
}

static void
@@ -1186,9 +1178,8 @@ static JNINativeMethod methods[] = {
{"nProgramFragmentDestroy",        "(I)V",                                 (void*)nProgramFragmentDestroy },

{"nProgramVertexDestroy",          "(I)V",                                 (void*)nProgramVertexDestroy },
{"nProgramVertexBindAllocation",   "(III)V",                               (void*)nProgramVertexBindAllocation },
{"nProgramVertexBindAllocation",   "(II)V",                                (void*)nProgramVertexBindAllocation },
{"nProgramVertexBegin",            "(II)V",                                (void*)nProgramVertexBegin },
{"nProgramVertexSetType",          "(II)V",                                (void*)nProgramVertexSetType },
{"nProgramVertexSetTextureMatrixEnable",   "(Z)V",                         (void*)nProgramVertexSetTextureMatrixEnable },
{"nProgramVertexAddLight",         "(I)V",                                 (void*)nProgramVertexAddLight },
{"nProgramVertexCreate",           "()I",                                  (void*)nProgramVertexCreate },
+4 −3
Original line number Diff line number Diff line
@@ -21,6 +21,7 @@ import android.renderscript.RenderScript;
import android.renderscript.ScriptC;
import android.renderscript.ProgramFragment;
import android.renderscript.ProgramStore;
import android.renderscript.ProgramVertex;
import android.renderscript.Allocation;
import android.renderscript.Sampler;
import android.renderscript.ProgramVertex;
@@ -210,7 +211,7 @@ class FallRS {
        ProgramVertex.Builder pvb = new ProgramVertex.Builder(mRS, null, null);
        pvb.setTextureMatrixEnable(true);
        mPvBackground = pvb.create();
        mPvBackground.bindAllocation(0, mPvOrthoAlloc);
        mPvBackground.bindAllocation(mPvOrthoAlloc);
        mPvBackground.setName("PVBackground");
    }
}
+2 −2
Original line number Diff line number Diff line
@@ -240,8 +240,8 @@ public class FilmRS {
        initState();

        mPVA = new ProgramVertex.MatrixAllocation(mRS);
        mPVBackground.bindAllocation(0, mPVA);
        mPVImages.bindAllocation(0, mPVA);
        mPVBackground.bindAllocation(mPVA);
        mPVImages.bindAllocation(mPVA);
        mPVA.setupProjectionNormalized(320, 480);


Loading