clarify lifetime of objects passed to Debug Utils label functions #152
Labels
clarification
Reflects a spec clarification request
synced to gitlab
A corresponding issue has been filed in the Khronos internal GitLab
vendor-extension
waiting for reporter
Need more info or a revision
Example 3 in 12.26. XR_EXT_debug_utils describes the data passed to the callback at two different points as
which suggests the callback data contains pointers to the original
XrDebugUtilsLabelEXT
structures passed topfnSessionBeginDebugUtilsLabelRegionEXT
orpfnSessionInsertDebugUtilsLabelEXT
, rather than a copy owned by the runtime.If that is the case, it should be reconsidered or made very explicit and the example should probably be changed to allocate
individual_label
on the heap rather than stack since in generalInsert
ed labels will probably last longer than the function that added them.If the mention of the specific structures was just illustrative and not intended to mean it was actually the same structure, it would be nice to clarify that the pointers to the
XrDebugUtilsLabelEXT
struct and the contained string do not need to remain valid after the call toBegin
orInsert
the label (and that those functions must not store them indefinitely.)Many languages can't easily build long-lived C struct on the stack as in the example, and might need to translate their own native string types, so can be expected to allocate and free both around each call. Even in C, though, I'd probably wrap those functions in something that accepts a string and passes it in a stack-allocated struct local to the wrapper function.
Not sure if any other functions accept similar potentially long-lived data, if so it might be better to put something like that in the implicit validity section.
The text was updated successfully, but these errors were encountered: