Appendix H. Buffer Object Layouts

This appendix describes ways to deterministically lay out buffers that are shared among multiple readers or writers. It has the following major sections:

• “Using Standard Layout Qualifiers

• “The std140 Layout Rules

• “The std430 Layout Rules

Using Standard Layout Qualifiers

When you group a number of variables in a uniform buffer or shader storage buffer, and you want to read or write their values outside a shader, you need to know the offset of each one. You can query these offsets, but for large collections of uniforms, this process requires many queries and is cumbersome. As an alternative, the standard layout qualifiers request that the GLSL shader compiler organize the variables according to a set ...

Get OpenGL® Programming Guide: The Official Guide to Learning OpenGL®, Version 4.5 with SPIR-V, Ninth Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.