mkxp/shader
Jonas Kulla 541e24f678 Bitmap: Use more accurate HSV-based hue shift algorithm
The previously YIQ-based algorithm turned out to be both slow,
and horribly inaccurate.

Another algorithm based on rotating the color value in the
RGB cube along the diagonal axis was also considered, which was
acceptable in terms of accuracy, and very fast.

In the end, I decided on a HSV-based one, because it is by far
the most accurate one, while still being a tad faster than the
YIQ solution.
Algorithm source: gamedev.stackexchange.com/a/59808/24839

A very simple GPU time benchmark when shifting a 2048^2 bitmap:

         YIQ rot   RGB rot   HSV shift
radeon   13.4 ms   2.8 ms    11.4 ms
intel    13.0 ms   6.0 ms    10.5 ms

radeon: HD 3650 mobility
intel:  N3540 integrated (Baytrail)

However hue shifting has never shown up as a bottleneck before,
so these are more academic.
2016-10-30 08:50:45 +01:00
..
bitmapBlit.frag Shader: Refine preprocessing on GLES platform 2014-12-31 18:52:19 +01:00
blur.frag Shader: Refine preprocessing on GLES platform 2014-12-31 18:52:19 +01:00
blurH.vert Fix shader code. Thanks Mesa! 2013-10-02 15:00:17 +02:00
blurV.vert Fix shader code. Thanks Mesa! 2013-10-02 15:00:17 +02:00
common.h Shader: Refine preprocessing on GLES platform 2014-12-31 18:52:19 +01:00
flashMap.frag Shader: Refine preprocessing on GLES platform 2014-12-31 18:52:19 +01:00
flatColor.frag Graphics: Optimize Viewport effect rendering 2014-12-31 18:52:19 +01:00
gray.frag Graphics: Optimize Viewport effect rendering 2014-12-31 18:52:19 +01:00
hue.frag Bitmap: Use more accurate HSV-based hue shift algorithm 2016-10-30 08:50:45 +01:00
minimal.vert Graphics: Optimize Viewport effect rendering 2014-12-31 18:52:19 +01:00
plane.frag Shader: Refine preprocessing on GLES platform 2014-12-31 18:52:19 +01:00
simple.frag Remove the remaining bits of deprecated GL usage 2013-09-23 07:50:22 +02:00
simple.vert Remove unneeded shader uniform 2013-09-28 15:41:09 +02:00
simpleAlpha.frag Shader: Refine preprocessing on GLES platform 2014-12-31 18:52:19 +01:00
simpleAlphaUni.frag Sprite: Add special case shader for translucent effect 2014-12-31 18:52:19 +01:00
simpleColor.frag Shader: Refine preprocessing on GLES platform 2014-12-31 18:52:19 +01:00
simpleColor.vert Shader: Refine preprocessing on GLES platform 2014-12-31 18:52:19 +01:00
simpleMatrix.vert Shader: Refine preprocessing on GLES platform 2014-12-31 18:52:19 +01:00
sprite.frag Shader: Refine preprocessing on GLES platform 2014-12-31 18:52:19 +01:00
sprite.vert Remove the remaining bits of deprecated GL usage 2013-09-23 07:50:22 +02:00
tilemap.vert Shaders: Prefer arithmetic conditionals to branching 2014-12-31 18:52:20 +01:00
tilemapvx.vert Shaders: Prefer arithmetic conditionals to branching 2014-12-31 18:52:20 +01:00
trans.frag Shader: Refine preprocessing on GLES platform 2014-12-31 18:52:19 +01:00
transSimple.frag Remove the remaining bits of deprecated GL usage 2013-09-23 07:50:22 +02:00