History log of /frameworks/base/libs/hwui/ProgramCache.cpp
Revision Date Author Comments (<<< Hide modified files) (Show modified files >>>)
39284b763a09688468ed3799ebd2ebb76ea5dfd5 27-Sep-2012 Romain Guy <romainguy@google.com> Make gradients beautiful again
Bug #7239634

This change passes two matrices to the vertex shader instead of one.
We used to compute the final MVP matrix on the CPU to minimize the
number of operations in the vertex shaders. Shader compilers are
however smart enough to perform this optimization for us. Since we
need the MV matrix to properly compute gradients dithering, this
change splits the MVP matrix into two. This has the advantage of
removing one matrix multiplication per drawing operation on the
CPU.
The SGX 540 shader compiler produces the same number of instructions
in both cases. There is no penalty hit with having two matrices
instead of one. We also send so few vertices per frame that it
does not matter very much.

Change-Id: I17d47ac4772615418e0e1885b97493d31435a936
/frameworks/base/libs/hwui/ProgramCache.cpp
e83221c547cf2038752e5378e72e49a62cfd9954 25-Sep-2012 Romain Guy <romainguy@google.com> Fix alpha channel computation with ColorMatrixColorFilter
Bug #7222476

There were two issues:
- Blending was ignored with color filters
- The addition vector of a color filter was treated as integer values
instead of float values

Change-Id: Id94065704a30ee8aaaa5724a9f3a3cff7c50ced7
/frameworks/base/libs/hwui/ProgramCache.cpp
dbb261455b1b8d2fdf4f0f8ad84ddb09dda1ed9b 22-Sep-2012 Chet Haase <chet@google.com> Merge "Optimize shaders for dithered gradients" into jb-mr1-dev
a1d12dd619c86c9ac121a3095ff5e5633c11e876 21-Sep-2012 Chet Haase <chet@google.com> Optimize shaders for dithered gradients

It's faster to compute a dither calculation in the vertex shader and use
a varying (letting the GPU interpolate the fragment values) than to perform
that calculation in the fragment shader as part of a texture lookup.

Issue #7207600 Prime mr1 shader performance issues
Issue #7158326 Bad framerates on MR1 (Mako, Manta, Prime)

Change-Id: I15789582a6e9e2d8b9dd22aa5b0f72f0ba1cce7f
/frameworks/base/libs/hwui/ProgramCache.cpp
710f46d9d6a5bf9ea1c1833384caf61e1934124f 18-Sep-2012 Chris Craik <ccraik@google.com> Polygonal rendering of simple fill shapes

bug:4419017

Change-Id: If0428e1732139786cba15f54b285d880e4a56b89
/frameworks/base/libs/hwui/ProgramCache.cpp
0990ffbc4d407e174423a4a04b5902ed83f71db5 18-Sep-2012 Chet Haase <chet@google.com> Fix GL shader bugs

Fixing errors in emitted shader code that caused GL errors
at runtime

Change-Id: I267a84398a81329a6688b292505f8779bd750ad1
/frameworks/base/libs/hwui/ProgramCache.cpp
1c5c206953d673f8424908c77c974c06d5b99a9c 18-Sep-2012 Chet Haase <chet@google.com> Fix bad shader code

Shader code missing "=" in a couple of cases.

Change-Id: Iff8a99a0ccb2903c30e2bdb2f698ef9b2e03d5d1
/frameworks/base/libs/hwui/ProgramCache.cpp
a938f569ce206c1ed68d736181016b5b708c0084 14-Sep-2012 Romain Guy <romainguy@google.com> Fix modulation and gamma correction issues

Modulation is normally enabled in a shader when drawing with an alpha
mask (A8 texture.) Modulation is used to do one of two things:

- Colorize the primitive (to draw text in red for instance)
- Apply extra translucency (50% translucent circle filled with a bitmap)

The current implementation has four issues:

1. Unnecessary work is performed by assigning the modulation color
to vec4 fragColor early in the shader
2. The modulation color's alpha is applied twice when the primitive
is drawn with an SkShader
3. The decision to modulate is wrong and triggers when any of the
RGB channels is < 1.0. Only the alpha channel needs to be taken
into account to make the decision
4. Gamma correction is not applied properly

