I know that when you pass structures as uniforms to the GPU, they need to be 16-byte aligned. But sometimes I get an error that doesn't make sense to me. FOr example, I am getting this error now:
failed assertion `(length - offset)(64) must be >= 80 at buffer binding at index 1 for uniforms[0].'
This is the structure:
struct fontFragmentUniforms {
var _colorGlowUniform:float4 = float4(1.0,0.0,0.0,1.0)
var _colorOutlineUniform:float4 = float4(1.0,0.0,0.0,1.0)
var _glowThickness:Float = 0.0
var _outlineThickness:Float = 0.0
var _rippleCenter:Float = 0.0
var _rippleRange:Float = 0.0
var _smoothing:Float = 0.0
var dummy1:Float = 0.0
var _glow:UInt8 = 0
var _outline:UInt8 = 0
var _shadow:UInt8 = 0
var _ripple:UInt8 = 0
var _d1:UInt8 = 0
var _d2:UInt8 = 0
var _d3:UInt8 = 0
var _d4:UInt8 = 0
}
I added variables 'dummy1' and 'd1' through'd4' to pad the size to 64 bytes. So why does it want me to send a structure of size 80 or more? Does the string of UInt8's have to start on a 16 byte boundary also?