Snektron/vulkan-zig

sometimes nested pointer parsing is incorrect

Closed this issue · 4 comments

I noticed this in vkCmdBuildAccelerationStructuresKHR -- vulkan-zig expects the ppBuildRangeInfos field to be [*]const *const vk.AccelerationStructureBuildRangeInfoKHR, whereas it should be [*]const [*]const vk.AccelerationStructureBuildRangeInfoKHR.

Haven't spent enough time looking at the pointer-parsing code to see why this might be, or what other cases this might affect. It seems that vk.xml doesn't provide useful information here.

Sorry for not responding - vulkan-zig infers whether a pointer should me many or single from the len attribute on a <param> tag in a command. This is a comma-separated list of things that indicate the length of each rank of the pointer, usually an expression or null-terminated. It looks like in the case of vkCmdBuildAccelerationStructuresKHR there is only one such name, and so the fallback - single a item pointer - is chosen for the inner type.

Seems like there are a number of similar cases, and theyre all resolved by changing the fallback from a single-item pointer to many. I guess its not really a proper solution, but given that there seem to be no regressive cases it seems fine to me.

Makes sense to me, the fallback is used when you don’t know anything, so it should be the most general thing.

fixed in be59386