I discovered this thread after porting WarrenM's C++ sample myself. In your code you have declared your uniforms both in ShaderTypes.h and Swift. I believe the correct method is to have a single declaration in ShaderTypes.h and import it into Swift using the bridging header. Apparently the Swift compiler uses different padding and alignment rules for structs. C/C++ have compiler options for altering struct padding and alignment so it's a common issue. Nevertheless, thanks for your sample.
Topic:
Graphics & Games
SubTopic:
General
Tags: