0
votes

In case of treating many kind of materials, some information are omitted because they are not needed. and if they are not handled, CPU will pass nothing to GPU(or vertex to frag).

In this case, should I concern if variables(especially uniforms) are correct(passed) or not in the shader?

Or, should I handle variables in CPU and trust that variables are correct(passed) in the shader?

1

1 Answers

0
votes

Uniforms: You should at least know what is in that uniform and if that value can affect result.

Default value is zero as stated here.

Other than that, there can be any value, you stored here last time and it depends only on your code if it can affect result in any way. It's better to "upload" current values or zeros so you don't have to check it.

In: Input values are depending on current input array you are passing in and you can control only source of these informations. Without it, shaders don't have much sense. These arrays control number of instances of shaders.


Either way, if you pass variables correctly, they will be correct in shader too. Checking this is sometimes quite hard, but it can be done. For example by reading from frame buffer.