9

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?

Felipe Lira
  • 1,246
  • 1
  • 11
  • 16
  • 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 – Alan Wolfe Aug 24 '15 at 23:36
  • Desktop or mobile? Uniforms can be surprisingly costly on some mobile GPUs. – Noah Witherspoon Aug 31 '15 at 21:50

1 Answers1

2

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)

yuriks
  • 1,140
  • 10
  • 16