diff options
author | Fredrik Ehnbom <fehnbom@nvidia.com> | 2010-10-12 09:34:04 -0700 |
---|---|---|
committer | Marco Nelissen <marcone@google.com> | 2010-10-13 09:55:17 -0700 |
commit | 229c496d4a47bd610c97af0578ce6b1e2a982c57 (patch) | |
tree | 28155fdf543f80c64cc728340cfb7651b6c520da /res | |
parent | ca13e07c26186e2b82721564f63108c286b5216d (diff) | |
download | android_packages_wallpapers_MagicSmoke-229c496d4a47bd610c97af0578ce6b1e2a982c57.tar.gz android_packages_wallpapers_MagicSmoke-229c496d4a47bd610c97af0578ce6b1e2a982c57.tar.bz2 android_packages_wallpapers_MagicSmoke-229c496d4a47bd610c97af0578ce6b1e2a982c57.zip |
Performance optimizations for MagicSmoke
The MagicSmoke wallpaper was modified to be single pass
multi texture rather than blended multipass.
Change-Id: If838a4abd2c3fa73def46c47d1f362c8a2af3363
Diffstat (limited to 'res')
-rw-r--r-- | res/raw/pf4tex.glslf | 23 | ||||
-rw-r--r-- | res/raw/pf5tex.glslf | 26 | ||||
-rw-r--r-- | res/raw/pv4tex.glslv | 20 | ||||
-rw-r--r-- | res/raw/pv5tex.glslv | 22 |
4 files changed, 91 insertions, 0 deletions
diff --git a/res/raw/pf4tex.glslf b/res/raw/pf4tex.glslf new file mode 100644 index 0000000..32810dc --- /dev/null +++ b/res/raw/pf4tex.glslf @@ -0,0 +1,23 @@ +precision mediump float; + +varying vec2 varTex0; +varying vec2 varTex1; +varying vec2 varTex2; +varying vec2 varTex3; + +void main() { + lowp vec4 tex = texture2D(UNI_Tex0, varTex0); + lowp vec4 col = mix(UNI_clearColor, tex.rgba, tex.a); + + tex = texture2D(UNI_Tex1, varTex1); + col = mix(col, tex.rgba, tex.a); + + tex = texture2D(UNI_Tex2, varTex2); + col = mix(col, tex.rgba, tex.a); + + tex = texture2D(UNI_Tex3, varTex3); + col = mix(col, tex.rgba, tex.a); + + gl_FragColor = col; +} + diff --git a/res/raw/pf5tex.glslf b/res/raw/pf5tex.glslf new file mode 100644 index 0000000..b1da1f6 --- /dev/null +++ b/res/raw/pf5tex.glslf @@ -0,0 +1,26 @@ +precision mediump float; + +varying vec2 varTex0; +varying vec2 varTex1; +varying vec2 varTex2; +varying vec2 varTex3; +varying vec2 varTex4; + +void main() { + lowp vec4 tex = texture2D(UNI_Tex0, varTex0); + lowp vec4 col = mix(UNI_clearColor, tex.rgba, tex.a); + + tex = texture2D(UNI_Tex1, varTex1); + col = mix(col, tex.rgba, tex.a); + + tex = texture2D(UNI_Tex2, varTex2); + col = mix(col, tex.rgba, tex.a); + + tex = texture2D(UNI_Tex3, varTex3); + col = mix(col, tex.rgba, tex.a); + + tex = texture2D(UNI_Tex4, varTex4); + col = mix(col, tex.rgba, tex.a); + gl_FragColor = col; +} + diff --git a/res/raw/pv4tex.glslv b/res/raw/pv4tex.glslv new file mode 100644 index 0000000..9fd1f04 --- /dev/null +++ b/res/raw/pv4tex.glslv @@ -0,0 +1,20 @@ +varying vec2 varTex0; +varying vec2 varTex1; +varying vec2 varTex2; +varying vec2 varTex3; + +vec2 mul(vec4 uni, vec2 attr, float idx) +{ + float invz = 0.35 + idx*0.05; + return vec2( + 0.5 + 0.5 * invz * (uni.z * ( uni.y * attr.x + uni.x * attr.y)) + uni.w, + 0.5 + 0.5 * invz * (uni.z * (-uni.x * attr.x + uni.y * attr.y))); +} + +void main() { + varTex0 = mul(UNI_layer0, ATTRIB_position.xy, 1.0); + varTex1 = mul(UNI_layer1, ATTRIB_position.xy, 2.0); + varTex2 = mul(UNI_layer2, ATTRIB_position.xy, 3.0); + varTex3 = mul(UNI_layer3, ATTRIB_position.xy, 4.0); + gl_Position = ATTRIB_position; +} diff --git a/res/raw/pv5tex.glslv b/res/raw/pv5tex.glslv new file mode 100644 index 0000000..998f209 --- /dev/null +++ b/res/raw/pv5tex.glslv @@ -0,0 +1,22 @@ +varying vec2 varTex0; +varying vec2 varTex1; +varying vec2 varTex2; +varying vec2 varTex3; +varying vec2 varTex4; + +vec2 mul(vec4 uni, vec2 attr, float idx) +{ + float invz = 0.5 + idx*0.05; + return vec2( + 0.5 + 0.5 * invz * (uni.z * ( uni.y * attr.x + uni.x * attr.y)) + uni.w, + 0.5 + 0.5 * invz * (uni.z * (-uni.x * attr.x + uni.y * attr.y))); +} + +void main() { + varTex0 = mul(UNI_layer0, ATTRIB_position.xy, 1.0); + varTex1 = mul(UNI_layer1, ATTRIB_position.xy, 2.0); + varTex2 = mul(UNI_layer2, ATTRIB_position.xy, 3.0); + varTex3 = mul(UNI_layer3, ATTRIB_position.xy, 4.0); + varTex4 = mul(UNI_layer4, ATTRIB_position.xy, 5.0); + gl_Position = ATTRIB_position; +} |