[Android Software Development] Chainfire:
INSTALL ON HC/ICS/JB AT YOUR OWN PERIL ! - ITS NOT SUPPOSED TO WORK ON THOSE

SGS2 USERS: Upgrading to KG1 (2.3.4) or newer ROM will fix additional graphics glitches, if you are running an older SGS2 ROM.

About

Chainfire3D is an intermediary OpenGL driver. What does that mean? It means that Chainfire3D sits between your apps and the graphics drivers, and can intercept and/or change commands between the two. It has some built-in functions, and can be further extended with plugins to provide extra functionality.

Features

- CF3D OpenGL driver

- NightMode (inspired by Jeff Sharkey, more info here)

--- Handy shortcut to toggle on/off

--- Supports red, green, blue, amber, salmon and custom (pro only) modes

- Global OpenGL manipulation

--- Reduce texture size

--- Reduce texture quality

--- Unroll textures

--- BGRA emulation

--- Load plugins

--- Replace shaders

--- (Pro) Disable Chainfire3D detection

--- (Pro) Dump all shaders

--- (Pro) Force depth buffer size (EGL)

--- (Pro) Force MSAA (MultiSample Anti-Aliasing) (EGL)

- (Pro) OpenGL manipulation on a per-app bases

- (Pro) Fix market settings

- (Pro) Manage installed plugins and shaders

- (Pro) Backup and restore settings, plugins and shaders

A bit more detail about some features

NightMode

NightMode reduces the number of colors on your screen, which on OLED screens saves a lot of battery. The various modes (especially red) are also great in low-light conditions, as they have less effect on your night-vision than a full-color screen

Generic note about textures

The features below are only used if a texture format is supported. Natively Chainfire3D only supports raw textures, but these can be extended through plugins.

Reduce texture size

This essentially cuts (supported) textures' resolution in half, which usually reduces memory use (4x) and improves performance, at the cost of slightly reducing texture quality. This is not compatible with all apps! For many 3D apps, this works, as the GPU stretches the graphics, but it does not work for many 2D apps.

Reduce texture quality

This converts 32-bit textures to 16-bit textures, reducing memory use (2x). This will lower texture quality, but for many games the difference isn't even visible. Whether this is actually faster or slower depends on your hardware.

Unroll textures

Converts non-32-bit textures to 32-bit. This should not influence texture quality, but it does use more memory. On some hardware this is faster than using 16-bit textures.

Disable BGRA emulation

Some GPU's do not support BGRA - in this case, Chainfire3D emulates BGRA support. Developers may not expect this (i.e., hardcode features for a specific GPU) and it may cause issues. If red and blue appear swapped in-app or in-game, enable this feature, and see if it helps.

Disable Chainfire3D detection

For compatibility reasons, Chainfire3D announces to applications that it is being used. Using this feature you can turn that off.

Depth buffer (per-app only)

Some apps expect a certain depth buffer size. Without setting this, they may not run (at all). This feature should only be used if an app specifically requires it - there is a good chance apps will NOT run if you change this setting the wrong way.

MSAA (MultiSample Anti-Aliasing) (per-app only)

Enabling MSAA drastically improves image quality at the cost of performance. Lines/edges become much smoother. Available options are automatic (the app decides), 4x, and 16x. Most apps don't enable MSAA themselves at all. The ARM Mali 400 MP (used in the SGS2) can even do 4xMSAA at no performance cost. Note that if your GPU does not support the level of MSAA requested, the app will likely not start at all.

Fix market settings

Plugins may add support for various features not normally supported by your hardware. Market, however, only reports the functionality your hardware provides. Using this feature, Chainfire3D will adjust Market so it also shows apps that require the features provided by the plugins. This is not useful without the plugins :)

Backup and restore settings

Backup and restore all app settings, plugins, shaders, etc to/from your SD card

Plugins / API

At the moment, the Plugin API is rather limited, but it does allow for some rather interesting plugins like Tegra2 / PowerVR / ATI texture emulation (see the API docs a post below). The idea is to further improve Chainfire3D so Plugins can manipulate the entire OpenGL data stream.

Shaders

From version v1.9, you can replace app's shaders with your own modified versions. See a few posts down for further details.

Pro version

As outlined above, the Pro version adds a little bit of functionality. Purchasing it will support my efforts.

Pro version - warez

Chainfire3D Pro is available from some warez sites, if you feel like ripping me off :) However I should warn you that none of those versions actually work as the real Pro version does.

Requirements

- OpenGL ES 2.0 (every 1ghz+ phone has this)

- SuperUser / Root

- Writable /system (it will try to remount system as read/write when needed, but the changes need to stick between reboots)

- S-OFF ?

- Having root access from recovery is a big plus to solve problems if you run into them (run "/system/lib/cf3d_uninstall.sh"

as root

to remove the driver and restore the old one)

CF3D driver installation

There is some risk involved, so you should have either root access in recovery, a CWM backup, or a firmware to flash handy. Nevertheless, the driver has been tested and found working on the following devices:

- HTC HD2

- Samsung Galaxy S

- Samsung Galaxy Tab 7"

- Samsung Galaxy S II

- Samsung Epic 4G

- Motorola Atrix 4G

- Motorola Droid 2

- LG Optimus 2X

- Google Nexus S

It's likely to work on far more devices. So far nobody has reported a failed install, so that's good. Doesn't mean problems can't happen.

Download

Market link (mobile): market://details?id=eu.chainfire.cf3d

Market link (desktop): https://market.android.com/details?id=eu.chainfire.cf3d

Note: If you were running the "CF3D :: NightMode" application earlier, you should uninstall it before installing this.