gen_vulkan: fix 64-bit ABI (handles, dup members, bitflags/sTypes)

The generated offsets/sizes were wrong on the 64-bit ABI because of
three registry-parsing bugs, which silently broke any struct carrying
a handle (swapchain, render pass, framebuffers, ...):

- handles: their name lives in a child <name> element, not a `name`
  attribute (e.g. <type category="handle"><type>VK_DEFINE_HANDLE</type>
  (<name>VkInstance</name>)</type>), so every handle fell through to
  the 4-byte default. Read the child element; handles are 8-byte
  pointers again (VkSwapchainCreateInfoKHR.surface @24, not @20).
- duplicated members: vk.xml lists some members once per API variant
  (api="vulkan" and api="vulkansc"); keep only the default Vulkan ones,
  else the field is emitted twice and inflates the struct size.
- constants: emit bitflags from `bitpos`, extension enums from
  `offset`+extension `number` (sTypes like ..._SWAPCHAIN_CREATE_INFO_KHR
  = 1000001000), SPEC_VERSION numerics and EXTENSION_NAME strings from
  inside <require>, and resolve aliases.

Verified against the system Vulkan header: 37 struct sizes/offsets
checked, 0 mismatches; suite still 130 green.
This commit is contained in:
Minus committed 2026-11-17 19:42:40 +00:00
1 parent 6f6f444beb
commit 920e672d29
8 files changed
+4582 -1613

No files matched your search

+16
View File
@@ -0,0 +1,16 @@
#version 450
layout(location = 0) out vec3 fragColor;
vec2 positions[3] = vec2[](
vec2( 0.0, -0.5),
vec2( 0.5, 0.5),
vec2(-0.5, 0.5)
);
vec3 colors[3] = vec3[](
vec3(1.0, 0.0, 0.0),
vec3(0.0, 1.0, 0.0),
vec3(0.0, 0.0, 1.0)
);
void main() {
gl_Position = vec4(positions[gl_VertexIndex], 0.0, 1.0);
fragColor = colors[gl_VertexIndex];
}