'GLSL std140 layout for Arrays of Scalars
My quadrants were not rendering properly due to some sort padding or alignment issues with the UBO shown below, so I had a read of this PDF: http://ptgmedia.pearsoncmg.com/images/9780321552624/downloads/0321552628_AppL.pdf
I'm still confused about all this, but adding three uint padding values at the end seemed to sort it out for me. Based on the PDF, am I right to assume that this is happening because the struct Quadrant is an array of scalars, thus the "entire array is padded to be a multiple of the size of vec4"?
Is there a better way of doing things?
Verter Shader:
struct Quadrant
{
float xPos;
float yPos;
uint width;
uint height;
uint vTexIndex;
uint dump1, dump2, dump3;
};
layout(std140, set = 0, binding = 0) uniform QuadBuffer
{
Quadrant quads[MAX_QUADRANTS];
};
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
