Add support for selecting the color bit depth and if the application used a depth buffer.

This commit is contained in:
Jason Sams
2009-08-25 11:34:49 -07:00
parent dbade9d6a0
commit b13ada5071
19 changed files with 134 additions and 106 deletions

View File

@ -141,15 +141,12 @@ public class RSSurfaceView extends SurfaceView implements SurfaceHolder.Callback
// ----------------------------------------------------------------------
public RenderScript createRenderScript() {
Log.v(RenderScript.LOG_TAG, "createRenderScript 1");
public RenderScript createRenderScript(boolean useDepth) {
Surface sur = null;
while ((sur == null) || (mSurfaceHolder == null)) {
sur = getHolder().getSurface();
}
Log.v(RenderScript.LOG_TAG, "createRenderScript 2");
RenderScript rs = new RenderScript(sur);
Log.v(RenderScript.LOG_TAG, "createRenderScript 3 rs");
RenderScript rs = new RenderScript(sur, useDepth);
return rs;
}

View File

@ -60,7 +60,7 @@ public class RenderScript {
native int nDeviceCreate();
native void nDeviceDestroy(int dev);
native int nContextCreate(int dev, Surface sur, int ver);
native int nContextCreate(int dev, Surface sur, int ver, boolean useDepth);
native void nContextDestroy(int con);
//void rsContextBindSampler (uint32_t slot, RsSampler sampler);
@ -194,10 +194,10 @@ public class RenderScript {
///////////////////////////////////////////////////////////////////////////////////
//
public RenderScript(Surface sur) {
public RenderScript(Surface sur, boolean useDepth) {
mSurface = sur;
mDev = nDeviceCreate();
mContext = nContextCreate(mDev, mSurface, 0);
mContext = nContextCreate(mDev, mSurface, 0, useDepth);
// TODO: This should be protected by a lock
if(!mElementsInitialized) {