Remove global IO context and integrate it into the RS context.
diff --git a/graphics/jni/android_renderscript_RenderScript.cpp b/graphics/jni/android_renderscript_RenderScript.cpp
index 4d6f252..ff997e7 100644
--- a/graphics/jni/android_renderscript_RenderScript.cpp
+++ b/graphics/jni/android_renderscript_RenderScript.cpp
@@ -74,7 +74,7 @@
jint len = _env->GetArrayLength(str);
jbyte * cptr = (jbyte *) _env->GetPrimitiveArrayCritical(str, 0);
- rsAssignName((void *)obj, (const char *)cptr, len);
+ rsAssignName(con, (void *)obj, (const char *)cptr, len);
_env->ReleasePrimitiveArrayCritical(str, cptr, JNI_ABORT);
}
@@ -87,7 +87,7 @@
jint len = _env->GetArrayLength(str);
jbyte * cptr = (jbyte *) _env->GetPrimitiveArrayCritical(str, 0);
- jint ret = (jint)rsFileOpen((const char *)cptr, len);
+ jint ret = (jint)rsFileOpen(con, (const char *)cptr, len);
_env->ReleasePrimitiveArrayCritical(str, cptr, JNI_ABORT);
return ret;
}
@@ -141,7 +141,7 @@
{
RsContext con = (RsContext)(_env->GetIntField(_this, gContextId));
LOG_API("nElementBegin, con(%p)", con);
- rsElementBegin();
+ rsElementBegin(con);
}
static void
@@ -149,7 +149,7 @@
{
RsContext con = (RsContext)(_env->GetIntField(_this, gContextId));
LOG_API("nElementAddPredefined, con(%p), predef(%i)", con, predef);
- rsElementAddPredefined((RsElementPredefined)predef);
+ rsElementAddPredefined(con, (RsElementPredefined)predef);
}
static void
@@ -161,7 +161,7 @@
n = _env->GetStringUTFChars(name, NULL);
}
LOG_API("nElementAdd, con(%p), kind(%i), type(%i), norm(%i), bits(%i)", con, kind, type, norm, bits);
- rsElementAdd((RsDataKind)kind, (RsDataType)type, norm != 0, (size_t)bits, n);
+ rsElementAdd(con, (RsDataKind)kind, (RsDataType)type, norm != 0, (size_t)bits, n);
if (n) {
_env->ReleaseStringUTFChars(name, n);
}
@@ -172,7 +172,7 @@
{
RsContext con = (RsContext)(_env->GetIntField(_this, gContextId));
LOG_API("nElementCreate, con(%p)", con);
- return (jint)rsElementCreate();
+ return (jint)rsElementCreate(con);
}
static jint
@@ -180,7 +180,7 @@
{
RsContext con = (RsContext)(_env->GetIntField(_this, gContextId));
LOG_API("nElementGetPredefined, con(%p) predef(%i)", con, predef);
- return (jint)rsElementGetPredefined((RsElementPredefined)predef);
+ return (jint)rsElementGetPredefined(con, (RsElementPredefined)predef);
}
static void
@@ -188,7 +188,7 @@
{
RsContext con = (RsContext)(_env->GetIntField(_this, gContextId));
LOG_API("nElementDestroy, con(%p) e(%p)", con, (RsElement)e);
- rsElementDestroy((RsElement)e);
+ rsElementDestroy(con, (RsElement)e);
}
// -----------------------------------
@@ -198,7 +198,7 @@
{
RsContext con = (RsContext)(_env->GetIntField(_this, gContextId));
LOG_API("nTypeBegin, con(%p) e(%p)", con, (RsElement)eID);
- rsTypeBegin((RsElement)eID);
+ rsTypeBegin(con, (RsElement)eID);
}
static void
@@ -206,7 +206,7 @@
{
RsContext con = (RsContext)(_env->GetIntField(_this, gContextId));
LOG_API("nTypeAdd, con(%p) dim(%i), val(%i)", con, dim, val);
- rsTypeAdd((RsDimension)dim, val);
+ rsTypeAdd(con, (RsDimension)dim, val);
}
static jint
@@ -214,7 +214,7 @@
{
RsContext con = (RsContext)(_env->GetIntField(_this, gContextId));
LOG_API("nTypeCreate, con(%p)", con);
- return (jint)rsTypeCreate();
+ return (jint)rsTypeCreate(con);
}
static void
@@ -222,7 +222,7 @@
{
RsContext con = (RsContext)(_env->GetIntField(_this, gContextId));
LOG_API("nTypeDestroy, con(%p), t(%p)", con, (RsType)eID);
- rsTypeDestroy((RsType)eID);
+ rsTypeDestroy(con, (RsType)eID);
}
static void * SF_LoadInt(JNIEnv *_env, jobject _obj, jfieldID _field, void *buffer)
@@ -317,7 +317,7 @@
{
RsContext con = (RsContext)(_env->GetIntField(_this, gContextId));
LOG_API("nAllocationCreateTyped, con(%p), e(%p)", con, (RsElement)e);
- return (jint) rsAllocationCreateTyped((RsElement)e);
+ return (jint) rsAllocationCreateTyped(con, (RsElement)e);
}
static jint
@@ -325,7 +325,7 @@
{
RsContext con = (RsContext)(_env->GetIntField(_this, gContextId));
LOG_API("nAllocationCreatePredefSized, con(%p), predef(%i), count(%i)", con, predef, count);
- return (jint) rsAllocationCreatePredefSized((RsElementPredefined)predef, count);
+ return (jint) rsAllocationCreatePredefSized(con, (RsElementPredefined)predef, count);
}
static jint
@@ -333,7 +333,7 @@
{
RsContext con = (RsContext)(_env->GetIntField(_this, gContextId));
LOG_API("nAllocationCreateSized, con(%p), e(%p), count(%i)", con, (RsElement)e, count);
- return (jint) rsAllocationCreateSized((RsElement)e, count);
+ return (jint) rsAllocationCreateSized(con, (RsElement)e, count);
}
static void
@@ -341,7 +341,7 @@
{
RsContext con = (RsContext)(_env->GetIntField(_this, gContextId));
LOG_API("nAllocationUploadToTexture, con(%p), a(%p), mip(%i)", con, (RsAllocation)a, mip);
- rsAllocationUploadToTexture((RsAllocation)a, mip);
+ rsAllocationUploadToTexture(con, (RsAllocation)a, mip);
}
static RsElementPredefined SkBitmapToPredefined(SkBitmap::Config cfg)
@@ -380,7 +380,7 @@
const int w = bitmap.width();
const int h = bitmap.height();
const void* ptr = bitmap.getPixels();
- jint id = (jint)rsAllocationCreateFromBitmap(w, h, (RsElementPredefined)dstFmt, e, genMips, ptr);
+ jint id = (jint)rsAllocationCreateFromBitmap(con, w, h, (RsElementPredefined)dstFmt, e, genMips, ptr);
bitmap.unlockPixels();
return id;
}
@@ -403,7 +403,7 @@
const int w = bitmap.width();
const int h = bitmap.height();
const void* ptr = bitmap.getPixels();
- jint id = (jint)rsAllocationCreateFromBitmapBoxed(w, h, (RsElementPredefined)dstFmt, e, genMips, ptr);
+ jint id = (jint)rsAllocationCreateFromBitmapBoxed(con, w, h, (RsElementPredefined)dstFmt, e, genMips, ptr);
bitmap.unlockPixels();
return id;
}
@@ -416,7 +416,7 @@
{
RsContext con = (RsContext)(_env->GetIntField(_this, gContextId));
LOG_API("nAllocationDestroy, con(%p), a(%p)", con, (RsAllocation)a);
- rsAllocationDestroy((RsAllocation)a);
+ rsAllocationDestroy(con, (RsAllocation)a);
}
static void
@@ -426,7 +426,7 @@
jint len = _env->GetArrayLength(data);
LOG_API("nAllocationData_i, con(%p), alloc(%p), len(%i)", con, (RsAllocation)alloc, len);
jint *ptr = _env->GetIntArrayElements(data, NULL);
- rsAllocationData((RsAllocation)alloc, ptr);
+ rsAllocationData(con, (RsAllocation)alloc, ptr);
_env->ReleaseIntArrayElements(data, ptr, JNI_ABORT);
}
@@ -437,7 +437,7 @@
jint len = _env->GetArrayLength(data);
LOG_API("nAllocationData_i, con(%p), alloc(%p), len(%i)", con, (RsAllocation)alloc, len);
jfloat *ptr = _env->GetFloatArrayElements(data, NULL);
- rsAllocationData((RsAllocation)alloc, ptr);
+ rsAllocationData(con, (RsAllocation)alloc, ptr);
_env->ReleaseFloatArrayElements(data, ptr, JNI_ABORT);
}
@@ -448,7 +448,7 @@
jint len = _env->GetArrayLength(data);
LOG_API("nAllocation1DSubData_i, con(%p), adapter(%p), offset(%i), count(%i), len(%i)", con, (RsAllocation)alloc, offset, count, len);
jint *ptr = _env->GetIntArrayElements(data, NULL);
- rsAllocation1DSubData((RsAllocation)alloc, offset, count, ptr);
+ rsAllocation1DSubData(con, (RsAllocation)alloc, offset, count, ptr);
_env->ReleaseIntArrayElements(data, ptr, JNI_ABORT);
}
@@ -459,7 +459,7 @@
jint len = _env->GetArrayLength(data);
LOG_API("nAllocation1DSubData_f, con(%p), adapter(%p), offset(%i), count(%i), len(%i)", con, (RsAllocation)alloc, offset, count, len);
jfloat *ptr = _env->GetFloatArrayElements(data, NULL);
- rsAllocation1DSubData((RsAllocation)alloc, offset, count, ptr);
+ rsAllocation1DSubData(con, (RsAllocation)alloc, offset, count, ptr);
_env->ReleaseFloatArrayElements(data, ptr, JNI_ABORT);
}
@@ -470,7 +470,7 @@
jint len = _env->GetArrayLength(data);
LOG_API("nAllocation2DSubData_i, con(%p), adapter(%p), xoff(%i), yoff(%i), w(%i), h(%i), len(%i)", con, (RsAllocation)alloc, xoff, yoff, w, h, len);
jint *ptr = _env->GetIntArrayElements(data, NULL);
- rsAllocation2DSubData((RsAllocation)alloc, xoff, yoff, w, h, ptr);
+ rsAllocation2DSubData(con, (RsAllocation)alloc, xoff, yoff, w, h, ptr);
_env->ReleaseIntArrayElements(data, ptr, JNI_ABORT);
}
@@ -481,7 +481,7 @@
jint len = _env->GetArrayLength(data);
LOG_API("nAllocation2DSubData_i, con(%p), adapter(%p), xoff(%i), yoff(%i), w(%i), h(%i), len(%i)", con, (RsAllocation)alloc, xoff, yoff, w, h, len);
jfloat *ptr = _env->GetFloatArrayElements(data, NULL);
- rsAllocation2DSubData((RsAllocation)alloc, xoff, yoff, w, h, ptr);
+ rsAllocation2DSubData(con, (RsAllocation)alloc, xoff, yoff, w, h, ptr);
_env->ReleaseFloatArrayElements(data, ptr, JNI_ABORT);
}
@@ -492,7 +492,7 @@
jint len = _env->GetArrayLength(data);
LOG_API("nAllocationRead_i, con(%p), alloc(%p), len(%i)", con, (RsAllocation)alloc, len);
jint *ptr = _env->GetIntArrayElements(data, NULL);
- rsAllocationRead((RsAllocation)alloc, ptr);
+ rsAllocationRead(con, (RsAllocation)alloc, ptr);
_env->ReleaseIntArrayElements(data, ptr, JNI_COMMIT);
}
@@ -503,7 +503,7 @@
jint len = _env->GetArrayLength(data);
LOG_API("nAllocationRead_f, con(%p), alloc(%p), len(%i)", con, (RsAllocation)alloc, len);
jfloat *ptr = _env->GetFloatArrayElements(data, NULL);
- rsAllocationRead((RsAllocation)alloc, ptr);
+ rsAllocationRead(con, (RsAllocation)alloc, ptr);
_env->ReleaseFloatArrayElements(data, ptr, JNI_COMMIT);
}
@@ -523,7 +523,7 @@
const TypeFieldCache *tfc = &tc->fields[ct];
buf = tfc->ptr(_env, _o, tfc->field, buf);
}
- rsAllocationData((RsAllocation)alloc, bufAlloc);
+ rsAllocationData(con, (RsAllocation)alloc, bufAlloc);
const uint32_t * tmp = (const uint32_t *)bufAlloc;
free(bufAlloc);
}
@@ -535,7 +535,7 @@
{
RsContext con = (RsContext)(_env->GetIntField(_this, gContextId));
LOG_API("nTriangleMeshDestroy, con(%p), tm(%p)", con, (RsAllocation)tm);
- rsTriangleMeshDestroy((RsTriangleMesh)tm);
+ rsTriangleMeshDestroy(con, (RsTriangleMesh)tm);
}
static void
@@ -543,7 +543,7 @@
{
RsContext con = (RsContext)(_env->GetIntField(_this, gContextId));
LOG_API("nTriangleMeshBegin, con(%p), vertex(%p), index(%p)", con, (RsElement)v, (RsElement)i);
- rsTriangleMeshBegin((RsElement)v, (RsElement)i);
+ rsTriangleMeshBegin(con, (RsElement)v, (RsElement)i);
}
static void
@@ -552,7 +552,7 @@
float v[] = {x, y};
RsContext con = (RsContext)(_env->GetIntField(_this, gContextId));
LOG_API("nTriangleMeshAddVertex_XY, con(%p), x(%f), y(%f)", con, x, y);
- rsTriangleMeshAddVertex(v);
+ rsTriangleMeshAddVertex(con, v);
}
static void
@@ -561,7 +561,7 @@
float v[] = {x, y, z};
RsContext con = (RsContext)(_env->GetIntField(_this, gContextId));
LOG_API("nTriangleMeshAddVertex_XYZ, con(%p), x(%f), y(%f), z(%f)", con, x, y, z);
- rsTriangleMeshAddVertex(v);
+ rsTriangleMeshAddVertex(con, v);
}
static void
@@ -570,7 +570,7 @@
float v[] = {s, t, x, y};
RsContext con = (RsContext)(_env->GetIntField(_this, gContextId));
LOG_API("nTriangleMeshAddVertex_XY_ST, con(%p), x(%f), y(%f), s(%f), t(%f)", con, x, y, s, t);
- rsTriangleMeshAddVertex(v);
+ rsTriangleMeshAddVertex(con, v);
}
static void
@@ -579,7 +579,7 @@
float v[] = {s, t, x, y, z};
RsContext con = (RsContext)(_env->GetIntField(_this, gContextId));
LOG_API("nTriangleMeshAddVertex_XYZ_ST, con(%p), x(%f), y(%f), z(%f), s(%f), t(%f)", con, x, y, z, s, t);
- rsTriangleMeshAddVertex(v);
+ rsTriangleMeshAddVertex(con, v);
}
static void
@@ -588,7 +588,7 @@
float v[] = {nx, ny, nz, s, t, x, y, z};
RsContext con = (RsContext)(_env->GetIntField(_this, gContextId));
LOG_API("nTriangleMeshAddVertex_XYZ_ST, con(%p), x(%f), y(%f), z(%f), s(%f), t(%f)", con, x, y, z, s, t);
- rsTriangleMeshAddVertex(v);
+ rsTriangleMeshAddVertex(con, v);
}
static void
@@ -596,7 +596,7 @@
{
RsContext con = (RsContext)(_env->GetIntField(_this, gContextId));
LOG_API("nTriangleMeshAddTriangle, con(%p), i1(%i), i2(%i), i3(%i)", con, i1, i2, i3);
- rsTriangleMeshAddTriangle(i1, i2, i3);
+ rsTriangleMeshAddTriangle(con, i1, i2, i3);
}
static jint
@@ -604,7 +604,7 @@
{
RsContext con = (RsContext)(_env->GetIntField(_this, gContextId));
LOG_API("nTriangleMeshCreate, con(%p)", con);
- return (jint) rsTriangleMeshCreate();
+ return (jint) rsTriangleMeshCreate(con);
}
// -----------------------------------
@@ -614,7 +614,7 @@
{
RsContext con = (RsContext)(_env->GetIntField(_this, gContextId));
LOG_API("nAdapter1DDestroy, con(%p), adapter(%p)", con, (RsAdapter1D)adapter);
- rsAdapter1DDestroy((RsAdapter1D)adapter);
+ rsAdapter1DDestroy(con, (RsAdapter1D)adapter);
}
static void
@@ -622,7 +622,7 @@
{
RsContext con = (RsContext)(_env->GetIntField(_this, gContextId));
LOG_API("nAdapter1DBindAllocation, con(%p), adapter(%p), alloc(%p)", con, (RsAdapter1D)adapter, (RsAllocation)alloc);
- rsAdapter1DBindAllocation((RsAdapter1D)adapter, (RsAllocation)alloc);
+ rsAdapter1DBindAllocation(con, (RsAdapter1D)adapter, (RsAllocation)alloc);
}
static void
@@ -630,7 +630,7 @@
{
RsContext con = (RsContext)(_env->GetIntField(_this, gContextId));
LOG_API("nAdapter1DSetConstraint, con(%p), adapter(%p), dim(%i), value(%i)", con, (RsAdapter1D)adapter, dim, value);
- rsAdapter1DSetConstraint((RsAdapter1D)adapter, (RsDimension)dim, value);
+ rsAdapter1DSetConstraint(con, (RsAdapter1D)adapter, (RsDimension)dim, value);
}
static void
@@ -640,7 +640,7 @@
jint len = _env->GetArrayLength(data);
LOG_API("nAdapter1DData_i, con(%p), adapter(%p), len(%i)", con, (RsAdapter1D)adapter, len);
jint *ptr = _env->GetIntArrayElements(data, NULL);
- rsAdapter1DData((RsAdapter1D)adapter, ptr);
+ rsAdapter1DData(con, (RsAdapter1D)adapter, ptr);
_env->ReleaseIntArrayElements(data, ptr, 0/*JNI_ABORT*/);
}
@@ -651,7 +651,7 @@
jint len = _env->GetArrayLength(data);
LOG_API("nAdapter1DSubData_i, con(%p), adapter(%p), offset(%i), count(%i), len(%i)", con, (RsAdapter1D)adapter, offset, count, len);
jint *ptr = _env->GetIntArrayElements(data, NULL);
- rsAdapter1DSubData((RsAdapter1D)adapter, offset, count, ptr);
+ rsAdapter1DSubData(con, (RsAdapter1D)adapter, offset, count, ptr);
_env->ReleaseIntArrayElements(data, ptr, 0/*JNI_ABORT*/);
}
@@ -662,7 +662,7 @@
jint len = _env->GetArrayLength(data);
LOG_API("nAdapter1DData_f, con(%p), adapter(%p), len(%i)", con, (RsAdapter1D)adapter, len);
jfloat *ptr = _env->GetFloatArrayElements(data, NULL);
- rsAdapter1DData((RsAdapter1D)adapter, ptr);
+ rsAdapter1DData(con, (RsAdapter1D)adapter, ptr);
_env->ReleaseFloatArrayElements(data, ptr, 0/*JNI_ABORT*/);
}
@@ -673,7 +673,7 @@
jint len = _env->GetArrayLength(data);
LOG_API("nAdapter1DSubData_f, con(%p), adapter(%p), offset(%i), count(%i), len(%i)", con, (RsAdapter1D)adapter, offset, count, len);
jfloat *ptr = _env->GetFloatArrayElements(data, NULL);
- rsAdapter1DSubData((RsAdapter1D)adapter, offset, count, ptr);
+ rsAdapter1DSubData(con, (RsAdapter1D)adapter, offset, count, ptr);
_env->ReleaseFloatArrayElements(data, ptr, 0/*JNI_ABORT*/);
}
@@ -682,7 +682,7 @@
{
RsContext con = (RsContext)(_env->GetIntField(_this, gContextId));
LOG_API("nAdapter1DCreate, con(%p)", con);
- return (jint)rsAdapter1DCreate();
+ return (jint)rsAdapter1DCreate(con);
}
// -----------------------------------
@@ -692,7 +692,7 @@
{
RsContext con = (RsContext)(_env->GetIntField(_this, gContextId));
LOG_API("nAdapter2DDestroy, con(%p), adapter(%p)", con, (RsAdapter2D)adapter);
- rsAdapter2DDestroy((RsAdapter2D)adapter);
+ rsAdapter2DDestroy(con, (RsAdapter2D)adapter);
}
static void
@@ -700,7 +700,7 @@
{
RsContext con = (RsContext)(_env->GetIntField(_this, gContextId));
LOG_API("nAdapter2DBindAllocation, con(%p), adapter(%p), alloc(%p)", con, (RsAdapter2D)adapter, (RsAllocation)alloc);
- rsAdapter2DBindAllocation((RsAdapter2D)adapter, (RsAllocation)alloc);
+ rsAdapter2DBindAllocation(con, (RsAdapter2D)adapter, (RsAllocation)alloc);
}
static void
@@ -708,7 +708,7 @@
{
RsContext con = (RsContext)(_env->GetIntField(_this, gContextId));
LOG_API("nAdapter2DSetConstraint, con(%p), adapter(%p), dim(%i), value(%i)", con, (RsAdapter2D)adapter, dim, value);
- rsAdapter2DSetConstraint((RsAdapter2D)adapter, (RsDimension)dim, value);
+ rsAdapter2DSetConstraint(con, (RsAdapter2D)adapter, (RsDimension)dim, value);
}
static void
@@ -718,7 +718,7 @@
jint len = _env->GetArrayLength(data);
LOG_API("nAdapter2DData_i, con(%p), adapter(%p), len(%i)", con, (RsAdapter2D)adapter, len);
jint *ptr = _env->GetIntArrayElements(data, NULL);
- rsAdapter2DData((RsAdapter2D)adapter, ptr);
+ rsAdapter2DData(con, (RsAdapter2D)adapter, ptr);
_env->ReleaseIntArrayElements(data, ptr, 0/*JNI_ABORT*/);
}
@@ -729,7 +729,7 @@
jint len = _env->GetArrayLength(data);
LOG_API("nAdapter2DData_f, con(%p), adapter(%p), len(%i)", con, (RsAdapter2D)adapter, len);
jfloat *ptr = _env->GetFloatArrayElements(data, NULL);
- rsAdapter2DData((RsAdapter2D)adapter, ptr);
+ rsAdapter2DData(con, (RsAdapter2D)adapter, ptr);
_env->ReleaseFloatArrayElements(data, ptr, 0/*JNI_ABORT*/);
}
@@ -741,7 +741,7 @@
LOG_API("nAdapter2DSubData_i, con(%p), adapter(%p), xoff(%i), yoff(%i), w(%i), h(%i), len(%i)",
con, (RsAdapter2D)adapter, xoff, yoff, w, h, len);
jint *ptr = _env->GetIntArrayElements(data, NULL);
- rsAdapter2DSubData((RsAdapter2D)adapter, xoff, yoff, w, h, ptr);
+ rsAdapter2DSubData(con, (RsAdapter2D)adapter, xoff, yoff, w, h, ptr);
_env->ReleaseIntArrayElements(data, ptr, 0/*JNI_ABORT*/);
}
@@ -753,7 +753,7 @@
LOG_API("nAdapter2DSubData_f, con(%p), adapter(%p), xoff(%i), yoff(%i), w(%i), h(%i), len(%i)",
con, (RsAdapter2D)adapter, xoff, yoff, w, h, len);
jfloat *ptr = _env->GetFloatArrayElements(data, NULL);
- rsAdapter2DSubData((RsAdapter1D)adapter, xoff, yoff, w, h, ptr);
+ rsAdapter2DSubData(con, (RsAdapter1D)adapter, xoff, yoff, w, h, ptr);
_env->ReleaseFloatArrayElements(data, ptr, 0/*JNI_ABORT*/);
}
@@ -762,7 +762,7 @@
{
RsContext con = (RsContext)(_env->GetIntField(_this, gContextId));
LOG_API("nAdapter2DCreate, con(%p)", con);
- return (jint)rsAdapter2DCreate();
+ return (jint)rsAdapter2DCreate(con);
}
// -----------------------------------
@@ -772,7 +772,7 @@
{
RsContext con = (RsContext)(_env->GetIntField(_this, gContextId));
LOG_API("nScriptDestroy, con(%p), script(%p)", con, (RsScript)script);
- rsScriptDestroy((RsScript)script);
+ rsScriptDestroy(con, (RsScript)script);
}
static void
@@ -780,7 +780,7 @@
{
RsContext con = (RsContext)(_env->GetIntField(_this, gContextId));
LOG_API("nScriptBindAllocation, con(%p), script(%p), alloc(%p), slot(%i)", con, (RsScript)script, (RsAllocation)alloc, slot);
- rsScriptBindAllocation((RsScript)script, (RsAllocation)alloc, slot);
+ rsScriptBindAllocation(con, (RsScript)script, (RsAllocation)alloc, slot);
}
static void
@@ -788,7 +788,7 @@
{
RsContext con = (RsContext)(_env->GetIntField(_this, gContextId));
LOG_API("nScriptSetClearColor, con(%p), s(%p), r(%f), g(%f), b(%f), a(%f)", con, script, r, g, b, a);
- rsScriptSetClearColor((RsScript)script, r, g, b, a);
+ rsScriptSetClearColor(con, (RsScript)script, r, g, b, a);
}
static void
@@ -796,7 +796,7 @@
{
RsContext con = (RsContext)(_env->GetIntField(_this, gContextId));
LOG_API("nScriptCSetClearDepth, con(%p), s(%p), depth(%f)", con, script, d);
- rsScriptSetClearDepth((RsScript)script, d);
+ rsScriptSetClearDepth(con, (RsScript)script, d);
}
static void
@@ -804,7 +804,7 @@
{
RsContext con = (RsContext)(_env->GetIntField(_this, gContextId));
LOG_API("nScriptCSetClearStencil, con(%p), s(%p), stencil(%i)", con, script, stencil);
- rsScriptSetClearStencil((RsScript)script, stencil);
+ rsScriptSetClearStencil(con, (RsScript)script, stencil);
}
static void
@@ -817,7 +817,7 @@
jbyte* timeZone_ptr;
timeZone_ptr = (jbyte *) _env->GetPrimitiveArrayCritical(timeZone, (jboolean *)0);
- rsScriptSetTimeZone((RsScript)script, (const char *)timeZone_ptr, length);
+ rsScriptSetTimeZone(con, (RsScript)script, (const char *)timeZone_ptr, length);
if (timeZone_ptr) {
_env->ReleasePrimitiveArrayCritical(timeZone, timeZone_ptr, 0);
@@ -833,7 +833,7 @@
if (_str) {
n = _env->GetStringUTFChars(_str, NULL);
}
- rsScriptSetType((RsType)type, slot, writable, n);
+ rsScriptSetType(con, (RsType)type, slot, writable, n);
if (n) {
_env->ReleaseStringUTFChars(_str, n);
}
@@ -844,7 +844,7 @@
{
RsContext con = (RsContext)(_env->GetIntField(_this, gContextId));
LOG_API("nScriptCSetRoot, con(%p), isRoot(%i)", con, isRoot);
- rsScriptSetRoot(isRoot);
+ rsScriptSetRoot(con, isRoot);
}
// -----------------------------------
@@ -854,7 +854,7 @@
{
RsContext con = (RsContext)(_env->GetIntField(_this, gContextId));
LOG_API("nScriptCBegin, con(%p)", con);
- rsScriptCBegin();
+ rsScriptCBegin(con);
}
static void
@@ -892,7 +892,7 @@
_env->GetPrimitiveArrayCritical(scriptRef, (jboolean *)0);
script_ptr = script_base + offset;
- rsScriptCSetText((const char *)script_ptr, length);
+ rsScriptCSetText(con, (const char *)script_ptr, length);
exit:
if (script_base) {
@@ -906,7 +906,7 @@
{
RsContext con = (RsContext)(_env->GetIntField(_this, gContextId));
LOG_API("nScriptCCreate, con(%p)", con);
- return (jint)rsScriptCCreate();
+ return (jint)rsScriptCCreate(con);
}
static void
@@ -915,7 +915,7 @@
RsContext con = (RsContext)(_env->GetIntField(_this, gContextId));
const char* n = _env->GetStringUTFChars(name, NULL);
LOG_API("nScriptCAddDefineI32, con(%p) name(%s) value(%d)", con, n, value);
- rsScriptCSetDefineI32(n, value);
+ rsScriptCSetDefineI32(con, n, value);
_env->ReleaseStringUTFChars(name, n);
}
@@ -925,7 +925,7 @@
RsContext con = (RsContext)(_env->GetIntField(_this, gContextId));
const char* n = _env->GetStringUTFChars(name, NULL);
LOG_API("nScriptCAddDefineF, con(%p) name(%s) value(%f)", con, n, value);
- rsScriptCSetDefineF(n, value);
+ rsScriptCSetDefineF(con, n, value);
_env->ReleaseStringUTFChars(name, n);
}
@@ -936,7 +936,7 @@
{
RsContext con = (RsContext)(_env->GetIntField(_this, gContextId));
LOG_API("nProgramFragmentStoreBegin, con(%p), in(%p), out(%p)", con, (RsElement)in, (RsElement)out);
- rsProgramFragmentStoreBegin((RsElement)in, (RsElement)out);
+ rsProgramFragmentStoreBegin(con, (RsElement)in, (RsElement)out);
}
static void
@@ -944,7 +944,7 @@
{
RsContext con = (RsContext)(_env->GetIntField(_this, gContextId));
LOG_API("nProgramFragmentStoreDepthFunc, con(%p), func(%i)", con, func);
- rsProgramFragmentStoreDepthFunc((RsDepthFunc)func);
+ rsProgramFragmentStoreDepthFunc(con, (RsDepthFunc)func);
}
static void
@@ -952,7 +952,7 @@
{
RsContext con = (RsContext)(_env->GetIntField(_this, gContextId));
LOG_API("nProgramFragmentStoreDepthMask, con(%p), enable(%i)", con, enable);
- rsProgramFragmentStoreDepthMask(enable);
+ rsProgramFragmentStoreDepthMask(con, enable);
}
static void
@@ -960,7 +960,7 @@
{
RsContext con = (RsContext)(_env->GetIntField(_this, gContextId));
LOG_API("nProgramFragmentStoreColorMask, con(%p), r(%i), g(%i), b(%i), a(%i)", con, r, g, b, a);
- rsProgramFragmentStoreColorMask(r, g, b, a);
+ rsProgramFragmentStoreColorMask(con, r, g, b, a);
}
static void
@@ -968,7 +968,7 @@
{
RsContext con = (RsContext)(_env->GetIntField(_this, gContextId));
LOG_API("nProgramFragmentStoreBlendFunc, con(%p), src(%i), dst(%i)", con, src, dst);
- rsProgramFragmentStoreBlendFunc((RsBlendSrcFunc)src, (RsBlendDstFunc)dst);
+ rsProgramFragmentStoreBlendFunc(con, (RsBlendSrcFunc)src, (RsBlendDstFunc)dst);
}
static void
@@ -976,7 +976,7 @@
{
RsContext con = (RsContext)(_env->GetIntField(_this, gContextId));
LOG_API("nProgramFragmentStoreDither, con(%p), enable(%i)", con, enable);
- rsProgramFragmentStoreDither(enable);
+ rsProgramFragmentStoreDither(con, enable);
}
static jint
@@ -985,7 +985,7 @@
RsContext con = (RsContext)(_env->GetIntField(_this, gContextId));
LOG_API("nProgramFragmentStoreCreate, con(%p)", con);
- return (jint)rsProgramFragmentStoreCreate();
+ return (jint)rsProgramFragmentStoreCreate(con);
}
static void
@@ -993,7 +993,7 @@
{
RsContext con = (RsContext)(_env->GetIntField(_this, gContextId));
LOG_API("nProgramFragmentStoreDestroy, con(%p), pgm(%i)", con, pgm);
- rsProgramFragmentStoreDestroy((RsProgramFragmentStore)pgm);
+ rsProgramFragmentStoreDestroy(con, (RsProgramFragmentStore)pgm);
}
// ---------------------------------------------------------------------------
@@ -1003,7 +1003,7 @@
{
RsContext con = (RsContext)(_env->GetIntField(_this, gContextId));
LOG_API("nProgramFragmentBegin, con(%p), in(%p), out(%p)", con, (RsElement)in, (RsElement)out);
- rsProgramFragmentBegin((RsElement)in, (RsElement)out);
+ rsProgramFragmentBegin(con, (RsElement)in, (RsElement)out);
}
static void
@@ -1011,7 +1011,7 @@
{
RsContext con = (RsContext)(_env->GetIntField(_this, gContextId));
LOG_API("nProgramFragmentBindTexture, con(%p), vpf(%p), slot(%i), a(%p)", con, (RsProgramFragment)vpf, slot, (RsAllocation)a);
- rsProgramFragmentBindTexture((RsProgramFragment)vpf, slot, (RsAllocation)a);
+ rsProgramFragmentBindTexture(con, (RsProgramFragment)vpf, slot, (RsAllocation)a);
}
static void
@@ -1019,7 +1019,7 @@
{
RsContext con = (RsContext)(_env->GetIntField(_this, gContextId));
LOG_API("nProgramFragmentBindSampler, con(%p), vpf(%p), slot(%i), a(%p)", con, (RsProgramFragment)vpf, slot, (RsSampler)a);
- rsProgramFragmentBindSampler((RsProgramFragment)vpf, slot, (RsSampler)a);
+ rsProgramFragmentBindSampler(con, (RsProgramFragment)vpf, slot, (RsSampler)a);
}
static void
@@ -1027,7 +1027,7 @@
{
RsContext con = (RsContext)(_env->GetIntField(_this, gContextId));
LOG_API("nProgramFragmentSetType, con(%p), slot(%i), vt(%p)", con, slot, (RsType)vt);
- rsProgramFragmentSetType(slot, (RsType)vt);
+ rsProgramFragmentSetType(con, slot, (RsType)vt);
}
static void
@@ -1035,7 +1035,7 @@
{
RsContext con = (RsContext)(_env->GetIntField(_this, gContextId));
LOG_API("nProgramFragmentSetEnvMode, con(%p), slot(%i), vt(%i)", con, slot, env);
- rsProgramFragmentSetEnvMode(slot, (RsTexEnvMode)env);
+ rsProgramFragmentSetEnvMode(con, slot, (RsTexEnvMode)env);
}
static void
@@ -1043,7 +1043,7 @@
{
RsContext con = (RsContext)(_env->GetIntField(_this, gContextId));
LOG_API("nProgramFragmentSetTexEnable, con(%p), slot(%i), enable(%i)", con, slot, enable);
- rsProgramFragmentSetTexEnable(slot, enable);
+ rsProgramFragmentSetTexEnable(con, slot, enable);
}
static jint
@@ -1051,7 +1051,7 @@
{
RsContext con = (RsContext)(_env->GetIntField(_this, gContextId));
LOG_API("nProgramFragmentCreate, con(%p)", con);
- return (jint)rsProgramFragmentCreate();
+ return (jint)rsProgramFragmentCreate(con);
}
static void
@@ -1059,7 +1059,7 @@
{
RsContext con = (RsContext)(_env->GetIntField(_this, gContextId));
LOG_API("nProgramFragmentDestroy, con(%p), pgm(%i)", con, pgm);
- rsProgramFragmentDestroy((RsProgramFragment)pgm);
+ rsProgramFragmentDestroy(con, (RsProgramFragment)pgm);
}
// ---------------------------------------------------------------------------
@@ -1069,7 +1069,7 @@
{
RsContext con = (RsContext)(_env->GetIntField(_this, gContextId));
LOG_API("nProgramVertexBegin, con(%p), in(%p), out(%p)", con, (RsElement)in, (RsElement)out);
- rsProgramVertexBegin((RsElement)in, (RsElement)out);
+ rsProgramVertexBegin(con, (RsElement)in, (RsElement)out);
}
static void
@@ -1077,7 +1077,7 @@
{
RsContext con = (RsContext)(_env->GetIntField(_this, gContextId));
LOG_API("nProgramVertexBindAllocation, con(%p), vpf(%p), slot(%i), a(%p)", con, (RsProgramVertex)vpv, slot, (RsAllocation)a);
- rsProgramVertexBindAllocation((RsProgramFragment)vpv, (RsAllocation)a);
+ rsProgramVertexBindAllocation(con, (RsProgramFragment)vpv, (RsAllocation)a);
}
static void
@@ -1085,7 +1085,7 @@
{
RsContext con = (RsContext)(_env->GetIntField(_this, gContextId));
LOG_API("nProgramVertexSetTextureMatrixEnable, con(%p), enable(%i)", con, enable);
- rsProgramVertexSetTextureMatrixEnable(enable);
+ rsProgramVertexSetTextureMatrixEnable(con, enable);
}
static void
@@ -1093,7 +1093,7 @@
{
RsContext con = (RsContext)(_env->GetIntField(_this, gContextId));
LOG_API("nProgramVertexAddLight, con(%p), light(%p)", con, (RsLight)light);
- rsProgramVertexAddLight((RsLight)light);
+ rsProgramVertexAddLight(con, (RsLight)light);
}
static jint
@@ -1101,7 +1101,7 @@
{
RsContext con = (RsContext)(_env->GetIntField(_this, gContextId));
LOG_API("nProgramVertexCreate, con(%p)", con);
- return (jint)rsProgramVertexCreate();
+ return (jint)rsProgramVertexCreate(con);
}
static void
@@ -1109,7 +1109,7 @@
{
RsContext con = (RsContext)(_env->GetIntField(_this, gContextId));
LOG_API("nProgramFragmentDestroy, con(%p), pgm(%i)", con, pgm);
- rsProgramFragmentDestroy((RsProgramFragment)pgm);
+ rsProgramFragmentDestroy(con, (RsProgramFragment)pgm);
}
@@ -1122,7 +1122,7 @@
{
RsContext con = (RsContext)(_env->GetIntField(_this, gContextId));
LOG_API("nContextBindRootScript, con(%p), script(%p)", con, (RsScript)script);
- rsContextBindRootScript((RsScript)script);
+ rsContextBindRootScript(con, (RsScript)script);
}
static void
@@ -1130,7 +1130,7 @@
{
RsContext con = (RsContext)(_env->GetIntField(_this, gContextId));
LOG_API("nContextBindProgramFragmentStore, con(%p), pfs(%p)", con, (RsProgramFragmentStore)pfs);
- rsContextBindProgramFragmentStore((RsProgramFragmentStore)pfs);
+ rsContextBindProgramFragmentStore(con, (RsProgramFragmentStore)pfs);
}
static void
@@ -1138,7 +1138,7 @@
{
RsContext con = (RsContext)(_env->GetIntField(_this, gContextId));
LOG_API("nContextBindProgramFragment, con(%p), pf(%p)", con, (RsProgramFragment)pf);
- rsContextBindProgramFragment((RsProgramFragment)pf);
+ rsContextBindProgramFragment(con, (RsProgramFragment)pf);
}
static void
@@ -1146,7 +1146,7 @@
{
RsContext con = (RsContext)(_env->GetIntField(_this, gContextId));
LOG_API("nContextBindProgramVertex, con(%p), pf(%p)", con, (RsProgramVertex)pf);
- rsContextBindProgramVertex((RsProgramVertex)pf);
+ rsContextBindProgramVertex(con, (RsProgramVertex)pf);
}
static void
@@ -1155,7 +1155,7 @@
RsContext con = (RsContext)(_env->GetIntField(_this, gContextId));
const char* n = _env->GetStringUTFChars(name, NULL);
LOG_API("nScriptCAddDefineI32, con(%p) name(%s) value(%d)", con, n, value);
- rsContextSetDefineI32(n, value);
+ rsContextSetDefineI32(con, n, value);
_env->ReleaseStringUTFChars(name, n);
}
@@ -1165,7 +1165,7 @@
RsContext con = (RsContext)(_env->GetIntField(_this, gContextId));
const char* n = _env->GetStringUTFChars(name, NULL);
LOG_API("nScriptCAddDefineF, con(%p) name(%s) value(%f)", con, n, value);
- rsContextSetDefineF(n, value);
+ rsContextSetDefineF(con, n, value);
_env->ReleaseStringUTFChars(name, n);
}
@@ -1177,7 +1177,7 @@
{
RsContext con = (RsContext)(_env->GetIntField(_this, gContextId));
LOG_API("nSamplerDestroy, con(%p), sampler(%p)", con, (RsSampler)s);
- rsSamplerDestroy((RsSampler)s);
+ rsSamplerDestroy(con, (RsSampler)s);
}
static void
@@ -1185,7 +1185,7 @@
{
RsContext con = (RsContext)(_env->GetIntField(_this, gContextId));
LOG_API("nSamplerBegin, con(%p)", con);
- rsSamplerBegin();
+ rsSamplerBegin(con);
}
static void
@@ -1193,7 +1193,7 @@
{
RsContext con = (RsContext)(_env->GetIntField(_this, gContextId));
LOG_API("nSamplerSet, con(%p), param(%i), value(%i)", con, p, v);
- rsSamplerSet((RsSamplerParam)p, (RsSamplerValue)v);
+ rsSamplerSet(con, (RsSamplerParam)p, (RsSamplerValue)v);
}
static jint
@@ -1201,7 +1201,7 @@
{
RsContext con = (RsContext)(_env->GetIntField(_this, gContextId));
LOG_API("nSamplerCreate, con(%p)", con);
- return (jint)rsSamplerCreate();
+ return (jint)rsSamplerCreate(con);
}
// ---------------------------------------------------------------------------
@@ -1211,7 +1211,7 @@
{
RsContext con = (RsContext)(_env->GetIntField(_this, gContextId));
LOG_API("nLightBegin, con(%p)", con);
- rsLightBegin();
+ rsLightBegin(con);
}
static void
@@ -1219,7 +1219,7 @@
{
RsContext con = (RsContext)(_env->GetIntField(_this, gContextId));
LOG_API("nLightSetIsMono, con(%p), isMono(%i)", con, isMono);
- rsLightSetMonochromatic(isMono);
+ rsLightSetMonochromatic(con, isMono);
}
static void
@@ -1227,7 +1227,7 @@
{
RsContext con = (RsContext)(_env->GetIntField(_this, gContextId));
LOG_API("nLightSetIsLocal, con(%p), isLocal(%i)", con, isLocal);
- rsLightSetLocal(isLocal);
+ rsLightSetLocal(con, isLocal);
}
static jint
@@ -1235,7 +1235,7 @@
{
RsContext con = (RsContext)(_env->GetIntField(_this, gContextId));
LOG_API("nLightCreate, con(%p)", con);
- return (jint)rsLightCreate();
+ return (jint)rsLightCreate(con);
}
static void
@@ -1243,7 +1243,7 @@
{
RsContext con = (RsContext)(_env->GetIntField(_this, gContextId));
LOG_API("nLightDestroy, con(%p), light(%p)", con, (RsLight)light);
- rsLightDestroy((RsLight)light);
+ rsLightDestroy(con, (RsLight)light);
}
static void
@@ -1251,7 +1251,7 @@
{
RsContext con = (RsContext)(_env->GetIntField(_this, gContextId));
LOG_API("nLightSetColor, con(%p), light(%p), r(%f), g(%f), b(%f)", con, (RsLight)light, r, g, b);
- rsLightSetColor((RsLight)light, r, g, b);
+ rsLightSetColor(con, (RsLight)light, r, g, b);
}
static void
@@ -1259,7 +1259,7 @@
{
RsContext con = (RsContext)(_env->GetIntField(_this, gContextId));
LOG_API("nLightSetPosition, con(%p), light(%p), x(%f), y(%f), z(%f)", con, (RsLight)light, x, y, z);
- rsLightSetPosition((RsLight)light, x, y, z);
+ rsLightSetPosition(con, (RsLight)light, x, y, z);
}
// ---------------------------------------------------------------------------
@@ -1269,7 +1269,7 @@
{
RsContext con = (RsContext)(_env->GetIntField(_this, gContextId));
LOG_API("nSimpleMeshDestroy, con(%p), SimpleMesh(%p)", con, (RsSimpleMesh)s);
- rsSimpleMeshDestroy((RsSimpleMesh)s);
+ rsSimpleMeshDestroy(con, (RsSimpleMesh)s);
}
static jint
@@ -1280,7 +1280,7 @@
LOG_API("nSimpleMeshCreate, con(%p), batchID(%i), indexID(%i), vtxIDs.len(%i), primID(%i)",
con, batchID, indexID, len, primID);
jint *ptr = _env->GetIntArrayElements(vtxIDs, NULL);
- int id = (int)rsSimpleMeshCreate((void *)batchID, (void *)indexID, (void **)ptr, len, primID);
+ int id = (int)rsSimpleMeshCreate(con, (void *)batchID, (void *)indexID, (void **)ptr, len, primID);
_env->ReleaseIntArrayElements(vtxIDs, ptr, 0/*JNI_ABORT*/);
return id;
}
@@ -1290,7 +1290,7 @@
{
RsContext con = (RsContext)(_env->GetIntField(_this, gContextId));
LOG_API("nSimpleMeshBindVertex, con(%p), SimpleMesh(%p), Alloc(%p), slot(%i)", con, (RsSimpleMesh)s, (RsAllocation)alloc, slot);
- rsSimpleMeshBindVertex((RsSimpleMesh)s, (RsAllocation)alloc, slot);
+ rsSimpleMeshBindVertex(con, (RsSimpleMesh)s, (RsAllocation)alloc, slot);
}
static void
@@ -1298,7 +1298,7 @@
{
RsContext con = (RsContext)(_env->GetIntField(_this, gContextId));
LOG_API("nSimpleMeshBindIndex, con(%p), SimpleMesh(%p), Alloc(%p)", con, (RsSimpleMesh)s, (RsAllocation)alloc);
- rsSimpleMeshBindIndex((RsSimpleMesh)s, (RsAllocation)alloc);
+ rsSimpleMeshBindIndex(con, (RsSimpleMesh)s, (RsAllocation)alloc);
}
// ---------------------------------------------------------------------------
diff --git a/libs/rs/rsContext.cpp b/libs/rs/rsContext.cpp
index 2860452..52389ea 100644
--- a/libs/rs/rsContext.cpp
+++ b/libs/rs/rsContext.cpp
@@ -84,11 +84,6 @@
bool Context::runRootScript()
{
-#if RS_LOG_TIMES
- struct timespec beginTime;
- clock_gettime(CLOCK_MONOTONIC, &beginTime);
-#endif
-
rsAssert(mRootScript->mEnviroment.mIsRoot);
//glColor4f(1,1,1,1);
@@ -116,9 +111,10 @@
struct timespec endTime;
clock_gettime(CLOCK_MONOTONIC, &endTime);
- int t1 = ((unsigned long)startTime.tv_nsec - (unsigned long)beginTime.tv_nsec) / 1000 / 1000;
- int t2 = ((unsigned long)endTime.tv_nsec - (unsigned long)startTime.tv_nsec) / 1000 / 1000;
- LOGE("times %i, %i", t1, t2);
+ uint64_t t1 = endTime.tv_nsec + ((uint64_t)endTime.tv_sec * 1000 * 1000 * 1000);
+ uint64_t t2 = startTime.tv_nsec + ((uint64_t)startTime.tv_sec * 1000 * 1000 * 1000);
+ int t3 = (int)((t1 - t2) / 1000 / 1000);
+ LOGE("times %i", t3);
#endif
return ret;
@@ -143,7 +139,6 @@
{
Context *rsc = static_cast<Context *>(vrsc);
- gIO = new ThreadIO();
rsc->initEGL();
ScriptTLSStruct *tlsStruct = new ScriptTLSStruct;
@@ -168,7 +163,7 @@
rsc->mRunning = true;
bool mDraw = true;
while (!rsc->mExit) {
- mDraw |= gIO->playCoreCommands(rsc, !mDraw);
+ mDraw |= rsc->mIO.playCoreCommands(rsc, !mDraw);
mDraw &= (rsc->mRootScript.get() != NULL);
if (mDraw) {
diff --git a/libs/rs/rsContext.h b/libs/rs/rsContext.h
index 60a526b..3d17298 100644
--- a/libs/rs/rsContext.h
+++ b/libs/rs/rsContext.h
@@ -21,6 +21,7 @@
#include <ui/Surface.h>
+#include "rsThreadIO.h"
#include "rsType.h"
#include "rsMatrix.h"
#include "rsAllocation.h"
@@ -115,6 +116,9 @@
uint32_t getWidth() const {return mWidth;}
uint32_t getHeight() const {return mHeight;}
+
+ ThreadIO mIO;
+
protected:
Device *mDev;
diff --git a/libs/rs/rsThreadIO.cpp b/libs/rs/rsThreadIO.cpp
index 89df59d..20b0a94 100644
--- a/libs/rs/rsThreadIO.cpp
+++ b/libs/rs/rsThreadIO.cpp
@@ -21,8 +21,6 @@
using namespace android;
using namespace android::renderscript;
-ThreadIO *android::renderscript::gIO = NULL;
-
ThreadIO::ThreadIO()
{
mToCore.init(16 * 1024);
diff --git a/libs/rs/rsThreadIO.h b/libs/rs/rsThreadIO.h
index 72746c5..4aab1b4 100644
--- a/libs/rs/rsThreadIO.h
+++ b/libs/rs/rsThreadIO.h
@@ -43,9 +43,6 @@
};
-extern ThreadIO *gIO;
-
-
}
}
diff --git a/libs/rs/rsg_generator.c b/libs/rs/rsg_generator.c
index 7cf6bb6..e3f816f 100644
--- a/libs/rs/rsg_generator.c
+++ b/libs/rs/rsg_generator.c
@@ -103,8 +103,10 @@
fprintf(f, " %s%s (", prefix, api->name);
if (addContext) {
fprintf(f, "Context *");
+ } else {
+ fprintf(f, "RsContext rsc");
}
- printArgList(f, api, addContext);
+ printArgList(f, api, 1);
fprintf(f, ")");
}
@@ -147,7 +149,7 @@
printFuncDecl(f, api, "rs", 0);
fprintf(f, "\n{\n");
- fprintf(f, " ThreadIO *io = gIO;\n");
+ fprintf(f, " ThreadIO *io = &((Context *)rsc)->mIO;\n");
//fprintf(f, " LOGE(\"add command %s\\n\");\n", api->name);
fprintf(f, " RS_CMD_%s *cmd = static_cast<RS_CMD_%s *>(io->mToCore.reserve(sizeof(RS_CMD_%s)));\n", api->name, api->name, api->name);
fprintf(f, " uint32_t size = sizeof(RS_CMD_%s);\n", api->name);
@@ -200,7 +202,7 @@
fprintf(f, " const RS_CMD_%s *cmd = static_cast<const RS_CMD_%s *>(vp);\n", api->name, api->name);
fprintf(f, " ");
if (api->ret.typeName[0]) {
- fprintf(f, "gIO->mToCoreRet = (intptr_t)");
+ fprintf(f, "con->mIO.mToCoreRet = (intptr_t)");
}
fprintf(f, "rsi_%s(con", api->name);
for(ct2=0; ct2 < api->paramCount; ct2++) {