Add support for selecting the color bit depth and if the application used a depth buffer.
This commit is contained in:
@ -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;
|
||||
}
|
||||
|
||||
|
@ -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) {
|
||||
|
Reference in New Issue
Block a user