summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJason Sams <rjsams@android.com>2011-07-25 12:58:37 -0700
committerJason Sams <rjsams@android.com>2011-07-25 12:58:37 -0700
commitcf57dec80b3d34f09fd22693fa5a07a3f3a9ea83 (patch)
tree31e96275c5ac6b97f3996ba94f6455985022bd96
parent1a15b03f62e487103348d3e6a44cd31178dd1988 (diff)
downloadframeworks_base-cf57dec80b3d34f09fd22693fa5a07a3f3a9ea83.zip
frameworks_base-cf57dec80b3d34f09fd22693fa5a07a3f3a9ea83.tar.gz
frameworks_base-cf57dec80b3d34f09fd22693fa5a07a3f3a9ea83.tar.bz2
Add size param to rsForEach
bug 5074640 Change-Id: I395bd8b295beacc979681ccdd3451d9d6cc3d672
-rw-r--r--libs/rs/driver/rsdRuntimeStubs.cpp52
-rw-r--r--libs/rs/scriptc/rs_math.rsh17
-rw-r--r--libs/rs/scriptc/rs_types.rsh5
-rw-r--r--tests/RenderScriptTests/ImageProcessing/src/com/android/rs/image/threshold.rs4
-rw-r--r--tests/RenderScriptTests/ModelViewer/src/com/android/modelviewer/scenegraph.rs2
-rw-r--r--tests/RenderScriptTests/ModelViewer/src/com/android/modelviewer/transform.rs2
-rw-r--r--tests/RenderScriptTests/PerfTest/src/com/android/perftest/rsbench.rs8
7 files changed, 68 insertions, 22 deletions
diff --git a/libs/rs/driver/rsdRuntimeStubs.cpp b/libs/rs/driver/rsdRuntimeStubs.cpp
index 2f9f410..d8050ac 100644
--- a/libs/rs/driver/rsdRuntimeStubs.cpp
+++ b/libs/rs/driver/rsdRuntimeStubs.cpp
@@ -365,24 +365,49 @@ static const Allocation * SC_GetAllocation(const void *ptr) {
return rsrGetAllocation(rsc, sc, ptr);
}
-static void SC_ForEach(Script *target,
- Allocation *in,
- Allocation *out,
- const void *usr,
- const RsScriptCall *call) {
+static void SC_ForEach_SAA(Script *target,
+ Allocation *in,
+ Allocation *out) {
+ GET_TLS();
+ rsrForEach(rsc, sc, target, in, out, NULL, 0, NULL);
+}
+
+static void SC_ForEach_SAAU(Script *target,
+ Allocation *in,
+ Allocation *out,
+ const void *usr) {
GET_TLS();
rsrForEach(rsc, sc, target, in, out, usr, 0, NULL);
}
-static void SC_ForEach2(Script *target,
- Allocation *in,
- Allocation *out,
- const void *usr,
- const RsScriptCall *call) {
+static void SC_ForEach_SAAUS(Script *target,
+ Allocation *in,
+ Allocation *out,
+ const void *usr,
+ const RsScriptCall *call) {
GET_TLS();
rsrForEach(rsc, sc, target, in, out, usr, 0, call);
}
+static void SC_ForEach_SAAUL(Script *target,
+ Allocation *in,
+ Allocation *out,
+ const void *usr,
+ uint32_t usrLen) {
+ GET_TLS();
+ rsrForEach(rsc, sc, target, in, out, usr, usrLen, NULL);
+}
+
+static void SC_ForEach_SAAULS(Script *target,
+ Allocation *in,
+ Allocation *out,
+ const void *usr,
+ uint32_t usrLen,
+ const RsScriptCall *call) {
+ GET_TLS();
+ rsrForEach(rsc, sc, target, in, out, usr, usrLen, call);
+}
+
//////////////////////////////////////////////////////////////////////////////
@@ -648,8 +673,11 @@ static RsdSymbolTable gSyms[] = {
{ "_Z19rsgClearDepthTargetv", (void *)&SC_ClearFrameBufferObjectDepthTarget, false },
{ "_Z24rsgClearAllRenderTargetsv", (void *)&SC_ClearFrameBufferObjectTargets, false },
- { "_Z9rsForEach9rs_script13rs_allocationS0_PKv", (void *)&SC_ForEach, false },
- { "_Z9rsForEach9rs_script13rs_allocationS0_PKvj", (void *)&SC_ForEach2, false },
+ { "_Z9rsForEach9rs_script13rs_allocationS0_", (void *)&SC_ForEach_SAA, false },
+ { "_Z9rsForEach9rs_script13rs_allocationS0_PKv", (void *)&SC_ForEach_SAAU, false },
+ { "_Z9rsForEach9rs_script13rs_allocationS0_PKvPK16rs_script_call_t", (void *)&SC_ForEach_SAAUS, false },
+ { "_Z9rsForEach9rs_script13rs_allocationS0_PKvj", (void *)&SC_ForEach_SAAUL, false },
+ { "_Z9rsForEach9rs_script13rs_allocationS0_PKvjPK16rs_script_call_t", (void *)&SC_ForEach_SAAULS, false },
// time
{ "_Z6rsTimePi", (void *)&SC_Time, true },
diff --git a/libs/rs/scriptc/rs_math.rsh b/libs/rs/scriptc/rs_math.rsh
index f38f72c..fb5c4f6 100644
--- a/libs/rs/scriptc/rs_math.rsh
+++ b/libs/rs/scriptc/rs_math.rsh
@@ -249,15 +249,28 @@ typedef struct rs_script_call {
uint32_t arrayEnd;
} rs_script_call_t;
+#if 1//(RS_VERSION >= 14)
extern void __attribute__((overloadable))
- rsForEach(rs_script script, rs_allocation input,
- rs_allocation output, const void * usrData);
+ rsForEach(rs_script script, rs_allocation input, rs_allocation output);
extern void __attribute__((overloadable))
+ rsForEach(rs_script script, rs_allocation input, rs_allocation output,
+ const void * usrData, size_t usrDataLen);
+
+extern void __attribute__((overloadable))
+ rsForEach(rs_script script, rs_allocation input, rs_allocation output,
+ const void * usrData, size_t usrDataLen, const rs_script_call_t *);
+#else
+extern void __attribute__((overloadable))
rsForEach(rs_script script, rs_allocation input,
rs_allocation output, const void * usrData,
const rs_script_call_t *);
+#endif
+// Move me once dependant changes are in.
+extern void __attribute__((overloadable))
+ rsForEach(rs_script script, rs_allocation input,
+ rs_allocation output, const void * usrData);
/**
diff --git a/libs/rs/scriptc/rs_types.rsh b/libs/rs/scriptc/rs_types.rsh
index 536d1f0..121e013 100644
--- a/libs/rs/scriptc/rs_types.rsh
+++ b/libs/rs/scriptc/rs_types.rsh
@@ -19,6 +19,9 @@ typedef uint16_t ushort;
typedef uint32_t uint;
typedef uint64_t ulong;
+typedef uint32_t size_t;
+typedef int32_t ssize_t;
+
typedef struct { const int* const p; } __attribute__((packed, aligned(4))) rs_element;
typedef struct { const int* const p; } __attribute__((packed, aligned(4))) rs_type;
typedef struct { const int* const p; } __attribute__((packed, aligned(4))) rs_allocation;
@@ -88,6 +91,8 @@ typedef float4 rs_quaternion;
#define RS_PACKED __attribute__((packed, aligned(4)))
+#define NULL ((const void *)0)
+
typedef enum {
RS_ALLOCATION_CUBEMAP_FACE_POSITIVE_X = 0,
RS_ALLOCATION_CUBEMAP_FACE_NEGATIVE_X = 1,
diff --git a/tests/RenderScriptTests/ImageProcessing/src/com/android/rs/image/threshold.rs b/tests/RenderScriptTests/ImageProcessing/src/com/android/rs/image/threshold.rs
index 16ebe08..d93238c 100644
--- a/tests/RenderScriptTests/ImageProcessing/src/com/android/rs/image/threshold.rs
+++ b/tests/RenderScriptTests/ImageProcessing/src/com/android/rs/image/threshold.rs
@@ -84,10 +84,10 @@ void filter() {
fs.radius = radius;
fs.ain = rsGetAllocation(ScratchPixel1);
- rsForEach(hBlurScript, fs.ain, rsGetAllocation(ScratchPixel2), &fs);
+ rsForEach(hBlurScript, fs.ain, rsGetAllocation(ScratchPixel2), &fs, sizeof(fs));
fs.ain = rsGetAllocation(ScratchPixel2);
- rsForEach(vBlurScript, fs.ain, rsGetAllocation(OutPixel), &fs);
+ rsForEach(vBlurScript, fs.ain, rsGetAllocation(OutPixel), &fs, sizeof(fs));
rsSendToClientBlocking(CMD_FINISHED);
}
diff --git a/tests/RenderScriptTests/ModelViewer/src/com/android/modelviewer/scenegraph.rs b/tests/RenderScriptTests/ModelViewer/src/com/android/modelviewer/scenegraph.rs
index f046952..0e619ea 100644
--- a/tests/RenderScriptTests/ModelViewer/src/com/android/modelviewer/scenegraph.rs
+++ b/tests/RenderScriptTests/ModelViewer/src/com/android/modelviewer/scenegraph.rs
@@ -60,7 +60,7 @@ int root(void) {
robot2Ptr->transforms[1].w += 2.5f;
robot2Ptr->isDirty = 1;
- rsForEach(gTransformRS, gRootNode->children, gRootNode->children, 0);
+ rsForEach(gTransformRS, gRootNode->children, gRootNode->children, NULL, 0);
rsgClearColor(1.0f, 1.0f, 1.0f, 1.0f);
rsgClearDepth(1.0f);
diff --git a/tests/RenderScriptTests/ModelViewer/src/com/android/modelviewer/transform.rs b/tests/RenderScriptTests/ModelViewer/src/com/android/modelviewer/transform.rs
index f328025..85c0630 100644
--- a/tests/RenderScriptTests/ModelViewer/src/com/android/modelviewer/transform.rs
+++ b/tests/RenderScriptTests/ModelViewer/src/com/android/modelviewer/transform.rs
@@ -91,6 +91,6 @@ void root(const void *v_in, void *v_out, const void *usrData, uint32_t x, uint32
//rsDebug("Transform calling self with child ", (int)data->children.p);
if (data->children.p) {
- rsForEach(transformScript, data->children, data->children, (void*)&toChild);
+ rsForEach(transformScript, data->children, data->children, (void*)&toChild, sizeof(toChild));
}
}
diff --git a/tests/RenderScriptTests/PerfTest/src/com/android/perftest/rsbench.rs b/tests/RenderScriptTests/PerfTest/src/com/android/perftest/rsbench.rs
index eaafe1d..db97835 100644
--- a/tests/RenderScriptTests/PerfTest/src/com/android/perftest/rsbench.rs
+++ b/tests/RenderScriptTests/PerfTest/src/com/android/perftest/rsbench.rs
@@ -280,7 +280,7 @@ static void displayFontSamples(int fillNum) {
testData.renderSurfaceW = gRenderSurfaceW;
testData.renderSurfaceH = gRenderSurfaceH;
testData.user = fillNum;
- rsForEach(gFontScript, gDummyAlloc, gDummyAlloc, &testData);
+ rsForEach(gFontScript, gDummyAlloc, gDummyAlloc, &testData, sizeof(testData));
}
static void bindProgramVertexOrtho() {
@@ -520,7 +520,7 @@ static void displaySimpleGeoSamples(bool useTexture, int numMeshes) {
testData.user = 0;
testData.user1 = useTexture ? 1 : 0;
testData.user2 = numMeshes;
- rsForEach(gTorusScript, gDummyAlloc, gDummyAlloc, &testData);
+ rsForEach(gTorusScript, gDummyAlloc, gDummyAlloc, &testData, sizeof(testData));
}
static void displayCustomShaderSamples(int numMeshes) {
@@ -530,7 +530,7 @@ static void displayCustomShaderSamples(int numMeshes) {
testData.dt = gDt;
testData.user = 1;
testData.user1 = numMeshes;
- rsForEach(gTorusScript, gDummyAlloc, gDummyAlloc, &testData);
+ rsForEach(gTorusScript, gDummyAlloc, gDummyAlloc, &testData, sizeof(testData));
}
static void displayPixelLightSamples(int numMeshes, bool heavyVertex) {
@@ -541,7 +541,7 @@ static void displayPixelLightSamples(int numMeshes, bool heavyVertex) {
testData.user = 2;
testData.user1 = numMeshes;
testData.user2 = heavyVertex ? 1 : 0;
- rsForEach(gTorusScript, gDummyAlloc, gDummyAlloc, &testData);
+ rsForEach(gTorusScript, gDummyAlloc, gDummyAlloc, &testData, sizeof(testData));
}
static void displayMultitextureSample(bool blend, int quadCount) {