load the instance proc addr from vkb instead of the loader

Am honestly not sure if this is objectively better, but I can imagine that it's cleaner to rely on GLFW proc only to load the vkb. then rely on the vkb for everything else after that.
Feedback is appreciated!
This commit is contained in:
Codotaku
2023-06-03 23:46:05 +01:00
committed by GitHub
parent a795a6d5cf
commit 21383ef259

View File

@@ -7,6 +7,7 @@ const required_device_extensions = [_][*:0]const u8{vk.extension_info.khr_swapch
const BaseDispatch = vk.BaseWrapper(.{ const BaseDispatch = vk.BaseWrapper(.{
.createInstance = true, .createInstance = true,
.getInstanceProcAddr = true,
}); });
const InstanceDispatch = vk.InstanceWrapper(.{ const InstanceDispatch = vk.InstanceWrapper(.{
@@ -114,7 +115,7 @@ pub const GraphicsContext = struct {
.pp_enabled_extension_names = @ptrCast([*]const [*:0]const u8, glfw_exts), .pp_enabled_extension_names = @ptrCast([*]const [*:0]const u8, glfw_exts),
}, null); }, null);
self.vki = try InstanceDispatch.load(self.instance, c.glfwGetInstanceProcAddress); self.vki = try InstanceDispatch.load(self.instance, self.vkb.dispatch.vkGetInstanceProcAddr);
errdefer self.vki.destroyInstance(self.instance, null); errdefer self.vki.destroyInstance(self.instance, null);
self.surface = try createSurface(self.instance, window); self.surface = try createSurface(self.instance, window);