This change addresses all four issues above.

Change-Id: I73fcc74efc4b094bf2d1b835f10ffaa2ea4b9eb9
/frameworks/base/libs/hwui/ProgramCache.cpp
9f44a13a125980fee92cdc76376063129f0eebc9 14-Sep-2012 Chris Craik <ccraik@google.com> Multiply alpha for AA as late as possible

Should be done after all color computation

Change-Id: Iaadd565f7d2263f111f6841a00e7c341025833d3
/frameworks/base/libs/hwui/ProgramCache.cpp
6ebdc114e0d72137394f02bc8ffe9d7a782a65c4 01-Sep-2012 Chris Craik <ccraik@google.com> Varying-based AA rect drawing

Instead of calculating opacity from relative position in the shader, use a
shader varying to do this computation for us.

bug:5045101

Also adds a test to HwAccelerationTest to show incorrect antialiasing in
scaled drawAARect / boundarySize calculation.

Change-Id: Icdc41acb01dc10ce354834f8389a5aed2f439162
/frameworks/base/libs/hwui/ProgramCache.cpp
a798b95a9ef328720febec72d01462cd97e3d4c7 28-Aug-2012 Chris Craik <ccraik@google.com> Use smoothstep to eliminate branches in AA shader

Change-Id: If4ecb1a9446f29b2f8444f5cee551f863c1993e8
/frameworks/base/libs/hwui/ProgramCache.cpp
320d46bf844b84351cb80c5d4a4768d86447ac81 09-Aug-2012 Romain Guy <romainguy@google.com> Reduce gradients textures size whenever possible

Change-Id: Ifd58625ee62edac3b5d20b77553cb98b6fa2b46e
/frameworks/base/libs/hwui/ProgramCache.cpp
211efea7376371ee755edd2ad03e83ef6eea464e 01-Aug-2012 Romain Guy <romainguy@google.com> Add dithering to gradients

Change-Id: Ic1208855bde3a254eca2fd7cef43e0f1318ce419
/frameworks/base/libs/hwui/ProgramCache.cpp
42e1e0d482d774cf18a55773e434f02edb9e4462 30-Jul-2012 Romain Guy <romainguy@google.com> Improve gradients

Avoid using textures for common gradients (two stops from 0.0 to 1.0)

Change-Id: Iff55d21b126c8cfc4cfb701669f2339c8f6b131a
/frameworks/base/libs/hwui/ProgramCache.cpp
63553478130f78d44c8fbeaebc610e19925544a5 19-Jul-2012 Romain Guy <romainguy@google.com> Remove vendor specific precision qualifier

Change-Id: I0a56ca7a5a399ec94993d3cea0c4aff6c0f86e39
/frameworks/base/libs/hwui/ProgramCache.cpp
8e025de5fb3ab1c099541e3a387123170bf9d1a9 19-Jul-2012 Romain Guy <romainguy@google.com> Note to self

Change-Id: Ic5699bdbf880ad68748c827bb5b4976b12d4d413
/frameworks/base/libs/hwui/ProgramCache.cpp
4121063313ac0d6f69f6253cac821d0c1c122086 17-Jul-2012 Romain Guy <romainguy@google.com> Add shader-based text gamma correction

To enable it, the system property ro.hwui.text_gamma_shader must be
set to true. For testing, DEBUG_FONT_RENDERER_FORCE_SHADER_GAMMA
can be set to 1 in libhwui/Debug.h.

Change-Id: If345c6b71b67ecf1ef2e8847b71f30f3ef251a27
/frameworks/base/libs/hwui/ProgramCache.cpp
f3a910b423db7ad79cf61518bdd9278c048ad0d8 13-Dec-2011 Romain Guy <romainguy@google.com> Optimize state changes

Change-Id: Iae59bc8dfd6427d0967472462cc1994987092827
/frameworks/base/libs/hwui/ProgramCache.cpp
a60c3889718f4513a6c9d8b80f655db5d6346905 02-Aug-2011 Romain Guy <romainguy@google.com> Use high precision iterators on specific GPUs
Bug #5098359

