summaryrefslogtreecommitdiffstats
path: root/libs/hwui/OpenGLRenderer.h
Commit message (Collapse)AuthorAgeFilesLines
* Disable shadow overdraw avoidance in the inverse clip caseChris Craik2014-03-271-1/+1
| | | | | | | The caster is effectivly transparent, so skip the optimization just as is done for alpha < 1.0 Change-Id: I3d294222adf0137e20c1fb5808313d487e92e0a8
* Add private circular reveal API on View/RenderNodeChris Craik2014-03-251-1/+1
| | | | Change-Id: I139c8e12b354083149a665f6768f3f6931a8dd15
* Create one hole inside the umbra area to avoid overdraw.ztenghui2014-03-171-1/+2
| | | | | | bug:13439450 Change-Id: I859575196bd5a3029f447883025a6ec3a1f1face
* Rename DisplayList->RenderNodeJohn Reck2014-03-121-2/+2
| | | | Change-Id: Id42e23c9a1a6eb6eaeafef707ced7fa6887b03d0
* Fix orthographic shadows projection, simplify shadow reorderingChris Craik2014-03-121-2/+2
| | | | | | | | | Separate matrix passed to shadow system into two parts, one for transforming the polygon XY points (using the actual draw matrix) and a separate one which respects correct 4x4 3d rotations and translations for determining Z values. Change-Id: I7e30a84774a8709df6b2241e8f51fc5583648fe8
* Use pre-computed index to draw the shadow.ztenghui2014-02-251-2/+7
| | | | | | | | Also draw the umbra part as triangle fans instead of zig zag fashion. b/12840179 Change-Id: Iaa5d15e77351acdd71f076bd8f9bb2d4d2b92faf
* Removing SkiaColorFilter and inspecting the native object directly.Derek Sollenberger2014-02-071-53/+22
| | | | | bug: 10650594 Change-Id: I4fcf66d008765afa0e35d011f58bc792183cb74f
* Keep the SkPaint used when creating a layer.Derek Sollenberger2014-02-071-14/+4
| | | | | | | | This will allow us to inspect the paint for thing other than color and xfermode, such as SkColorFilters and SkShaders. bug: 10650594 Change-Id: I2c3ddd07a3966e1e77af34136307e2b59b2898c1
* Merge "Native-side proxy"John Reck2014-01-281-1/+1
|\
| * Native-side proxyJohn Reck2014-01-271-1/+1
| | | | | | | | | | | | | | Remove RemoteGLRenderer Remove reflection-based control Change-Id: If17c2bbb61c7141986d88c4763def77ed1074985
* | Use path outlines to define shadow shapesChris Craik2014-01-261-1/+1
|/ | | | | | | | | Fixes the simplifying assumption that shadow casters were always rectangular. Java side APIs + plumbing to pass down correct shapes still need to be added. Change-Id: Ic4fee90af15679951a44bb5cc6ae454b98c4c194
* Use const where possible for drawing parametersChris Craik2014-01-031-43/+48
| | | | | | They should never be modified by a Renderer, only read and copied. Change-Id: I9d8d55dca19115ee9dfeb2bb3f092ba2fb327cd4
* Fix Clang warnings/errorsChris Craik2014-01-021-4/+4
| | | | | | | Fix several build warnings (struct != class, int != size_t) and errors (variable leng non-POD arrays). Change-Id: I70b4e784365514303d8954bfcb1f39d7c22c1321
* Use const access to snapshot from OpenGLRendererChris Craik2014-01-021-17/+5
| | | | | | Additionally, move clipping methods to StatefulBaseRenderer Change-Id: Iff232bf16fc1ad3b7d89493da6d8915db7bc5e4f
* Move Snapshot management to intermediate StatefulBaseRenderer classChris Craik2014-01-011-70/+8
| | | | | | | | | | | | | | | | | | The eventual goal is for the StatefulBaseRenderer to serve as the common base class between the DisplayListRenderer and OpenGLRenderer. This will separate DisplayList recording, Snapshot stack management, and the GL in OpenGLRenderer. Additionally, avoid sp<> parameters, and use const parameters in several places, with the intent of greatly reducing the surface area where renderer subclasses can modify snapshot stack. Next steps: -move bulk of clipping logic into StatefulBaseRenderer -disable direct snapshot access Change-Id: Ibc3c6747134ec7daf8ea535866239fa73b874390
* Create abstract base class for OpenGLRendererChris Craik2013-12-271-98/+14
| | | | | | | | | | | | This will eventually serve as a base class to allow DisplayListRenderer to split off from OpenGLRenderer, and could eventually support other rendering approaches, such as an SkCanvas/SkPicture. This will also be the main source of (implementation-independent) documentation of the canvas/renderer methods. Change-Id: I52047f338f5cf86a3b0b3002af7154bff5c3c227
* Merge "3d view system!"Chris Craik2013-12-131-2/+11
|\
| * 3d view system!Chris Craik2013-12-121-2/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | True 3d transformations are now supported by DisplayLists and the renderer, initially with the translationZ property on view. Renderer operations used directly by DisplayList (formerly, clip/save/restore/saveLayer) are now more simply managed by allocating them temporarily on the handler's allocator, which exists for a single frame. This is much simpler than continuing to expand the pool of pre-allocated DisplayListOps now that more operations are called directly by DisplayList, especially with z ordered drawing. Still TODO: -APIs for camera positioning, shadows -Make Z apis public, and expose through XML -Make invalidation / input 3d aware Change-Id: I95fe6fa03f9b6ddd34a7e0c6ec8dd9fe47c6c6eb
* | Unbreak display list debug dumpingJohn Reck2013-12-101-1/+0
|/ | | | Change-Id: I1c6a79f047b29fa60907f6e128cb843a45b88bff
* Clean up quick rejection, especially surrounding points + lines.Chris Craik2013-11-221-24/+12
| | | | | | | | | | | | | | | | | | | | bug:4351353 quickReject and quickRejectNoScissor have been renamed and refactored: - to make the scissor side effect clear and explicit - dangerous methods no longer public - to make the simple quick reject check logic const - simple quick reject is now conservative This CL also fixes several issues with line and point quickRejection - sub-pixel and hairline lines are much less likely to be incorrectly rejected, especially at small canvas scale. Additionally, alpha modulation for AA points < 1px in size is now correct, dumplicating SW behavior (similar to lines and stroked shapes work). Change-Id: Ibb0710c721b9fb415d05acf54dd3d2b4d602156a
* Clean up modelView matrix logicChris Craik2013-11-181-12/+56
| | | | | | | | | bug:11359533 Also changes shader matrix to correctly account for modelView and currentTransform() Change-Id: I6ce18857dc6d08ea08ca7535385c2ad351ec3caa
* Clean unused parameters, disable warningsChris Craik2013-10-171-7/+6
| | | | Change-Id: Iddb872f53075dd022eeef45265594d1c6a9e2bc0
* Correct bitmap merging logicChris Craik2013-09-201-1/+1
| | | | | | | | | | | | | | | bug:10863163 This fixes two issues The check for pure translation was incorrect. It was fixed and renamed for clarity. Certain matrix paths weren't setting kTypePositiveScale. For simplicity (and because positive scale is simple to check) removed flag in favor of dynamic checking. Change-Id: Ic5ce235653ef49a68b8b242bd89fc2e95874ecc9
* Move DeferredDisplayState out of opsChris Craik2013-09-121-15/+2
| | | | | | | | | | | | | | bug:9969358 Instead of storing DeferredDisplayState within an op (thus forcing ops to be tied to a single state instance), associate each op with a new state at DeferredDisplayList insertion time. Now, DisplayLists (and the ops within) can be reused in a single DeferredDisplayList draw call, as ops will use different state instances at different points in the frame. Change-Id: I525ab2abe0c3883679f2fa00b219b293e9ec53d9
* Take shadow bounds into account for quick rejectsRomain Guy2013-08-091-0/+8
| | | | | | Bug #8634346 Change-Id: I995c5205c2959d8e4da638ae47fedcda92eb1b36
* Remove an unnecessary allocationRomain Guy2013-08-091-1/+0
| | | | | | Also remove dead code from OpenGLRenderer.cpp Change-Id: I7eb54ca19e77ee3c32f1fe9513a031e6b2e115cf (cherry picked from commit 5c7d5ab878b26f855175a3305a14ac12fcacf25e)
* Fix quickReject's handling of AA ramp geometryChris Craik2013-08-021-3/+10
| | | | | | | | By having quickReject round out the window-space geometry bounds, we prevent the AA perimeter (which falls outside the local bounds passed in) from drawing outside the clip. Change-Id: I8ee36be9039a9c47906815ee2f0dbaa5eb910b82
* Use global indices array to draw layersRomain Guy2013-07-221-1/+8
| | | | | | | | | | | | An array of indices local to a layer would only be necessary if we changed the way we resolve T-junctions. Since we only ever draw quads, let's just use the indices we use everywhere else. This change also uses the global indices array to render list of colored rectangles to save on the number of vertices generated CPU-side. Change-Id: Ia6d1970b0e9247805af5a114ca2a84b5d0b7c282
* Track the atlas' generation IDRomain Guy2013-06-271-2/+2
| | | | | | | | | | | | Bug #9589379 If the atlas is terminated/reinitialized and a view does not invalidate in between it might end up using a stale AssetAtlas::Entry. This change is similar to how 9patch meshes are cached in DrawPatchOp: we simply track the generation ID of the cache to make sure we always use the latest data. Change-Id: Ib5abb3769d2ce0eabe9adc04e320ca27c422019e
* Initialize MergingDrawBatch clip with viewport boundsChris Craik2013-06-211-0/+3
| | | | | | | | | | This allows merged, clipped operations to behave correctly within a savelayer, even if the base viewport has a large offset. Additionally, disregard opaqueness when within a complexclip/savelayer, as the coverage can't be trusted. Change-Id: Ic908b82a4bb410bc7fac1b4295f4874ed166efc5
* Batch 9-patches in a single mesh whenever possibleRomain Guy2013-06-211-1/+5
| | | | | | | | | | This change also fixes the way batched bitmaps were handled inside a layer. The layer is now correctly dirtied to minimize the amount of pixels to blend. Fix alpha, mode and opaque computations for DrawPatchOp. Change-Id: I1b6cd581c0f0db66c1002bb4fb1a9811e55bfa78
* Merge "Better handle op size edge cases"Chris Craik2013-06-171-1/+2
|\
| * Better handle op size edge casesChris Craik2013-06-171-1/+2
| | | | | | | | | | | | | | | | | | | | | | bug:9464358 Previously, empty and unknown sized ops are assumed to fully cover their clip. This is now corrected such that empty sized ops are pre-rejected before defer. Additionally, unknown sized ops disable overdraw avoidance. Change-Id: Icf2ce24f98be5ea6299e24ffcf826790373564a1
* | Merge "Cancel layer update when a layer is about to be destroyed Bug #9310706"Romain Guy2013-06-171-0/+1
|\ \
| * | Cancel layer update when a layer is about to be destroyedRomain Guy2013-06-171-0/+1
| |/ | | | | | | | | | | Bug #9310706 Change-Id: I73eea6314c326f15a979617e3a05b525935f0d3f
* | Fix clip merging behaviorChris Craik2013-06-141-1/+1
|/ | | | | | | Previously, a new op with a clipped side could be added to a MergingDrawBatch without considering the batch's current bounds. Change-Id: I1b873ecf821bad7cda6630c3f311edd90ac5cc8c
* Fix various draw ops that may incorrectly not scissorChris Craik2013-06-131-14/+22
| | | | | | | | | | bug:8965976 Also consolidates quickReject scissor-ing and scissor-less paths. Renamed plain 'quickReject' method, as it has sideEffects beyond what the java and skia canvases do. Change-Id: I4bdf874d3c8f469d283eae1e71c5e7ea53d47016
* Merge "Restore buildLayer()'s old behavior; it's synchronous again Bug #9193833"Romain Guy2013-06-131-0/+1
|\
| * Restore buildLayer()'s old behavior; it's synchronous againRomain Guy2013-06-121-0/+1
| | | | | | | | | | | | Bug #9193833 Change-Id: I4ee07e65c0a8967f0b55da030ecaad6dfc46136f
* | Overdraw avoidance and merging of clipped opsChris Craik2013-06-121-1/+11
|/ | | | | | | | | | | | | | | | | bug:8951267 If an opaque op, or group of opaque ops covers the invalidate region, skip draw operations that precede it. Clipped operations may now be merged, but only if they share a clipRect - this is a very case for e.g. ListView, where all background elements may now be a part of the same MergingDrawBatch. It is this more aggressive merging that groups together clipped background elements in the ListView case, enabling the overdraw avoidance skipping the window background. Change-Id: Ib0961977e272c5ac37f59e4c67d828467422d259
* Avoid 9patch cache lookups when possibleRomain Guy2013-06-111-1/+1
| | | | | | | This optimization saves up to 0.3ms per frame on the Play Store's front page, on a Nexus 4 device. Change-Id: Iaa4ef33c6e3b37e175efd5b9eea9ef59b43f14f3
* Introduce Caches::bindTexture() to reduce glBindTexture callsRomain Guy2013-06-041-2/+2
| | | | Change-Id: Ic345422567c020c0a9035ff51dcf2ae2a1fc59f4
* Make sure atlas antries can correctly filter/wrap texturesRomain Guy2013-05-241-1/+0
| | | | | | | | The virtual textures would each have their own values for wrapping and filtering which could lead to conflict and/or extraneous GL commands being issued. Change-Id: I64cb59a03e598f46bf645bd1d30fccfa63a07431
* Merge "Merge scaled bitmaps with translated bitmaps"Romain Guy2013-05-221-1/+2
|\
| * Merge scaled bitmaps with translated bitmapsRomain Guy2013-05-211-1/+2
| | | | | | | | Change-Id: I03089f48f97b69fcb4a0171984d3ff548d41c4a8
* | Use individual glyph positions to determine text bounds.Chris Craik2013-05-211-3/+6
|/ | | | | | | | | | | | | | | bug:8766924 Previously text bounds were calculated to be from 0 to totalAdvance in the X, and from the font's top to bottom. These are incorrect, especially in light of the font fallback mechanism. Now, we calculate the bounds of the text as we layout each glyph. Since these are much tighter bounds in the common case, this significantly reduces the amount of clipping required (which in turn enables more aggressive text merging). Change-Id: I172e5466bf5975bf837af894a9964c41db538746
* Add tessellation path for pointsChris Craik2013-05-141-2/+0
| | | | | | | | | | | | | | | | | | 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/+15
| | | | | | | | | 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-6/+28
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* Draw Operation mergingChris Craik2013-04-151-18/+41
| | | | | | | | | | | | | | | | | | Merge simple bitmap draw operations and text operations to avoid issuing individual gl draws for each operation. Merging other ops to be done eventually. The methods are different - the bitmap merging generates a single mesh for reused, unclipped images (esp. repeated images in a listview) The text approach queries just defers the normal font rendering until the last drawText in the sequence that can share the same shader. Patches are sorted and merged, but don't yet have a multiDraw implementation. For now, the pretending-to-merge gives better sorting behavior by keeping similar patches together. Change-Id: Ic300cdab0a53814cf7b09c58bf54b1bf0f58ccd6