This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Uniform blocks : Optimal qualifiers

Greetings,

I'm currently playing with OpenGL ES 3.0 and I'm wondering if Mali (>= T6xx) drivers can perform interesting optimisations based on the chosen layout qualifier applied to Interface Blocks  ? (shared, packed, std140, row_major, column_major)

The fact that Std140 avoids pinging the OpenGL implementation, about the data layout, makes me wonder if there's any reason to choose another layout qualifier.

  • If a uniform block is shared between multiple programs, is it useful to choose shared ? Even though the uniform block will just get its data from a Uniform Buffer Object ?
  • Does packed really provides useful memory optimisations for OpenGL programs ?
Parents
  • In general we recommend only using buffer objects for uniforms which are created on the GPU; direct set uniforms (glUniform*() in OpenGL ES, or push constants in Vulkan) give us far more freedom to handle them in the fastest possible way for any given shader.

    That said, we accept it's a trade off with application complexity so there isn't always a "right" answer, and the differences are probably marginal in the overall frame cost

    In general "packed" isn't worth using - keeping things naturally aligned ensures best access efficiency, and if you have enough uniforms that you start getting cache pressure that would benefit from packing then you're doing something wrong ...

Reply
  • In general we recommend only using buffer objects for uniforms which are created on the GPU; direct set uniforms (glUniform*() in OpenGL ES, or push constants in Vulkan) give us far more freedom to handle them in the fastest possible way for any given shader.

    That said, we accept it's a trade off with application complexity so there isn't always a "right" answer, and the differences are probably marginal in the overall frame cost

    In general "packed" isn't worth using - keeping things naturally aligned ensures best access efficiency, and if you have enough uniforms that you start getting cache pressure that would benefit from packing then you're doing something wrong ...

Children