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

wrong type for PfnDebugReportCallbackEXT? #158

Open
andrewrk opened this issue Sep 8, 2024 · 3 comments
Open

wrong type for PfnDebugReportCallbackEXT? #158

andrewrk opened this issue Sep 8, 2024 · 3 comments

Comments

@andrewrk
Copy link
Contributor

andrewrk commented Sep 8, 2024

 pub const PfnDebugReportCallbackEXT = ?*const fn (
     flags: DebugReportFlagsEXT,
     object_type: DebugReportObjectTypeEXT,
     object: u64,
     location: usize,
     message_code: i32,
     p_layer_prefix: ?*const u8,
-    p_message: ?*const u8,
+    p_message: [*:0]const u8,
     p_user_data: ?*anyopaque,
 ) callconv(vulkan_call_conv) Bool32;

According to https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/PFN_vkDebugReportCallbackEXT.html:

pMessage is a null-terminated UTF-8 string detailing the trigger conditions. pMessage is only valid for the duration of the callback.

@Snektron
Copy link
Owner

Snektron commented Sep 8, 2024

The spec is not descriptive enough for this: for structures each member is wrapped in a tag, and for commands, but nothing like that exists for the fuction pointers and implementations are left in the dark:

         <type category="funcpointer">typedef VkBool32 (VKAPI_PTR *<name>PFN_vkDebugReportCallbackEXT</name>)(
     <type>VkDebugReportFlagsEXT</type>                       flags,
     <type>VkDebugReportObjectTypeEXT</type>                  objectType,
     <type>uint64_t</type>                                    object,
     <type>size_t</type>                                      location,
     <type>int32_t</type>                                     messageCode,
     const <type>char</type>*                                 pLayerPrefix,
      const <type>char</type>*                                 pMessage,
     <type>void</type>*                                       pUserData);</type>

We can probably hardcode in the generator that char* will always be a [0:*]const u8 for now. It would be nice if the spec wasnt hyper optimized for C, though

@andrewrk
Copy link
Contributor Author

andrewrk commented Sep 8, 2024

I see. I suppose the other option here would be a set of overrides on top of the provided data.

@Snektron
Copy link
Owner

Snektron commented Sep 8, 2024

Yep, some parts are already handled like that. Ideally I'd get it 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