summaryrefslogtreecommitdiff
path: root/libs/hwui/ProgramCache.cpp
AgeCommit message (Collapse)Author
2014-08-12Switch to cos interpolation of shadow alphaChris Craik
bug:16852257 Updates default shadow opacities to compensate. Also, update variable/constant naming related to vertex alpha. Change-Id: I9055b4ac3c9ac305ca9d515f21b52d6aa6dc9c5c
2014-08-12Rework shadow interpolationChris Craik
bug:16852257 Use pow(alpha, 1.5) to avoid harsh edges on shadow alpha ramps. Also adjusts shadow constants to compensate. Change-Id: I5869956d7d292db2a8e496bc320084b6d64c3fb7
2014-08-05Fix large radius RR clipping issue on certain devicesChris Craik
bug:16804363 Since dist can be in the 1000s of pixels, and length() may square it in its current precision, scale the value down significantly first, since final precision isn't very important. Change-Id: Id20f7a49d6171355c8e242442c2b5083f746dca3
2014-05-15Round rect outline clippingChris Craik
Change-Id: Iee9cf4f719f6f1917507b69189ad114fa365917b
2014-02-07Removing SkiaColorFilter and inspecting the native object directly.Derek Sollenberger
bug: 10650594 Change-Id: I4fcf66d008765afa0e35d011f58bc792183cb74f
2013-05-14Add tessellation path for pointsChris Craik
bug:4351353 bug:8185479 Point tessellation is similar to line special case, except that we only tessellate one point (as a circle or rect) and duplicate it across other instances. Additionally: Fixes square caps for AA=false lines Cleanup in CanvasCompare, disabling interpolation on zoomed-in comparison view Change-Id: I0756fcc4b20f77878fed0d8057297c80e82ed9dc
2013-05-03Add an on-screen overdraw counterRomain Guy
The counter can be enabled by setting the system property called debug.hwui.overdraw to the string "count". If the string is set to "show", overdraw will be highlighted on screen instead of printing out a simple counter. Change-Id: I9a9c970d54bffab43138bbb7682f6c04bc2c40bd
2013-04-09Change the dither texture's swizzlingRomain Guy
This is a more elegant way to sample from a float alpha texture. Instead of sampling from the red channel in the fragment shader we can set the alpha channel swizzle to redirect it to the red channel. This lets us sample from the alpha channel in the fragment shader and get the correct value. Change-Id: I95bbf7a82964e1bf42c0fee1b782b6bdbbcef618
2013-04-05Use float textures to render gradients when possibleRomain Guy
Float textures offer better precision for dithering. In addition this change removes two uniforms from gradient shaders. These uniforms were used to dither gradients but their value is a build time constant. Instead we hardcode the value directly in the shader source at compile time. Change-Id: I05e9fd3eef93771843bbd91b453274452dfaefee
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