Change-Id: I52ee8c7b4c9e8d4c7bedb684eaf7bef6c44c74b9
/frameworks/base/libs/hwui/ProgramCache.cpp
df0a7fbdcff3c683641b7980da50a7d0eebe0876 03-May-2011 Romain Guy <romainguy@google.com> Merge "Allows to render with an OpenGL context inside a TextureView."
8f0095cd33558e9cc8a440047908e53b68906f5f 03-May-2011 Romain Guy <romainguy@google.com> Allows to render with an OpenGL context inside a TextureView.

Change-Id: I59453f7fc3997f0502a1c5d325d37fed376fabc7
/frameworks/base/libs/hwui/ProgramCache.cpp
99585adeb4167ca357a72eb866f34c1af944f4b9 03-May-2011 Chet Haase <chet@google.com> Line endcaps for AA lines are now antialiased.

Also fixed other minor issues with AA and line rendering.

Change-Id: Icd4638d27c70e2ee0f28b5d9a2b97d8b29e8ac4d
/frameworks/base/libs/hwui/ProgramCache.cpp
aa6c24c21c727a196451332448d4e3b11a80be69 29-Apr-2011 Romain Guy <romainguy@google.com> New widget: TextureView
Bug #4343984

TextureView can be used to render media content (video, OpenGL,
RenderScript) inside a View.

The key difference with SurfaceView is that TextureView does
not create a new Surface. This gives the ability to seamlessly
transform, animate, fade, etc. a TextureView, which was hard
if not impossible to do with a SurfaceView.
A TextureView also interacts perfectly with ScrollView,
ListView, etc. It allows application to embed media content
in a much more flexible way than before.

For instance, to render the camera preview at 50% opacity,
all you need to do is the following:

mTextureView.setAlpha(0.5f);
Camera c = Camera.open();
c.setPreviewTexture(mTextureView.getSurfaceTexture());
c.startPreview();

TextureView uses a SurfaceTexture to get the job done. More
APIs are required to make it easy to create OpenGL contexts
for a TextureView. It can currently be done with a bit of
JNI code.

Change-Id: Iaa7953097ab5beb8437bcbbfa03b2df5b7f80cd7
/frameworks/base/libs/hwui/ProgramCache.cpp
740bf2bb2e900d3db2292b5909b4b4c6e90320e6 27-Apr-2011 Romain Guy <romainguy@google.com> Apply shaders/filters to text drop shadows.
Bug #4318323

This change also fixes the fact that shaders were not modulated
by the paint's color when drawing paths.

Change-Id: Id88804143aea06c895d4cbcdbe106d660230aa5a
/frameworks/base/libs/hwui/ProgramCache.cpp
5b0200bd47e8a9a4dc8d2e6c3a110d522b30bf82 14-Apr-2011 Chet Haase <chet@google.com> Enable anti-aliasing for hw-accelerated lines

Draw anti-aliased lines with OpenGL by constructing a quad with
a border that fades out (to mimic fragment coverage).

Change-Id: Ib81a3e62d663acdf1b46b401ac4aa7ee9855cc7e
/frameworks/base/libs/hwui/ProgramCache.cpp
80bbfb19eefe3cb9be8833b136381cece069e24d 24-Mar-2011 Romain Guy <romainguy@google.com> Fix shaders generation on IMG GPUs.

Change-Id: Id15df2663e41e31f04c8d86b958312341da8101d
/frameworks/base/libs/hwui/ProgramCache.cpp
ed6fcb034b44d9a6ac2fc72fee6030417811f234 21-Mar-2011 Romain Guy <romainguy@google.com> Add support for drawPoint() and drawPoints().

Change-Id: I01bef50c08ec3160f8d40dc060b2cf6c2e4d7639
/frameworks/base/libs/hwui/ProgramCache.cpp
67f27952c1bcb2230beef9b5ca0bf42edad436a9 08-Dec-2010 Romain Guy <romainguy@google.com> Correctly release the OpenGL Canvas on EGL error.

