Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Generator does not parse struct "VkCudaLaunchInfoNV" #109

Closed
SiebrenW opened this issue Oct 21, 2023 · 1 comment
Closed

Generator does not parse struct "VkCudaLaunchInfoNV" #109

SiebrenW opened this issue Oct 21, 2023 · 1 comment

Comments

@SiebrenW
Copy link

When trying to generate the zig file from the latest (as of writing) vk.xml file: https://raw.githubusercontent.com/KhronosGroup/Vulkan-Docs/463f8c616f49fb83ae4736de0d84b0048a7c76e2/xml/vk.xml
I got a runtime InvalidRegistry error in parsePointerMeta in the else case of the it.next().
With the debugger I found it had to do with paramCount, which was only added in VkCudaLaunchInfoNV, so when I commented this out, it seemed to work. I don't think this should be deemed as a solution.
I don't know whether the XML is wrong (looks fine to me though) or the generator is missing something, but I do think this needs solving.
The output (I formatted, so the line nr may not be the same as in git):

error: InvalidRegistry
/home/tates/projects/vulkan-zig/generator/vulkan/parse.zig:346:17: 0x24c86c in parsePointerMeta (generator)
                return error.InvalidRegistry;
                ^
/home/tates/projects/vulkan-zig/generator/vulkan/parse.zig:240:9: 0x24de0e in parseContainer (generator)
        try parsePointerMeta(.{ .container = members }, &member.field_type, member_elem);
        ^
/home/tates/projects/vulkan-zig/generator/vulkan/parse.zig:73:28: 0x24ee69 in parseTypes (generator)
                break :blk try parseContainer(allocator, ty, false, api);
                           ^
/home/tates/projects/vulkan-zig/generator/vulkan/parse.zig:48:14: 0x252c5c in parseDeclarations (generator)
    count += try parseTypes(allocator, decls, types_elem, api);
             ^
/home/tates/projects/vulkan-zig/generator/vulkan/parse.zig:27:18: 0x259fbd in parseXml (generator)
        .decls = try parseDeclarations(allocator, root, api),
                 ^
/home/tates/projects/vulkan-zig/generator/vulkan/generator.zig:103:24: 0x25a552 in init (generator)
        const result = try parseXml(allocator, spec, api);
                       ^
/home/tates/projects/vulkan-zig/generator/vulkan/generator.zig:210:12: 0x27215b in generate__anon_4124 (generator)
        => return error.InvalidRegistry,
           ^
/home/tates/projects/vulkan-zig/generator/main.zig:78:5: 0x2745d2 in main (generator)
    try generator.generate(allocator, api, xml_src, out_buffer.writer());
    ^

And to be more specific, I commented out the lines 7518 to 7633 in the vk.xml file to avoid the above error.

@Snektron
Copy link
Owner

Seems like the spec is actually invalid for this particular struct.

<member optional="true" len="paramCount">const <type>void</type>* const *    <name>pParams</name></member>

optional is supposed to have one bool for each pointer, but it doesn't, and so the generator doesn't know what to do anymore. I've changed this for now to work around the problem by assuming that it is optional, though really it should be fixed in the spec.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants