Multiple writes to gl_FragColor within main

Hi all,

I had to modify a little shader wrote in GLSL someone else than me wrote. In this shader, there are several lines like this:


gl_FragColor = ...

From what I am use to do (and from what I read here and there), I always write the color to a temporary value (a vec4) and at the end of the main function, effectively write to gl_FragColor.

I tried to find out if this could be a performance issue (since there are several write calls to the fragment), but could achieve to find anything related.

So I hope some people here could say me if that’s not a problem at all, or if we should write to a temporary value to avoid effective writes to the fragment color.

Regards.

The compiler will create a temporary automatically, if it needs one.

Thanks for this quick answer.

This topic was automatically closed 183 days after the last reply. New replies are no longer allowed.