summaryrefslogtreecommitdiffstatshomepage
path: root/src/osd/modules/render/bgfx/shaders/chains/misc/fs_lut.sc
diff options
context:
space:
mode:
Diffstat (limited to 'src/osd/modules/render/bgfx/shaders/chains/misc/fs_lut.sc')
-rw-r--r--src/osd/modules/render/bgfx/shaders/chains/misc/fs_lut.sc13
1 files changed, 6 insertions, 7 deletions
diff --git a/src/osd/modules/render/bgfx/shaders/chains/misc/fs_lut.sc b/src/osd/modules/render/bgfx/shaders/chains/misc/fs_lut.sc
index 2c8cffab7e1..6b00e4a1934 100644
--- a/src/osd/modules/render/bgfx/shaders/chains/misc/fs_lut.sc
+++ b/src/osd/modules/render/bgfx/shaders/chains/misc/fs_lut.sc
@@ -5,9 +5,9 @@ $input v_color0, v_texcoord0
#include "common.sh"
-#define LUT_TEXTURE_WIDTH 4096.0f
-#define LUT_SIZE 64.0f
-#define LUT_SCALE vec2(1.0f / LUT_TEXTURE_WIDTH, 1.0f / LUT_SIZE)
+// Autos
+uniform vec4 u_tex_size1;
+uniform vec4 u_inv_tex_size1;
SAMPLER2D(s_tex, 0);
SAMPLER2D(s_3dlut, 1);
@@ -17,13 +17,12 @@ void main()
vec4 bp = texture2D(s_tex, v_texcoord0);
vec3 color = bp.rgb;
// NOTE: Do not change the order of parameters here.
- vec3 lutcoord = vec3(color.rg * ((LUT_SIZE - 1.0f) + 0.5f) *
- LUT_SCALE, (LUT_SIZE - 1.0f) * color.b);
+ vec3 lutcoord = vec3(color.rg * ((u_tex_size1.y - 1.0) + 0.5) * u_inv_tex_size1.xy, (u_tex_size1.y - 1.0) * color.b);
float shift = floor(lutcoord.z);
- lutcoord.x += shift * LUT_SCALE.y;
+ lutcoord.x += shift * u_inv_tex_size1.y;
color.rgb = mix(texture2D(s_3dlut, lutcoord.xy).rgb,
- texture2D(s_3dlut, vec2(lutcoord.x + LUT_SCALE.y,
+ texture2D(s_3dlut, vec2(lutcoord.x + u_inv_tex_size1.y,
lutcoord.y)).rgb, lutcoord.z - shift);
gl_FragColor = vec4(color, bp.a) * v_color0;
}