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

Commit 19e1086d authored by Jason Sams's avatar Jason Sams
Browse files

Move the kernel launch to specific intrinsic class.

This allows support of both input types. Kernel source
and global source.

Change-Id: Iea60bebd79c786795eae81c14cbec352b470a9c0
parent ee98610f
Loading
Loading
Loading
Loading
+0 −4
Original line number Diff line number Diff line
@@ -28,8 +28,4 @@ public class ScriptIntrinsic extends Script {
    ScriptIntrinsic(int id, RenderScript rs) {
        super(id, rs);
    }

    public void forEach(Allocation ain, Allocation aout) {
        forEach(0, ain, aout, null);
    }
}
+11 −1
Original line number Diff line number Diff line
@@ -32,6 +32,7 @@ import java.util.HashMap;
 **/
public class ScriptIntrinsicConvolve3x3 extends ScriptIntrinsic {
    private float[] mValues = new float[9];
    private Allocation mInput;

    ScriptIntrinsicConvolve3x3(int id, RenderScript rs) {
        super(id, rs);
@@ -52,8 +53,12 @@ public class ScriptIntrinsicConvolve3x3 extends ScriptIntrinsic {

    }

    public void setInput(Allocation ain) {
        mInput = ain;
        bindAllocation(ain, 1);
    }

    public void setValues(float v[]) {
    public void setColorMatrix(float v[]) {
        FieldPacker fp = new FieldPacker(9*4);
        for (int ct=0; ct < mValues.length; ct++) {
            mValues[ct] = v[ct];
@@ -61,5 +66,10 @@ public class ScriptIntrinsicConvolve3x3 extends ScriptIntrinsic {
        }
        setVar(0, fp);
    }

    public void forEach(Allocation aout) {
        forEach(0, null, aout, null);
    }

}
+3 −2
Original line number Diff line number Diff line
@@ -46,7 +46,7 @@ public class Intrinsics extends TestBase {
        v[0] = 0.f;     v[1] = -s;      v[2] = 0.f;
        v[3] = -s;      v[4] = s*4+1;   v[5] = -s;
        v[6] = 0.f;     v[7] = -s;      v[8] = 0.f;
        mScript.setValues(v);
        mScript.setColorMatrix(v);
    }


@@ -55,7 +55,8 @@ public class Intrinsics extends TestBase {
    }

    public void runTest() {
        mScript.forEach(mInPixelsAllocation, mOutPixelsAllocation);
        mScript.setInput(mInPixelsAllocation);
        mScript.forEach(mOutPixelsAllocation);
    }

}