BufferLayout.lua 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. return {
  2. description = [[
  3. The different ways to pack Buffer fields into memory.
  4. The default is `packed`, which is suitable for vertex buffers and index buffers. It doesn't add
  5. any padding between elements, and so it doesn't waste any space. However, this layout won't
  6. necessarily work for uniform buffers and storage buffers.
  7. The `std140` layout corresponds to the std140 layout used for uniform buffers in GLSL. It adds
  8. the most padding between fields, and requires the stride to be a multiple of 16. Example:
  9. layout(std140) uniform ObjectScales { float scales[64]; };
  10. The `std430` layout corresponds to the std430 layout used for storage buffers in GLSL. It adds
  11. some padding between certain types, and may round up the stride. Example:
  12. layout(std430) buffer TileSizes { vec2 sizes[]; }
  13. ]],
  14. values = {
  15. {
  16. name = 'packed',
  17. description = 'The packed layout, without any padding.'
  18. },
  19. {
  20. name = 'std140',
  21. description = 'The std140 layout.'
  22. },
  23. {
  24. name = 'std430',
  25. description = 'The std430 layout.'
  26. }
  27. },
  28. related = {
  29. 'lovr.graphics.newBuffer',
  30. 'lovr.graphics.getBuffer',
  31. 'Buffer:getFormat',
  32. 'Buffer:getStride',
  33. 'FieldType'
  34. }
  35. }