BeRo1985 / pasvulkan

Vulkan header generator, OOP-style API wrapper, framework and prospective Vulkan-based game engine for Object Pascal
zlib License
191 stars 30 forks source link

Possible incorrect constant value. #7

Closed chapmanworld closed 6 years ago

chapmanworld commented 6 years ago

I'm currently working on my own header generator and came across a bug in my output. Under the enum VkStructureType = (), my generator creates two values for

VK_STRUCTURE_TYPE_DEVICE_GROUP_PRESENT_CAPABILITIES_KHR = 1000001007, VK_STRUCTURE_TYPE_DEVICE_GROUP_PRESENT_CAPABILITIES_KHR = 1000060007

I'm still debugging my output, but I compared my results to both your generated header (Vulkan.pas) and the official vulkan header (vulkan_core.h). Yours appears to use the first value (1000001007), while the vulkan_core.h contains this:

VK_STRUCTURE_TYPE_DEVICE_GROUP_PRESENT_CAPABILITIES_KHR = 1000060007,

Assuming vulkan_core.h is correct, it appears you may have an issue in your generator.

chapmanworld commented 6 years ago

It turns out that in the vk.xml file this enum is defined twice, the first definition is the one which is in error. I assume your code watches for and excludes duplicates, which is why you're getting the wrong value.....

       <extension name="VK_KHR_swapchain" number="2" type="device" requires="VK_KHR_surface" author="KHR" contact="James Jones @cubanismo,Ian Elliott @ianelliottus" supported="vulkan">
            <require> 
                <enum extends="VkStructureType" extnumber="61"  offset="7"      name="VK_STRUCTURE_TYPE_DEVICE_GROUP_PRESENT_CAPABILITIES_KHR"/>

In this case the <enum> node is the child of an <extension> node where the extension number is "2", however, the <enum> node has a 'extnumber' attribute with a value of "61" - being more local, the 'extnumber' attribute should override the extension number obtained from the <extension> node.

The correct value here should be

VK_STRUCTURE_TYPE_DEVICE_GROUP_PRESENT_CAPABILITIES_KHR = 1000060007

BeRo1985 commented 6 years ago

Look at https://github.com/LWJGL/lwjgl3-generated/blob/master/vulkan/src/generated/java/org/lwjgl/vulkan/KHRSwapchain.java where the value 1000001007 is also used. So please report it rather at https://github.com/KhronosGroup/Vulkan-Docs/issues since it seems to be rather a issue of the vk.xml itself.

chapmanworld commented 6 years ago

This is not a problem with the vk.xml.

1) The vk.xml file provides an attribute for overriding the extension number.

2) My references are the official Vulkan-Docs and Vulkan-Headers repositories, which are in agreement, however you are referencing a third-party header generator for Java, which appears to also be in error.