summaryrefslogtreecommitdiffstats
path: root/graphics/java/android/renderscript/RenderScript.java
diff options
context:
space:
mode:
Diffstat (limited to 'graphics/java/android/renderscript/RenderScript.java')
-rw-r--r--graphics/java/android/renderscript/RenderScript.java57
1 files changed, 30 insertions, 27 deletions
diff --git a/graphics/java/android/renderscript/RenderScript.java b/graphics/java/android/renderscript/RenderScript.java
index 0d8b675..29361af 100644
--- a/graphics/java/android/renderscript/RenderScript.java
+++ b/graphics/java/android/renderscript/RenderScript.java
@@ -76,8 +76,6 @@ public class RenderScript {
native void nContextBindProgramFragment(int pf);
native void nContextBindProgramVertex(int pf);
native void nContextBindProgramRaster(int pr);
- native void nContextAddDefineI32(String name, int value);
- native void nContextAddDefineF(String name, float value);
native void nContextPause();
native void nContextResume();
native int nContextGetMessage(int[] data, boolean wait);
@@ -89,9 +87,9 @@ public class RenderScript {
native void nObjDestroyOOB(int id);
native int nFileOpen(byte[] name);
- native void nElementBegin();
- native void nElementAdd(int kind, int type, boolean norm, int bits, String s);
- native int nElementCreate();
+
+ native int nElementCreate(int type, int kind, boolean norm, int vecSize);
+ native int nElementCreate2(int[] elements, String[] names);
native void nTypeBegin(int elementID);
native void nTypeAdd(int dim, int val);
@@ -167,17 +165,15 @@ public class RenderScript {
native void nProgramRasterSetLineWidth(int pr, float v);
native void nProgramRasterSetPointSize(int pr, float v);
- native void nProgramFragmentBegin(int in, int out, boolean pointSpriteEnable);
- native void nProgramFragmentBindTexture(int vpf, int slot, int a);
- native void nProgramFragmentBindSampler(int vpf, int slot, int s);
- native void nProgramFragmentSetSlot(int slot, boolean enable, int env, int vt);
- native int nProgramFragmentCreate();
+ native void nProgramBindConstants(int pv, int slot, int mID);
+ native void nProgramBindTexture(int vpf, int slot, int a);
+ native void nProgramBindSampler(int vpf, int slot, int s);
+
+ native int nProgramFragmentCreate(int[] params);
+ native int nProgramFragmentCreate2(String shader, int[] params);
- native void nProgramVertexBindAllocation(int pv, int mID);
- native void nProgramVertexBegin(int inID, int outID);
- native void nProgramVertexSetTextureMatrixEnable(boolean enable);
- native void nProgramVertexAddLight(int id);
- native int nProgramVertexCreate();
+ native int nProgramVertexCreate(boolean texMat);
+ native int nProgramVertexCreate2(String shader, int[] params);
native void nLightBegin();
native void nLightSetIsMono(boolean isMono);
@@ -200,14 +196,13 @@ public class RenderScript {
private Surface mSurface;
private MessageThread mMessageThread;
-
Element mElement_USER_U8;
Element mElement_USER_I8;
Element mElement_USER_U16;
Element mElement_USER_I16;
Element mElement_USER_U32;
Element mElement_USER_I32;
- Element mElement_USER_FLOAT;
+ Element mElement_USER_F32;
Element mElement_A_8;
Element mElement_RGB_565;
@@ -217,9 +212,12 @@ public class RenderScript {
Element mElement_RGBA_8888;
Element mElement_INDEX_16;
- Element mElement_XY_F32;
- Element mElement_XYZ_F32;
-
+ Element mElement_POSITION_2;
+ Element mElement_POSITION_3;
+ Element mElement_TEXTURE_2;
+ Element mElement_NORMAL_3;
+ Element mElement_COLOR_U8_4;
+ Element mElement_COLOR_F32_4;
///////////////////////////////////////////////////////////////////////////////////
//
@@ -248,13 +246,8 @@ public class RenderScript {
}
}
- void validateSurface() {
- if (mSurface == null) {
- throw new IllegalStateException("Uploading data to GL with no surface.");
- }
- }
-
public void contextSetPriority(Priority p) {
+ validate();
nContextSetPriority(p.mID);
}
@@ -305,23 +298,26 @@ public class RenderScript {
nDeviceSetConfig(mDev, 0, 1);
}
mContext = nContextCreate(mDev, 0, useDepth);
- Element.initPredefined(this);
mMessageThread = new MessageThread(this);
mMessageThread.start();
+ Element.initPredefined(this);
}
public void contextSetSurface(int w, int h, Surface sur) {
mSurface = sur;
mWidth = w;
mHeight = h;
+ validate();
nContextSetSurface(w, h, mSurface);
}
public void contextDump(int bits) {
+ validate();
nContextDump(bits);
}
public void destroy() {
+ validate();
nContextDeinitToClient();
mMessageThread.mRun = false;
@@ -337,10 +333,12 @@ public class RenderScript {
}
void pause() {
+ validate();
nContextPause();
}
void resume() {
+ validate();
nContextResume();
}
@@ -381,22 +379,27 @@ public class RenderScript {
}
public void contextBindRootScript(Script s) {
+ validate();
nContextBindRootScript(safeID(s));
}
public void contextBindProgramFragmentStore(ProgramStore p) {
+ validate();
nContextBindProgramFragmentStore(safeID(p));
}
public void contextBindProgramFragment(ProgramFragment p) {
+ validate();
nContextBindProgramFragment(safeID(p));
}
public void contextBindProgramRaster(ProgramRaster p) {
+ validate();
nContextBindProgramRaster(safeID(p));
}
public void contextBindProgramVertex(ProgramVertex p) {
+ validate();
nContextBindProgramVertex(safeID(p));
}