summaryrefslogtreecommitdiffstats
path: root/libs/hwui/ProgramCache.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Make gradients beautiful againRomain Guy2012-09-261-7/+8
| | | | | | | | | | | | | | | | | | | 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
* Fix alpha channel computation with ColorMatrixColorFilterRomain Guy2012-09-251-1/+0
| | | | | | | | | | | 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
* Merge "Optimize shaders for dithered gradients" into jb-mr1-devChet Haase2012-09-211-19/+34
|\
| * Optimize shaders for dithered gradientsChet Haase2012-09-211-19/+34
| | | | | | | | | | | | | | | | | | | | | | 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
* | Polygonal rendering of simple fill shapesChris Craik2012-09-201-32/+42
|/ | | | | | bug:4419017 Change-Id: If0428e1732139786cba15f54b285d880e4a56b89
* Fix GL shader bugsChet Haase2012-09-181-6/+6
| | | | | | | Fixing errors in emitted shader code that caused GL errors at runtime Change-Id: I267a84398a81329a6688b292505f8779bd750ad1
* Fix bad shader codeChet Haase2012-09-171-2/+2
| | | | | | Shader code missing "=" in a couple of cases. Change-Id: Iff8a99a0ccb2903c30e2bdb2f698ef9b2e03d5d1
* Fix modulation and gamma correction issuesRomain Guy2012-09-141-37/+50
| | | | | | | | | | | | | | | | | | | | | | | 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
* Multiply alpha for AA as late as possibleChris Craik2012-09-131-5/+7
| | | | | | Should be done after all color computation Change-Id: Iaadd565f7d2263f111f6841a00e7c341025833d3
* Varying-based AA rect drawingChris Craik2012-09-051-6/+25
| | | | | | | | | | | | 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
* Use smoothstep to eliminate branches in AA shaderChris Craik2012-08-291-13/+4
| | | | Change-Id: If4ecb1a9446f29b2f8444f5cee551f863c1993e8
* Reduce gradients textures size whenever possibleRomain Guy2012-08-081-9/+7
| | | | Change-Id: Ifd58625ee62edac3b5d20b77553cb98b6fa2b46e
* Add dithering to gradientsRomain Guy2012-08-011-19/+39
| | | | Change-Id: Ic1208855bde3a254eca2fd7cef43e0f1318ce419
* Improve gradientsRomain Guy2012-07-311-23/+49
| | | | | | Avoid using textures for common gradients (two stops from 0.0 to 1.0) Change-Id: Iff55d21b126c8cfc4cfb701669f2339c8f6b131a
* Remove vendor specific precision qualifierRomain Guy2012-07-181-27/+17
| | | | Change-Id: I0a56ca7a5a399ec94993d3cea0c4aff6c0f86e39
* Note to selfRomain Guy2012-07-181-0/+2
| | | | Change-Id: Ic5699bdbf880ad68748c827bb5b4976b12d4d413
* Add shader-based text gamma correctionRomain Guy2012-07-161-3/+31
| | | | | | | | 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
* Optimize state changesRomain Guy2011-12-121-1/+1
| | | | Change-Id: Iae59bc8dfd6427d0967472462cc1994987092827
* Use high precision iterators on specific GPUsRomain Guy2011-08-011-9/+19
| | | | | | Bug #5098359 Change-Id: I52ee8c7b4c9e8d4c7bedb684eaf7bef6c44c74b9
* Merge "Allows to render with an OpenGL context inside a TextureView."Romain Guy2011-05-021-7/+5
|\
| * Allows to render with an OpenGL context inside a TextureView.Romain Guy2011-05-021-7/+5
| | | | | | | | Change-Id: I59453f7fc3997f0502a1c5d325d37fed376fabc7
* | Line endcaps for AA lines are now antialiased.Chet Haase2011-05-021-27/+36
|/ | | | | | Also fixed other minor issues with AA and line rendering. Change-Id: Icd4638d27c70e2ee0f28b5d9a2b97d8b29e8ac4d
* New widget: TextureViewRomain Guy2011-04-281-7/+27
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* Apply shaders/filters to text drop shadows.Romain Guy2011-04-261-0/+9
| | | | | | | | | Bug #4318323 This change also fixes the fact that shaders were not modulated by the paint's color when drawing paths. Change-Id: Id88804143aea06c895d4cbcdbe106d660230aa5a
* Enable anti-aliasing for hw-accelerated linesChet Haase2011-04-211-2/+36
| | | | | | | Draw anti-aliased lines with OpenGL by constructing a quad with a border that fades out (to mimic fragment coverage). Change-Id: Ib81a3e62d663acdf1b46b401ac4aa7ee9855cc7e
* Fix shaders generation on IMG GPUs.Romain Guy2011-03-231-2/+2
| | | | Change-Id: Id15df2663e41e31f04c8d86b958312341da8101d
* Add support for drawPoint() and drawPoints().Romain Guy2011-03-211-4/+38
| | | | Change-Id: I01bef50c08ec3160f8d40dc060b2cf6c2e4d7639
* Correctly release the OpenGL Canvas on EGL error.Romain Guy2010-12-071-0/+2
| | | | Change-Id: Ib31fd8445f7ce5f7aa7e0205de0e7db80d024fc2
* Move all debug flags in a single place.Romain Guy2010-11-101-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | 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
* Color filters were ignored by the program cache fast path.Romain Guy2010-10-131-1/+1
| | | | Change-Id: I08f2f02d356234a674be778d088e0558fd49c849
* Simplify black texture fragment shader.Romain Guy2010-10-121-2/+2
| | | | Change-Id: If2d43f92f4c98ec128692761a670b0f31207a3c0
* Optimize GLSL shaders.Romain Guy2010-10-111-21/+150
| | | | Change-Id: I9a5e01bced63d8da0c61330a543a2b805388a59d
* Improve performance of linear gradients.Romain Guy2010-10-111-3/+3
| | | | Change-Id: If1caee31fc045dea13a4c5c10f25f2ffd325c4f8
* Add 3D transforms support to all gradients.Romain Guy2010-10-071-10/+3
| | | | Change-Id: I61409edd00dab3a11684a3f5e4f7df0afc734758
* Apply 3D transformations to gradient shaders.Romain Guy2010-10-061-5/+1
| | | | | | | This fixes only linear gradients. Sweep and radial gradients, as well as bitmap shaders, will be fixed in a future commit. Change-Id: I4eee4ff62e9bbf3b9339fc111a780167449ecfef
* Add support for circular gradients to the GL renderer.Romain Guy2010-09-211-5/+11
| | | | | | | This change also adds full support for local transformation matrices on sweep and radial gradients. Change-Id: Id8773bc0766575190e3f3d51984fc5e57b266c3f
* Add support for SweepGradient in the GL renderer.Romain Guy2010-09-201-17/+50
| | | | Change-Id: I7aa397ed4e34655ead9ba1f5b4ce087665e0f022
* Correct implementation of saveLayer().Romain Guy2010-09-121-1/+4
| | | | Change-Id: I5375126636913e0a84f2d6bbd0ebe40d2e4f2763
* Add support for advanced blend modes with the framebuffer.Romain Guy2010-09-091-2/+20
| | | | | | | This adds the ability to blend with the framebuffer using Darken, Lighten, Add, Multiply, Overlay and Screen. Change-Id: Iae01a53797d4ad39c373cba6ff2a42293129da1a
* Add extra blending modes.Romain Guy2010-08-101-7/+24
| | | | | | | | | | | | This change adds the following blending modes for shaders and color filters: Add Multiply Screen Overlay Darken Lighten Change-Id: Iff22f5ce6041b43c71b1857d73013f5010ab3413
* Fix tons of bugs and add new text rendering support.Romain Guy2010-08-101-0/+6
| | | | Change-Id: I326c66b10784006f6df2f12d38e120cef94cd0d7
* Add support for paths.Romain Guy2010-08-051-1/+1
| | | | | | | Rendering is implementing by rasterizing the paths into A8 textures. This cna be extremely inefficient if the path changes often. Change-Id: I609343f304ae38e0d319359403ee73b9b5b3c93a
* Add support for ColorFilters.Romain Guy2010-08-021-9/+28
| | | | | | Color filters are fully supported and can be used with shaders. Change-Id: Id90ccf1c81cb462f2431f366f3f8f710d7971e04
* Refactor Skia shaders handling.Romain Guy2010-07-301-9/+9
| | | | | | | | 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
* Moved all the rendering code to the new shader generator.Romain Guy2010-07-291-2/+65
| | | | | | | | | | | 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
* Generate shaders to cover all possible cases.Romain Guy2010-07-271-0/+332
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