vulkan-zig
vulkan-zig copied to clipboard
Mark wrapper functions inline
Zig has well-defined return copy elision. If we define the wrapper functions to be inline, then many copies from a semantical view would be eliminated. For example:
pub fn getPhysicalDeviceProperties(
self: Self,
physical_device: PhysicalDevice,
) callconv(.Inline) PhysicalDeviceProperties {
var properties: PhysicalDeviceProperties = undefined;
self.dispatch.vkGetPhysicalDeviceProperties(
physical_device,
&properties,
);
return properties;
}
Wow sorry, I completely missed this issue. Considering that this is mostly just a light-weight wrapper, I think there is no downside into making these function inline (there shouldn't be too much extra processing time).
I was new to Zig. Lately I found that we could just write pub inline fn, simpler than my original proposal