summaryrefslogtreecommitdiffstats
path: root/libs/hwui/Texture.h
Commit message (Collapse)AuthorAgeFilesLines
* Fix issue with bitmap uploadingJohn Reck2014-04-141-0/+6
| | | | | | Bug: 13912749 Change-Id: Ic23fa1d280118dc93dc2716a4a24cc0bbbdca595
* Assume a texture is unbound after deleting itRomain Guy2013-06-061-1/+6
| | | | | | | | | | | Bug #9316260 The GL specification indicates that deleting a bound texture has the side effect of binding the default texture (name=0). This change replaces all calls to glDeleteTextures() by Caches::deleteTexture() to properly keep track of texture bindings. Change-Id: Ifbc60ef433e0f9776a668dd5bd5f0adbc65a77a0
* Introduce Caches::bindTexture() to reduce glBindTexture callsRomain Guy2013-06-041-62/+17
| | | | Change-Id: Ic345422567c020c0a9035ff51dcf2ae2a1fc59f4
* Make sure atlas antries can correctly filter/wrap texturesRomain Guy2013-05-241-4/+6
| | | | | | | | 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
* Pack preloaded framework assets in a texture atlasRomain Guy2013-05-021-0/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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 API to enable mipmaps on BitmapRomain Guy2012-10-161-1/+9
| | | | | | | | | Bug #7353771 This API can be used when scaling large images down to a small size to get nicer looking results. Change-Id: If09087eed36077eee5355f6047a3ca67747d7d9e
* Assign default texture id of 0Chet Haase2012-09-261-0/+2
| | | | | | | | | | Some logic depends on a default value of 0, which was not being assigned. Issue #7195815 chrome url bar is corrupted Issue #7190656 Textures corrupted on mr1 Change-Id: I346b7b76e885bf8f04740e711fd88f917a5418c7
* Various OpenGL optimizationsRomain Guy2011-12-121-1/+1
| | | | Change-Id: Ib0742c96f10f5f50e7e5148b742c31b6c232d127
* Optimize away unnecessary state changesRomain Guy2011-11-301-2/+12
| | | | Change-Id: I0f6816f9f6234853575ecee5033186ad19e76380
* Improve rendering performance on some GPUsRomain Guy2011-07-251-6/+39
| | | | | | | | This change sets textures filtering to GL_NEAREST by default. GL_LINEAR filtering is only used when textures are transformed with a scale or a rotation. This helps save a couple of fps on some GPUs. Change-Id: I1efaa452c2c79905f00238e54d886a37203a2ac1
* Use NEAREST filtering for layers whenever possible.Romain Guy2011-07-071-0/+20
| | | | Change-Id: Id5bee1bd4a322cf93e8000b08e18f1e1b058648e
* 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
* Don't change textures wrap modes on every draw.Romain Guy2010-10-251-0/+8
| | | | Change-Id: If6d3f313778cc7f3e803a063338539c8b3e165e3
* Fix possible infinite loop when purging textures.Romain Guy2010-09-081-0/+5
| | | | Change-Id: Ib05b398ae03e734da2dab0496df416fed4570b1c
* Automatically cleanup textures that don't fit in the cache.Romain Guy2010-08-061-0/+22
| | | | Change-Id: I4f29ed96ea11118b391fb957e1e4d1b8fcef1537
* Remove extra leftover logs and use uint32_t instead of unsigned int.Romain Guy2010-07-021-2/+2
| | | | Change-Id: I944f82fe3255de38dc04048cc8bd861f578f01a7
* Remove unnecessary return and add bitmap generation ID tracking.Romain Guy2010-06-301-0/+4
| | | | Change-Id: Icf5e0635e789f5ea53268c22fad51cf733b5b1a6
* Add hooks for drawBitmap().Romain Guy2010-06-301-0/+50
Change-Id: I58e962c3a8b2bc75c2605fe369ad3002579d86e0 Add texture cache. Change-Id: I1c0e5581d228869e114438258a1014e33e024ad7