Simplify HelloCompute example. :)
Change-Id: I45ca48df6f56c7f01f32fe609e8975c34ea183be
diff --git a/samples/RenderScript/HelloCompute/src/com/example/android/rs/hellocompute/HelloCompute.java b/samples/RenderScript/HelloCompute/src/com/example/android/rs/hellocompute/HelloCompute.java
index a017273..0d6c47b 100644
--- a/samples/RenderScript/HelloCompute/src/com/example/android/rs/hellocompute/HelloCompute.java
+++ b/samples/RenderScript/HelloCompute/src/com/example/android/rs/hellocompute/HelloCompute.java
@@ -62,10 +62,7 @@
mScript = new ScriptC_mono(mRS, getResources(), R.raw.mono);
- mScript.set_gIn(mInAllocation);
- mScript.set_gOut(mOutAllocation);
- mScript.set_gScript(mScript);
- mScript.invoke_filter();
+ mScript.forEach_root(mInAllocation, mOutAllocation);
mOutAllocation.copyTo(mBitmapOut);
}
diff --git a/samples/RenderScript/HelloCompute/src/com/example/android/rs/hellocompute/mono.rs b/samples/RenderScript/HelloCompute/src/com/example/android/rs/hellocompute/mono.rs
index a7c9b8b..08592f5 100644
--- a/samples/RenderScript/HelloCompute/src/com/example/android/rs/hellocompute/mono.rs
+++ b/samples/RenderScript/HelloCompute/src/com/example/android/rs/hellocompute/mono.rs
@@ -17,20 +17,12 @@
#pragma version(1)
#pragma rs java_package_name(com.example.android.rs.hellocompute)
-rs_allocation gIn;
-rs_allocation gOut;
-rs_script gScript;
-
const static float3 gMonoMult = {0.299f, 0.587f, 0.114f};
-void root(const uchar4 *v_in, uchar4 *v_out, const void *usrData, uint32_t x, uint32_t y) {
+void root(const uchar4 *v_in, uchar4 *v_out) {
float4 f4 = rsUnpackColor8888(*v_in);
float3 mono = dot(f4.rgb, gMonoMult);
*v_out = rsPackColorTo8888(mono);
}
-void filter() {
- rsForEach(gScript, gIn, gOut, 0);
-}
-