summaryrefslogtreecommitdiffstats
path: root/libs/hwui/Program.h
Commit message (Collapse)AuthorAgeFilesLines
* Glop Bitmap and RoundRect clipping supportChris Craik2015-02-121-1/+2
| | | | Change-Id: I4577546a5d2e5f084cc03f39a89db9231b8111ee
* Glop ColorFilter & VertexBuffer support, initial enableChris Craik2015-02-061-2/+2
| | | | | | | Enables Glop rendering for supported Rects and VertexBuffers Also removes unused Query object Change-Id: Ibe227bc362685a153159f75077664f0947764e06
* Refactoring of Program ownership/lifecycle, and WIP Glop rendering pathChris Craik2015-02-021-6/+1
| | | | Change-Id: I2549032790bddbc048b0bccc224ed8f386b4517c
* Revert "resolved conflicts for merge of 220c3f4f to master"Andreas Gampe2014-11-221-2/+0
| | | | | | | | Reverted as hwui doesn't agree. This reverts commit 8a902d9f24e83c87b054adb5836b4a5b8a257be9. Change-Id: I109e7b02bee2921e2155ded6df36f52e6f574b5a
* resolved conflicts for merge of 99377df1 to lmp-mr1-dev-plus-aospAndreas Gampe2014-11-211-0/+2
|\ | | | | | | Change-Id: I3a98f55832ac447b1ed0dd129c7a93d088025943
| * Frameworks/base: Unused parameters in hwuiAndreas Gampe2014-11-211-0/+2
| | | | | | | | | | | | | | | | | | Remove Clang cutout for unused parameters. Fix warnings. Remove Clang cutout for deprecated Skia function usage. Has been fixed in the L push. Change-Id: I7ea073ff67127cc1e14e798b655e2c50615fe8e7
* | Cleanup debug optionsJohn Reck2014-10-271-5/+1
|/ | | | | | Bug: 18138852 Bug: 18065434 Change-Id: Ibb07b73b147c2a8b287fe8aee3f6624582f21b00
* Switch to cos interpolation of shadow alphaChris Craik2014-08-121-8/+8
| | | | | | | | | | bug:16852257 Updates default shadow opacities to compensate. Also, update variable/constant naming related to vertex alpha. Change-Id: I9055b4ac3c9ac305ca9d515f21b52d6aa6dc9c5c
* Rework shadow interpolationChris Craik2014-08-121-8/+12
| | | | | | | | | | bug:16852257 Use pow(alpha, 1.5) to avoid harsh edges on shadow alpha ramps. Also adjusts shadow constants to compensate. Change-Id: I5869956d7d292db2a8e496bc320084b6d64c3fb7
* Round rect outline clippingChris Craik2014-05-151-11/+17
| | | | Change-Id: Iee9cf4f719f6f1917507b69189ad114fa365917b
* Removing SkiaColorFilter and inspecting the native object directly.Derek Sollenberger2014-02-071-7/+2
| | | | | bug: 10650594 Change-Id: I4fcf66d008765afa0e35d011f58bc792183cb74f
* Fix projection offset cachingChris Craik2014-01-291-0/+1
| | | | | | | | Because the caching of projection matrix didn't account for changes in the offset flag, the flag could be ignored. Now we use both to verify that the cached matrix can be used. Change-Id: I193b94eaf0b98f046a6484f0866c3d25048653fd
* Clean unused parameters, disable warningsChris Craik2013-10-171-2/+2
| | | | Change-Id: Iddb872f53075dd022eeef45265594d1c6a9e2bc0
* Add tessellation path for pointsChris Craik2013-05-141-18/+9
| | | | | | | | | | | | | | | | | | 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
* Add an on-screen overdraw counterRomain Guy2013-05-031-0/+3
| | | | | | | | | 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
* Pack preloaded framework assets in a texture atlasRomain Guy2013-05-021-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When the Android runtime starts, the system preloads a series of assets in the Zygote process. These assets are shared across all processes. Unfortunately, each one of these assets is later uploaded in its own OpenGL texture, once per process. This wastes memory and generates unnecessary OpenGL state changes. This CL introduces an asset server that provides an atlas to all processes. Note: bitmaps used by skia shaders are *not* sampled from the atlas. It's an uncommon use case and would require extra texture transforms in the GL shaders. WHAT IS THE ASSETS ATLAS The "assets atlas" is a single, shareable graphic buffer that contains all the system's preloaded bitmap drawables (this includes 9-patches.) The atlas is made of two distinct objects: the graphic buffer that contains the actual pixels and the map which indicates where each preloaded bitmap can be found in the atlas (essentially a pair of x and y coordinates.) HOW IS THE ASSETS ATLAS GENERATED Because we need to support a wide variety of devices and because it is easy to change the list of preloaded drawables, the atlas is generated at runtime, during the startup phase of the system process. There are several steps that lead to the atlas generation: 1. If the device is booting for the first time, or if the device was updated, we need to find the best atlas configuration. To do so, the atlas service tries a number of width, height and algorithm variations that allows us to pack as many assets as possible while using as little memory as possible. Once a best configuration is found, it gets written to disk in /data/system/framework_atlas 2. Given a best configuration (algorithm variant, dimensions and number of bitmaps that can be packed in the atlas), the atlas service packs all the preloaded bitmaps into a single graphic buffer object. 3. The packing is done using Skia in a temporary native bitmap. The Skia bitmap is then copied into the graphic buffer using OpenGL ES to benefit from texture swizzling. HOW PROCESSES USE THE ATLAS Whenever a process' hardware renderer initializes its EGL context, it queries the atlas service for the graphic buffer and the map. It is important to remember that both the context and the map will be valid for the lifetime of the hardware renderer (if the system process goes down, all apps get killed as well.) Every time the hardware renderer needs to render a bitmap, it first checks whether the bitmap can be found in the assets atlas. When the bitmap is part of the atlas, texture coordinates are remapped appropriately before rendering. Change-Id: I8eaecf53e7f6a33d90da3d0047c5ceec89ea3af0
* Add shader program selection shortcutChris Craik2013-03-011-0/+1
| | | | | | | | | | | 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
* Add new property to debug non-rectangular clip operationsRomain Guy2013-02-251-0/+7
| | | | | | | | | | | | | 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
* Implement support for drawBitmapMesh's colors arrayRomain Guy2013-02-131-0/+8
| | | | Change-Id: I3d901f6267c2918771ac30ff55c8d80c3ab5b725
* Add cap tessellation supportChris Craik2013-02-061-6/+1
| | | | | | | | | | | 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
* Make gradients beautiful againRomain Guy2012-09-261-0/+5
| | | | | | | | | | | | | | | | | | | 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
* Polygonal rendering of simple fill shapesChris Craik2012-09-201-4/+4
| | | | | | bug:4419017 Change-Id: If0428e1732139786cba15f54b285d880e4a56b89
* Fix modulation and gamma correction issuesRomain Guy2012-09-141-2/+1
| | | | | | | | | | | | | | | | | | | | | | | 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
* Varying-based AA rect drawingChris Craik2012-09-051-0/+5
| | | | | | | | | | | | 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
* Improve gradientsRomain Guy2012-07-311-2/+7
| | | | | | Avoid using textures for common gradients (two stops from 0.0 to 1.0) Change-Id: Iff55d21b126c8cfc4cfb701669f2339c8f6b131a
* Add shader-based text gamma correctionRomain Guy2012-07-161-1/+10
| | | | | | | | 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
* Remove obsolete optimizationRomain Guy2012-07-121-2/+2
| | | | Change-Id: I2d43c009c62a7f4a4a2e0a6303bdfa692c4b8c8c
* Rename (IF_)LOGD(_IF) to (IF_)ALOGD(_IF) DO NOT MERGESteve Block2012-01-031-1/+1
| | | | | | | See https://android-git.corp.google.com/g/156016 Bug: 5449033 Change-Id: I4c4e33bb9df3e39e11cd985e193e6fbab4635298
* Reduce the number of active texture changesRomain Guy2011-12-131-0/+2
| | | | Change-Id: I94046bdfe20740c26c8183822e3002d692fde7c4
* Optimize state changesRomain Guy2011-12-121-2/+255
| | | | Change-Id: Iae59bc8dfd6427d0967472462cc1994987092827
* Keep shaders to render properlyRomain Guy2011-12-121-1/+13
| | | | | | | I don't know who's to blame, SGX or Tegra2 but one of those two GPUs is not following the OpenGL ES 2.0 spec. Change-Id: I2624e0efbc9c57d571c55c8b440a5e43f08a54f2
* Free up resources by deleting shaders early onRomain Guy2011-12-091-7/+6
| | | | Change-Id: I29a39775732c0a48d3e6823f7afa3e741cae8541
* Fix various hw-accelerated line/point bugsChet Haase2011-04-271-1/+1
| | | | | | | | | | | All accelerated lines are now rendered as quads. Hairlines used to be rendered as GL_LINES, but these lines don't render the same as our non-accelerated lines, so we're using quads for everything. Also, fixed a bug in the way that we were offsetting quads (and not offseting points) to ensure that our lines/points actuall start on the same pixels as Skia's. Change-Id: I51b923cc08a9858444c430ba07bc8aa0c83cbe6a
* Correctly release the OpenGL Canvas on EGL error.Romain Guy2010-12-071-0/+8
| | | | Change-Id: Ib31fd8445f7ce5f7aa7e0205de0e7db80d024fc2
* Optimize FBO drawing with regions.Romain Guy2010-11-021-3/+3
| | | | | | | | | This optimization is currently disabled until Launcher is modified to take advantage of it. The optimization can be enabled by turning on RENDER_LAYERS_AS_REGIONS in the OpenGLRenderer.h file. Change-Id: I2fdf59d0f4dc690a3d7f712173ab8db3848b27b1
* Optimize GLSL shaders.Romain Guy2010-10-111-4/+4
| | | | Change-Id: I9a5e01bced63d8da0c61330a543a2b805388a59d
* Moved all the rendering code to the new shader generator.Romain Guy2010-07-291-142/+23
| | | | | | | | | | | 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-13/+15
| | | | | | | | | | 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
* Add text rendering.Romain Guy2010-07-211-0/+6
| | | | Change-Id: Ibe5a9fa844d531b31b55e43de403a98d49f659b9
* Add support for linear gradients.Romain Guy2010-07-191-0/+11
| | | | Change-Id: Id15329da065045b3f06fdaed615f33cd57608496
* Add program for linear gradient.Romain Guy2010-07-161-0/+39
| | | | | | | | This change adds a new DrawLinearGradientProgram class to enable the drawing of linear gradients. Two new vertex and fragment shaders are introduced, based on DrawTextureProgram's shaders. Change-Id: I885afc076bb6cef8cd3962ae21a086fa6a03bf96
* Correctly support pre-multiplied alpha, optimizations, more stuff.Romain Guy2010-07-121-3/+25
| | | | | | | | | | | | | | Add support for the following drawing functions: - drawBitmap(int[]...) - drawPaint() Optimizes shader state changes by enabling/disabling attribute arrays only when needed. Adds quick rejects when drawing trivial shapes to avoid unnecessary OpenGL operations. Change-Id: Ic2c6c2ed1523d08a63a8c95601a1ec40b6c7fbc9
* Optimize shader binding changes.Romain Guy2010-07-121-1/+17
| | | | | | | This change also cleans up the internal API a little bit by using mat4 everywhere instead of float[16] (for the ortho matrix for instance.) Change-Id: I35924c7dc17bad17f30307118d5ed437c2ed37e0
* Remove math from the vertex shader.Romain Guy2010-07-091-12/+13
| | | | Change-Id: I02847a60a8734bf8b3d29ec12e76297795095e38
* Reduced the complexity of layers composition.Romain Guy2010-06-271-0/+156
This change also refactors the code base a bit by moving classes out of OpenGLRenderer into separate headers/implementations. This makes the code more manageable. This change also adds documentation for implementation methods. The undocumented methods are simply Skia's Canvas methods. Change-Id: I54c68b443580a0129251dddc1a7ac95813d5289e