diff options
author | Jason Sams <rjsams@android.com> | 2010-08-17 16:25:41 -0700 |
---|---|---|
committer | Jason Sams <rjsams@android.com> | 2010-08-17 16:25:41 -0700 |
commit | 2e1872fe07cf8952812a417985e6e1f61bdeab5d (patch) | |
tree | 76ae06c669cc6610c706d1295acfec35555d3d2b /graphics/java/android/renderscript/RenderScript.java | |
parent | 43c31421b4ce1cdff7c26c988bfe5e1bff64ce23 (diff) |
Make java entry points for native fifo synchronized.
Change-Id: I1baf2beb920016f0202042982075cbce1e67df42
Diffstat (limited to 'graphics/java/android/renderscript/RenderScript.java')
-rw-r--r-- | graphics/java/android/renderscript/RenderScript.java | 596 |
1 files changed, 451 insertions, 145 deletions
diff --git a/graphics/java/android/renderscript/RenderScript.java b/graphics/java/android/renderscript/RenderScript.java index 4eeb4d3a7452..e42f9f66ee9f 100644 --- a/graphics/java/android/renderscript/RenderScript.java +++ b/graphics/java/android/renderscript/RenderScript.java @@ -57,151 +57,457 @@ public class RenderScript { } } + // Non-threadsafe functions. native void nInitElements(int a8, int rgba4444, int rgba8888, int rgb565); - native int nDeviceCreate(); native void nDeviceDestroy(int dev); native void nDeviceSetConfig(int dev, int param, int value); - native int nContextCreateGL(int dev, int ver, boolean useDepth); - native int nContextCreate(int dev, int ver); - native void nContextDestroy(int con); - native void nContextSetSurface(int w, int h, Surface sur); - native void nContextSetPriority(int p); - native void nContextDump(int bits); - native void nContextFinish(); - - native void nContextBindRootScript(int script); - native void nContextBindSampler(int sampler, int slot); - native void nContextBindProgramStore(int pfs); - native void nContextBindProgramFragment(int pf); - native void nContextBindProgramVertex(int pf); - native void nContextBindProgramRaster(int pr); - native void nContextPause(); - native void nContextResume(); - native int nContextGetMessage(int[] data, boolean wait); - native void nContextInitToClient(); - native void nContextDeinitToClient(); - - native void nAssignName(int obj, byte[] name); - native String nGetName(int obj); - native void nObjDestroy(int id); - native void nObjDestroyOOB(int id); - native int nFileOpen(byte[] name); - - - native int nElementCreate(int type, int kind, boolean norm, int vecSize); - native int nElementCreate2(int[] elements, String[] names); - native void nElementGetNativeData(int id, int[] elementData); - native void nElementGetSubElements(int id, int[] IDs, String[] names); - - native void nTypeBegin(int elementID); - native void nTypeAdd(int dim, int val); - native int nTypeCreate(); - native void nTypeFinalDestroy(Type t); - native void nTypeSetupFields(Type t, int[] types, int[] bits, Field[] IDs); - native void nTypeGetNativeData(int id, int[] typeData); - - native int nAllocationCreateTyped(int type); - native int nAllocationCreateFromBitmap(int dstFmt, boolean genMips, Bitmap bmp); - native int nAllocationCreateBitmapRef(int type, Bitmap bmp); - native int nAllocationCreateFromBitmapBoxed(int dstFmt, boolean genMips, Bitmap bmp); - native int nAllocationCreateFromAssetStream(int dstFmt, boolean genMips, int assetStream); - - native void nAllocationUploadToTexture(int alloc, boolean genMips, int baseMioLevel); - native void nAllocationUploadToBufferObject(int alloc); - - native void nAllocationSubData1D(int id, int off, int count, int[] d, int sizeBytes); - native void nAllocationSubData1D(int id, int off, int count, short[] d, int sizeBytes); - native void nAllocationSubData1D(int id, int off, int count, byte[] d, int sizeBytes); - native void nAllocationSubData1D(int id, int off, int count, float[] d, int sizeBytes); - - native void nAllocationSubData2D(int id, int xoff, int yoff, int w, int h, int[] d, int sizeBytes); - native void nAllocationSubData2D(int id, int xoff, int yoff, int w, int h, float[] d, int sizeBytes); - native void nAllocationRead(int id, int[] d); - native void nAllocationRead(int id, float[] d); - native void nAllocationSubDataFromObject(int id, Type t, int offset, Object o); - native void nAllocationSubReadFromObject(int id, Type t, int offset, Object o); - native int nAllocationGetType(int id); - - native int nFileA3DCreateFromAssetStream(int assetStream); - native int nFileA3DGetNumIndexEntries(int fileA3D); - native void nFileA3DGetIndexEntries(int fileA3D, int numEntries, int[] IDs, String[] names); - native int nFileA3DGetEntryByIndex(int fileA3D, int index); - - native int nFontCreateFromFile(String fileName, int size, int dpi); - - native void nAdapter1DBindAllocation(int ad, int alloc); - native void nAdapter1DSetConstraint(int ad, int dim, int value); - native void nAdapter1DData(int ad, int[] d); - native void nAdapter1DData(int ad, float[] d); - native void nAdapter1DSubData(int ad, int off, int count, int[] d); - native void nAdapter1DSubData(int ad, int off, int count, float[] d); - native int nAdapter1DCreate(); - - native void nAdapter2DBindAllocation(int ad, int alloc); - native void nAdapter2DSetConstraint(int ad, int dim, int value); - native void nAdapter2DData(int ad, int[] d); - native void nAdapter2DData(int ad, float[] d); - native void nAdapter2DSubData(int ad, int xoff, int yoff, int w, int h, int[] d); - native void nAdapter2DSubData(int ad, int xoff, int yoff, int w, int h, float[] d); - native int nAdapter2DCreate(); - - native void nScriptBindAllocation(int script, int alloc, int slot); - native void nScriptSetTimeZone(int script, byte[] timeZone); - native void nScriptInvoke(int id, int slot); - native void nScriptInvokeV(int id, int slot, byte[] params); - native void nScriptSetVarI(int id, int slot, int val); - native void nScriptSetVarF(int id, int slot, float val); - native void nScriptSetVarV(int id, int slot, byte[] val); - - native void nScriptCBegin(); - native void nScriptCSetScript(byte[] script, int offset, int length); - native int nScriptCCreate(); - - native void nSamplerBegin(); - native void nSamplerSet(int param, int value); - native int nSamplerCreate(); - - native void nProgramStoreBegin(int in, int out); - native void nProgramStoreDepthFunc(int func); - native void nProgramStoreDepthMask(boolean enable); - native void nProgramStoreColorMask(boolean r, boolean g, boolean b, boolean a); - native void nProgramStoreBlendFunc(int src, int dst); - native void nProgramStoreDither(boolean enable); - native int nProgramStoreCreate(); - - native int nProgramRasterCreate(boolean pointSmooth, boolean lineSmooth, boolean pointSprite); - native void nProgramRasterSetLineWidth(int pr, float v); - native void nProgramRasterSetCullMode(int pr, int mode); - - 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 int nProgramVertexCreate(boolean texMat); - native int nProgramVertexCreate2(String shader, int[] params); - - native void nLightBegin(); - native void nLightSetIsMono(boolean isMono); - native void nLightSetIsLocal(boolean isLocal); - native int nLightCreate(); - native void nLightSetColor(int l, float r, float g, float b); - native void nLightSetPosition(int l, float x, float y, float z); - - native int nMeshCreate(int vtxCount, int indexCount); - native void nMeshBindVertex(int id, int alloc, int slot); - native void nMeshBindIndex(int id, int alloc, int prim, int slot); - native int nMeshGetVertexBufferCount(int id); - native int nMeshGetIndexCount(int id); - native void nMeshGetVertices(int id, int[] vtxIds, int vtxIdCount); - native void nMeshGetIndices(int id, int[] idxIds, int[] primitives, int vtxIdCount); - - native void nAnimationBegin(int attribCount, int keyframeCount); - native void nAnimationAdd(float time, float[] attribs); - native int nAnimationCreate(); + native int nContextGetMessage(int con, int[] data, boolean wait); + native void nContextInitToClient(int con); + native void nContextDeinitToClient(int con); + + + // Methods below are wrapped to protect the non-threadsafe + // lockless fifo. + native int rsnContextCreateGL(int dev, int ver, boolean useDepth); + synchronized int nContextCreateGL(int dev, int ver, boolean useDepth) { + return rsnContextCreateGL(dev, ver, useDepth); + } + native int rsnContextCreate(int dev, int ver); + synchronized int nContextCreate(int dev, int ver) { + return rsnContextCreate(dev, ver); + } + native void rsnContextDestroy(int con); + synchronized void nContextDestroy() { + rsnContextDestroy(mContext); + } + native void rsnContextSetSurface(int con, int w, int h, Surface sur); + synchronized void nContextSetSurface(int w, int h, Surface sur) { + rsnContextSetSurface(mContext, w, h, sur); + } + native void rsnContextSetPriority(int con, int p); + synchronized void nContextSetPriority(int p) { + rsnContextSetPriority(mContext, p); + } + native void rsnContextDump(int con, int bits); + synchronized void nContextDump(int bits) { + rsnContextDump(mContext, bits); + } + native void rsnContextFinish(int con); + synchronized void nContextFinish() { + rsnContextFinish(mContext); + } + + native void rsnContextBindRootScript(int con, int script); + synchronized void nContextBindRootScript(int script) { + rsnContextBindRootScript(mContext, script); + } + native void rsnContextBindSampler(int con, int sampler, int slot); + synchronized void nContextBindSampler(int sampler, int slot) { + rsnContextBindSampler(mContext, sampler, slot); + } + native void rsnContextBindProgramStore(int con, int pfs); + synchronized void nContextBindProgramStore(int pfs) { + rsnContextBindProgramStore(mContext, pfs); + } + native void rsnContextBindProgramFragment(int con, int pf); + synchronized void nContextBindProgramFragment(int pf) { + rsnContextBindProgramFragment(mContext, pf); + } + native void rsnContextBindProgramVertex(int con, int pv); + synchronized void nContextBindProgramVertex(int pv) { + rsnContextBindProgramVertex(mContext, pv); + } + native void rsnContextBindProgramRaster(int con, int pr); + synchronized void nContextBindProgramRaster(int pr) { + rsnContextBindProgramRaster(mContext, pr); + } + native void rsnContextPause(int con); + synchronized void nContextPause() { + rsnContextPause(mContext); + } + native void rsnContextResume(int con); + synchronized void nContextResume() { + rsnContextResume(mContext); + } + + native void rsnAssignName(int con, int obj, byte[] name); + synchronized void nAssignName(int obj, byte[] name) { + rsnAssignName(mContext, obj, name); + } + native String rsnGetName(int con, int obj); + synchronized String nGetName(int obj) { + return rsnGetName(mContext, obj); + } + native void rsnObjDestroy(int con, int id); + synchronized void nObjDestroy(int id) { + rsnObjDestroy(mContext, id); + } + native void rsnObjDestroyOOB(int con, int id); + synchronized void nObjDestroyOOB(int id) { + rsnObjDestroyOOB(mContext, id); + } + native int rsnFileOpen(int con, byte[] name); + synchronized int nFileOpen(byte[] name) { + return rsnFileOpen(mContext, name); + } + + native int rsnElementCreate(int con, int type, int kind, boolean norm, int vecSize); + synchronized int nElementCreate(int type, int kind, boolean norm, int vecSize) { + return rsnElementCreate(mContext, type, kind, norm, vecSize); + } + native int rsnElementCreate2(int con, int[] elements, String[] names); + synchronized int nElementCreate2(int[] elements, String[] names) { + return rsnElementCreate2(mContext, elements, names); + } + native void rsnElementGetNativeData(int con, int id, int[] elementData); + synchronized void nElementGetNativeData(int id, int[] elementData) { + rsnElementGetNativeData(mContext, id, elementData); + } + native void rsnElementGetSubElements(int con, int id, int[] IDs, String[] names); + synchronized void nElementGetSubElements(int id, int[] IDs, String[] names) { + rsnElementGetSubElements(mContext, id, IDs, names); + } + + native void rsnTypeBegin(int con, int elementID); + synchronized void nTypeBegin(int elementID) { + rsnTypeBegin(mContext, elementID); + } + native void rsnTypeAdd(int con, int dim, int val); + synchronized void nTypeAdd(int dim, int val) { + rsnTypeAdd(mContext, dim, val); + } + native int rsnTypeCreate(int con); + synchronized int nTypeCreate() { + return rsnTypeCreate(mContext); + } + native void rsnTypeFinalDestroy(int con, Type t); + synchronized void nTypeFinalDestroy(Type t) { + rsnTypeFinalDestroy(mContext, t); + } + native void rsnTypeSetupFields(int con, Type t, int[] types, int[] bits, Field[] IDs); + synchronized void nTypeSetupFields(Type t, int[] types, int[] bits, Field[] IDs) { + rsnTypeSetupFields(mContext, t, types, bits, IDs); + } + native void rsnTypeGetNativeData(int con, int id, int[] typeData); + synchronized void nTypeGetNativeData(int id, int[] typeData) { + rsnTypeGetNativeData(mContext, id, typeData); + } + + native int rsnAllocationCreateTyped(int con, int type); + synchronized int nAllocationCreateTyped(int type) { + return rsnAllocationCreateTyped(mContext, type); + } + native int rsnAllocationCreateFromBitmap(int con, int dstFmt, boolean genMips, Bitmap bmp); + synchronized int nAllocationCreateFromBitmap(int dstFmt, boolean genMips, Bitmap bmp) { + return rsnAllocationCreateFromBitmap(mContext, dstFmt, genMips, bmp); + } + native int rsnAllocationCreateBitmapRef(int con, int type, Bitmap bmp); + synchronized int nAllocationCreateBitmapRef(int type, Bitmap bmp) { + return rsnAllocationCreateBitmapRef(mContext, type, bmp); + } + native int rsnAllocationCreateFromBitmapBoxed(int con, int dstFmt, boolean genMips, Bitmap bmp); + synchronized int nAllocationCreateFromBitmapBoxed(int dstFmt, boolean genMips, Bitmap bmp) { + return rsnAllocationCreateFromBitmapBoxed(mContext, dstFmt, genMips, bmp); + } + native int rsnAllocationCreateFromAssetStream(int con, int dstFmt, boolean genMips, int assetStream); + synchronized int nAllocationCreateFromAssetStream(int dstFmt, boolean genMips, int assetStream) { + return rsnAllocationCreateFromAssetStream(mContext, dstFmt, genMips, assetStream); + } + + native void rsnAllocationUploadToTexture(int con, int alloc, boolean genMips, int baseMioLevel); + synchronized void nAllocationUploadToTexture(int alloc, boolean genMips, int baseMioLevel) { + rsnAllocationUploadToTexture(mContext, alloc, genMips, baseMioLevel); + } + native void rsnAllocationUploadToBufferObject(int con, int alloc); + synchronized void nAllocationUploadToBufferObject(int alloc) { + rsnAllocationUploadToBufferObject(mContext, alloc); + } + + native void rsnAllocationSubData1D(int con, int id, int off, int count, int[] d, int sizeBytes); + synchronized void nAllocationSubData1D(int id, int off, int count, int[] d, int sizeBytes) { + rsnAllocationSubData1D(mContext, id, off, count, d, sizeBytes); + } + native void rsnAllocationSubData1D(int con, int id, int off, int count, short[] d, int sizeBytes); + synchronized void nAllocationSubData1D(int id, int off, int count, short[] d, int sizeBytes) { + rsnAllocationSubData1D(mContext, id, off, count, d, sizeBytes); + } + native void rsnAllocationSubData1D(int con, int id, int off, int count, byte[] d, int sizeBytes); + synchronized void nAllocationSubData1D(int id, int off, int count, byte[] d, int sizeBytes) { + rsnAllocationSubData1D(mContext, id, off, count, d, sizeBytes); + } + native void rsnAllocationSubData1D(int con, int id, int off, int count, float[] d, int sizeBytes); + synchronized void nAllocationSubData1D(int id, int off, int count, float[] d, int sizeBytes) { + rsnAllocationSubData1D(mContext, id, off, count, d, sizeBytes); + } + + native void rsnAllocationSubData2D(int con, int id, int xoff, int yoff, int w, int h, int[] d, int sizeBytes); + synchronized void nAllocationSubData2D(int id, int xoff, int yoff, int w, int h, int[] d, int sizeBytes) { + rsnAllocationSubData2D(mContext, id, xoff, yoff, w, h, d, sizeBytes); + } + native void rsnAllocationSubData2D(int con, int id, int xoff, int yoff, int w, int h, float[] d, int sizeBytes); + synchronized void nAllocationSubData2D(int id, int xoff, int yoff, int w, int h, float[] d, int sizeBytes) { + rsnAllocationSubData2D(mContext, id, xoff, yoff, w, h, d, sizeBytes); + } + native void rsnAllocationRead(int con, int id, int[] d); + synchronized void nAllocationRead(int id, int[] d) { + rsnAllocationRead(mContext, id, d); + } + native void rsnAllocationRead(int con, int id, float[] d); + synchronized void nAllocationRead(int id, float[] d) { + rsnAllocationRead(mContext, id, d); + } + native void rsnAllocationSubDataFromObject(int con, int id, Type t, int offset, Object o); + synchronized void nAllocationSubDataFromObject(int id, Type t, int offset, Object o) { + rsnAllocationSubDataFromObject(mContext, id, t, offset, o); + } + native void rsnAllocationSubReadFromObject(int con, int id, Type t, int offset, Object o); + synchronized void nAllocationSubReadFromObject(int id, Type t, int offset, Object o) { + rsnAllocationSubReadFromObject(mContext, id, t, offset, o); + } + native int rsnAllocationGetType(int con, int id); + synchronized int nAllocationGetType(int id) { + return rsnAllocationGetType(mContext, id); + } + + native int rsnFileA3DCreateFromAssetStream(int con, int assetStream); + synchronized int nFileA3DCreateFromAssetStream(int assetStream) { + return rsnFileA3DCreateFromAssetStream(mContext, assetStream); + } + native int rsnFileA3DGetNumIndexEntries(int con, int fileA3D); + synchronized int nFileA3DGetNumIndexEntries(int fileA3D) { + return rsnFileA3DGetNumIndexEntries(mContext, fileA3D); + } + native void rsnFileA3DGetIndexEntries(int con, int fileA3D, int numEntries, int[] IDs, String[] names); + synchronized void nFileA3DGetIndexEntries(int fileA3D, int numEntries, int[] IDs, String[] names) { + rsnFileA3DGetIndexEntries(mContext, fileA3D, numEntries, IDs, names); + } + native int rsnFileA3DGetEntryByIndex(int con, int fileA3D, int index); + synchronized int nFileA3DGetEntryByIndex(int fileA3D, int index) { + return rsnFileA3DGetEntryByIndex(mContext, fileA3D, index); + } + + native int rsnFontCreateFromFile(int con, String fileName, int size, int dpi); + synchronized int nFontCreateFromFile(String fileName, int size, int dpi) { + return rsnFontCreateFromFile(mContext, fileName, size, dpi); + } + + native void rsnAdapter1DBindAllocation(int con, int ad, int alloc); + synchronized void nAdapter1DBindAllocation(int ad, int alloc) { + rsnAdapter1DBindAllocation(mContext, ad, alloc); + } + native void rsnAdapter1DSetConstraint(int con, int ad, int dim, int value); + synchronized void nAdapter1DSetConstraint(int ad, int dim, int value) { + rsnAdapter1DSetConstraint(mContext, ad, dim, value); + } + native void rsnAdapter1DData(int con, int ad, int[] d); + synchronized void nAdapter1DData(int ad, int[] d) { + rsnAdapter1DData(mContext, ad, d); + } + native void rsnAdapter1DData(int con, int ad, float[] d); + synchronized void nAdapter1DData(int ad, float[] d) { + rsnAdapter1DData(mContext, ad, d); + } + native void rsnAdapter1DSubData(int con, int ad, int off, int count, int[] d); + synchronized void nAdapter1DSubData(int ad, int off, int count, int[] d) { + rsnAdapter1DSubData(mContext, ad, off, count, d); + } + native void rsnAdapter1DSubData(int con, int ad, int off, int count, float[] d); + synchronized void nAdapter1DSubData(int ad, int off, int count, float[] d) { + rsnAdapter1DSubData(mContext, ad, off, count, d); + } + native int rsnAdapter1DCreate(int con); + synchronized int nAdapter1DCreate() { + return rsnAdapter1DCreate(mContext); + } + + native void rsnAdapter2DBindAllocation(int con, int ad, int alloc); + synchronized void nAdapter2DBindAllocation(int ad, int alloc) { + rsnAdapter2DBindAllocation(mContext, ad, alloc); + } + native void rsnAdapter2DSetConstraint(int con, int ad, int dim, int value); + synchronized void nAdapter2DSetConstraint(int ad, int dim, int value) { + rsnAdapter2DSetConstraint(mContext, ad, dim, value); + } + native void rsnAdapter2DData(int con, int ad, int[] d); + synchronized void nAdapter2DData(int ad, int[] d) { + rsnAdapter2DData(mContext, ad, d); + } + native void rsnAdapter2DData(int con, int ad, float[] d); + synchronized void nAdapter2DData(int ad, float[] d) { + rsnAdapter2DData(mContext, ad, d); + } + native void rsnAdapter2DSubData(int con, int ad, int xoff, int yoff, int w, int h, int[] d); + synchronized void nAdapter2DSubData(int ad, int xoff, int yoff, int w, int h, int[] d) { + rsnAdapter2DSubData(mContext, ad, xoff, yoff, w, h, d); + } + native void rsnAdapter2DSubData(int con, int ad, int xoff, int yoff, int w, int h, float[] d); + synchronized void nAdapter2DSubData(int ad, int xoff, int yoff, int w, int h, float[] d) { + rsnAdapter2DSubData(mContext, ad, xoff, yoff, w, h, d); + } + native int rsnAdapter2DCreate(int con); + synchronized int nAdapter2DCreate() { + return rsnAdapter2DCreate(mContext); + } + + native void rsnScriptBindAllocation(int con, int script, int alloc, int slot); + synchronized void nScriptBindAllocation(int script, int alloc, int slot) { + rsnScriptBindAllocation(mContext, script, alloc, slot); + } + native void rsnScriptSetTimeZone(int con, int script, byte[] timeZone); + synchronized void nScriptSetTimeZone(int script, byte[] timeZone) { + rsnScriptSetTimeZone(mContext, script, timeZone); + } + native void rsnScriptInvoke(int con, int id, int slot); + synchronized void nScriptInvoke(int id, int slot) { + rsnScriptInvoke(mContext, id, slot); + } + native void rsnScriptInvokeV(int con, int id, int slot, byte[] params); + synchronized void nScriptInvokeV(int id, int slot, byte[] params) { + rsnScriptInvokeV(mContext, id, slot, params); + } + native void rsnScriptSetVarI(int con, int id, int slot, int val); + synchronized void nScriptSetVarI(int id, int slot, int val) { + rsnScriptSetVarI(mContext, id, slot, val); + } + native void rsnScriptSetVarF(int con, int id, int slot, float val); + synchronized void nScriptSetVarF(int id, int slot, float val) { + rsnScriptSetVarF(mContext, id, slot, val); + } + native void rsnScriptSetVarV(int con, int id, int slot, byte[] val); + synchronized void nScriptSetVarV(int id, int slot, byte[] val) { + rsnScriptSetVarV(mContext, id, slot, val); + } + + native void rsnScriptCBegin(int con); + synchronized void nScriptCBegin() { + rsnScriptCBegin(mContext); + } + native void rsnScriptCSetScript(int con, byte[] script, int offset, int length); + synchronized void nScriptCSetScript(byte[] script, int offset, int length) { + rsnScriptCSetScript(mContext, script, offset, length); + } + native int rsnScriptCCreate(int con); + synchronized int nScriptCCreate() { + return rsnScriptCCreate(mContext); + } + + native void rsnSamplerBegin(int con); + synchronized void nSamplerBegin() { + rsnSamplerBegin(mContext); + } + native void rsnSamplerSet(int con, int param, int value); + synchronized void nSamplerSet(int param, int value) { + rsnSamplerSet(mContext, param, value); + } + native int rsnSamplerCreate(int con); + synchronized int nSamplerCreate() { + return rsnSamplerCreate(mContext); + } + + native void rsnProgramStoreBegin(int con, int in, int out); + synchronized void nProgramStoreBegin(int in, int out) { + rsnProgramStoreBegin(mContext, in, out); + } + native void rsnProgramStoreDepthFunc(int con, int func); + synchronized void nProgramStoreDepthFunc(int func) { + rsnProgramStoreDepthFunc(mContext, func); + } + native void rsnProgramStoreDepthMask(int con, boolean enable); + synchronized void nProgramStoreDepthMask(boolean enable) { + rsnProgramStoreDepthMask(mContext, enable); + } + native void rsnProgramStoreColorMask(int con, boolean r, boolean g, boolean b, boolean a); + synchronized void nProgramStoreColorMask(boolean r, boolean g, boolean b, boolean a) { + rsnProgramStoreColorMask(mContext, r, g, b, a); + } + native void rsnProgramStoreBlendFunc(int con, int src, int dst); + synchronized void nProgramStoreBlendFunc(int src, int dst) { + rsnProgramStoreBlendFunc(mContext, src, dst); + } + native void rsnProgramStoreDither(int con, boolean enable); + synchronized void nProgramStoreDither(boolean enable) { + rsnProgramStoreDither(mContext, enable); + } + native int rsnProgramStoreCreate(int con); + synchronized int nProgramStoreCreate() { + return rsnProgramStoreCreate(mContext); + } + + native int rsnProgramRasterCreate(int con, boolean pointSmooth, boolean lineSmooth, boolean pointSprite); + synchronized int nProgramRasterCreate(boolean pointSmooth, boolean lineSmooth, boolean pointSprite) { + return rsnProgramRasterCreate(mContext, pointSmooth, lineSmooth, pointSprite); + } + native void rsnProgramRasterSetLineWidth(int con, int pr, float v); + synchronized void nProgramRasterSetLineWidth(int pr, float v) { + rsnProgramRasterSetLineWidth(mContext, pr, v); + } + native void rsnProgramRasterSetCullMode(int con, int pr, int mode); + synchronized void nProgramRasterSetCullMode(int pr, int mode) { + rsnProgramRasterSetCullMode(mContext, pr, mode); + } + + native void rsnProgramBindConstants(int con, int pv, int slot, int mID); + synchronized void nProgramBindConstants(int pv, int slot, int mID) { + rsnProgramBindConstants(mContext, pv, slot, mID); + } + native void rsnProgramBindTexture(int con, int vpf, int slot, int a); + synchronized void nProgramBindTexture(int vpf, int slot, int a) { + rsnProgramBindTexture(mContext, vpf, slot, a); + } + native void rsnProgramBindSampler(int con, int vpf, int slot, int s); + synchronized void nProgramBindSampler(int vpf, int slot, int s) { + rsnProgramBindSampler(mContext, vpf, slot, s); + } + + native int rsnProgramFragmentCreate(int con, int[] params); + synchronized int nProgramFragmentCreate(int[] params) { + return rsnProgramFragmentCreate(mContext, params); + } + native int rsnProgramFragmentCreate2(int con, String shader, int[] params); + synchronized int nProgramFragmentCreate2(String shader, int[] params) { + return rsnProgramFragmentCreate2(mContext, shader, params); + } + + native int rsnProgramVertexCreate(int con, boolean texMat); + synchronized int nProgramVertexCreate(boolean texMat) { + return rsnProgramVertexCreate(mContext, texMat); + } + native int rsnProgramVertexCreate2(int con, String shader, int[] params); + synchronized int nProgramVertexCreate2(String shader, int[] params) { + return rsnProgramVertexCreate2(mContext, shader, params); + } + + + native int rsnMeshCreate(int con, int vtxCount, int indexCount); + synchronized int nMeshCreate(int vtxCount, int indexCount) { + return rsnMeshCreate(mContext, vtxCount, indexCount); + } + native void rsnMeshBindVertex(int con, int id, int alloc, int slot); + synchronized void nMeshBindVertex(int id, int alloc, int slot) { + rsnMeshBindVertex(mContext, id, alloc, slot); + } + native void rsnMeshBindIndex(int con, int id, int alloc, int prim, int slot); + synchronized void nMeshBindIndex(int id, int alloc, int prim, int slot) { + rsnMeshBindIndex(mContext, id, alloc, prim, slot); + } + native int rsnMeshGetVertexBufferCount(int con, int id); + synchronized int nMeshGetVertexBufferCount(int id) { + return rsnMeshGetVertexBufferCount(mContext, id); + } + native int rsnMeshGetIndexCount(int con, int id); + synchronized int nMeshGetIndexCount(int id) { + return rsnMeshGetIndexCount(mContext, id); + } + native void rsnMeshGetVertices(int con, int id, int[] vtxIds, int vtxIdCount); + synchronized void nMeshGetVertices(int id, int[] vtxIds, int vtxIdCount) { + rsnMeshGetVertices(mContext, id, vtxIds, vtxIdCount); + } + native void rsnMeshGetIndices(int con, int id, int[] idxIds, int[] primitives, int vtxIdCount); + synchronized void nMeshGetIndices(int id, int[] idxIds, int[] primitives, int vtxIdCount) { + rsnMeshGetIndices(mContext, id, idxIds, primitives, vtxIdCount); + } + protected int mDev; protected int mContext; @@ -293,9 +599,9 @@ public class RenderScript { // This function is a temporary solution. The final solution will // used typed allocations where the message id is the type indicator. int[] rbuf = new int[16]; - mRS.nContextInitToClient(); + mRS.nContextInitToClient(mRS.mContext); while(mRun) { - int msg = mRS.nContextGetMessage(rbuf, true); + int msg = mRS.nContextGetMessage(mRS.mContext, rbuf, true); if (msg == 0) { // Should only happen during teardown. // But we want to avoid starving other threads during @@ -341,10 +647,10 @@ public class RenderScript { public void destroy() { validate(); - nContextDeinitToClient(); + nContextDeinitToClient(mContext); mMessageThread.mRun = false; - nContextDestroy(mContext); + nContextDestroy(); mContext = 0; nDeviceDestroy(mDev); |