diff options
| author | Jason Sams <jsams@google.com> | 2012-03-23 11:47:26 -0700 |
|---|---|---|
| committer | Jason Sams <jsams@google.com> | 2012-03-23 11:47:26 -0700 |
| commit | fe1d5ffd1b6c4977a9f301997d2ad90e5b049a3b (patch) | |
| tree | 7a3135d31e4415a4b6b31c7e44ad15cfa1ccc86f /graphics/java/android/renderscript | |
| parent | 3da5525558ad84757c48907eead66f44f0f5dd32 (diff) | |
| download | frameworks_base-fe1d5ffd1b6c4977a9f301997d2ad90e5b049a3b.zip frameworks_base-fe1d5ffd1b6c4977a9f301997d2ad90e5b049a3b.tar.gz frameworks_base-fe1d5ffd1b6c4977a9f301997d2ad90e5b049a3b.tar.bz2 | |
Implement USAGE_IO_INPUT
Change-Id: Idbf7bb21f5ab673ad77082c5c19921d2b276c04b
Diffstat (limited to 'graphics/java/android/renderscript')
| -rw-r--r-- | graphics/java/android/renderscript/Allocation.java | 27 | ||||
| -rw-r--r-- | graphics/java/android/renderscript/RenderScript.java | 7 |
2 files changed, 15 insertions, 19 deletions
diff --git a/graphics/java/android/renderscript/Allocation.java b/graphics/java/android/renderscript/Allocation.java index 6539ff3..adeeaca 100644 --- a/graphics/java/android/renderscript/Allocation.java +++ b/graphics/java/android/renderscript/Allocation.java @@ -131,22 +131,13 @@ public class Allocation extends BaseObj { public static final int USAGE_GRAPHICS_RENDER_TARGET = 0x0010; /** - * USAGE_GRAPHICS_SURFACE_TEXTURE_INPUT_OPAQUE The allocation - * will be used as a SurfaceTexture graphics consumer. This - * usage may only be used with USAGE_GRAPHICS_TEXTURE. - * - * @hide - */ - public static final int USAGE_GRAPHICS_SURFACE_TEXTURE_INPUT_OPAQUE = 0x0020; - - /** * USAGE_IO_INPUT The allocation will be used as SurfaceTexture * consumer. This usage will cause the allocation to be created * read only. * * @hide */ - public static final int USAGE_IO_INPUT = 0x0040; + public static final int USAGE_IO_INPUT = 0x0020; /** * USAGE_IO_OUTPUT The allocation will be used as a @@ -155,7 +146,7 @@ public class Allocation extends BaseObj { * * @hide */ - public static final int USAGE_IO_OUTPUT = 0x0080; + public static final int USAGE_IO_OUTPUT = 0x0040; /** * Controls mipmap behavior when using the bitmap creation and @@ -217,17 +208,15 @@ public class Allocation extends BaseObj { USAGE_GRAPHICS_VERTEX | USAGE_GRAPHICS_CONSTANTS | USAGE_GRAPHICS_RENDER_TARGET | - USAGE_GRAPHICS_SURFACE_TEXTURE_INPUT_OPAQUE | USAGE_IO_INPUT | USAGE_IO_OUTPUT)) != 0) { throw new RSIllegalArgumentException("Unknown usage specified."); } - if ((usage & (USAGE_GRAPHICS_SURFACE_TEXTURE_INPUT_OPAQUE | USAGE_IO_INPUT)) != 0) { + if ((usage & USAGE_IO_INPUT) != 0) { mWriteAllowed = false; - if ((usage & ~(USAGE_GRAPHICS_SURFACE_TEXTURE_INPUT_OPAQUE | - USAGE_IO_INPUT | + if ((usage & ~(USAGE_IO_INPUT | USAGE_GRAPHICS_TEXTURE | USAGE_SCRIPT)) != 0) { throw new RSIllegalArgumentException("Invalid usage combination."); @@ -348,7 +337,7 @@ public class Allocation extends BaseObj { public void ioGetInput() { if ((mUsage & USAGE_IO_INPUT) == 0) { throw new RSIllegalArgumentException( - "Can only send buffer if IO_OUTPUT usage specified."); + "Can only receive if IO_INPUT usage specified."); } mRS.validate(); mRS.nAllocationIoReceive(getID()); @@ -1134,13 +1123,15 @@ public class Allocation extends BaseObj { * */ public SurfaceTexture getSurfaceTexture() { - if ((mUsage & USAGE_GRAPHICS_SURFACE_TEXTURE_INPUT_OPAQUE) == 0) { + if ((mUsage & USAGE_IO_INPUT) == 0) { throw new RSInvalidStateException("Allocation is not a surface texture."); } int id = mRS.nAllocationGetSurfaceTextureID(getID()); - return new SurfaceTexture(id); + SurfaceTexture st = new SurfaceTexture(id); + mRS.nAllocationGetSurfaceTextureID2(getID(), st); + return st; } /** diff --git a/graphics/java/android/renderscript/RenderScript.java b/graphics/java/android/renderscript/RenderScript.java index 6921f37..ab6ba54 100644 --- a/graphics/java/android/renderscript/RenderScript.java +++ b/graphics/java/android/renderscript/RenderScript.java @@ -16,8 +16,8 @@ package android.renderscript; -import java.lang.reflect.Field; import java.io.File; +import java.lang.reflect.Field; import android.content.Context; import android.content.pm.ApplicationInfo; @@ -294,6 +294,11 @@ public class RenderScript { validate(); return rsnAllocationGetSurfaceTextureID(mContext, alloc); } + native void rsnAllocationGetSurfaceTextureID2(int con, int alloc, SurfaceTexture st); + synchronized void nAllocationGetSurfaceTextureID2(int alloc, SurfaceTexture st) { + validate(); + rsnAllocationGetSurfaceTextureID2(mContext, alloc, st); + } native void rsnAllocationSetSurfaceTexture(int con, int alloc, SurfaceTexture sur); synchronized void nAllocationSetSurfaceTexture(int alloc, SurfaceTexture sur) { validate(); |
