From 20f3c173fe10bee6d04814d08bfe21e23c294cf8 Mon Sep 17 00:00:00 2001 From: Neil Roberts Date: Wed, 24 Jun 2009 12:04:55 +0100 Subject: [PATCH] [test-shader] Fix some of the shaders to use premultiplied colors Texture data is now in premultiplied format and the shader should output a premultiplied color if the default blend mode is being used. Shaders that directly manipulate the rgb values now unpremultiply and premultiply again afterwards. --- tests/interactive/test-shader.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/tests/interactive/test-shader.c b/tests/interactive/test-shader.c index ecb8d2251..3c59861bf 100644 --- a/tests/interactive/test-shader.c +++ b/tests/interactive/test-shader.c @@ -69,8 +69,10 @@ static ShaderSource shaders[]= FRAGMENT_SHADER_VARS "uniform float brightness, contrast;" FRAGMENT_SHADER_BEGIN + " color.rgb /= color.a;" " color.rgb = (color.rgb - vec3(0.5, 0.5, 0.5)) * contrast + " "vec3 (brightness + 0.5, brightness + 0.5, brightness + 0.5);" + " color.rgb *= color.a;" FRAGMENT_SHADER_END }, @@ -118,7 +120,9 @@ static ShaderSource shaders[]= {"invert", FRAGMENT_SHADER_VARS FRAGMENT_SHADER_BEGIN + " color.rgb /= color.a;" " color.rgb = vec3(1.0, 1.0, 1.0) - color.rgb;\n" + " color.rgb *= color.a;" FRAGMENT_SHADER_END }, @@ -127,9 +131,11 @@ static ShaderSource shaders[]= "uniform float brightness;" "uniform float contrast;" FRAGMENT_SHADER_BEGIN + " color.rgb /= color.a;" " color.r = (color.r - 0.5) * contrast + brightness + 0.5;" " color.g = (color.g - 0.5) * contrast + brightness + 0.5;" " color.b = (color.b - 0.5) * contrast + brightness + 0.5;" + " color.rgb *= color.a;" FRAGMENT_SHADER_END },