mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-24 01:00:37 +00:00
gleffects: fix little rectangle that appears at the center of squeeze and tunnel effects
These two shader will calculate the vector length and use it as denominator. But length could be zero which will cause undefine behaviour. Add protection for this condition https://bugzilla.gnome.org/show_bug.cgi?id=767635
This commit is contained in:
parent
861ce43cd8
commit
5e8a650130
1 changed files with 4 additions and 2 deletions
|
@ -100,7 +100,8 @@ const gchar *squeeze_fragment_source_gles2 =
|
|||
"void main () {"
|
||||
" vec2 texturecoord = v_texcoord.xy;"
|
||||
" vec2 normcoord = texturecoord - 0.5;"
|
||||
" float r = length (normcoord);"
|
||||
/* Add a very small value to length otherwise it could be 0 */
|
||||
" float r = length (normcoord)+0.01;"
|
||||
" r = pow(r, 0.40)*1.3;"
|
||||
" normcoord = normcoord / r;"
|
||||
" texturecoord = (normcoord + 0.5);"
|
||||
|
@ -136,6 +137,7 @@ const gchar *tunnel_fragment_source_gles2 =
|
|||
* rect textures */
|
||||
" normcoord = (texturecoord - 0.5);"
|
||||
" float r = length(normcoord);"
|
||||
" if (r > 0.0)"
|
||||
" normcoord *= clamp (r, 0.0, 0.275) / r;"
|
||||
" texturecoord = normcoord + 0.5;"
|
||||
" gl_FragColor = texture2D (tex, texturecoord);"
|
||||
|
|
Loading…
Reference in a new issue