nmg-vulkan icon indicating copy to clipboard operation
nmg-vulkan copied to clipboard

SPIR-V Warning in Font Shader

Open acgaudette opened this issue 5 years ago • 2 comments

DEBUG_REPORT:  [ UNASSIGNED-CoreValidation-Shader-InconsistentSpirv ] Object: VK_NULL_HANDLE (Type = 0) | SPIR-V module not valid: Structure id 27 decorated as Block must follow standard uniform buffer layout rules: member 1 at offset 12 overlaps previous member ending at offset 15
  OpFunctionEnd

Check the disassembly for more details on this. Might be because you're passing a vec2 after a vec3.

acgaudette avatar Aug 22 '18 02:08 acgaudette

Seems like a typical offset/padding issue.

acgaudette avatar Aug 22 '18 02:08 acgaudette

I did some digging. It turns out this is due to the Light struct in the base frag shader.

struct Light {
  vec3 vector;
  float radius;
  vec3 color;
  float intensity;
};

Because there is an array of this struct in the UBO, Vulkan complains about padding--namely, that the vec3 should have a vec4's worth of padding. You can "fix" it by using two vec4s instead of the current struct. It's not possible to manually specify offsets because it's a struct outside of a UBO declaration.

acgaudette avatar Sep 02 '18 21:09 acgaudette