Skip to main content
added 155 characters in body
Source Link

If you mean: Can I compute a variable in the first fragment and pass it around? No, not like that. The fragments are processed in parallel.

If you need to do that, compute the variable CPU side and pass it in as a uniform. If you needed to do a lot of computation you could output to a texture or a buffer and then read it back, but you only need one float from the sounds of it.

If you mean: Can I compute a variable in the first fragment and pass it around? No, not like that. The fragments are processed in parallel.

If you need to do that, compute the variable CPU side and pass it in as a uniform.

If you mean: Can I compute a variable in the first fragment and pass it around? No, not like that. The fragments are processed in parallel.

If you need to do that, compute the variable CPU side and pass it in as a uniform. If you needed to do a lot of computation you could output to a texture or a buffer and then read it back, but you only need one float from the sounds of it.

Source Link

If you mean: Can I compute a variable in the first fragment and pass it around? No, not like that. The fragments are processed in parallel.

If you need to do that, compute the variable CPU side and pass it in as a uniform.