RenderScript.java revision 6b32fab1dbfd8bc1cc176557fe0a7b2ebd4966bd
160aa3eaf559b1410898c228e4f6ab7920f3953d0Jack Palevich/* 260aa3eaf559b1410898c228e4f6ab7920f3953d0Jack Palevich * Copyright (C) 2008 The Android Open Source Project 360aa3eaf559b1410898c228e4f6ab7920f3953d0Jack Palevich * 460aa3eaf559b1410898c228e4f6ab7920f3953d0Jack Palevich * Licensed under the Apache License, Version 2.0 (the "License"); 560aa3eaf559b1410898c228e4f6ab7920f3953d0Jack Palevich * you may not use this file except in compliance with the License. 660aa3eaf559b1410898c228e4f6ab7920f3953d0Jack Palevich * You may obtain a copy of the License at 760aa3eaf559b1410898c228e4f6ab7920f3953d0Jack Palevich * 860aa3eaf559b1410898c228e4f6ab7920f3953d0Jack Palevich * http://www.apache.org/licenses/LICENSE-2.0 960aa3eaf559b1410898c228e4f6ab7920f3953d0Jack Palevich * 1060aa3eaf559b1410898c228e4f6ab7920f3953d0Jack Palevich * Unless required by applicable law or agreed to in writing, software 1160aa3eaf559b1410898c228e4f6ab7920f3953d0Jack Palevich * distributed under the License is distributed on an "AS IS" BASIS, 1260aa3eaf559b1410898c228e4f6ab7920f3953d0Jack Palevich * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 1360aa3eaf559b1410898c228e4f6ab7920f3953d0Jack Palevich * See the License for the specific language governing permissions and 1460aa3eaf559b1410898c228e4f6ab7920f3953d0Jack Palevich * limitations under the License. 1560aa3eaf559b1410898c228e4f6ab7920f3953d0Jack Palevich */ 1660aa3eaf559b1410898c228e4f6ab7920f3953d0Jack Palevich 1794d8e90ad78ee1dbc0efa315117688abd126ae55Jason Samspackage android.renderscript; 1860aa3eaf559b1410898c228e4f6ab7920f3953d0Jack Palevich 1943ee06857bb7f99446d1d84f8789016c5d105558Jason Samsimport java.lang.reflect.Field; 2036e612a488511940b61f09803b270aa1c61b68e0Jason Sams 216b32fab1dbfd8bc1cc176557fe0a7b2ebd4966bdShih-wei Liaoimport android.content.Context; 22b8c5a84e7c23746a3fc26013e0880d3d95ca6588Jason Samsimport android.graphics.Bitmap; 23650a3eb7d621dc8e81573142a4498bbd07bcde27Romain Guyimport android.graphics.BitmapFactory; 2436e612a488511940b61f09803b270aa1c61b68e0Jason Samsimport android.util.Config; 2536e612a488511940b61f09803b270aa1c61b68e0Jason Samsimport android.util.Log; 2636e612a488511940b61f09803b270aa1c61b68e0Jason Samsimport android.view.Surface; 2743702d8925c54360ad5f9f66b0d35d61d59f6910Jack Palevich 2860aa3eaf559b1410898c228e4f6ab7920f3953d0Jack Palevich 29e29d471e5ca9781d8772d445ec7832e94856fd14Jason Sams/** 30e29d471e5ca9781d8772d445ec7832e94856fd14Jason Sams * @hide 31e29d471e5ca9781d8772d445ec7832e94856fd14Jason Sams * 3227676fe24be7444a174c15df476e49adc5335d03Jason Sams * RenderScript base master class. An instance of this class creates native 3327676fe24be7444a174c15df476e49adc5335d03Jason Sams * worker threads for processing commands from this object. This base class 3427676fe24be7444a174c15df476e49adc5335d03Jason Sams * does not provide any extended capabilities beyond simple data processing. 3527676fe24be7444a174c15df476e49adc5335d03Jason Sams * For extended capabilities use derived classes such as RenderScriptGL. 3627676fe24be7444a174c15df476e49adc5335d03Jason Sams * 3727676fe24be7444a174c15df476e49adc5335d03Jason Sams * 3827676fe24be7444a174c15df476e49adc5335d03Jason Sams * 39e29d471e5ca9781d8772d445ec7832e94856fd14Jason Sams **/ 4060aa3eaf559b1410898c228e4f6ab7920f3953d0Jack Palevichpublic class RenderScript { 413bc47d438171dce294e816366d53bc9eca772c5bJason Sams static final String LOG_TAG = "RenderScript_jni"; 42bf6ef8d78fffbce6c1849a4a28fb3f4401ad039eJason Sams static final boolean DEBUG = false; 43650a3eb7d621dc8e81573142a4498bbd07bcde27Romain Guy @SuppressWarnings({"UnusedDeclaration", "deprecation"}) 44bf6ef8d78fffbce6c1849a4a28fb3f4401ad039eJason Sams static final boolean LOG_ENABLED = DEBUG ? Config.LOGD : Config.LOGV; 4560aa3eaf559b1410898c228e4f6ab7920f3953d0Jack Palevich 466b32fab1dbfd8bc1cc176557fe0a7b2ebd4966bdShih-wei Liao private Context mApplicationContext; 4760aa3eaf559b1410898c228e4f6ab7920f3953d0Jack Palevich 486b32fab1dbfd8bc1cc176557fe0a7b2ebd4966bdShih-wei Liao /* 4960aa3eaf559b1410898c228e4f6ab7920f3953d0Jack Palevich * We use a class initializer to allow the native code to cache some 5060aa3eaf559b1410898c228e4f6ab7920f3953d0Jack Palevich * field offsets. 5160aa3eaf559b1410898c228e4f6ab7920f3953d0Jack Palevich */ 52650a3eb7d621dc8e81573142a4498bbd07bcde27Romain Guy @SuppressWarnings({"FieldCanBeLocal", "UnusedDeclaration"}) 53bf6ef8d78fffbce6c1849a4a28fb3f4401ad039eJason Sams static boolean sInitialized; 54bf6ef8d78fffbce6c1849a4a28fb3f4401ad039eJason Sams native static void _nInit(); 5560aa3eaf559b1410898c228e4f6ab7920f3953d0Jack Palevich 56dba3ba5b5bf6026abceced921b1b0d231b0faefdJason Sams 5760aa3eaf559b1410898c228e4f6ab7920f3953d0Jack Palevich static { 5860aa3eaf559b1410898c228e4f6ab7920f3953d0Jack Palevich sInitialized = false; 5960aa3eaf559b1410898c228e4f6ab7920f3953d0Jack Palevich try { 60e29d471e5ca9781d8772d445ec7832e94856fd14Jason Sams System.loadLibrary("rs_jni"); 6160aa3eaf559b1410898c228e4f6ab7920f3953d0Jack Palevich _nInit(); 6260aa3eaf559b1410898c228e4f6ab7920f3953d0Jack Palevich sInitialized = true; 6360aa3eaf559b1410898c228e4f6ab7920f3953d0Jack Palevich } catch (UnsatisfiedLinkError e) { 6460aa3eaf559b1410898c228e4f6ab7920f3953d0Jack Palevich Log.d(LOG_TAG, "RenderScript JNI library not found!"); 6560aa3eaf559b1410898c228e4f6ab7920f3953d0Jack Palevich } 6660aa3eaf559b1410898c228e4f6ab7920f3953d0Jack Palevich } 6760aa3eaf559b1410898c228e4f6ab7920f3953d0Jack Palevich 682e1872fe07cf8952812a417985e6e1f61bdeab5dJason Sams // Non-threadsafe functions. 6936e612a488511940b61f09803b270aa1c61b68e0Jason Sams native int nDeviceCreate(); 7036e612a488511940b61f09803b270aa1c61b68e0Jason Sams native void nDeviceDestroy(int dev); 71ebfb436a49673693b98469683451bd9ede797557Jason Sams native void nDeviceSetConfig(int dev, int param, int value); 721c41517124a90fcfdb95dc069fc492c6fcf1ff25Jason Sams native void nContextGetUserMessage(int con, int[] data); 731c41517124a90fcfdb95dc069fc492c6fcf1ff25Jason Sams native String nContextGetErrorMessage(int con); 741c41517124a90fcfdb95dc069fc492c6fcf1ff25Jason Sams native int nContextPeekMessage(int con, int[] subID, boolean wait); 752e1872fe07cf8952812a417985e6e1f61bdeab5dJason Sams native void nContextInitToClient(int con); 762e1872fe07cf8952812a417985e6e1f61bdeab5dJason Sams native void nContextDeinitToClient(int con); 772e1872fe07cf8952812a417985e6e1f61bdeab5dJason Sams 782e1872fe07cf8952812a417985e6e1f61bdeab5dJason Sams 792e1872fe07cf8952812a417985e6e1f61bdeab5dJason Sams // Methods below are wrapped to protect the non-threadsafe 802e1872fe07cf8952812a417985e6e1f61bdeab5dJason Sams // lockless fifo. 8111c8af9ded3a319635b4e91a639a616ec97fc7e3Jason Sams native int rsnContextCreateGL(int dev, int ver, 8211c8af9ded3a319635b4e91a639a616ec97fc7e3Jason Sams int colorMin, int colorPref, 8311c8af9ded3a319635b4e91a639a616ec97fc7e3Jason Sams int alphaMin, int alphaPref, 8411c8af9ded3a319635b4e91a639a616ec97fc7e3Jason Sams int depthMin, int depthPref, 8511c8af9ded3a319635b4e91a639a616ec97fc7e3Jason Sams int stencilMin, int stencilPref, 8611c8af9ded3a319635b4e91a639a616ec97fc7e3Jason Sams int samplesMin, int samplesPref, float samplesQ); 8711c8af9ded3a319635b4e91a639a616ec97fc7e3Jason Sams synchronized int nContextCreateGL(int dev, int ver, 8811c8af9ded3a319635b4e91a639a616ec97fc7e3Jason Sams int colorMin, int colorPref, 8911c8af9ded3a319635b4e91a639a616ec97fc7e3Jason Sams int alphaMin, int alphaPref, 9011c8af9ded3a319635b4e91a639a616ec97fc7e3Jason Sams int depthMin, int depthPref, 9111c8af9ded3a319635b4e91a639a616ec97fc7e3Jason Sams int stencilMin, int stencilPref, 9211c8af9ded3a319635b4e91a639a616ec97fc7e3Jason Sams int samplesMin, int samplesPref, float samplesQ) { 9311c8af9ded3a319635b4e91a639a616ec97fc7e3Jason Sams return rsnContextCreateGL(dev, ver, colorMin, colorPref, 9411c8af9ded3a319635b4e91a639a616ec97fc7e3Jason Sams alphaMin, alphaPref, depthMin, depthPref, 9511c8af9ded3a319635b4e91a639a616ec97fc7e3Jason Sams stencilMin, stencilPref, 9611c8af9ded3a319635b4e91a639a616ec97fc7e3Jason Sams samplesMin, samplesPref, samplesQ); 972e1872fe07cf8952812a417985e6e1f61bdeab5dJason Sams } 982e1872fe07cf8952812a417985e6e1f61bdeab5dJason Sams native int rsnContextCreate(int dev, int ver); 992e1872fe07cf8952812a417985e6e1f61bdeab5dJason Sams synchronized int nContextCreate(int dev, int ver) { 1002e1872fe07cf8952812a417985e6e1f61bdeab5dJason Sams return rsnContextCreate(dev, ver); 1012e1872fe07cf8952812a417985e6e1f61bdeab5dJason Sams } 1022e1872fe07cf8952812a417985e6e1f61bdeab5dJason Sams native void rsnContextDestroy(int con); 1032e1872fe07cf8952812a417985e6e1f61bdeab5dJason Sams synchronized void nContextDestroy() { 1042e1872fe07cf8952812a417985e6e1f61bdeab5dJason Sams rsnContextDestroy(mContext); 1052e1872fe07cf8952812a417985e6e1f61bdeab5dJason Sams } 1062e1872fe07cf8952812a417985e6e1f61bdeab5dJason Sams native void rsnContextSetSurface(int con, int w, int h, Surface sur); 1072e1872fe07cf8952812a417985e6e1f61bdeab5dJason Sams synchronized void nContextSetSurface(int w, int h, Surface sur) { 1082e1872fe07cf8952812a417985e6e1f61bdeab5dJason Sams rsnContextSetSurface(mContext, w, h, sur); 1092e1872fe07cf8952812a417985e6e1f61bdeab5dJason Sams } 1102e1872fe07cf8952812a417985e6e1f61bdeab5dJason Sams native void rsnContextSetPriority(int con, int p); 1112e1872fe07cf8952812a417985e6e1f61bdeab5dJason Sams synchronized void nContextSetPriority(int p) { 1122e1872fe07cf8952812a417985e6e1f61bdeab5dJason Sams rsnContextSetPriority(mContext, p); 1132e1872fe07cf8952812a417985e6e1f61bdeab5dJason Sams } 1142e1872fe07cf8952812a417985e6e1f61bdeab5dJason Sams native void rsnContextDump(int con, int bits); 1152e1872fe07cf8952812a417985e6e1f61bdeab5dJason Sams synchronized void nContextDump(int bits) { 1162e1872fe07cf8952812a417985e6e1f61bdeab5dJason Sams rsnContextDump(mContext, bits); 1172e1872fe07cf8952812a417985e6e1f61bdeab5dJason Sams } 1182e1872fe07cf8952812a417985e6e1f61bdeab5dJason Sams native void rsnContextFinish(int con); 1192e1872fe07cf8952812a417985e6e1f61bdeab5dJason Sams synchronized void nContextFinish() { 1202e1872fe07cf8952812a417985e6e1f61bdeab5dJason Sams rsnContextFinish(mContext); 1212e1872fe07cf8952812a417985e6e1f61bdeab5dJason Sams } 1222e1872fe07cf8952812a417985e6e1f61bdeab5dJason Sams 1232e1872fe07cf8952812a417985e6e1f61bdeab5dJason Sams native void rsnContextBindRootScript(int con, int script); 1242e1872fe07cf8952812a417985e6e1f61bdeab5dJason Sams synchronized void nContextBindRootScript(int script) { 1252e1872fe07cf8952812a417985e6e1f61bdeab5dJason Sams rsnContextBindRootScript(mContext, script); 1262e1872fe07cf8952812a417985e6e1f61bdeab5dJason Sams } 1272e1872fe07cf8952812a417985e6e1f61bdeab5dJason Sams native void rsnContextBindSampler(int con, int sampler, int slot); 1282e1872fe07cf8952812a417985e6e1f61bdeab5dJason Sams synchronized void nContextBindSampler(int sampler, int slot) { 1292e1872fe07cf8952812a417985e6e1f61bdeab5dJason Sams rsnContextBindSampler(mContext, sampler, slot); 1302e1872fe07cf8952812a417985e6e1f61bdeab5dJason Sams } 1312e1872fe07cf8952812a417985e6e1f61bdeab5dJason Sams native void rsnContextBindProgramStore(int con, int pfs); 1322e1872fe07cf8952812a417985e6e1f61bdeab5dJason Sams synchronized void nContextBindProgramStore(int pfs) { 1332e1872fe07cf8952812a417985e6e1f61bdeab5dJason Sams rsnContextBindProgramStore(mContext, pfs); 1342e1872fe07cf8952812a417985e6e1f61bdeab5dJason Sams } 1352e1872fe07cf8952812a417985e6e1f61bdeab5dJason Sams native void rsnContextBindProgramFragment(int con, int pf); 1362e1872fe07cf8952812a417985e6e1f61bdeab5dJason Sams synchronized void nContextBindProgramFragment(int pf) { 1372e1872fe07cf8952812a417985e6e1f61bdeab5dJason Sams rsnContextBindProgramFragment(mContext, pf); 1382e1872fe07cf8952812a417985e6e1f61bdeab5dJason Sams } 1392e1872fe07cf8952812a417985e6e1f61bdeab5dJason Sams native void rsnContextBindProgramVertex(int con, int pv); 1402e1872fe07cf8952812a417985e6e1f61bdeab5dJason Sams synchronized void nContextBindProgramVertex(int pv) { 1412e1872fe07cf8952812a417985e6e1f61bdeab5dJason Sams rsnContextBindProgramVertex(mContext, pv); 1422e1872fe07cf8952812a417985e6e1f61bdeab5dJason Sams } 1432e1872fe07cf8952812a417985e6e1f61bdeab5dJason Sams native void rsnContextBindProgramRaster(int con, int pr); 1442e1872fe07cf8952812a417985e6e1f61bdeab5dJason Sams synchronized void nContextBindProgramRaster(int pr) { 1452e1872fe07cf8952812a417985e6e1f61bdeab5dJason Sams rsnContextBindProgramRaster(mContext, pr); 1462e1872fe07cf8952812a417985e6e1f61bdeab5dJason Sams } 1472e1872fe07cf8952812a417985e6e1f61bdeab5dJason Sams native void rsnContextPause(int con); 1482e1872fe07cf8952812a417985e6e1f61bdeab5dJason Sams synchronized void nContextPause() { 1492e1872fe07cf8952812a417985e6e1f61bdeab5dJason Sams rsnContextPause(mContext); 1502e1872fe07cf8952812a417985e6e1f61bdeab5dJason Sams } 1512e1872fe07cf8952812a417985e6e1f61bdeab5dJason Sams native void rsnContextResume(int con); 1522e1872fe07cf8952812a417985e6e1f61bdeab5dJason Sams synchronized void nContextResume() { 1532e1872fe07cf8952812a417985e6e1f61bdeab5dJason Sams rsnContextResume(mContext); 1542e1872fe07cf8952812a417985e6e1f61bdeab5dJason Sams } 1552e1872fe07cf8952812a417985e6e1f61bdeab5dJason Sams 1562e1872fe07cf8952812a417985e6e1f61bdeab5dJason Sams native void rsnAssignName(int con, int obj, byte[] name); 1572e1872fe07cf8952812a417985e6e1f61bdeab5dJason Sams synchronized void nAssignName(int obj, byte[] name) { 1582e1872fe07cf8952812a417985e6e1f61bdeab5dJason Sams rsnAssignName(mContext, obj, name); 1592e1872fe07cf8952812a417985e6e1f61bdeab5dJason Sams } 1602e1872fe07cf8952812a417985e6e1f61bdeab5dJason Sams native String rsnGetName(int con, int obj); 1612e1872fe07cf8952812a417985e6e1f61bdeab5dJason Sams synchronized String nGetName(int obj) { 1622e1872fe07cf8952812a417985e6e1f61bdeab5dJason Sams return rsnGetName(mContext, obj); 1632e1872fe07cf8952812a417985e6e1f61bdeab5dJason Sams } 1642e1872fe07cf8952812a417985e6e1f61bdeab5dJason Sams native void rsnObjDestroy(int con, int id); 1652e1872fe07cf8952812a417985e6e1f61bdeab5dJason Sams synchronized void nObjDestroy(int id) { 1662e1872fe07cf8952812a417985e6e1f61bdeab5dJason Sams rsnObjDestroy(mContext, id); 1672e1872fe07cf8952812a417985e6e1f61bdeab5dJason Sams } 1682e1872fe07cf8952812a417985e6e1f61bdeab5dJason Sams 1692e1872fe07cf8952812a417985e6e1f61bdeab5dJason Sams native int rsnElementCreate(int con, int type, int kind, boolean norm, int vecSize); 1702e1872fe07cf8952812a417985e6e1f61bdeab5dJason Sams synchronized int nElementCreate(int type, int kind, boolean norm, int vecSize) { 1712e1872fe07cf8952812a417985e6e1f61bdeab5dJason Sams return rsnElementCreate(mContext, type, kind, norm, vecSize); 1722e1872fe07cf8952812a417985e6e1f61bdeab5dJason Sams } 17370d4e5024298f71edb3b04867e05568f5495b4ceJason Sams native int rsnElementCreate2(int con, int[] elements, String[] names, int[] arraySizes); 17470d4e5024298f71edb3b04867e05568f5495b4ceJason Sams synchronized int nElementCreate2(int[] elements, String[] names, int[] arraySizes) { 17570d4e5024298f71edb3b04867e05568f5495b4ceJason Sams return rsnElementCreate2(mContext, elements, names, arraySizes); 1762e1872fe07cf8952812a417985e6e1f61bdeab5dJason Sams } 1772e1872fe07cf8952812a417985e6e1f61bdeab5dJason Sams native void rsnElementGetNativeData(int con, int id, int[] elementData); 1782e1872fe07cf8952812a417985e6e1f61bdeab5dJason Sams synchronized void nElementGetNativeData(int id, int[] elementData) { 1792e1872fe07cf8952812a417985e6e1f61bdeab5dJason Sams rsnElementGetNativeData(mContext, id, elementData); 1802e1872fe07cf8952812a417985e6e1f61bdeab5dJason Sams } 1812e1872fe07cf8952812a417985e6e1f61bdeab5dJason Sams native void rsnElementGetSubElements(int con, int id, int[] IDs, String[] names); 1822e1872fe07cf8952812a417985e6e1f61bdeab5dJason Sams synchronized void nElementGetSubElements(int id, int[] IDs, String[] names) { 1832e1872fe07cf8952812a417985e6e1f61bdeab5dJason Sams rsnElementGetSubElements(mContext, id, IDs, names); 1842e1872fe07cf8952812a417985e6e1f61bdeab5dJason Sams } 1852e1872fe07cf8952812a417985e6e1f61bdeab5dJason Sams 186bf6ef8d78fffbce6c1849a4a28fb3f4401ad039eJason Sams native int rsnTypeCreate(int con, int eid, int x, int y, int z, boolean mips, boolean faces); 187bf6ef8d78fffbce6c1849a4a28fb3f4401ad039eJason Sams synchronized int nTypeCreate(int eid, int x, int y, int z, boolean mips, boolean faces) { 188bf6ef8d78fffbce6c1849a4a28fb3f4401ad039eJason Sams return rsnTypeCreate(mContext, eid, x, y, z, mips, faces); 1892e1872fe07cf8952812a417985e6e1f61bdeab5dJason Sams } 1902e1872fe07cf8952812a417985e6e1f61bdeab5dJason Sams native void rsnTypeGetNativeData(int con, int id, int[] typeData); 1912e1872fe07cf8952812a417985e6e1f61bdeab5dJason Sams synchronized void nTypeGetNativeData(int id, int[] typeData) { 1922e1872fe07cf8952812a417985e6e1f61bdeab5dJason Sams rsnTypeGetNativeData(mContext, id, typeData); 1932e1872fe07cf8952812a417985e6e1f61bdeab5dJason Sams } 1942e1872fe07cf8952812a417985e6e1f61bdeab5dJason Sams 195d4b23b54445b13dacaafad97d100999abb36ea6fJason Sams native int rsnAllocationCreateTyped(int con, int type, int mip, int usage); 196d4b23b54445b13dacaafad97d100999abb36ea6fJason Sams synchronized int nAllocationCreateTyped(int type, int mip, int usage) { 197d4b23b54445b13dacaafad97d100999abb36ea6fJason Sams return rsnAllocationCreateTyped(mContext, type, mip, usage); 1982e1872fe07cf8952812a417985e6e1f61bdeab5dJason Sams } 1995476b450e50939940dcf3f15c92335cee2fc572dJason Sams native int rsnAllocationCreateFromBitmap(int con, int type, int mip, Bitmap bmp, int usage); 2005476b450e50939940dcf3f15c92335cee2fc572dJason Sams synchronized int nAllocationCreateFromBitmap(int type, int mip, Bitmap bmp, int usage) { 2015476b450e50939940dcf3f15c92335cee2fc572dJason Sams return rsnAllocationCreateFromBitmap(mContext, type, mip, bmp, usage); 20226ae3904e8050eae655722caf93ee5d3f0ab195aAlex Sakhartchouk } 2035476b450e50939940dcf3f15c92335cee2fc572dJason Sams native int rsnAllocationCubeCreateFromBitmap(int con, int type, int mip, Bitmap bmp, int usage); 2045476b450e50939940dcf3f15c92335cee2fc572dJason Sams synchronized int nAllocationCubeCreateFromBitmap(int type, int mip, Bitmap bmp, int usage) { 2055476b450e50939940dcf3f15c92335cee2fc572dJason Sams return rsnAllocationCubeCreateFromBitmap(mContext, type, mip, bmp, usage); 20667f2e442a31b8395e3c1951f8e91139ec7f2be99Alex Sakhartchouk } 2072e1872fe07cf8952812a417985e6e1f61bdeab5dJason Sams native int rsnAllocationCreateBitmapRef(int con, int type, Bitmap bmp); 2082e1872fe07cf8952812a417985e6e1f61bdeab5dJason Sams synchronized int nAllocationCreateBitmapRef(int type, Bitmap bmp) { 2092e1872fe07cf8952812a417985e6e1f61bdeab5dJason Sams return rsnAllocationCreateBitmapRef(mContext, type, bmp); 2102e1872fe07cf8952812a417985e6e1f61bdeab5dJason Sams } 2115476b450e50939940dcf3f15c92335cee2fc572dJason Sams native int rsnAllocationCreateFromAssetStream(int con, int mips, int assetStream, int usage); 2125476b450e50939940dcf3f15c92335cee2fc572dJason Sams synchronized int nAllocationCreateFromAssetStream(int mips, int assetStream, int usage) { 2135476b450e50939940dcf3f15c92335cee2fc572dJason Sams return rsnAllocationCreateFromAssetStream(mContext, mips, assetStream, usage); 2145476b450e50939940dcf3f15c92335cee2fc572dJason Sams } 2155476b450e50939940dcf3f15c92335cee2fc572dJason Sams 2164ef6650bd05a39a09958ea1db92f120ea4949cb1Jason Sams native void rsnAllocationCopyToBitmap(int con, int alloc, Bitmap bmp); 2174ef6650bd05a39a09958ea1db92f120ea4949cb1Jason Sams synchronized void nAllocationCopyToBitmap(int alloc, Bitmap bmp) { 2184ef6650bd05a39a09958ea1db92f120ea4949cb1Jason Sams rsnAllocationCopyToBitmap(mContext, alloc, bmp); 2194ef6650bd05a39a09958ea1db92f120ea4949cb1Jason Sams } 2204ef6650bd05a39a09958ea1db92f120ea4949cb1Jason Sams 2214ef6650bd05a39a09958ea1db92f120ea4949cb1Jason Sams 2225476b450e50939940dcf3f15c92335cee2fc572dJason Sams native void rsnAllocationSyncAll(int con, int alloc, int src); 2235476b450e50939940dcf3f15c92335cee2fc572dJason Sams synchronized void nAllocationSyncAll(int alloc, int src) { 2245476b450e50939940dcf3f15c92335cee2fc572dJason Sams rsnAllocationSyncAll(mContext, alloc, src); 2255476b450e50939940dcf3f15c92335cee2fc572dJason Sams } 2264ef6650bd05a39a09958ea1db92f120ea4949cb1Jason Sams native void rsnAllocationCopyFromBitmap(int con, int alloc, Bitmap bmp); 2274ef6650bd05a39a09958ea1db92f120ea4949cb1Jason Sams synchronized void nAllocationCopyFromBitmap(int alloc, Bitmap bmp) { 2284ef6650bd05a39a09958ea1db92f120ea4949cb1Jason Sams rsnAllocationCopyFromBitmap(mContext, alloc, bmp); 2292e1872fe07cf8952812a417985e6e1f61bdeab5dJason Sams } 2302e1872fe07cf8952812a417985e6e1f61bdeab5dJason Sams 2312e1872fe07cf8952812a417985e6e1f61bdeab5dJason Sams native void rsnAllocationUploadToTexture(int con, int alloc, boolean genMips, int baseMioLevel); 2322e1872fe07cf8952812a417985e6e1f61bdeab5dJason Sams synchronized void nAllocationUploadToTexture(int alloc, boolean genMips, int baseMioLevel) { 2332e1872fe07cf8952812a417985e6e1f61bdeab5dJason Sams rsnAllocationUploadToTexture(mContext, alloc, genMips, baseMioLevel); 2342e1872fe07cf8952812a417985e6e1f61bdeab5dJason Sams } 2352e1872fe07cf8952812a417985e6e1f61bdeab5dJason Sams native void rsnAllocationUploadToBufferObject(int con, int alloc); 2362e1872fe07cf8952812a417985e6e1f61bdeab5dJason Sams synchronized void nAllocationUploadToBufferObject(int alloc) { 2372e1872fe07cf8952812a417985e6e1f61bdeab5dJason Sams rsnAllocationUploadToBufferObject(mContext, alloc); 2382e1872fe07cf8952812a417985e6e1f61bdeab5dJason Sams } 2392e1872fe07cf8952812a417985e6e1f61bdeab5dJason Sams 2402e1872fe07cf8952812a417985e6e1f61bdeab5dJason Sams native void rsnAllocationSubData1D(int con, int id, int off, int count, int[] d, int sizeBytes); 2412e1872fe07cf8952812a417985e6e1f61bdeab5dJason Sams synchronized void nAllocationSubData1D(int id, int off, int count, int[] d, int sizeBytes) { 2422e1872fe07cf8952812a417985e6e1f61bdeab5dJason Sams rsnAllocationSubData1D(mContext, id, off, count, d, sizeBytes); 2432e1872fe07cf8952812a417985e6e1f61bdeab5dJason Sams } 2442e1872fe07cf8952812a417985e6e1f61bdeab5dJason Sams native void rsnAllocationSubData1D(int con, int id, int off, int count, short[] d, int sizeBytes); 2452e1872fe07cf8952812a417985e6e1f61bdeab5dJason Sams synchronized void nAllocationSubData1D(int id, int off, int count, short[] d, int sizeBytes) { 2462e1872fe07cf8952812a417985e6e1f61bdeab5dJason Sams rsnAllocationSubData1D(mContext, id, off, count, d, sizeBytes); 2472e1872fe07cf8952812a417985e6e1f61bdeab5dJason Sams } 2482e1872fe07cf8952812a417985e6e1f61bdeab5dJason Sams native void rsnAllocationSubData1D(int con, int id, int off, int count, byte[] d, int sizeBytes); 2492e1872fe07cf8952812a417985e6e1f61bdeab5dJason Sams synchronized void nAllocationSubData1D(int id, int off, int count, byte[] d, int sizeBytes) { 2502e1872fe07cf8952812a417985e6e1f61bdeab5dJason Sams rsnAllocationSubData1D(mContext, id, off, count, d, sizeBytes); 2512e1872fe07cf8952812a417985e6e1f61bdeab5dJason Sams } 25249bdaf0293408159df18a1d8540360f9623c40f7Jason Sams native void rsnAllocationSubElementData1D(int con, int id, int xoff, int compIdx, byte[] d, int sizeBytes); 25349bdaf0293408159df18a1d8540360f9623c40f7Jason Sams synchronized void nAllocationSubElementData1D(int id, int xoff, int compIdx, byte[] d, int sizeBytes) { 25449bdaf0293408159df18a1d8540360f9623c40f7Jason Sams rsnAllocationSubElementData1D(mContext, id, xoff, compIdx, d, sizeBytes); 25549bdaf0293408159df18a1d8540360f9623c40f7Jason Sams } 2562e1872fe07cf8952812a417985e6e1f61bdeab5dJason Sams native void rsnAllocationSubData1D(int con, int id, int off, int count, float[] d, int sizeBytes); 2572e1872fe07cf8952812a417985e6e1f61bdeab5dJason Sams synchronized void nAllocationSubData1D(int id, int off, int count, float[] d, int sizeBytes) { 2582e1872fe07cf8952812a417985e6e1f61bdeab5dJason Sams rsnAllocationSubData1D(mContext, id, off, count, d, sizeBytes); 2592e1872fe07cf8952812a417985e6e1f61bdeab5dJason Sams } 2602e1872fe07cf8952812a417985e6e1f61bdeab5dJason Sams 2612e1872fe07cf8952812a417985e6e1f61bdeab5dJason Sams native void rsnAllocationSubData2D(int con, int id, int xoff, int yoff, int w, int h, int[] d, int sizeBytes); 2622e1872fe07cf8952812a417985e6e1f61bdeab5dJason Sams synchronized void nAllocationSubData2D(int id, int xoff, int yoff, int w, int h, int[] d, int sizeBytes) { 2632e1872fe07cf8952812a417985e6e1f61bdeab5dJason Sams rsnAllocationSubData2D(mContext, id, xoff, yoff, w, h, d, sizeBytes); 2642e1872fe07cf8952812a417985e6e1f61bdeab5dJason Sams } 2652e1872fe07cf8952812a417985e6e1f61bdeab5dJason Sams native void rsnAllocationSubData2D(int con, int id, int xoff, int yoff, int w, int h, float[] d, int sizeBytes); 2662e1872fe07cf8952812a417985e6e1f61bdeab5dJason Sams synchronized void nAllocationSubData2D(int id, int xoff, int yoff, int w, int h, float[] d, int sizeBytes) { 2672e1872fe07cf8952812a417985e6e1f61bdeab5dJason Sams rsnAllocationSubData2D(mContext, id, xoff, yoff, w, h, d, sizeBytes); 2682e1872fe07cf8952812a417985e6e1f61bdeab5dJason Sams } 2692e1872fe07cf8952812a417985e6e1f61bdeab5dJason Sams native void rsnAllocationRead(int con, int id, int[] d); 2702e1872fe07cf8952812a417985e6e1f61bdeab5dJason Sams synchronized void nAllocationRead(int id, int[] d) { 2712e1872fe07cf8952812a417985e6e1f61bdeab5dJason Sams rsnAllocationRead(mContext, id, d); 2722e1872fe07cf8952812a417985e6e1f61bdeab5dJason Sams } 2732e1872fe07cf8952812a417985e6e1f61bdeab5dJason Sams native void rsnAllocationRead(int con, int id, float[] d); 2742e1872fe07cf8952812a417985e6e1f61bdeab5dJason Sams synchronized void nAllocationRead(int id, float[] d) { 2752e1872fe07cf8952812a417985e6e1f61bdeab5dJason Sams rsnAllocationRead(mContext, id, d); 2762e1872fe07cf8952812a417985e6e1f61bdeab5dJason Sams } 2772e1872fe07cf8952812a417985e6e1f61bdeab5dJason Sams native int rsnAllocationGetType(int con, int id); 2782e1872fe07cf8952812a417985e6e1f61bdeab5dJason Sams synchronized int nAllocationGetType(int id) { 2792e1872fe07cf8952812a417985e6e1f61bdeab5dJason Sams return rsnAllocationGetType(mContext, id); 2802e1872fe07cf8952812a417985e6e1f61bdeab5dJason Sams } 2812e1872fe07cf8952812a417985e6e1f61bdeab5dJason Sams 2825edc608a0749ed4b7074b5c1243043eb722c3c31Jason Sams native void rsnAllocationResize1D(int con, int id, int dimX); 2835edc608a0749ed4b7074b5c1243043eb722c3c31Jason Sams synchronized void nAllocationResize1D(int id, int dimX) { 2845edc608a0749ed4b7074b5c1243043eb722c3c31Jason Sams rsnAllocationResize1D(mContext, id, dimX); 2855edc608a0749ed4b7074b5c1243043eb722c3c31Jason Sams } 2865edc608a0749ed4b7074b5c1243043eb722c3c31Jason Sams native void rsnAllocationResize2D(int con, int id, int dimX, int dimY); 2875edc608a0749ed4b7074b5c1243043eb722c3c31Jason Sams synchronized void nAllocationResize2D(int id, int dimX, int dimY) { 2885edc608a0749ed4b7074b5c1243043eb722c3c31Jason Sams rsnAllocationResize2D(mContext, id, dimX, dimY); 2895edc608a0749ed4b7074b5c1243043eb722c3c31Jason Sams } 2905edc608a0749ed4b7074b5c1243043eb722c3c31Jason Sams 2912e1872fe07cf8952812a417985e6e1f61bdeab5dJason Sams native int rsnFileA3DCreateFromAssetStream(int con, int assetStream); 2922e1872fe07cf8952812a417985e6e1f61bdeab5dJason Sams synchronized int nFileA3DCreateFromAssetStream(int assetStream) { 2932e1872fe07cf8952812a417985e6e1f61bdeab5dJason Sams return rsnFileA3DCreateFromAssetStream(mContext, assetStream); 2942e1872fe07cf8952812a417985e6e1f61bdeab5dJason Sams } 2952e1872fe07cf8952812a417985e6e1f61bdeab5dJason Sams native int rsnFileA3DGetNumIndexEntries(int con, int fileA3D); 2962e1872fe07cf8952812a417985e6e1f61bdeab5dJason Sams synchronized int nFileA3DGetNumIndexEntries(int fileA3D) { 2972e1872fe07cf8952812a417985e6e1f61bdeab5dJason Sams return rsnFileA3DGetNumIndexEntries(mContext, fileA3D); 2982e1872fe07cf8952812a417985e6e1f61bdeab5dJason Sams } 2992e1872fe07cf8952812a417985e6e1f61bdeab5dJason Sams native void rsnFileA3DGetIndexEntries(int con, int fileA3D, int numEntries, int[] IDs, String[] names); 3002e1872fe07cf8952812a417985e6e1f61bdeab5dJason Sams synchronized void nFileA3DGetIndexEntries(int fileA3D, int numEntries, int[] IDs, String[] names) { 3012e1872fe07cf8952812a417985e6e1f61bdeab5dJason Sams rsnFileA3DGetIndexEntries(mContext, fileA3D, numEntries, IDs, names); 3022e1872fe07cf8952812a417985e6e1f61bdeab5dJason Sams } 3032e1872fe07cf8952812a417985e6e1f61bdeab5dJason Sams native int rsnFileA3DGetEntryByIndex(int con, int fileA3D, int index); 3042e1872fe07cf8952812a417985e6e1f61bdeab5dJason Sams synchronized int nFileA3DGetEntryByIndex(int fileA3D, int index) { 3052e1872fe07cf8952812a417985e6e1f61bdeab5dJason Sams return rsnFileA3DGetEntryByIndex(mContext, fileA3D, index); 3062e1872fe07cf8952812a417985e6e1f61bdeab5dJason Sams } 3072e1872fe07cf8952812a417985e6e1f61bdeab5dJason Sams 3082e1872fe07cf8952812a417985e6e1f61bdeab5dJason Sams native int rsnFontCreateFromFile(int con, String fileName, int size, int dpi); 3092e1872fe07cf8952812a417985e6e1f61bdeab5dJason Sams synchronized int nFontCreateFromFile(String fileName, int size, int dpi) { 3102e1872fe07cf8952812a417985e6e1f61bdeab5dJason Sams return rsnFontCreateFromFile(mContext, fileName, size, dpi); 3112e1872fe07cf8952812a417985e6e1f61bdeab5dJason Sams } 3122e1872fe07cf8952812a417985e6e1f61bdeab5dJason Sams 3132e1872fe07cf8952812a417985e6e1f61bdeab5dJason Sams native void rsnAdapter1DBindAllocation(int con, int ad, int alloc); 3142e1872fe07cf8952812a417985e6e1f61bdeab5dJason Sams synchronized void nAdapter1DBindAllocation(int ad, int alloc) { 3152e1872fe07cf8952812a417985e6e1f61bdeab5dJason Sams rsnAdapter1DBindAllocation(mContext, ad, alloc); 3162e1872fe07cf8952812a417985e6e1f61bdeab5dJason Sams } 3172e1872fe07cf8952812a417985e6e1f61bdeab5dJason Sams native void rsnAdapter1DSetConstraint(int con, int ad, int dim, int value); 3182e1872fe07cf8952812a417985e6e1f61bdeab5dJason Sams synchronized void nAdapter1DSetConstraint(int ad, int dim, int value) { 3192e1872fe07cf8952812a417985e6e1f61bdeab5dJason Sams rsnAdapter1DSetConstraint(mContext, ad, dim, value); 3202e1872fe07cf8952812a417985e6e1f61bdeab5dJason Sams } 3212e1872fe07cf8952812a417985e6e1f61bdeab5dJason Sams native void rsnAdapter1DData(int con, int ad, int[] d); 3222e1872fe07cf8952812a417985e6e1f61bdeab5dJason Sams synchronized void nAdapter1DData(int ad, int[] d) { 3232e1872fe07cf8952812a417985e6e1f61bdeab5dJason Sams rsnAdapter1DData(mContext, ad, d); 3242e1872fe07cf8952812a417985e6e1f61bdeab5dJason Sams } 3252e1872fe07cf8952812a417985e6e1f61bdeab5dJason Sams native void rsnAdapter1DData(int con, int ad, float[] d); 3262e1872fe07cf8952812a417985e6e1f61bdeab5dJason Sams synchronized void nAdapter1DData(int ad, float[] d) { 3272e1872fe07cf8952812a417985e6e1f61bdeab5dJason Sams rsnAdapter1DData(mContext, ad, d); 3282e1872fe07cf8952812a417985e6e1f61bdeab5dJason Sams } 3292e1872fe07cf8952812a417985e6e1f61bdeab5dJason Sams native void rsnAdapter1DSubData(int con, int ad, int off, int count, int[] d); 3302e1872fe07cf8952812a417985e6e1f61bdeab5dJason Sams synchronized void nAdapter1DSubData(int ad, int off, int count, int[] d) { 3312e1872fe07cf8952812a417985e6e1f61bdeab5dJason Sams rsnAdapter1DSubData(mContext, ad, off, count, d); 3322e1872fe07cf8952812a417985e6e1f61bdeab5dJason Sams } 3332e1872fe07cf8952812a417985e6e1f61bdeab5dJason Sams native void rsnAdapter1DSubData(int con, int ad, int off, int count, float[] d); 3342e1872fe07cf8952812a417985e6e1f61bdeab5dJason Sams synchronized void nAdapter1DSubData(int ad, int off, int count, float[] d) { 3352e1872fe07cf8952812a417985e6e1f61bdeab5dJason Sams rsnAdapter1DSubData(mContext, ad, off, count, d); 3362e1872fe07cf8952812a417985e6e1f61bdeab5dJason Sams } 3372e1872fe07cf8952812a417985e6e1f61bdeab5dJason Sams native int rsnAdapter1DCreate(int con); 3382e1872fe07cf8952812a417985e6e1f61bdeab5dJason Sams synchronized int nAdapter1DCreate() { 3392e1872fe07cf8952812a417985e6e1f61bdeab5dJason Sams return rsnAdapter1DCreate(mContext); 3402e1872fe07cf8952812a417985e6e1f61bdeab5dJason Sams } 3412e1872fe07cf8952812a417985e6e1f61bdeab5dJason Sams 3422e1872fe07cf8952812a417985e6e1f61bdeab5dJason Sams native void rsnAdapter2DBindAllocation(int con, int ad, int alloc); 3432e1872fe07cf8952812a417985e6e1f61bdeab5dJason Sams synchronized void nAdapter2DBindAllocation(int ad, int alloc) { 3442e1872fe07cf8952812a417985e6e1f61bdeab5dJason Sams rsnAdapter2DBindAllocation(mContext, ad, alloc); 3452e1872fe07cf8952812a417985e6e1f61bdeab5dJason Sams } 3462e1872fe07cf8952812a417985e6e1f61bdeab5dJason Sams native void rsnAdapter2DSetConstraint(int con, int ad, int dim, int value); 3472e1872fe07cf8952812a417985e6e1f61bdeab5dJason Sams synchronized void nAdapter2DSetConstraint(int ad, int dim, int value) { 3482e1872fe07cf8952812a417985e6e1f61bdeab5dJason Sams rsnAdapter2DSetConstraint(mContext, ad, dim, value); 3492e1872fe07cf8952812a417985e6e1f61bdeab5dJason Sams } 3502e1872fe07cf8952812a417985e6e1f61bdeab5dJason Sams native void rsnAdapter2DData(int con, int ad, int[] d); 3512e1872fe07cf8952812a417985e6e1f61bdeab5dJason Sams synchronized void nAdapter2DData(int ad, int[] d) { 3522e1872fe07cf8952812a417985e6e1f61bdeab5dJason Sams rsnAdapter2DData(mContext, ad, d); 3532e1872fe07cf8952812a417985e6e1f61bdeab5dJason Sams } 3542e1872fe07cf8952812a417985e6e1f61bdeab5dJason Sams native void rsnAdapter2DData(int con, int ad, float[] d); 3552e1872fe07cf8952812a417985e6e1f61bdeab5dJason Sams synchronized void nAdapter2DData(int ad, float[] d) { 3562e1872fe07cf8952812a417985e6e1f61bdeab5dJason Sams rsnAdapter2DData(mContext, ad, d); 3572e1872fe07cf8952812a417985e6e1f61bdeab5dJason Sams } 3582e1872fe07cf8952812a417985e6e1f61bdeab5dJason Sams native void rsnAdapter2DSubData(int con, int ad, int xoff, int yoff, int w, int h, int[] d); 3592e1872fe07cf8952812a417985e6e1f61bdeab5dJason Sams synchronized void nAdapter2DSubData(int ad, int xoff, int yoff, int w, int h, int[] d) { 3602e1872fe07cf8952812a417985e6e1f61bdeab5dJason Sams rsnAdapter2DSubData(mContext, ad, xoff, yoff, w, h, d); 3612e1872fe07cf8952812a417985e6e1f61bdeab5dJason Sams } 3622e1872fe07cf8952812a417985e6e1f61bdeab5dJason Sams native void rsnAdapter2DSubData(int con, int ad, int xoff, int yoff, int w, int h, float[] d); 3632e1872fe07cf8952812a417985e6e1f61bdeab5dJason Sams synchronized void nAdapter2DSubData(int ad, int xoff, int yoff, int w, int h, float[] d) { 3642e1872fe07cf8952812a417985e6e1f61bdeab5dJason Sams rsnAdapter2DSubData(mContext, ad, xoff, yoff, w, h, d); 3652e1872fe07cf8952812a417985e6e1f61bdeab5dJason Sams } 3662e1872fe07cf8952812a417985e6e1f61bdeab5dJason Sams native int rsnAdapter2DCreate(int con); 3672e1872fe07cf8952812a417985e6e1f61bdeab5dJason Sams synchronized int nAdapter2DCreate() { 3682e1872fe07cf8952812a417985e6e1f61bdeab5dJason Sams return rsnAdapter2DCreate(mContext); 3692e1872fe07cf8952812a417985e6e1f61bdeab5dJason Sams } 3702e1872fe07cf8952812a417985e6e1f61bdeab5dJason Sams 3712e1872fe07cf8952812a417985e6e1f61bdeab5dJason Sams native void rsnScriptBindAllocation(int con, int script, int alloc, int slot); 3722e1872fe07cf8952812a417985e6e1f61bdeab5dJason Sams synchronized void nScriptBindAllocation(int script, int alloc, int slot) { 3732e1872fe07cf8952812a417985e6e1f61bdeab5dJason Sams rsnScriptBindAllocation(mContext, script, alloc, slot); 3742e1872fe07cf8952812a417985e6e1f61bdeab5dJason Sams } 3752e1872fe07cf8952812a417985e6e1f61bdeab5dJason Sams native void rsnScriptSetTimeZone(int con, int script, byte[] timeZone); 3762e1872fe07cf8952812a417985e6e1f61bdeab5dJason Sams synchronized void nScriptSetTimeZone(int script, byte[] timeZone) { 3772e1872fe07cf8952812a417985e6e1f61bdeab5dJason Sams rsnScriptSetTimeZone(mContext, script, timeZone); 3782e1872fe07cf8952812a417985e6e1f61bdeab5dJason Sams } 3792e1872fe07cf8952812a417985e6e1f61bdeab5dJason Sams native void rsnScriptInvoke(int con, int id, int slot); 3802e1872fe07cf8952812a417985e6e1f61bdeab5dJason Sams synchronized void nScriptInvoke(int id, int slot) { 3812e1872fe07cf8952812a417985e6e1f61bdeab5dJason Sams rsnScriptInvoke(mContext, id, slot); 3822e1872fe07cf8952812a417985e6e1f61bdeab5dJason Sams } 3832e1872fe07cf8952812a417985e6e1f61bdeab5dJason Sams native void rsnScriptInvokeV(int con, int id, int slot, byte[] params); 3842e1872fe07cf8952812a417985e6e1f61bdeab5dJason Sams synchronized void nScriptInvokeV(int id, int slot, byte[] params) { 3852e1872fe07cf8952812a417985e6e1f61bdeab5dJason Sams rsnScriptInvokeV(mContext, id, slot, params); 3862e1872fe07cf8952812a417985e6e1f61bdeab5dJason Sams } 3872e1872fe07cf8952812a417985e6e1f61bdeab5dJason Sams native void rsnScriptSetVarI(int con, int id, int slot, int val); 3882e1872fe07cf8952812a417985e6e1f61bdeab5dJason Sams synchronized void nScriptSetVarI(int id, int slot, int val) { 3892e1872fe07cf8952812a417985e6e1f61bdeab5dJason Sams rsnScriptSetVarI(mContext, id, slot, val); 3902e1872fe07cf8952812a417985e6e1f61bdeab5dJason Sams } 391031ec58cfc7a20927302a5300eba3f5fc1709b50Stephen Hines native void rsnScriptSetVarJ(int con, int id, int slot, long val); 392031ec58cfc7a20927302a5300eba3f5fc1709b50Stephen Hines synchronized void nScriptSetVarJ(int id, int slot, long val) { 393031ec58cfc7a20927302a5300eba3f5fc1709b50Stephen Hines rsnScriptSetVarJ(mContext, id, slot, val); 394031ec58cfc7a20927302a5300eba3f5fc1709b50Stephen Hines } 3952e1872fe07cf8952812a417985e6e1f61bdeab5dJason Sams native void rsnScriptSetVarF(int con, int id, int slot, float val); 3962e1872fe07cf8952812a417985e6e1f61bdeab5dJason Sams synchronized void nScriptSetVarF(int id, int slot, float val) { 3972e1872fe07cf8952812a417985e6e1f61bdeab5dJason Sams rsnScriptSetVarF(mContext, id, slot, val); 3982e1872fe07cf8952812a417985e6e1f61bdeab5dJason Sams } 399ca54ec302f5bddd1674ea1f36cd3b7c540b2fbcaStephen Hines native void rsnScriptSetVarD(int con, int id, int slot, double val); 400ca54ec302f5bddd1674ea1f36cd3b7c540b2fbcaStephen Hines synchronized void nScriptSetVarD(int id, int slot, double val) { 401ca54ec302f5bddd1674ea1f36cd3b7c540b2fbcaStephen Hines rsnScriptSetVarD(mContext, id, slot, val); 402ca54ec302f5bddd1674ea1f36cd3b7c540b2fbcaStephen Hines } 4032e1872fe07cf8952812a417985e6e1f61bdeab5dJason Sams native void rsnScriptSetVarV(int con, int id, int slot, byte[] val); 4042e1872fe07cf8952812a417985e6e1f61bdeab5dJason Sams synchronized void nScriptSetVarV(int id, int slot, byte[] val) { 4052e1872fe07cf8952812a417985e6e1f61bdeab5dJason Sams rsnScriptSetVarV(mContext, id, slot, val); 4062e1872fe07cf8952812a417985e6e1f61bdeab5dJason Sams } 4076f4cf0b8885403ead157ae00fd43cf1282331c23Jason Sams native void rsnScriptSetVarObj(int con, int id, int slot, int val); 4086f4cf0b8885403ead157ae00fd43cf1282331c23Jason Sams synchronized void nScriptSetVarObj(int id, int slot, int val) { 4096f4cf0b8885403ead157ae00fd43cf1282331c23Jason Sams rsnScriptSetVarObj(mContext, id, slot, val); 4106f4cf0b8885403ead157ae00fd43cf1282331c23Jason Sams } 4112e1872fe07cf8952812a417985e6e1f61bdeab5dJason Sams 4122e1872fe07cf8952812a417985e6e1f61bdeab5dJason Sams native void rsnScriptCBegin(int con); 4132e1872fe07cf8952812a417985e6e1f61bdeab5dJason Sams synchronized void nScriptCBegin() { 4142e1872fe07cf8952812a417985e6e1f61bdeab5dJason Sams rsnScriptCBegin(mContext); 4152e1872fe07cf8952812a417985e6e1f61bdeab5dJason Sams } 4162e1872fe07cf8952812a417985e6e1f61bdeab5dJason Sams native void rsnScriptCSetScript(int con, byte[] script, int offset, int length); 4172e1872fe07cf8952812a417985e6e1f61bdeab5dJason Sams synchronized void nScriptCSetScript(byte[] script, int offset, int length) { 4182e1872fe07cf8952812a417985e6e1f61bdeab5dJason Sams rsnScriptCSetScript(mContext, script, offset, length); 4192e1872fe07cf8952812a417985e6e1f61bdeab5dJason Sams } 4206b32fab1dbfd8bc1cc176557fe0a7b2ebd4966bdShih-wei Liao native int rsnScriptCCreate(int con, String val, String cacheDir); 4216b32fab1dbfd8bc1cc176557fe0a7b2ebd4966bdShih-wei Liao synchronized int nScriptCCreate(String resName, String cacheDir) { 4226b32fab1dbfd8bc1cc176557fe0a7b2ebd4966bdShih-wei Liao return rsnScriptCCreate(mContext, resName, cacheDir); 4232e1872fe07cf8952812a417985e6e1f61bdeab5dJason Sams } 4242e1872fe07cf8952812a417985e6e1f61bdeab5dJason Sams 4252e1872fe07cf8952812a417985e6e1f61bdeab5dJason Sams native void rsnSamplerBegin(int con); 4262e1872fe07cf8952812a417985e6e1f61bdeab5dJason Sams synchronized void nSamplerBegin() { 4272e1872fe07cf8952812a417985e6e1f61bdeab5dJason Sams rsnSamplerBegin(mContext); 4282e1872fe07cf8952812a417985e6e1f61bdeab5dJason Sams } 4292e1872fe07cf8952812a417985e6e1f61bdeab5dJason Sams native void rsnSamplerSet(int con, int param, int value); 4302e1872fe07cf8952812a417985e6e1f61bdeab5dJason Sams synchronized void nSamplerSet(int param, int value) { 4312e1872fe07cf8952812a417985e6e1f61bdeab5dJason Sams rsnSamplerSet(mContext, param, value); 4322e1872fe07cf8952812a417985e6e1f61bdeab5dJason Sams } 433f5b3510c706ed1f7611760dff0c94f2111531c68Alex Sakhartchouk native void rsnSamplerSet2(int con, int param, float value); 434f5b3510c706ed1f7611760dff0c94f2111531c68Alex Sakhartchouk synchronized void nSamplerSet2(int param, float value) { 435f5b3510c706ed1f7611760dff0c94f2111531c68Alex Sakhartchouk rsnSamplerSet2(mContext, param, value); 436f5b3510c706ed1f7611760dff0c94f2111531c68Alex Sakhartchouk } 4372e1872fe07cf8952812a417985e6e1f61bdeab5dJason Sams native int rsnSamplerCreate(int con); 4382e1872fe07cf8952812a417985e6e1f61bdeab5dJason Sams synchronized int nSamplerCreate() { 4392e1872fe07cf8952812a417985e6e1f61bdeab5dJason Sams return rsnSamplerCreate(mContext); 4402e1872fe07cf8952812a417985e6e1f61bdeab5dJason Sams } 4412e1872fe07cf8952812a417985e6e1f61bdeab5dJason Sams 4422e1872fe07cf8952812a417985e6e1f61bdeab5dJason Sams native void rsnProgramStoreBegin(int con, int in, int out); 4432e1872fe07cf8952812a417985e6e1f61bdeab5dJason Sams synchronized void nProgramStoreBegin(int in, int out) { 4442e1872fe07cf8952812a417985e6e1f61bdeab5dJason Sams rsnProgramStoreBegin(mContext, in, out); 4452e1872fe07cf8952812a417985e6e1f61bdeab5dJason Sams } 4462e1872fe07cf8952812a417985e6e1f61bdeab5dJason Sams native void rsnProgramStoreDepthFunc(int con, int func); 4472e1872fe07cf8952812a417985e6e1f61bdeab5dJason Sams synchronized void nProgramStoreDepthFunc(int func) { 4482e1872fe07cf8952812a417985e6e1f61bdeab5dJason Sams rsnProgramStoreDepthFunc(mContext, func); 4492e1872fe07cf8952812a417985e6e1f61bdeab5dJason Sams } 4502e1872fe07cf8952812a417985e6e1f61bdeab5dJason Sams native void rsnProgramStoreDepthMask(int con, boolean enable); 4512e1872fe07cf8952812a417985e6e1f61bdeab5dJason Sams synchronized void nProgramStoreDepthMask(boolean enable) { 4522e1872fe07cf8952812a417985e6e1f61bdeab5dJason Sams rsnProgramStoreDepthMask(mContext, enable); 4532e1872fe07cf8952812a417985e6e1f61bdeab5dJason Sams } 4542e1872fe07cf8952812a417985e6e1f61bdeab5dJason Sams native void rsnProgramStoreColorMask(int con, boolean r, boolean g, boolean b, boolean a); 4552e1872fe07cf8952812a417985e6e1f61bdeab5dJason Sams synchronized void nProgramStoreColorMask(boolean r, boolean g, boolean b, boolean a) { 4562e1872fe07cf8952812a417985e6e1f61bdeab5dJason Sams rsnProgramStoreColorMask(mContext, r, g, b, a); 4572e1872fe07cf8952812a417985e6e1f61bdeab5dJason Sams } 4582e1872fe07cf8952812a417985e6e1f61bdeab5dJason Sams native void rsnProgramStoreBlendFunc(int con, int src, int dst); 4592e1872fe07cf8952812a417985e6e1f61bdeab5dJason Sams synchronized void nProgramStoreBlendFunc(int src, int dst) { 4602e1872fe07cf8952812a417985e6e1f61bdeab5dJason Sams rsnProgramStoreBlendFunc(mContext, src, dst); 4612e1872fe07cf8952812a417985e6e1f61bdeab5dJason Sams } 4622e1872fe07cf8952812a417985e6e1f61bdeab5dJason Sams native void rsnProgramStoreDither(int con, boolean enable); 4632e1872fe07cf8952812a417985e6e1f61bdeab5dJason Sams synchronized void nProgramStoreDither(boolean enable) { 4642e1872fe07cf8952812a417985e6e1f61bdeab5dJason Sams rsnProgramStoreDither(mContext, enable); 4652e1872fe07cf8952812a417985e6e1f61bdeab5dJason Sams } 4662e1872fe07cf8952812a417985e6e1f61bdeab5dJason Sams native int rsnProgramStoreCreate(int con); 4672e1872fe07cf8952812a417985e6e1f61bdeab5dJason Sams synchronized int nProgramStoreCreate() { 4682e1872fe07cf8952812a417985e6e1f61bdeab5dJason Sams return rsnProgramStoreCreate(mContext); 4692e1872fe07cf8952812a417985e6e1f61bdeab5dJason Sams } 4702e1872fe07cf8952812a417985e6e1f61bdeab5dJason Sams 4712e1872fe07cf8952812a417985e6e1f61bdeab5dJason Sams native int rsnProgramRasterCreate(int con, boolean pointSmooth, boolean lineSmooth, boolean pointSprite); 4722e1872fe07cf8952812a417985e6e1f61bdeab5dJason Sams synchronized int nProgramRasterCreate(boolean pointSmooth, boolean lineSmooth, boolean pointSprite) { 4732e1872fe07cf8952812a417985e6e1f61bdeab5dJason Sams return rsnProgramRasterCreate(mContext, pointSmooth, lineSmooth, pointSprite); 4742e1872fe07cf8952812a417985e6e1f61bdeab5dJason Sams } 4752e1872fe07cf8952812a417985e6e1f61bdeab5dJason Sams native void rsnProgramRasterSetLineWidth(int con, int pr, float v); 4762e1872fe07cf8952812a417985e6e1f61bdeab5dJason Sams synchronized void nProgramRasterSetLineWidth(int pr, float v) { 4772e1872fe07cf8952812a417985e6e1f61bdeab5dJason Sams rsnProgramRasterSetLineWidth(mContext, pr, v); 4782e1872fe07cf8952812a417985e6e1f61bdeab5dJason Sams } 4792e1872fe07cf8952812a417985e6e1f61bdeab5dJason Sams native void rsnProgramRasterSetCullMode(int con, int pr, int mode); 4802e1872fe07cf8952812a417985e6e1f61bdeab5dJason Sams synchronized void nProgramRasterSetCullMode(int pr, int mode) { 4812e1872fe07cf8952812a417985e6e1f61bdeab5dJason Sams rsnProgramRasterSetCullMode(mContext, pr, mode); 4822e1872fe07cf8952812a417985e6e1f61bdeab5dJason Sams } 4832e1872fe07cf8952812a417985e6e1f61bdeab5dJason Sams 4842e1872fe07cf8952812a417985e6e1f61bdeab5dJason Sams native void rsnProgramBindConstants(int con, int pv, int slot, int mID); 4852e1872fe07cf8952812a417985e6e1f61bdeab5dJason Sams synchronized void nProgramBindConstants(int pv, int slot, int mID) { 4862e1872fe07cf8952812a417985e6e1f61bdeab5dJason Sams rsnProgramBindConstants(mContext, pv, slot, mID); 4872e1872fe07cf8952812a417985e6e1f61bdeab5dJason Sams } 4882e1872fe07cf8952812a417985e6e1f61bdeab5dJason Sams native void rsnProgramBindTexture(int con, int vpf, int slot, int a); 4892e1872fe07cf8952812a417985e6e1f61bdeab5dJason Sams synchronized void nProgramBindTexture(int vpf, int slot, int a) { 4902e1872fe07cf8952812a417985e6e1f61bdeab5dJason Sams rsnProgramBindTexture(mContext, vpf, slot, a); 4912e1872fe07cf8952812a417985e6e1f61bdeab5dJason Sams } 4922e1872fe07cf8952812a417985e6e1f61bdeab5dJason Sams native void rsnProgramBindSampler(int con, int vpf, int slot, int s); 4932e1872fe07cf8952812a417985e6e1f61bdeab5dJason Sams synchronized void nProgramBindSampler(int vpf, int slot, int s) { 4942e1872fe07cf8952812a417985e6e1f61bdeab5dJason Sams rsnProgramBindSampler(mContext, vpf, slot, s); 4952e1872fe07cf8952812a417985e6e1f61bdeab5dJason Sams } 496b89aaacb2ca9d062e0a17a32e3d4dbf3f6948a17Alex Sakhartchouk native int rsnProgramFragmentCreate(int con, String shader, int[] params); 497b89aaacb2ca9d062e0a17a32e3d4dbf3f6948a17Alex Sakhartchouk synchronized int nProgramFragmentCreate(String shader, int[] params) { 498b89aaacb2ca9d062e0a17a32e3d4dbf3f6948a17Alex Sakhartchouk return rsnProgramFragmentCreate(mContext, shader, params); 4992e1872fe07cf8952812a417985e6e1f61bdeab5dJason Sams } 500b89aaacb2ca9d062e0a17a32e3d4dbf3f6948a17Alex Sakhartchouk native int rsnProgramVertexCreate(int con, String shader, int[] params); 501b89aaacb2ca9d062e0a17a32e3d4dbf3f6948a17Alex Sakhartchouk synchronized int nProgramVertexCreate(String shader, int[] params) { 502b89aaacb2ca9d062e0a17a32e3d4dbf3f6948a17Alex Sakhartchouk return rsnProgramVertexCreate(mContext, shader, params); 5032e1872fe07cf8952812a417985e6e1f61bdeab5dJason Sams } 5042e1872fe07cf8952812a417985e6e1f61bdeab5dJason Sams 5052e1872fe07cf8952812a417985e6e1f61bdeab5dJason Sams native int rsnMeshCreate(int con, int vtxCount, int indexCount); 5062e1872fe07cf8952812a417985e6e1f61bdeab5dJason Sams synchronized int nMeshCreate(int vtxCount, int indexCount) { 5072e1872fe07cf8952812a417985e6e1f61bdeab5dJason Sams return rsnMeshCreate(mContext, vtxCount, indexCount); 5082e1872fe07cf8952812a417985e6e1f61bdeab5dJason Sams } 5092e1872fe07cf8952812a417985e6e1f61bdeab5dJason Sams native void rsnMeshBindVertex(int con, int id, int alloc, int slot); 5102e1872fe07cf8952812a417985e6e1f61bdeab5dJason Sams synchronized void nMeshBindVertex(int id, int alloc, int slot) { 5112e1872fe07cf8952812a417985e6e1f61bdeab5dJason Sams rsnMeshBindVertex(mContext, id, alloc, slot); 5122e1872fe07cf8952812a417985e6e1f61bdeab5dJason Sams } 5132e1872fe07cf8952812a417985e6e1f61bdeab5dJason Sams native void rsnMeshBindIndex(int con, int id, int alloc, int prim, int slot); 5142e1872fe07cf8952812a417985e6e1f61bdeab5dJason Sams synchronized void nMeshBindIndex(int id, int alloc, int prim, int slot) { 5152e1872fe07cf8952812a417985e6e1f61bdeab5dJason Sams rsnMeshBindIndex(mContext, id, alloc, prim, slot); 5162e1872fe07cf8952812a417985e6e1f61bdeab5dJason Sams } 5179d71e2180062931416092f26276a07e55b318f62Alex Sakhartchouk native void rsnMeshInitVertexAttribs(int con, int id); 5189d71e2180062931416092f26276a07e55b318f62Alex Sakhartchouk synchronized void nMeshInitVertexAttribs(int id) { 5199d71e2180062931416092f26276a07e55b318f62Alex Sakhartchouk rsnMeshInitVertexAttribs(mContext, id); 5209d71e2180062931416092f26276a07e55b318f62Alex Sakhartchouk } 5212e1872fe07cf8952812a417985e6e1f61bdeab5dJason Sams native int rsnMeshGetVertexBufferCount(int con, int id); 5222e1872fe07cf8952812a417985e6e1f61bdeab5dJason Sams synchronized int nMeshGetVertexBufferCount(int id) { 5232e1872fe07cf8952812a417985e6e1f61bdeab5dJason Sams return rsnMeshGetVertexBufferCount(mContext, id); 5242e1872fe07cf8952812a417985e6e1f61bdeab5dJason Sams } 5252e1872fe07cf8952812a417985e6e1f61bdeab5dJason Sams native int rsnMeshGetIndexCount(int con, int id); 5262e1872fe07cf8952812a417985e6e1f61bdeab5dJason Sams synchronized int nMeshGetIndexCount(int id) { 5272e1872fe07cf8952812a417985e6e1f61bdeab5dJason Sams return rsnMeshGetIndexCount(mContext, id); 5282e1872fe07cf8952812a417985e6e1f61bdeab5dJason Sams } 5292e1872fe07cf8952812a417985e6e1f61bdeab5dJason Sams native void rsnMeshGetVertices(int con, int id, int[] vtxIds, int vtxIdCount); 5302e1872fe07cf8952812a417985e6e1f61bdeab5dJason Sams synchronized void nMeshGetVertices(int id, int[] vtxIds, int vtxIdCount) { 5312e1872fe07cf8952812a417985e6e1f61bdeab5dJason Sams rsnMeshGetVertices(mContext, id, vtxIds, vtxIdCount); 5322e1872fe07cf8952812a417985e6e1f61bdeab5dJason Sams } 5332e1872fe07cf8952812a417985e6e1f61bdeab5dJason Sams native void rsnMeshGetIndices(int con, int id, int[] idxIds, int[] primitives, int vtxIdCount); 5342e1872fe07cf8952812a417985e6e1f61bdeab5dJason Sams synchronized void nMeshGetIndices(int id, int[] idxIds, int[] primitives, int vtxIdCount) { 5352e1872fe07cf8952812a417985e6e1f61bdeab5dJason Sams rsnMeshGetIndices(mContext, id, idxIds, primitives, vtxIdCount); 5362e1872fe07cf8952812a417985e6e1f61bdeab5dJason Sams } 5372e1872fe07cf8952812a417985e6e1f61bdeab5dJason Sams 53860aa3eaf559b1410898c228e4f6ab7920f3953d0Jack Palevich 539bf6ef8d78fffbce6c1849a4a28fb3f4401ad039eJason Sams int mDev; 540bf6ef8d78fffbce6c1849a4a28fb3f4401ad039eJason Sams int mContext; 541650a3eb7d621dc8e81573142a4498bbd07bcde27Romain Guy @SuppressWarnings({"FieldCanBeLocal"}) 542bf6ef8d78fffbce6c1849a4a28fb3f4401ad039eJason Sams MessageThread mMessageThread; 54360aa3eaf559b1410898c228e4f6ab7920f3953d0Jack Palevich 5448cb39de03aef6097a90033600d11a60ae000a6e4Jason Sams Element mElement_U8; 5458cb39de03aef6097a90033600d11a60ae000a6e4Jason Sams Element mElement_I8; 5468cb39de03aef6097a90033600d11a60ae000a6e4Jason Sams Element mElement_U16; 5478cb39de03aef6097a90033600d11a60ae000a6e4Jason Sams Element mElement_I16; 5488cb39de03aef6097a90033600d11a60ae000a6e4Jason Sams Element mElement_U32; 5498cb39de03aef6097a90033600d11a60ae000a6e4Jason Sams Element mElement_I32; 55052d836332f6aae74ed97fda1b53681f36710af64Stephen Hines Element mElement_U64; 551ef1dac28d3bf98bd61cd9874fb3ccab42105e9b6Stephen Hines Element mElement_I64; 5528cb39de03aef6097a90033600d11a60ae000a6e4Jason Sams Element mElement_F32; 55302f41705199336f808ece50d81585450e7f8f61fStephen Hines Element mElement_F64; 554f110d4b787b91dabe968a812e76e5c1f8d953487Jason Sams Element mElement_BOOLEAN; 5558cb39de03aef6097a90033600d11a60ae000a6e4Jason Sams 5568cb39de03aef6097a90033600d11a60ae000a6e4Jason Sams Element mElement_ELEMENT; 5578cb39de03aef6097a90033600d11a60ae000a6e4Jason Sams Element mElement_TYPE; 5588cb39de03aef6097a90033600d11a60ae000a6e4Jason Sams Element mElement_ALLOCATION; 5598cb39de03aef6097a90033600d11a60ae000a6e4Jason Sams Element mElement_SAMPLER; 5608cb39de03aef6097a90033600d11a60ae000a6e4Jason Sams Element mElement_SCRIPT; 5618cb39de03aef6097a90033600d11a60ae000a6e4Jason Sams Element mElement_MESH; 5628cb39de03aef6097a90033600d11a60ae000a6e4Jason Sams Element mElement_PROGRAM_FRAGMENT; 5638cb39de03aef6097a90033600d11a60ae000a6e4Jason Sams Element mElement_PROGRAM_VERTEX; 5648cb39de03aef6097a90033600d11a60ae000a6e4Jason Sams Element mElement_PROGRAM_RASTER; 5658cb39de03aef6097a90033600d11a60ae000a6e4Jason Sams Element mElement_PROGRAM_STORE; 566a70f416c9cf2fc6cc5e132c1d656ce07441d6b82Jason Sams 5673c0dfbab807a459622aeade4940daddf482dec66Jason Sams Element mElement_A_8; 5683c0dfbab807a459622aeade4940daddf482dec66Jason Sams Element mElement_RGB_565; 5693c0dfbab807a459622aeade4940daddf482dec66Jason Sams Element mElement_RGB_888; 5703c0dfbab807a459622aeade4940daddf482dec66Jason Sams Element mElement_RGBA_5551; 5713c0dfbab807a459622aeade4940daddf482dec66Jason Sams Element mElement_RGBA_4444; 5723c0dfbab807a459622aeade4940daddf482dec66Jason Sams Element mElement_RGBA_8888; 5733c0dfbab807a459622aeade4940daddf482dec66Jason Sams 5748cb39de03aef6097a90033600d11a60ae000a6e4Jason Sams Element mElement_FLOAT_2; 5758cb39de03aef6097a90033600d11a60ae000a6e4Jason Sams Element mElement_FLOAT_3; 5768cb39de03aef6097a90033600d11a60ae000a6e4Jason Sams Element mElement_FLOAT_4; 5778cb39de03aef6097a90033600d11a60ae000a6e4Jason Sams Element mElement_UCHAR_4; 5787d787b4722eaeb79cab42c36060336e092b77b5fJason Sams 5791d45c47975ab2a8cef6db5a8976276de31e1e8d0Jason Sams Element mElement_MATRIX_4X4; 5801d45c47975ab2a8cef6db5a8976276de31e1e8d0Jason Sams Element mElement_MATRIX_3X3; 5811d45c47975ab2a8cef6db5a8976276de31e1e8d0Jason Sams Element mElement_MATRIX_2X2; 5821d45c47975ab2a8cef6db5a8976276de31e1e8d0Jason Sams 5834d3399337d18ef04116bc8a2e5799274655d0c30Jason Sams Sampler mSampler_CLAMP_NEAREST; 5844d3399337d18ef04116bc8a2e5799274655d0c30Jason Sams Sampler mSampler_CLAMP_LINEAR; 5854d3399337d18ef04116bc8a2e5799274655d0c30Jason Sams Sampler mSampler_CLAMP_LINEAR_MIP_LINEAR; 5864d3399337d18ef04116bc8a2e5799274655d0c30Jason Sams Sampler mSampler_WRAP_NEAREST; 5874d3399337d18ef04116bc8a2e5799274655d0c30Jason Sams Sampler mSampler_WRAP_LINEAR; 5884d3399337d18ef04116bc8a2e5799274655d0c30Jason Sams Sampler mSampler_WRAP_LINEAR_MIP_LINEAR; 5894d3399337d18ef04116bc8a2e5799274655d0c30Jason Sams 590d36f248eaf06c569010649902df653da1a9e2accAlex Sakhartchouk ProgramStore mProgramStore_BLEND_NONE_DEPTH_TEST; 591d36f248eaf06c569010649902df653da1a9e2accAlex Sakhartchouk ProgramStore mProgramStore_BLEND_NONE_DEPTH_NO_DEPTH; 592d36f248eaf06c569010649902df653da1a9e2accAlex Sakhartchouk ProgramStore mProgramStore_BLEND_NONE_DEPTH_NO_TEST; 593d36f248eaf06c569010649902df653da1a9e2accAlex Sakhartchouk ProgramStore mProgramStore_BLEND_NONE_DEPTH_NO_WRITE; 594d36f248eaf06c569010649902df653da1a9e2accAlex Sakhartchouk ProgramStore mProgramStore_BLEND_ALPHA_DEPTH_TEST; 595d36f248eaf06c569010649902df653da1a9e2accAlex Sakhartchouk ProgramStore mProgramStore_BLEND_ALPHA_DEPTH_NO_DEPTH; 596d36f248eaf06c569010649902df653da1a9e2accAlex Sakhartchouk ProgramStore mProgramStore_BLEND_ALPHA_DEPTH_NO_TEST; 597d36f248eaf06c569010649902df653da1a9e2accAlex Sakhartchouk ProgramStore mProgramStore_BLEND_ALPHA_DEPTH_NO_WRITE; 598d36f248eaf06c569010649902df653da1a9e2accAlex Sakhartchouk ProgramStore mProgramStore_BLEND_ADD_DEPTH_TEST; 599d36f248eaf06c569010649902df653da1a9e2accAlex Sakhartchouk ProgramStore mProgramStore_BLEND_ADD_DEPTH_NO_DEPTH; 600d36f248eaf06c569010649902df653da1a9e2accAlex Sakhartchouk ProgramStore mProgramStore_BLEND_ADD_DEPTH_NO_TEST; 601d36f248eaf06c569010649902df653da1a9e2accAlex Sakhartchouk ProgramStore mProgramStore_BLEND_ADD_DEPTH_NO_WRITE; 602d36f248eaf06c569010649902df653da1a9e2accAlex Sakhartchouk 603d36f248eaf06c569010649902df653da1a9e2accAlex Sakhartchouk ProgramRaster mProgramRaster_CULL_BACK; 604d36f248eaf06c569010649902df653da1a9e2accAlex Sakhartchouk ProgramRaster mProgramRaster_CULL_FRONT; 605d36f248eaf06c569010649902df653da1a9e2accAlex Sakhartchouk ProgramRaster mProgramRaster_CULL_NONE; 60632e09b5891da0174f161d99e2d3ebe67d6efa39cAlex Sakhartchouk 60760aa3eaf559b1410898c228e4f6ab7920f3953d0Jack Palevich /////////////////////////////////////////////////////////////////////////////////// 60843702d8925c54360ad5f9f66b0d35d61d59f6910Jack Palevich // 60960aa3eaf559b1410898c228e4f6ab7920f3953d0Jack Palevich 61027676fe24be7444a174c15df476e49adc5335d03Jason Sams /** 61127676fe24be7444a174c15df476e49adc5335d03Jason Sams * Base class application should derive from for handling RS messages 61227676fe24be7444a174c15df476e49adc5335d03Jason Sams * comming from their scripts. When a script calls sendToClient the data 61327676fe24be7444a174c15df476e49adc5335d03Jason Sams * fields will be filled in and then the run method called by a message 61427676fe24be7444a174c15df476e49adc5335d03Jason Sams * handling thread. This will occur some time after sendToClient completes 61527676fe24be7444a174c15df476e49adc5335d03Jason Sams * in the script. 61627676fe24be7444a174c15df476e49adc5335d03Jason Sams * 61727676fe24be7444a174c15df476e49adc5335d03Jason Sams */ 618bf6ef8d78fffbce6c1849a4a28fb3f4401ad039eJason Sams public static class RSMessageHandler implements Runnable { 619516c31911578db8ce53529483c3ded918ac7dc6bJason Sams protected int[] mData; 620516c31911578db8ce53529483c3ded918ac7dc6bJason Sams protected int mID; 6211c41517124a90fcfdb95dc069fc492c6fcf1ff25Jason Sams protected int mLength; 622516c31911578db8ce53529483c3ded918ac7dc6bJason Sams public void run() { 623516c31911578db8ce53529483c3ded918ac7dc6bJason Sams } 624516c31911578db8ce53529483c3ded918ac7dc6bJason Sams } 62527676fe24be7444a174c15df476e49adc5335d03Jason Sams /** 62627676fe24be7444a174c15df476e49adc5335d03Jason Sams * If an application is expecting messages it should set this field to an 62727676fe24be7444a174c15df476e49adc5335d03Jason Sams * instance of RSMessage. This instance will receive all the user messages 62827676fe24be7444a174c15df476e49adc5335d03Jason Sams * sent from sendToClient by scripts from this context. 62927676fe24be7444a174c15df476e49adc5335d03Jason Sams * 63027676fe24be7444a174c15df476e49adc5335d03Jason Sams */ 631bf6ef8d78fffbce6c1849a4a28fb3f4401ad039eJason Sams RSMessageHandler mMessageCallback = null; 632bf6ef8d78fffbce6c1849a4a28fb3f4401ad039eJason Sams 633bf6ef8d78fffbce6c1849a4a28fb3f4401ad039eJason Sams public void setMessageHandler(RSMessageHandler msg) { 634bf6ef8d78fffbce6c1849a4a28fb3f4401ad039eJason Sams mMessageCallback = msg; 635bf6ef8d78fffbce6c1849a4a28fb3f4401ad039eJason Sams } 636bf6ef8d78fffbce6c1849a4a28fb3f4401ad039eJason Sams public RSMessageHandler getMessageHandler() { 637bf6ef8d78fffbce6c1849a4a28fb3f4401ad039eJason Sams return mMessageCallback; 638bf6ef8d78fffbce6c1849a4a28fb3f4401ad039eJason Sams } 639516c31911578db8ce53529483c3ded918ac7dc6bJason Sams 64027676fe24be7444a174c15df476e49adc5335d03Jason Sams /** 64127676fe24be7444a174c15df476e49adc5335d03Jason Sams * Runtime error base class. An application should derive from this class 64227676fe24be7444a174c15df476e49adc5335d03Jason Sams * if it wishes to install an error handler. When errors occur at runtime 64327676fe24be7444a174c15df476e49adc5335d03Jason Sams * the fields in this class will be filled and the run method called. 64427676fe24be7444a174c15df476e49adc5335d03Jason Sams * 64527676fe24be7444a174c15df476e49adc5335d03Jason Sams */ 646bf6ef8d78fffbce6c1849a4a28fb3f4401ad039eJason Sams public static class RSErrorHandler implements Runnable { 6471c41517124a90fcfdb95dc069fc492c6fcf1ff25Jason Sams protected String mErrorMessage; 6481c41517124a90fcfdb95dc069fc492c6fcf1ff25Jason Sams protected int mErrorNum; 6491c41517124a90fcfdb95dc069fc492c6fcf1ff25Jason Sams public void run() { 6501c41517124a90fcfdb95dc069fc492c6fcf1ff25Jason Sams } 6511c41517124a90fcfdb95dc069fc492c6fcf1ff25Jason Sams } 65227676fe24be7444a174c15df476e49adc5335d03Jason Sams 65327676fe24be7444a174c15df476e49adc5335d03Jason Sams /** 65427676fe24be7444a174c15df476e49adc5335d03Jason Sams * Application Error handler. All runtime errors will be dispatched to the 65527676fe24be7444a174c15df476e49adc5335d03Jason Sams * instance of RSAsyncError set here. If this field is null a 65627676fe24be7444a174c15df476e49adc5335d03Jason Sams * RSRuntimeException will instead be thrown with details about the error. 65727676fe24be7444a174c15df476e49adc5335d03Jason Sams * This will cause program termaination. 65827676fe24be7444a174c15df476e49adc5335d03Jason Sams * 65927676fe24be7444a174c15df476e49adc5335d03Jason Sams */ 660bf6ef8d78fffbce6c1849a4a28fb3f4401ad039eJason Sams RSErrorHandler mErrorCallback = null; 661bf6ef8d78fffbce6c1849a4a28fb3f4401ad039eJason Sams 662bf6ef8d78fffbce6c1849a4a28fb3f4401ad039eJason Sams public void setErrorHandler(RSErrorHandler msg) { 663bf6ef8d78fffbce6c1849a4a28fb3f4401ad039eJason Sams mErrorCallback = msg; 664bf6ef8d78fffbce6c1849a4a28fb3f4401ad039eJason Sams } 665bf6ef8d78fffbce6c1849a4a28fb3f4401ad039eJason Sams public RSErrorHandler getErrorHandler() { 666bf6ef8d78fffbce6c1849a4a28fb3f4401ad039eJason Sams return mErrorCallback; 667bf6ef8d78fffbce6c1849a4a28fb3f4401ad039eJason Sams } 6681c41517124a90fcfdb95dc069fc492c6fcf1ff25Jason Sams 66927676fe24be7444a174c15df476e49adc5335d03Jason Sams /** 67027676fe24be7444a174c15df476e49adc5335d03Jason Sams * RenderScript worker threads priority enumeration. The default value is 67127676fe24be7444a174c15df476e49adc5335d03Jason Sams * NORMAL. Applications wishing to do background processing such as 67227676fe24be7444a174c15df476e49adc5335d03Jason Sams * wallpapers should set their priority to LOW to avoid starving forground 67327676fe24be7444a174c15df476e49adc5335d03Jason Sams * processes. 67427676fe24be7444a174c15df476e49adc5335d03Jason Sams */ 6757d787b4722eaeb79cab42c36060336e092b77b5fJason Sams public enum Priority { 676bf6ef8d78fffbce6c1849a4a28fb3f4401ad039eJason Sams // Remap these numbers to opaque... 6777d787b4722eaeb79cab42c36060336e092b77b5fJason Sams LOW (5), //ANDROID_PRIORITY_BACKGROUND + 5 6787d787b4722eaeb79cab42c36060336e092b77b5fJason Sams NORMAL (-4); //ANDROID_PRIORITY_DISPLAY 6797d787b4722eaeb79cab42c36060336e092b77b5fJason Sams 6807d787b4722eaeb79cab42c36060336e092b77b5fJason Sams int mID; 6817d787b4722eaeb79cab42c36060336e092b77b5fJason Sams Priority(int id) { 6827d787b4722eaeb79cab42c36060336e092b77b5fJason Sams mID = id; 6837d787b4722eaeb79cab42c36060336e092b77b5fJason Sams } 6847d787b4722eaeb79cab42c36060336e092b77b5fJason Sams } 6857d787b4722eaeb79cab42c36060336e092b77b5fJason Sams 686771bebb94054d06f97284379c93a2620613513c3Jason Sams void validate() { 687771bebb94054d06f97284379c93a2620613513c3Jason Sams if (mContext == 0) { 688c1d6210fb5cc558ccea95a59a2b33bb9015fc7deJason Sams throw new RSInvalidStateException("Calling RS with no Context active."); 689771bebb94054d06f97284379c93a2620613513c3Jason Sams } 690771bebb94054d06f97284379c93a2620613513c3Jason Sams } 691771bebb94054d06f97284379c93a2620613513c3Jason Sams 69227676fe24be7444a174c15df476e49adc5335d03Jason Sams 69327676fe24be7444a174c15df476e49adc5335d03Jason Sams /** 69427676fe24be7444a174c15df476e49adc5335d03Jason Sams * Change the priority of the worker threads for this context. 69527676fe24be7444a174c15df476e49adc5335d03Jason Sams * 69627676fe24be7444a174c15df476e49adc5335d03Jason Sams * @param p New priority to be set. 69727676fe24be7444a174c15df476e49adc5335d03Jason Sams */ 698bf6ef8d78fffbce6c1849a4a28fb3f4401ad039eJason Sams public void setPriority(Priority p) { 6995dbfe93b3f15f3a837836d024958635fd8f9ad14Jason Sams validate(); 7007d787b4722eaeb79cab42c36060336e092b77b5fJason Sams nContextSetPriority(p.mID); 7017d787b4722eaeb79cab42c36060336e092b77b5fJason Sams } 7027d787b4722eaeb79cab42c36060336e092b77b5fJason Sams 703bf6ef8d78fffbce6c1849a4a28fb3f4401ad039eJason Sams static class MessageThread extends Thread { 704516c31911578db8ce53529483c3ded918ac7dc6bJason Sams RenderScript mRS; 705516c31911578db8ce53529483c3ded918ac7dc6bJason Sams boolean mRun = true; 706bf6ef8d78fffbce6c1849a4a28fb3f4401ad039eJason Sams int[] mAuxData = new int[2]; 7071c41517124a90fcfdb95dc069fc492c6fcf1ff25Jason Sams 708bf6ef8d78fffbce6c1849a4a28fb3f4401ad039eJason Sams static final int RS_MESSAGE_TO_CLIENT_NONE = 0; 709bf6ef8d78fffbce6c1849a4a28fb3f4401ad039eJason Sams static final int RS_MESSAGE_TO_CLIENT_EXCEPTION = 1; 710bf6ef8d78fffbce6c1849a4a28fb3f4401ad039eJason Sams static final int RS_MESSAGE_TO_CLIENT_RESIZE = 2; 711bf6ef8d78fffbce6c1849a4a28fb3f4401ad039eJason Sams static final int RS_MESSAGE_TO_CLIENT_ERROR = 3; 712bf6ef8d78fffbce6c1849a4a28fb3f4401ad039eJason Sams static final int RS_MESSAGE_TO_CLIENT_USER = 4; 713516c31911578db8ce53529483c3ded918ac7dc6bJason Sams 714bf6ef8d78fffbce6c1849a4a28fb3f4401ad039eJason Sams static final int RS_ERROR_FATAL_UNKNOWN = 0x1000; 715add9d9633205f76cc34f04368b8482c2c369ba63Jason Sams 716516c31911578db8ce53529483c3ded918ac7dc6bJason Sams MessageThread(RenderScript rs) { 717516c31911578db8ce53529483c3ded918ac7dc6bJason Sams super("RSMessageThread"); 718516c31911578db8ce53529483c3ded918ac7dc6bJason Sams mRS = rs; 719516c31911578db8ce53529483c3ded918ac7dc6bJason Sams 720516c31911578db8ce53529483c3ded918ac7dc6bJason Sams } 721516c31911578db8ce53529483c3ded918ac7dc6bJason Sams 722516c31911578db8ce53529483c3ded918ac7dc6bJason Sams public void run() { 723516c31911578db8ce53529483c3ded918ac7dc6bJason Sams // This function is a temporary solution. The final solution will 724516c31911578db8ce53529483c3ded918ac7dc6bJason Sams // used typed allocations where the message id is the type indicator. 725516c31911578db8ce53529483c3ded918ac7dc6bJason Sams int[] rbuf = new int[16]; 7262e1872fe07cf8952812a417985e6e1f61bdeab5dJason Sams mRS.nContextInitToClient(mRS.mContext); 727516c31911578db8ce53529483c3ded918ac7dc6bJason Sams while(mRun) { 7281d45c47975ab2a8cef6db5a8976276de31e1e8d0Jason Sams rbuf[0] = 0; 729bf6ef8d78fffbce6c1849a4a28fb3f4401ad039eJason Sams int msg = mRS.nContextPeekMessage(mRS.mContext, mAuxData, true); 730bf6ef8d78fffbce6c1849a4a28fb3f4401ad039eJason Sams int size = mAuxData[1]; 731bf6ef8d78fffbce6c1849a4a28fb3f4401ad039eJason Sams int subID = mAuxData[0]; 7321c41517124a90fcfdb95dc069fc492c6fcf1ff25Jason Sams 7331c41517124a90fcfdb95dc069fc492c6fcf1ff25Jason Sams if (msg == RS_MESSAGE_TO_CLIENT_USER) { 7341c41517124a90fcfdb95dc069fc492c6fcf1ff25Jason Sams if ((size>>2) >= rbuf.length) { 7351c41517124a90fcfdb95dc069fc492c6fcf1ff25Jason Sams rbuf = new int[(size + 3) >> 2]; 7361c41517124a90fcfdb95dc069fc492c6fcf1ff25Jason Sams } 7371c41517124a90fcfdb95dc069fc492c6fcf1ff25Jason Sams mRS.nContextGetUserMessage(mRS.mContext, rbuf); 7381c41517124a90fcfdb95dc069fc492c6fcf1ff25Jason Sams 7391c41517124a90fcfdb95dc069fc492c6fcf1ff25Jason Sams if(mRS.mMessageCallback != null) { 7401c41517124a90fcfdb95dc069fc492c6fcf1ff25Jason Sams mRS.mMessageCallback.mData = rbuf; 7411c41517124a90fcfdb95dc069fc492c6fcf1ff25Jason Sams mRS.mMessageCallback.mID = subID; 7421c41517124a90fcfdb95dc069fc492c6fcf1ff25Jason Sams mRS.mMessageCallback.mLength = size; 7431c41517124a90fcfdb95dc069fc492c6fcf1ff25Jason Sams mRS.mMessageCallback.run(); 7441d45c47975ab2a8cef6db5a8976276de31e1e8d0Jason Sams } else { 7451c41517124a90fcfdb95dc069fc492c6fcf1ff25Jason Sams throw new RSInvalidStateException("Received a message from the script with no message handler installed."); 746516c31911578db8ce53529483c3ded918ac7dc6bJason Sams } 747ab98bb6e8b95bef7415c1ad239be71f93322fbadStephen Hines continue; 748516c31911578db8ce53529483c3ded918ac7dc6bJason Sams } 7491c41517124a90fcfdb95dc069fc492c6fcf1ff25Jason Sams 7501c41517124a90fcfdb95dc069fc492c6fcf1ff25Jason Sams if (msg == RS_MESSAGE_TO_CLIENT_ERROR) { 7511c41517124a90fcfdb95dc069fc492c6fcf1ff25Jason Sams String e = mRS.nContextGetErrorMessage(mRS.mContext); 7521c41517124a90fcfdb95dc069fc492c6fcf1ff25Jason Sams 753add9d9633205f76cc34f04368b8482c2c369ba63Jason Sams if (subID >= RS_ERROR_FATAL_UNKNOWN) { 754add9d9633205f76cc34f04368b8482c2c369ba63Jason Sams throw new RSRuntimeException("Fatal error " + subID + ", details: " + e); 755add9d9633205f76cc34f04368b8482c2c369ba63Jason Sams } 756add9d9633205f76cc34f04368b8482c2c369ba63Jason Sams 7571c41517124a90fcfdb95dc069fc492c6fcf1ff25Jason Sams if(mRS.mErrorCallback != null) { 7581c41517124a90fcfdb95dc069fc492c6fcf1ff25Jason Sams mRS.mErrorCallback.mErrorMessage = e; 7591c41517124a90fcfdb95dc069fc492c6fcf1ff25Jason Sams mRS.mErrorCallback.mErrorNum = subID; 7601c41517124a90fcfdb95dc069fc492c6fcf1ff25Jason Sams mRS.mErrorCallback.run(); 7611c41517124a90fcfdb95dc069fc492c6fcf1ff25Jason Sams } else { 7621c41517124a90fcfdb95dc069fc492c6fcf1ff25Jason Sams //throw new RSRuntimeException("Received error num " + subID + ", details: " + e); 7631c41517124a90fcfdb95dc069fc492c6fcf1ff25Jason Sams } 7641c41517124a90fcfdb95dc069fc492c6fcf1ff25Jason Sams continue; 7651c41517124a90fcfdb95dc069fc492c6fcf1ff25Jason Sams } 7661c41517124a90fcfdb95dc069fc492c6fcf1ff25Jason Sams 7671c41517124a90fcfdb95dc069fc492c6fcf1ff25Jason Sams // 2: teardown. 7681c41517124a90fcfdb95dc069fc492c6fcf1ff25Jason Sams // But we want to avoid starving other threads during 7691c41517124a90fcfdb95dc069fc492c6fcf1ff25Jason Sams // teardown by yielding until the next line in the destructor 7701c41517124a90fcfdb95dc069fc492c6fcf1ff25Jason Sams // can execute to set mRun = false 7711c41517124a90fcfdb95dc069fc492c6fcf1ff25Jason Sams try { 7721c41517124a90fcfdb95dc069fc492c6fcf1ff25Jason Sams sleep(1, 0); 7731c41517124a90fcfdb95dc069fc492c6fcf1ff25Jason Sams } catch(InterruptedException e) { 774516c31911578db8ce53529483c3ded918ac7dc6bJason Sams } 775516c31911578db8ce53529483c3ded918ac7dc6bJason Sams } 7763bc47d438171dce294e816366d53bc9eca772c5bJason Sams Log.d(LOG_TAG, "MessageThread exiting."); 777516c31911578db8ce53529483c3ded918ac7dc6bJason Sams } 778516c31911578db8ce53529483c3ded918ac7dc6bJason Sams } 779516c31911578db8ce53529483c3ded918ac7dc6bJason Sams 7806b32fab1dbfd8bc1cc176557fe0a7b2ebd4966bdShih-wei Liao RenderScript(Context ctx) { 7816b32fab1dbfd8bc1cc176557fe0a7b2ebd4966bdShih-wei Liao mApplicationContext = ctx.getApplicationContext(); 78260aa3eaf559b1410898c228e4f6ab7920f3953d0Jack Palevich } 78360aa3eaf559b1410898c228e4f6ab7920f3953d0Jack Palevich 78427676fe24be7444a174c15df476e49adc5335d03Jason Sams /** 7856b32fab1dbfd8bc1cc176557fe0a7b2ebd4966bdShih-wei Liao * Gets the application context associated with the RenderScript context. 78627676fe24be7444a174c15df476e49adc5335d03Jason Sams * 7876b32fab1dbfd8bc1cc176557fe0a7b2ebd4966bdShih-wei Liao * @return The application context. 7886b32fab1dbfd8bc1cc176557fe0a7b2ebd4966bdShih-wei Liao */ 7896b32fab1dbfd8bc1cc176557fe0a7b2ebd4966bdShih-wei Liao public final Context getApplicationContext() { 7906b32fab1dbfd8bc1cc176557fe0a7b2ebd4966bdShih-wei Liao return mApplicationContext; 7916b32fab1dbfd8bc1cc176557fe0a7b2ebd4966bdShih-wei Liao } 7926b32fab1dbfd8bc1cc176557fe0a7b2ebd4966bdShih-wei Liao 7936b32fab1dbfd8bc1cc176557fe0a7b2ebd4966bdShih-wei Liao /** 7946b32fab1dbfd8bc1cc176557fe0a7b2ebd4966bdShih-wei Liao * Create a basic RenderScript context. 79527676fe24be7444a174c15df476e49adc5335d03Jason Sams * 7966b32fab1dbfd8bc1cc176557fe0a7b2ebd4966bdShih-wei Liao * @param ctx The context. 79727676fe24be7444a174c15df476e49adc5335d03Jason Sams * @return RenderScript 79827676fe24be7444a174c15df476e49adc5335d03Jason Sams */ 7996b32fab1dbfd8bc1cc176557fe0a7b2ebd4966bdShih-wei Liao public static RenderScript create(Context ctx) { 8006b32fab1dbfd8bc1cc176557fe0a7b2ebd4966bdShih-wei Liao RenderScript rs = new RenderScript(ctx); 801704ff64b099406bb328898a7443921f22dbffd6dJason Sams 802704ff64b099406bb328898a7443921f22dbffd6dJason Sams rs.mDev = rs.nDeviceCreate(); 803704ff64b099406bb328898a7443921f22dbffd6dJason Sams rs.mContext = rs.nContextCreate(rs.mDev, 0); 804704ff64b099406bb328898a7443921f22dbffd6dJason Sams rs.mMessageThread = new MessageThread(rs); 805704ff64b099406bb328898a7443921f22dbffd6dJason Sams rs.mMessageThread.start(); 806704ff64b099406bb328898a7443921f22dbffd6dJason Sams return rs; 807efd9b6fb2e0f31b50db089352118e5daeb268879Jason Sams } 808efd9b6fb2e0f31b50db089352118e5daeb268879Jason Sams 80927676fe24be7444a174c15df476e49adc5335d03Jason Sams /** 81027676fe24be7444a174c15df476e49adc5335d03Jason Sams * Print the currently available debugging information about the state of 81127676fe24be7444a174c15df476e49adc5335d03Jason Sams * the RS context to the log. 81227676fe24be7444a174c15df476e49adc5335d03Jason Sams * 81327676fe24be7444a174c15df476e49adc5335d03Jason Sams */ 814bf6ef8d78fffbce6c1849a4a28fb3f4401ad039eJason Sams public void contextDump() { 8155dbfe93b3f15f3a837836d024958635fd8f9ad14Jason Sams validate(); 816bf6ef8d78fffbce6c1849a4a28fb3f4401ad039eJason Sams nContextDump(0); 817715333b832fb448c32165c7d97d408a3fa43f7cbJason Sams } 818715333b832fb448c32165c7d97d408a3fa43f7cbJason Sams 81927676fe24be7444a174c15df476e49adc5335d03Jason Sams /** 82027676fe24be7444a174c15df476e49adc5335d03Jason Sams * Wait for any commands in the fifo between the java bindings and native to 82127676fe24be7444a174c15df476e49adc5335d03Jason Sams * be processed. 82227676fe24be7444a174c15df476e49adc5335d03Jason Sams * 82327676fe24be7444a174c15df476e49adc5335d03Jason Sams */ 82496ed4cfa62dd09aafb3f9da01e047661b4fe3c95Jason Sams public void finish() { 82596ed4cfa62dd09aafb3f9da01e047661b4fe3c95Jason Sams nContextFinish(); 82696ed4cfa62dd09aafb3f9da01e047661b4fe3c95Jason Sams } 82796ed4cfa62dd09aafb3f9da01e047661b4fe3c95Jason Sams 82827676fe24be7444a174c15df476e49adc5335d03Jason Sams /** 82927676fe24be7444a174c15df476e49adc5335d03Jason Sams * Destroy this renderscript context. Once this function is called its no 83027676fe24be7444a174c15df476e49adc5335d03Jason Sams * longer legal to use this or any objects created by this context. 83127676fe24be7444a174c15df476e49adc5335d03Jason Sams * 83227676fe24be7444a174c15df476e49adc5335d03Jason Sams */ 833f5b4596a383b6ab83f92edecfe054e80b555c2d0Jason Sams public void destroy() { 8345dbfe93b3f15f3a837836d024958635fd8f9ad14Jason Sams validate(); 8352e1872fe07cf8952812a417985e6e1f61bdeab5dJason Sams nContextDeinitToClient(mContext); 836516c31911578db8ce53529483c3ded918ac7dc6bJason Sams mMessageThread.mRun = false; 837a8bf9429b29743b3489817feb21bde2416acc465Jason Sams try { 838a8bf9429b29743b3489817feb21bde2416acc465Jason Sams mMessageThread.join(); 839a8bf9429b29743b3489817feb21bde2416acc465Jason Sams } catch(InterruptedException e) { 840a8bf9429b29743b3489817feb21bde2416acc465Jason Sams } 841516c31911578db8ce53529483c3ded918ac7dc6bJason Sams 8422e1872fe07cf8952812a417985e6e1f61bdeab5dJason Sams nContextDestroy(); 843f5b4596a383b6ab83f92edecfe054e80b555c2d0Jason Sams mContext = 0; 844f5b4596a383b6ab83f92edecfe054e80b555c2d0Jason Sams 845f5b4596a383b6ab83f92edecfe054e80b555c2d0Jason Sams nDeviceDestroy(mDev); 846f5b4596a383b6ab83f92edecfe054e80b555c2d0Jason Sams mDev = 0; 847f5b4596a383b6ab83f92edecfe054e80b555c2d0Jason Sams } 84802fb2cb531035779a25dbf9595e0628ea40585b0Jason Sams 849a9e7a05b84470257637c97d65f6562aa832c66efJason Sams boolean isAlive() { 850a9e7a05b84470257637c97d65f6562aa832c66efJason Sams return mContext != 0; 851a9e7a05b84470257637c97d65f6562aa832c66efJason Sams } 852a9e7a05b84470257637c97d65f6562aa832c66efJason Sams 853bf6ef8d78fffbce6c1849a4a28fb3f4401ad039eJason Sams int safeID(BaseObj o) { 8546b9dec00afec359f091ed353f371f08ff150278aJason Sams if(o != null) { 85506d69de78845659e6904ae4964e606a7f1a6a4a8Jason Sams return o.getID(); 856d8e4161f114331343b897cbacea927e7e60e7b17Jason Sams } 8576b9dec00afec359f091ed353f371f08ff150278aJason Sams return 0; 85860aa3eaf559b1410898c228e4f6ab7920f3953d0Jack Palevich } 85960aa3eaf559b1410898c228e4f6ab7920f3953d0Jack Palevich} 860