9
$\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$
2
  • $\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, 2015 at 23:36
  • $\begingroup$ Desktop or mobile? Uniforms can be surprisingly costly on some mobile GPUs. $\endgroup$ Aug 31, 2015 at 21:50

1 Answer 1

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 and acknowledge that you have read and understand our privacy policy and code of conduct.

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