* tests/test-shader.c: fix incompatible types in shader programs

Apparently floats can't be multiplied or divided with ints without
explicit type casts. Use 2.0 or float(var) where appropriate. Patch
from Tommi Komulainen (#715).
This commit is contained in:
Øyvind Kolås 2008-01-21 11:27:53 +00:00
parent 92954a76a7
commit e58d0d7f34
2 changed files with 13 additions and 5 deletions

View File

@ -1,3 +1,11 @@
2008-01-21 Øyvind Kolås <pippin@gimp.org>
* tests/test-shader.c: fix incompatible types in shader programs
Apparently floats can't be multiplied or divided with ints without
explicit type casts. Use 2.0 or float(var) where appropriate. Patch
from Tommi Komulainen (#715).
2008-01-19 Emmanuele Bassi <ebassi@openedhand.com>
* clutter/clutter-main.c (generate_enter_leave_events): Do not

View File

@ -44,11 +44,11 @@ static ShaderSource shaders[]=
" for (u=-radius;u<radius;u++)"
" for (v=-radius;v<radius;v++)"
" {"
" color += texture2DRect(rectTexture, vec2(gl_TexCoord[0].s + u * 2, gl_TexCoord[0].t +v * 2));"
" color += texture2DRect(rectTexture, vec2(gl_TexCoord[0].s + u * 2.0, gl_TexCoord[0].t +v * 2.0));"
" count ++;"
" }"
""
" gl_FragColor = color / count;"
" gl_FragColor = color / float(count);"
"}"
},
{"brightness-contrast.asm",
@ -103,7 +103,7 @@ static ShaderSource shaders[]=
"void main ()"
"{"
" vec4 color = texture2DRect (tex, vec2(gl_TexCoord[0].st));"
" float avg = (color.r + color.g + color.b) / 3;"
" float avg = (color.r + color.g + color.b) / 3.0;"
" color.r = avg;"
" color.g = avg;"
" color.b = avg;"
@ -116,11 +116,11 @@ static ShaderSource shaders[]=
"{"
" vec4 color = texture2DRect (tex, vec2(gl_TexCoord[0].st));"
" vec4 colorB = texture2DRect (tex, vec2(gl_TexCoord[0].ts));"
" float avg = (color.r + color.g + color.b) / 3;"
" float avg = (color.r + color.g + color.b) / 3.0;"
" color.r = avg;"
" color.g = avg;"
" color.b = avg;"
" color = (color + colorB)/2;"
" color = (color + colorB)/2.0;"
" gl_FragColor = color;"
"}",
},