Add support for Float64 (double) to RenderScript.
Change-Id: Iad1c4adadf657a46aa38a3fad7813927e643e29d
This commit is contained in:
@@ -358,6 +358,10 @@ public class RenderScript {
|
||||
synchronized void nScriptSetVarF(int id, int slot, float val) {
|
||||
rsnScriptSetVarF(mContext, id, slot, val);
|
||||
}
|
||||
native void rsnScriptSetVarD(int con, int id, int slot, double val);
|
||||
synchronized void nScriptSetVarD(int id, int slot, double val) {
|
||||
rsnScriptSetVarD(mContext, id, slot, val);
|
||||
}
|
||||
native void rsnScriptSetVarV(int con, int id, int slot, byte[] val);
|
||||
synchronized void nScriptSetVarV(int id, int slot, byte[] val) {
|
||||
rsnScriptSetVarV(mContext, id, slot, val);
|
||||
|
||||
@@ -72,6 +72,10 @@ public class Script extends BaseObj {
|
||||
mRS.nScriptSetVarF(mID, index, v);
|
||||
}
|
||||
|
||||
public void setVar(int index, double v) {
|
||||
mRS.nScriptSetVarD(mID, index, v);
|
||||
}
|
||||
|
||||
public void setVar(int index, int v) {
|
||||
mRS.nScriptSetVarI(mID, index, v);
|
||||
}
|
||||
|
||||
@@ -791,10 +791,17 @@ nScriptSetVarI(JNIEnv *_env, jobject _this, RsContext con, jint script, jint slo
|
||||
static void
|
||||
nScriptSetVarF(JNIEnv *_env, jobject _this, RsContext con, jint script, jint slot, float val)
|
||||
{
|
||||
LOG_API("nScriptSetVarI, con(%p), s(%p), slot(%i), val(%f)", con, (void *)script, slot, val);
|
||||
LOG_API("nScriptSetVarF, con(%p), s(%p), slot(%i), val(%f)", con, (void *)script, slot, val);
|
||||
rsScriptSetVarF(con, (RsScript)script, slot, val);
|
||||
}
|
||||
|
||||
static void
|
||||
nScriptSetVarD(JNIEnv *_env, jobject _this, RsContext con, jint script, jint slot, double val)
|
||||
{
|
||||
LOG_API("nScriptSetVarD, con(%p), s(%p), slot(%i), val(%lf)", con, (void *)script, slot, val);
|
||||
rsScriptSetVarD(con, (RsScript)script, slot, val);
|
||||
}
|
||||
|
||||
static void
|
||||
nScriptSetVarV(JNIEnv *_env, jobject _this, RsContext con, jint script, jint slot, jbyteArray data)
|
||||
{
|
||||
@@ -1281,6 +1288,7 @@ static JNINativeMethod methods[] = {
|
||||
{"rsnScriptInvokeV", "(III[B)V", (void*)nScriptInvokeV },
|
||||
{"rsnScriptSetVarI", "(IIII)V", (void*)nScriptSetVarI },
|
||||
{"rsnScriptSetVarF", "(IIIF)V", (void*)nScriptSetVarF },
|
||||
{"rsnScriptSetVarD", "(IIID)V", (void*)nScriptSetVarD },
|
||||
{"rsnScriptSetVarV", "(III[B)V", (void*)nScriptSetVarV },
|
||||
|
||||
{"rsnScriptCBegin", "(I)V", (void*)nScriptCBegin },
|
||||
|
||||
@@ -338,6 +338,12 @@ ScriptSetVarF {
|
||||
param float value
|
||||
}
|
||||
|
||||
ScriptSetVarD {
|
||||
param RsScript s
|
||||
param uint32_t slot
|
||||
param double value
|
||||
}
|
||||
|
||||
ScriptSetVarV {
|
||||
param RsScript s
|
||||
param uint32_t slot
|
||||
|
||||
@@ -101,6 +101,12 @@ void rsi_ScriptSetVarF(Context *rsc, RsScript vs, uint32_t slot, float value)
|
||||
s->setVar(slot, &value, sizeof(value));
|
||||
}
|
||||
|
||||
void rsi_ScriptSetVarD(Context *rsc, RsScript vs, uint32_t slot, double value)
|
||||
{
|
||||
Script *s = static_cast<Script *>(vs);
|
||||
s->setVar(slot, &value, sizeof(value));
|
||||
}
|
||||
|
||||
void rsi_ScriptSetVarV(Context *rsc, RsScript vs, uint32_t slot, const void *data, uint32_t len)
|
||||
{
|
||||
const float *fp = (const float *)data;
|
||||
|
||||
Reference in New Issue
Block a user