View Full Version : Evaluation of flat variables

10-03-2011, 08:24 AM
I couldn't find this information anywhere. I was wondering if flat variables are evaluated only for the provoking vertex, as the first impression is that they aren't. Which would be a waste, obviously. Or maybe the answer is so obvious that there is no need to specify it.


Alfonse Reinheart
10-03-2011, 11:12 AM
What do you mean by "evaluated"?

10-03-2011, 11:26 AM
well, if I have an assignment like myFlatVariable = <whateverComplexExpression>, then I mean computing whateverComplexExpression. I guess I can't pretend to have more complex definitions.

Alfonse Reinheart
10-03-2011, 02:47 PM
You can safely assume that they will be evaluated at every vertex. It is permissible for an implementation to not evaluate it, but the structure of graphics hardware makes that impossible.

GPUs like a lot of executions of the same code running in lock-step. If some vertex shaders execute code and some don't, then they're not all running in lock-step. And that's bad.

10-04-2011, 02:25 AM
Ah, good to know. Thanks