summaryrefslogtreecommitdiffstats
path: root/libs/hwui/shaders
diff options
context:
space:
mode:
authorRomain Guy <romainguy@android.com>2010-06-26 00:13:53 -0700
committerRomain Guy <romainguy@android.com>2010-06-26 00:13:53 -0700
commitbd6b79b40247aea7bfe13d0831c6c0472df6c636 (patch)
tree71c913ec50df87a9463e30c8a28e5cb29e734c79 /libs/hwui/shaders
parent7ae7ac48aa2b53453c9805075171ecd5bcafd7de (diff)
downloadframeworks_base-bd6b79b40247aea7bfe13d0831c6c0472df6c636.zip
frameworks_base-bd6b79b40247aea7bfe13d0831c6c0472df6c636.tar.gz
frameworks_base-bd6b79b40247aea7bfe13d0831c6c0472df6c636.tar.bz2
Add implementations for saveLayerAlpha() and textured rects.
Even though there's an implementation for textured rects, drawBitmap() is not hooked up yet as it will require a good texture cache. This method is implemented using FBOs. There's currently an issue either in the driver or in the Canvas renderer that forces the FBO to be fullscreen, which is extremely expensive and yields terrible performance. Change-Id: I148419195e12d45653c60186938aa78c23a68e2c
Diffstat (limited to 'libs/hwui/shaders')
-rw-r--r--libs/hwui/shaders/drawColor.frag4
-rw-r--r--libs/hwui/shaders/drawTexture.frag12
-rw-r--r--libs/hwui/shaders/drawTexture.vert20
3 files changed, 33 insertions, 3 deletions
diff --git a/libs/hwui/shaders/drawColor.frag b/libs/hwui/shaders/drawColor.frag
index f753abb..e84c47b 100644
--- a/libs/hwui/shaders/drawColor.frag
+++ b/libs/hwui/shaders/drawColor.frag
@@ -1,8 +1,6 @@
SHADER_SOURCE(gDrawColorFragmentShader,
-precision mediump float;
-
-varying vec4 outColor;
+varying lowp vec4 outColor;
void main(void) {
gl_FragColor = outColor;
diff --git a/libs/hwui/shaders/drawTexture.frag b/libs/hwui/shaders/drawTexture.frag
new file mode 100644
index 0000000..5bd420e
--- /dev/null
+++ b/libs/hwui/shaders/drawTexture.frag
@@ -0,0 +1,12 @@
+SHADER_SOURCE(gDrawTextureFragmentShader,
+
+varying lowp vec4 outColor;
+varying mediump vec2 outTexCoords;
+
+uniform sampler2D sampler;
+
+void main(void) {
+ gl_FragColor = texture2D(sampler, outTexCoords) * outColor;
+}
+
+);
diff --git a/libs/hwui/shaders/drawTexture.vert b/libs/hwui/shaders/drawTexture.vert
new file mode 100644
index 0000000..310a812
--- /dev/null
+++ b/libs/hwui/shaders/drawTexture.vert
@@ -0,0 +1,20 @@
+SHADER_SOURCE(gDrawTextureVertexShader,
+
+attribute vec4 position;
+attribute vec2 texCoords;
+attribute vec4 color;
+
+uniform mat4 projection;
+uniform mat4 modelView;
+uniform mat4 transform;
+
+varying vec4 outColor;
+varying vec2 outTexCoords;
+
+void main(void) {
+ outColor = color;
+ outTexCoords = texCoords;
+ gl_Position = projection * transform * modelView * position;
+}
+
+);