Loading materials and textures

This commit is contained in:
2025-11-22 00:41:56 +01:00
parent 63a8eee18c
commit bf0224ccd8
16 changed files with 563 additions and 626 deletions

View File

@@ -4,6 +4,7 @@ const std = @import("std");
const vk = @import("vulkan");
const Engine = @import("Engine.zig");
const QSM = @import("QueueSharingMode.zig");
engine: *Engine,
params: Params,
@@ -92,12 +93,7 @@ pub fn recreate(self: *Swapchain) !void {
const surface_capabilities = try self.engine.instance.getPhysicalDeviceSurfaceCapabilitiesKHR(self.engine.physical_device, mode.surface);
const graphics_queue_family = self.engine.graphics_queue.allocation.family;
const presentation_queue_family = mode.presentation_queue.allocation.family;
const single_queue_family = graphics_queue_family == presentation_queue_family;
const queue_family_indices: []const u32 = if (single_queue_family) &.{} else &.{ graphics_queue_family, presentation_queue_family };
const qsm = QSM.resolve(self.engine.graphics_queue.allocation.family, mode.presentation_queue.allocation.family);
const new_swapchain = try self.engine.device.createSwapchainKHR(&.{
.surface = mode.surface,
.min_image_count = self.params.image_count,
@@ -106,9 +102,9 @@ pub fn recreate(self: *Swapchain) !void {
.image_extent = extent,
.image_array_layers = 1,
.image_usage = .{ .color_attachment_bit = true },
.image_sharing_mode = if (single_queue_family) .exclusive else .concurrent,
.queue_family_index_count = @intCast(queue_family_indices.len),
.p_queue_family_indices = queue_family_indices.ptr,
.image_sharing_mode = qsm.sharing_mode,
.queue_family_index_count = qsm.queue_family_index_count,
.p_queue_family_indices = qsm.p_queue_family_indices,
.pre_transform = surface_capabilities.current_transform,
.composite_alpha = .{ .opaque_bit_khr = true },
.present_mode = .fifo_khr,