Change-Id: Ib31fd8445f7ce5f7aa7e0205de0e7db80d024fc2
/frameworks/base/libs/hwui/ProgramCache.cpp
c15008e72ec00ca20a271c3006dac649fd07533b 10-Nov-2010 Romain Guy <romainguy@google.com> Move all debug flags in a single place.

This change also adds a new memory usage flag. When turned on, the
following is printed after every frame:

D/OpenGLRenderer( 3723): Current memory usage / total memory usage (bytes):
D/OpenGLRenderer( 3723): TextureCache 3766680 / 20971520
D/OpenGLRenderer( 3723): LayerCache 3538944 / 8388608
D/OpenGLRenderer( 3723): GradientCache 135168 / 524288
D/OpenGLRenderer( 3723): PathCache 41180 / 4194304
D/OpenGLRenderer( 3723): TextDropShadowCache 0 / 2097152
D/OpenGLRenderer( 3723): FontRenderer 0 262144 / 262144
D/OpenGLRenderer( 3723): FontRenderer 1 262144 / 262144
D/OpenGLRenderer( 3723): FontRenderer 2 262144 / 262144
D/OpenGLRenderer( 3723): Other:
D/OpenGLRenderer( 3723): FboCache 2 / 12
D/OpenGLRenderer( 3723): PatchCache 31 / 512
D/OpenGLRenderer( 3723): Total memory usage:
D/OpenGLRenderer( 3723): 8268404 bytes, 7.89 MB

This should help tracking possibe memory issues.

Change-Id: I83f483ca1d2dbef904829bce368e33fe5503e8d6
/frameworks/base/libs/hwui/ProgramCache.cpp
4afdf666fdb034834c48445570ed9d6f4133fc71 14-Oct-2010 Romain Guy <romainguy@android.com> Color filters were ignored by the program cache fast path.

Change-Id: I08f2f02d356234a674be778d088e0558fd49c849
/frameworks/base/libs/hwui/ProgramCache.cpp
9db91243c5ace4421091557b76a0b1cbd2312fec 12-Oct-2010 Romain Guy <romainguy@google.com> Simplify black texture fragment shader.

Change-Id: If2d43f92f4c98ec128692761a670b0f31207a3c0
/frameworks/base/libs/hwui/ProgramCache.cpp
707b2f78ccaa09965d7e030fda3a883ce9b75ea8 12-Oct-2010 Romain Guy <romainguy@google.com> Optimize GLSL shaders.

Change-Id: I9a5e01bced63d8da0c61330a543a2b805388a59d
/frameworks/base/libs/hwui/ProgramCache.cpp
7537f856f9076a84db04d8de447f6527b67166fd 11-Oct-2010 Romain Guy <romainguy@google.com> Improve performance of linear gradients.

Change-Id: If1caee31fc045dea13a4c5c10f25f2ffd325c4f8
/frameworks/base/libs/hwui/ProgramCache.cpp
14830948d02f768c41b97b7a8d15e1b3cab78267 08-Oct-2010 Romain Guy <romainguy@google.com> Add 3D transforms support to all gradients.

Change-Id: I61409edd00dab3a11684a3f5e4f7df0afc734758
/frameworks/base/libs/hwui/ProgramCache.cpp
e3095e0c1e2a4a4f34f741aa386eae56536ca5aa 07-Oct-2010 Romain Guy <romainguy@google.com> Apply 3D transformations to gradient shaders.

This fixes only linear gradients. Sweep and radial gradients, as well as
bitmap shaders, will be fixed in a future commit.

Change-Id: I4eee4ff62e9bbf3b9339fc111a780167449ecfef
/frameworks/base/libs/hwui/ProgramCache.cpp
ddb80bebb0776e6d852aab6e8bba5d5591847a55 21-Sep-2010 Romain Guy <romainguy@google.com> Add support for circular gradients to the GL renderer.

This change also adds full support for local transformation matrices on
sweep and radial gradients.

Change-Id: Id8773bc0766575190e3f3d51984fc5e57b266c3f
/frameworks/base/libs/hwui/ProgramCache.cpp
ee916f14cbd1fe1422c063ce2ef7b185e2bc5c6f 21-Sep-2010 Romain Guy <romainguy@google.com> Add support for SweepGradient in the GL renderer.

