Fix checking for device extensions
This commit is contained in:
parent
73a30b9d03
commit
e0aa4bb09c
1 changed files with 7 additions and 17 deletions
|
@ -8,14 +8,6 @@ const enable_validation_layers = true;
|
|||
const validation_layers = [_][*:0]const u8{"VK_LAYER_KHRONOS_validation"};
|
||||
|
||||
const apis: []const vk.ApiInfo = &.{
|
||||
// .{
|
||||
// .base_commands = .{
|
||||
// .createInstance = true,
|
||||
// },
|
||||
// .instance_commands = .{
|
||||
// .createDevice = true,
|
||||
// },
|
||||
// },
|
||||
vk.features.version_1_0,
|
||||
vk.features.version_1_1,
|
||||
vk.features.version_1_2,
|
||||
|
@ -60,13 +52,13 @@ pub const VulkanRenderer = struct {
|
|||
|
||||
self.vkb = try BaseDispatch.load(try sdl.vulkan.getVkGetInstanceProcAddr());
|
||||
|
||||
const instance = try self.createInstance();
|
||||
const instance_handle = try self.createInstance();
|
||||
|
||||
const vki = try allocator.create(InstanceDispatch);
|
||||
errdefer allocator.destroy(vki);
|
||||
vki.* = try InstanceDispatch.load(instance, self.vkb.dispatch.vkGetInstanceProcAddr);
|
||||
vki.* = try InstanceDispatch.load(instance_handle, self.vkb.dispatch.vkGetInstanceProcAddr);
|
||||
|
||||
self.instance = Instance.init(instance, vki);
|
||||
self.instance = Instance.init(instance_handle, vki);
|
||||
self.surface = try sdl.vulkan.createSurface(self.window, self.instance.handle);
|
||||
|
||||
if (enable_validation_layers) {
|
||||
|
@ -74,13 +66,13 @@ pub const VulkanRenderer = struct {
|
|||
}
|
||||
|
||||
self.physical_device = try self.getPhysicalDevice();
|
||||
const device = try self.createLogicalDevice();
|
||||
const device_handle = try self.createLogicalDevice();
|
||||
|
||||
const vkd = try allocator.create(DeviceDispatch);
|
||||
errdefer allocator.destroy(vkd);
|
||||
vkd.* = try DeviceDispatch.load(device, self.instance.wrapper.dispatch.vkGetDeviceProcAddr);
|
||||
vkd.* = try DeviceDispatch.load(device_handle, self.instance.wrapper.dispatch.vkGetDeviceProcAddr);
|
||||
|
||||
self.device = Device.init(device, vkd);
|
||||
self.device = Device.init(device_handle, vkd);
|
||||
const queues = try self.getDeviceQueues();
|
||||
|
||||
self.graphics_queue = Queue.init(queues[0], vkd);
|
||||
|
@ -178,15 +170,13 @@ pub const VulkanRenderer = struct {
|
|||
return false;
|
||||
}
|
||||
|
||||
std.debug.print("Ext count: {d}\n", .{prop_count});
|
||||
const props = try self.allocator.alloc(vk.ExtensionProperties, prop_count);
|
||||
defer self.allocator.free(props);
|
||||
|
||||
_ = try self.vkb.enumerateDeviceExtensionProperties(null, &prop_count, props.ptr);
|
||||
_ = try self.instance.enumerateDeviceExtensionProperties(pdev, null, &prop_count, props.ptr);
|
||||
|
||||
for (Utilities.device_extensions) |device_extension| {
|
||||
for (props) |prop| {
|
||||
// std.debug.print("Ext: {s}\n", .{&prop.extension_name});
|
||||
if (std.mem.eql(u8, std.mem.sliceTo(&prop.extension_name, 0), std.mem.span(device_extension))) {
|
||||
break;
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue