summaryrefslogtreecommitdiffstats
path: root/graphics/java
diff options
context:
space:
mode:
authorAlex Sakhartchouk <alexst@google.com>2011-04-01 14:19:01 -0700
committerAlex Sakhartchouk <alexst@google.com>2011-04-01 14:19:01 -0700
commit8e90f2bc1fa35a2dc7bd2aab8b8241b628800218 (patch)
treec2b3e36a41b00d7ef8be23d6441ff44893f686ab /graphics/java
parent397de169e5462bf0c62506827819f93336b3f123 (diff)
downloadframeworks_base-8e90f2bc1fa35a2dc7bd2aab8b8241b628800218.zip
frameworks_base-8e90f2bc1fa35a2dc7bd2aab8b8241b628800218.tar.gz
frameworks_base-8e90f2bc1fa35a2dc7bd2aab8b8241b628800218.tar.bz2
First draft of fbo in renderscript.
Updating samples and benchmark Change-Id: I469bf8b842fca72b59475c8fa024c12cf0e14954
Diffstat (limited to 'graphics/java')
-rw-r--r--graphics/java/android/renderscript/Allocation.java11
-rw-r--r--graphics/java/android/renderscript/Element.java26
2 files changed, 29 insertions, 8 deletions
diff --git a/graphics/java/android/renderscript/Allocation.java b/graphics/java/android/renderscript/Allocation.java
index 4b8c58e..9ac1a00 100644
--- a/graphics/java/android/renderscript/Allocation.java
+++ b/graphics/java/android/renderscript/Allocation.java
@@ -99,6 +99,14 @@ public class Allocation extends BaseObj {
*/
public static final int USAGE_GRAPHICS_CONSTANTS = 0x0008;
+ /**
+ * @hide
+ * USAGE_GRAPHICS_RENDER_TARGET The allcation will be used as a
+ * target for offscreen rendering
+ *
+ */
+ public static final int USAGE_GRAPHICS_RENDER_TARGET = 0x0010;
+
/**
* Controls mipmap behavior when using the bitmap creation and
@@ -137,7 +145,8 @@ public class Allocation extends BaseObj {
if ((usage & ~(USAGE_SCRIPT |
USAGE_GRAPHICS_TEXTURE |
USAGE_GRAPHICS_VERTEX |
- USAGE_GRAPHICS_CONSTANTS)) != 0) {
+ USAGE_GRAPHICS_CONSTANTS |
+ USAGE_GRAPHICS_RENDER_TARGET)) != 0) {
throw new RSIllegalArgumentException("Unknown usage specified.");
}
mType = t;
diff --git a/graphics/java/android/renderscript/Element.java b/graphics/java/android/renderscript/Element.java
index fae22f0..0c1ad2a 100644
--- a/graphics/java/android/renderscript/Element.java
+++ b/graphics/java/android/renderscript/Element.java
@@ -124,7 +124,8 @@ public class Element extends BaseObj {
PIXEL_A (8),
PIXEL_LA (9),
PIXEL_RGB (10),
- PIXEL_RGBA (11);
+ PIXEL_RGBA (11),
+ PIXEL_DEPTH (12);
int mID;
DataKind(int id) {
@@ -536,10 +537,12 @@ public class Element extends BaseObj {
dk == DataKind.PIXEL_A ||
dk == DataKind.PIXEL_LA ||
dk == DataKind.PIXEL_RGB ||
- dk == DataKind.PIXEL_RGBA)) {
+ dk == DataKind.PIXEL_RGBA ||
+ dk == DataKind.PIXEL_DEPTH)) {
throw new RSIllegalArgumentException("Unsupported DataKind");
}
if (!(dt == DataType.UNSIGNED_8 ||
+ dt == DataType.UNSIGNED_16 ||
dt == DataType.UNSIGNED_5_6_5 ||
dt == DataType.UNSIGNED_4_4_4_4 ||
dt == DataType.UNSIGNED_5_5_5_1)) {
@@ -554,16 +557,25 @@ public class Element extends BaseObj {
if (dt == DataType.UNSIGNED_4_4_4_4 && dk != DataKind.PIXEL_RGBA) {
throw new RSIllegalArgumentException("Bad kind and type combo");
}
+ if (dt == DataType.UNSIGNED_16 &&
+ dk != DataKind.PIXEL_DEPTH) {
+ throw new RSIllegalArgumentException("Bad kind and type combo");
+ }
int size = 1;
- if (dk == DataKind.PIXEL_LA) {
+ switch (dk) {
+ case PIXEL_LA:
size = 2;
- }
- if (dk == DataKind.PIXEL_RGB) {
+ break;
+ case PIXEL_RGB:
size = 3;
- }
- if (dk == DataKind.PIXEL_RGBA) {
+ break;
+ case PIXEL_RGBA:
size = 4;
+ break;
+ case PIXEL_DEPTH:
+ size = 2;
+ break;
}
boolean norm = true;