diff options
author | Alex Sakhartchouk <alexst@google.com> | 2012-01-18 14:55:11 -0800 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2012-01-18 14:55:11 -0800 |
commit | 7483a5e8fe23c1b806911297a6c4b5719b1b3a64 (patch) | |
tree | 2969f6ae8120dc55633c8a2d85129e386b00bdb2 /tests/RenderScriptTests | |
parent | bcf608f7325d4769ca4fee5aec78ae591ba002c4 (diff) | |
parent | 516054bf53b0a8844267185ddaf1d505c9e81da7 (diff) | |
download | frameworks_base-7483a5e8fe23c1b806911297a6c4b5719b1b3a64.zip frameworks_base-7483a5e8fe23c1b806911297a6c4b5719b1b3a64.tar.gz frameworks_base-7483a5e8fe23c1b806911297a6c4b5719b1b3a64.tar.bz2 |
Merge "Making sure that renderpass objects get properly updated." into graphics-dev
Diffstat (limited to 'tests/RenderScriptTests')
4 files changed, 15 insertions, 9 deletions
diff --git a/tests/RenderScriptTests/SceneGraph/res/raw/select_color.glsl b/tests/RenderScriptTests/SceneGraph/res/raw/select_color.glsl index 59a267b..42b231a 100644 --- a/tests/RenderScriptTests/SceneGraph/res/raw/select_color.glsl +++ b/tests/RenderScriptTests/SceneGraph/res/raw/select_color.glsl @@ -6,7 +6,7 @@ void main() { vec3 desat = vec3(0.299, 0.587, 0.114); float lum = dot(desat, col); float stepVal = step(lum, 0.8); - col = mix(col, vec3(0.0), stepVal)*0.8; + col = mix(col, vec3(0.0), stepVal)*0.5; gl_FragColor = vec4(col, 0.0); } diff --git a/tests/RenderScriptTests/SceneGraph/src/com/android/scenegraph/RenderPass.java b/tests/RenderScriptTests/SceneGraph/src/com/android/scenegraph/RenderPass.java index 6ba0637..a9cb688 100644 --- a/tests/RenderScriptTests/SceneGraph/src/com/android/scenegraph/RenderPass.java +++ b/tests/RenderScriptTests/SceneGraph/src/com/android/scenegraph/RenderPass.java @@ -79,6 +79,10 @@ public class RenderPass extends SceneGraphBase { mShouldClearDepth = shouldClearDepth; } + public ArrayList<RenderableBase> getRenderables() { + return mObjectsToDraw; + } + ScriptField_RenderPass_s.Item getRsField(RenderScriptGL rs, Resources res) { if (mRsField != null) { return mRsField; diff --git a/tests/RenderScriptTests/SceneGraph/src/com/android/scenegraph/Scene.java b/tests/RenderScriptTests/SceneGraph/src/com/android/scenegraph/Scene.java index f00bf13..baf6dff 100644 --- a/tests/RenderScriptTests/SceneGraph/src/com/android/scenegraph/Scene.java +++ b/tests/RenderScriptTests/SceneGraph/src/com/android/scenegraph/Scene.java @@ -35,11 +35,11 @@ import android.os.AsyncTask; public class Scene extends SceneGraphBase { private static String TIMER_TAG = "TIMER"; - private class ImageLoaderTask extends AsyncTask<String, Void, Boolean> { - protected Boolean doInBackground(String... names) { + private class ImageLoaderTask extends AsyncTask<ArrayList<RenderableBase>, Void, Boolean> { + protected Boolean doInBackground(ArrayList<RenderableBase>... objects) { long start = System.currentTimeMillis(); - for (int i = 0; i < mRenderables.size(); i ++) { - Renderable dI = (Renderable)mRenderables.get(i); + for (int i = 0; i < objects[0].size(); i ++) { + Renderable dI = (Renderable)objects[0].get(i); dI.updateTextures(mRS, mRes); } long end = System.currentTimeMillis(); @@ -202,9 +202,12 @@ public class Scene extends SceneGraphBase { mRenderPassAlloc = new ScriptField_RenderPass_s(mRS, mRenderPasses.size()); for (int i = 0; i < mRenderPasses.size(); i ++) { mRenderPassAlloc.set(mRenderPasses.get(i).getRsField(mRS, mRes), i, false); + new ImageLoaderTask().execute(mRenderPasses.get(i).getRenderables()); } mRenderPassAlloc.copyAll(); sceneManager.mRenderLoop.set_gRenderPasses(mRenderPassAlloc.getAllocation()); + } else { + new ImageLoaderTask().execute(mRenderables); } } @@ -238,8 +241,6 @@ public class Scene extends SceneGraphBase { initRenderPassRS(rs, sceneManager); - new ImageLoaderTask().execute(); - end = System.currentTimeMillis(); Log.v(TIMER_TAG, "Renderable init time: " + (end - start)); diff --git a/tests/RenderScriptTests/SceneGraph/src/com/android/scenegraph/render.rs b/tests/RenderScriptTests/SceneGraph/src/com/android/scenegraph/render.rs index e272232..cae6d27 100644 --- a/tests/RenderScriptTests/SceneGraph/src/com/android/scenegraph/render.rs +++ b/tests/RenderScriptTests/SceneGraph/src/com/android/scenegraph/render.rs @@ -154,8 +154,9 @@ static void drawAllObjects(rs_allocation allObj) { } void root(const void *v_in, void *v_out) { - - //rsDebug("=============================================================================", 0); +#ifdef DEBUG_RENDERABLES + rsDebug("=============================================================================", 0); +#endif // DEBUG_RENDERABLES // first step is to update the transform hierachy rsForEach(gTransformScript, gRootNode->children, nullAlloc, 0, 0); |