8
$\begingroup$

I'd like to know if there's any performance impact based on how I struct my shader uniforms. For instance, is passing 4 floats worse than passing a single vec4?

$\endgroup$
  • $\begingroup$ This is going to be a zero net comment, but... just wanted to mention, if you are unsure of performance, you could profile and see. But, of course, there might be different characteristics on different hardware that you might not have access to, and you may not be aware of the ways it might be faster or slower. Like, texture reads are really cheap til you are texture read bound :P $\endgroup$ – Alan Wolfe Aug 24 '15 at 23:36
  • $\begingroup$ Desktop or mobile? Uniforms can be surprisingly costly on some mobile GPUs. $\endgroup$ – Noah Witherspoon Aug 31 '15 at 21:50
2
$\begingroup$

In any modern desktop hardware, there shouldn't be: uniform buffers will just be memory blobs read by the shader. (See also: Uniform Buffer Objects)

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.