KhronosGroup / MoltenVK

MoltenVK is a Vulkan Portability implementation. It layers a subset of the high-performance, industry-standard Vulkan graphics and compute API over Apple's Metal graphics framework, enabling Vulkan applications to run on macOS, iOS and tvOS.
Apache License 2.0
4.76k stars 419 forks source link

Return MoltenVK log level string in pMessageIdName field of debug utils callback data #2224

Closed SRSaunders closed 5 months ago

SRSaunders commented 5 months ago

Fixes #2219.

Previously the pMessageIdName field of debug utils callback data was set to nullptr, i.e. no messageId name. To provide more context and information to the user, we now fill this field with the MoltenVK log level string. This, combined with the pMessage string, shows the severity of the message in textual form, and indicates that it comes from MoltenVK.

Note I have changed the mvkGetReportingLevelString() function declaration to inline - I hope this is appropriate.

Also, after making this change I wonder whether it should also be applied to the debug report callback code, i.e. replace _debugReportCallbackLayerPrefix with mvkGetReportingLevelString() for consistency? I don't want to break anything re automated testing scripts, etc. so I didn't make this change yet. However, I think it's a question worth asking.

billhollings commented 5 months ago

Also, after making this change I wonder whether it should also be applied to the debug report callback code, i.e. replace _debugReportCallbackLayerPrefix with mvkGetReportingLevelString() for consistency? I don't want to break anything re automated testing scripts, etc. so I didn't make this change yet. However, I think it's a question worth asking.

Hmmm...I'm not sure. It's kind of arbitrary, but PFN_vkDebugReportCallbackEXT:: pLayerPrefix seems to be about layer identification, so "MoltenVK" seems appropriate to me.

SRSaunders commented 5 months ago

UPDATE: by changing to constexpr, I am now getting a bunch of these for the static library build configs:

ISO C++11 does not allow conversion from string literal to 'char *'