Change-Id: I7aa397ed4e34655ead9ba1f5b4ce087665e0f022
/frameworks/base/libs/hwui/ProgramCache.cpp
f607bdc167f66b3e7003acaa4736ae46d78c1492 11-Sep-2010 Romain Guy <romainguy@google.com> Correct implementation of saveLayer().

Change-Id: I5375126636913e0a84f2d6bbd0ebe40d2e4f2763
/frameworks/base/libs/hwui/ProgramCache.cpp
a5aed0d58962a24c44728ffc46dc9e1ba2f9fda5 09-Sep-2010 Romain Guy <romainguy@google.com> Add support for advanced blend modes with the framebuffer.

This adds the ability to blend with the framebuffer using Darken,
Lighten, Add, Multiply, Overlay and Screen.

Change-Id: Iae01a53797d4ad39c373cba6ff2a42293129da1a
/frameworks/base/libs/hwui/ProgramCache.cpp
48daa54d31fc59ec969dcff65eb3cbb0ce879a8d 11-Aug-2010 Romain Guy <romainguy@google.com> Add extra blending modes.

This change adds the following blending modes for shaders and color filters:
Add
Multiply
Screen
Overlay
Darken
Lighten

Change-Id: Iff22f5ce6041b43c71b1857d73013f5010ab3413
/frameworks/base/libs/hwui/ProgramCache.cpp
61c8c9c5b2006d18e9310b6521c65b36ffe75ce4 10-Aug-2010 Romain Guy <romainguy@google.com> Fix tons of bugs and add new text rendering support.

Change-Id: I326c66b10784006f6df2f12d38e120cef94cd0d7
/frameworks/base/libs/hwui/ProgramCache.cpp
7fbcc0492fca03857e3c45064f4aa040af817d55 05-Aug-2010 Romain Guy <romainguy@google.com> Add support for paths.

Rendering is implementing by rasterizing the paths into A8 textures.
This cna be extremely inefficient if the path changes often.

Change-Id: I609343f304ae38e0d319359403ee73b9b5b3c93a
/frameworks/base/libs/hwui/ProgramCache.cpp
db1938e0e6ef816e228c815adccebd5cb05f2aa8 03-Aug-2010 Romain Guy <romainguy@google.com> Add support for ColorFilters.

Color filters are fully supported and can be used with shaders.

Change-Id: Id90ccf1c81cb462f2431f366f3f8f710d7971e04
/frameworks/base/libs/hwui/ProgramCache.cpp
06f96e2652e4855b6520ad9dd70583677605b79a 31-Jul-2010 Romain Guy <romainguy@google.com> Refactor Skia shaders handling.

With this change, Skia shaders can easily be applied to any mesh. This change also
supports ComposeShader. For instance, this can be used to blend a gradient and a
bitmap togehter and paint a string of text with the result.

Change-Id: I701c2f9cf7f89b2ff58005e8a1d0d80ccf4a4aea
/frameworks/base/libs/hwui/ProgramCache.cpp
889f8d1403761d5668115ced6cbb3f767cfe966d 29-Jul-2010 Romain Guy <romainguy@google.com> Moved all the rendering code to the new shader generator.

The generator supports features that are not yet implement in the
renderer: color matrix, lighting, porterduff color blending and
composite shaders.

This change also adds support for repeated/mirrored non-power of 2
bitmap shaders.

Change-Id: I903a11a070c0eb9cc8850a60ef305751e5b47234
/frameworks/base/libs/hwui/ProgramCache.cpp
ac670c0433d19397d4e36ced2110475b6f54fe26 28-Jul-2010 Romain Guy <romainguy@google.com> Generate shaders to cover all possible cases.

With this change, all the vertex and fragment shaders used by the GL
renderer are now generated based on a program description supplied
by the caller. This allows the renderer to generate a large number
of shaders without having to write all the possible combinations by
hand. The generated shaders are stored in a program cache.

Change-Id: If54d286e77ae021c724d42090da476df12a18ebb
/frameworks/base/libs/hwui/ProgramCache.cpp