summaryrefslogtreecommitdiff
path: root/libs/hwui/ProgramCache.cpp
AgeCommit message (Collapse)Author
2013-03-01Add shader program selection shortcutChris Craik
Add a key manipulation that makes black text/paths use the standard simple bitmap/patch shader, since they are the same. Previously we'd create a separate shader for each because the keys differed, even though the shaders were functionally equivalent. Also fixes some issues around setting DEBUG_PROGRAM Change-Id: I0c77c684d58da03501ee9ab8239c7d4a70fd6b5c
2013-02-25Add new property to debug non-rectangular clip operationsRomain Guy
This change adds a new property called "debug.hwui.show_stencil_clip" that accepts the following values: - "highlight", colorizes in green any drawing command that's tested against a non-rectangular clip region - "region", shows the non-rectangular clip region in blue every time it is used - "hide", default value, nothing is shown Change-Id: I83c8602310edc4aaeb8b905371cdd185b17d32b5
2013-02-13Implement support for drawBitmapMesh's colors arrayRomain Guy
Change-Id: I3d901f6267c2918771ac30ff55c8d80c3ab5b725
2013-02-06Add cap tessellation supportChris Craik
bug:7117155 bug:8114304 Currently used for lines (with and without AA) and arcs with useCenter=false Also removes 0.375, 0.375 offset for AA lines Change-Id: Ic8ace418739344db1e2814edf65253fe7448b0b0
2012-09-26Make gradients beautiful againRomain Guy
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
2012-09-25Fix alpha channel computation with ColorMatrixColorFilterRomain Guy
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
2012-09-21Merge "Optimize shaders for dithered gradients" into jb-mr1-devChet Haase
2012-09-21Optimize shaders for dithered gradientsChet Haase
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
2012-09-20Polygonal rendering of simple fill shapesChris Craik
bug:4419017 Change-Id: If0428e1732139786cba15f54b285d880e4a56b89
2012-09-18Fix GL shader bugsChet Haase
Fixing errors in emitted shader code that caused GL errors at runtime Change-Id: I267a84398a81329a6688b292505f8779bd750ad1
2012-09-17Fix bad shader codeChet Haase
Shader code missing "=" in a couple of cases. Change-Id: Iff8a99a0ccb2903c30e2bdb2f698ef9b2e03d5d1
2012-09-14Fix modulation and gamma correction issuesRomain Guy
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
2012-09-13Multiply alpha for AA as late as possibleChris Craik
Should be done after all color computation Change-Id: Iaadd565f7d2263f111f6841a00e7c341025833d3
2012-09-05Varying-based AA rect drawingChris Craik
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
2012-08-29Use smoothstep to eliminate branches in AA shaderChris Craik
Change-Id: If4ecb1a9446f29b2f8444f5cee551f863c1993e8
2012-08-08Reduce gradients textures size whenever possibleRomain Guy
Change-Id: Ifd58625ee62edac3b5d20b77553cb98b6fa2b46e
2012-08-01Add dithering to gradientsRomain Guy
Change-Id: Ic1208855bde3a254eca2fd7cef43e0f1318ce419
2012-07-31Improve gradientsRomain Guy
Avoid using textures for common gradients (two stops from 0.0 to 1.0) Change-Id: Iff55d21b126c8cfc4cfb701669f2339c8f6b131a
2012-07-18Remove vendor specific precision qualifierRomain Guy
Change-Id: I0a56ca7a5a399ec94993d3cea0c4aff6c0f86e39
2012-07-18Note to selfRomain Guy
Change-Id: Ic5699bdbf880ad68748c827bb5b4976b12d4d413
2012-07-16Add shader-based text gamma correctionRomain Guy
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
2011-12-12Optimize state changesRomain Guy
Change-Id: Iae59bc8dfd6427d0967472462cc1994987092827
2011-08-01Use high precision iterators on specific GPUsRomain Guy
Bug #5098359 Change-Id: I52ee8c7b4c9e8d4c7bedb684eaf7bef6c44c74b9
2011-05-02Merge "Allows to render with an OpenGL context inside a TextureView."Romain Guy
2011-05-02Allows to render with an OpenGL context inside a TextureView.Romain Guy
Change-Id: I59453f7fc3997f0502a1c5d325d37fed376fabc7
2011-05-02Line endcaps for AA lines are now antialiased.Chet Haase
Also fixed other minor issues with AA and line rendering. Change-Id: Icd4638d27c70e2ee0f28b5d9a2b97d8b29e8ac4d
2011-04-28New widget: TextureViewRomain Guy
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
2011-04-26Apply shaders/filters to text drop shadows.Romain Guy
Bug #4318323 This change also fixes the fact that shaders were not modulated by the paint's color when drawing paths. Change-Id: Id88804143aea06c895d4cbcdbe106d660230aa5a
2011-04-21Enable anti-aliasing for hw-accelerated linesChet Haase
Draw anti-aliased lines with OpenGL by constructing a quad with a border that fades out (to mimic fragment coverage). Change-Id: Ib81a3e62d663acdf1b46b401ac4aa7ee9855cc7e
2011-03-23Fix shaders generation on IMG GPUs.Romain Guy
Change-Id: Id15df2663e41e31f04c8d86b958312341da8101d
2011-03-21Add support for drawPoint() and drawPoints().Romain Guy
Change-Id: I01bef50c08ec3160f8d40dc060b2cf6c2e4d7639
2010-12-07Correctly release the OpenGL Canvas on EGL error.Romain Guy
Change-Id: Ib31fd8445f7ce5f7aa7e0205de0e7db80d024fc2
2010-11-10Move all debug flags in a single place.Romain Guy
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
2010-10-13Color filters were ignored by the program cache fast path.Romain Guy
Change-Id: I08f2f02d356234a674be778d088e0558fd49c849
2010-10-12Simplify black texture fragment shader.Romain Guy
Change-Id: If2d43f92f4c98ec128692761a670b0f31207a3c0
2010-10-11Optimize GLSL shaders.Romain Guy
Change-Id: I9a5e01bced63d8da0c61330a543a2b805388a59d
2010-10-11Improve performance of linear gradients.Romain Guy
Change-Id: If1caee31fc045dea13a4c5c10f25f2ffd325c4f8
2010-10-07Add 3D transforms support to all gradients.Romain Guy
Change-Id: I61409edd00dab3a11684a3f5e4f7df0afc734758
2010-10-06Apply 3D transformations to gradient shaders.Romain Guy
This fixes only linear gradients. Sweep and radial gradients, as well as bitmap shaders, will be fixed in a future commit. Change-Id: I4eee4ff62e9bbf3b9339fc111a780167449ecfef
2010-09-21Add support for circular gradients to the GL renderer.Romain Guy
This change also adds full support for local transformation matrices on sweep and radial gradients. Change-Id: Id8773bc0766575190e3f3d51984fc5e57b266c3f
2010-09-20Add support for SweepGradient in the GL renderer.Romain Guy
Change-Id: I7aa397ed4e34655ead9ba1f5b4ce087665e0f022
2010-09-12Correct implementation of saveLayer().Romain Guy
Change-Id: I5375126636913e0a84f2d6bbd0ebe40d2e4f2763
2010-09-09Add support for advanced blend modes with the framebuffer.Romain Guy
This adds the ability to blend with the framebuffer using Darken, Lighten, Add, Multiply, Overlay and Screen. Change-Id: Iae01a53797d4ad39c373cba6ff2a42293129da1a
2010-08-10Add extra blending modes.Romain Guy
This change adds the following blending modes for shaders and color filters: Add Multiply Screen Overlay Darken Lighten Change-Id: Iff22f5ce6041b43c71b1857d73013f5010ab3413
2010-08-10Fix tons of bugs and add new text rendering support.Romain Guy
Change-Id: I326c66b10784006f6df2f12d38e120cef94cd0d7
2010-08-05Add support for paths.Romain Guy
Rendering is implementing by rasterizing the paths into A8 textures. This cna be extremely inefficient if the path changes often. Change-Id: I609343f304ae38e0d319359403ee73b9b5b3c93a
2010-08-02Add support for ColorFilters.Romain Guy
Color filters are fully supported and can be used with shaders. Change-Id: Id90ccf1c81cb462f2431f366f3f8f710d7971e04
2010-07-30Refactor Skia shaders handling.Romain Guy
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
2010-07-29Moved all the rendering code to the new shader generator.Romain Guy
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
2010-07-27Generate shaders to cover all possible cases.Romain Guy
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