Shaders: Prefer arithmetic conditionals to branching
This commit is contained in:
parent
373b90af00
commit
2f95c0613a
2 changed files with 8 additions and 6 deletions
|
@ -18,8 +18,9 @@ const float atAniOffset = 32.0*3.0;
|
|||
void main()
|
||||
{
|
||||
vec2 tex = texCoord;
|
||||
if (tex.x <= atAreaW && tex.y <= atAreaH)
|
||||
tex.x += aniIndex * atAniOffset;
|
||||
|
||||
lowp float pred = float(tex.x <= atAreaW && tex.y <= atAreaH);
|
||||
tex.x += aniIndex * atAniOffset * pred;
|
||||
|
||||
gl_Position = projMat * vec4(position + translation, 0, 1);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue