Vulkan - UBO Constant buffer memory rules

Greetings,

in the Vulkan documentation regarding push constants it reads

“Note: Small, statically indexed UBOs may also be placed in constant buffers, but this behaviour is not guaranteed.”

https://docs.imgtec.com/Profiling_and_Optimisations/PerfRec/topics/c_PerfRec_vulkan_push_constants.html

Can someone tell me what rules one can follow with the current driver versions to make it as likely as possible that an UBO is stored in such a way?

Can the usage of constant buffers be verified from shader disassembly?

Regards

Hi Desperado,

To clarify “but this behaviour is not guaranteed” is because this depends on both the register usage required by the rest of the shader and the amount of each type of register for the target device. Basically if the ubo accesses are static and there’s enough space in the USC, the shader will load the data on-chip because why not.

The answer to the question “Can the usage of constant buffers be verified from shader disassembly?” is yes. but to understand the disassembly you’ll need to read the instruction set reference. and to get access to that you’ll need an NDA.

If you want to guarantee that a constant buffer is placed into the command buffer for fast access, then you can just declare it as a push constant instead of as a UBO.

All the best,
Lawrence.

© Imagination Technologies Limited. All rights reserved.
Privacy PolicyTerms & ConditionsTrademarksCookies