hrydgard/ppsspp — pull request #6853 by unknownbrackets (2014-09-07 17:21:07+00:00)
Title: Cache fragment test results using a texture

This keeps a cache of color/alpha test results, and looks up rather than computing.

This has the following potential advantages:
* Avoids rounding operations in the fragment shader (GPU likely can do texel rounding better.)
* Avoids possible lowp accuracy issues with rounding, e.g. on PowerVR.
* Enables the "not equal" test on PowerVR, which was statically disabled due to driver bugs.
* Supports bitwise masks even on cards which do not support bitwise operations.

However, it's possible this may be slower on some configurations. That's why I've left it an option for user benchmarking. If it's slower in cases, we could use it e.g. only on PowerVR, or only with masks != 0xFF, etc. Note that one source of slowness can be the driver.

Some potential areas of improvement, depending on benchmarks/etc.:
* Use a two dimensional texture, against e.g. ref, to reduce rebinding.
* Use always, even when against 0, to reduce rebinding and shader changes.
* Use a different texture format.
* Separate alpha and color to separate sampler units and bind separately (reduce binding overhead.)

-[Unknown]