Update to zig 0.16.0, update deps, Vulkan validation fixes

This commit is contained in:
2026-05-13 00:43:49 +02:00
parent 39712e359d
commit 79c62141df
16 changed files with 204 additions and 137 deletions

View File

@@ -24,6 +24,7 @@ const Swapchain = @import("engine/Swapchain.zig");
const Textures = @import("assets/Textures.zig");
allocator: std.mem.Allocator,
io: std.Io,
engine: *Engine,
swapchain: *Swapchain,
global_descriptor_set_layout: vk.DescriptorSetLayout,
@@ -60,8 +61,8 @@ const chunk_descriptor_pool = 1024;
const camera_near_plane = 0.1;
pub fn init(allocator: std.mem.Allocator, engine: *Engine, swapchain: *Swapchain) !Game {
var stbi = media.stbi.init(allocator);
pub fn init(allocator: std.mem.Allocator, io: std.Io, engine: *Engine, swapchain: *Swapchain) !Game {
var stbi = media.stbi.init(allocator, io);
errdefer stbi.deinit();
var materials = try Materials.init(engine, allocator);
@@ -77,7 +78,7 @@ pub fn init(allocator: std.mem.Allocator, engine: *Engine, swapchain: *Swapchain
// will crash the game with segfault reading address 0x140 (presumably
// within librenderdoc.so).
blocks.loadAll(engine, &materials, &textures, &stbi, allocator);
blocks.loadAll(engine, &materials, &textures, &stbi, allocator, io);
const sampler = try engine.createSampler(.{
.mag_filter = .linear,
@@ -438,10 +439,10 @@ pub fn init(allocator: std.mem.Allocator, engine: *Engine, swapchain: *Swapchain
});
engine.setObjectName(global_descriptor_set, "DS Global", .{});
const block_grass = try blocks.getOrLoad(engine, &materials, &textures, &stbi, "Grass.json", allocator);
const block_dirt = try blocks.getOrLoad(engine, &materials, &textures, &stbi, "Dirt.json", allocator);
const block_stone = try blocks.getOrLoad(engine, &materials, &textures, &stbi, "Stone.json", allocator);
const block_bedrock = try blocks.getOrLoad(engine, &materials, &textures, &stbi, "Bedrock.json", allocator);
const block_grass = try blocks.getOrLoad(engine, &materials, &textures, &stbi, "Grass.json", allocator, io);
const block_dirt = try blocks.getOrLoad(engine, &materials, &textures, &stbi, "Dirt.json", allocator, io);
const block_stone = try blocks.getOrLoad(engine, &materials, &textures, &stbi, "Stone.json", allocator, io);
const block_bedrock = try blocks.getOrLoad(engine, &materials, &textures, &stbi, "Bedrock.json", allocator, io);
// VOLATILE Load all assets before this point
@@ -632,11 +633,21 @@ pub fn init(allocator: std.mem.Allocator, engine: *Engine, swapchain: *Swapchain
.elements = directional_lights_data,
});
var skybox = try Skybox.load("skybox.hdr", engine, &stbi, 512, global_uniforms.buffer, swapchain.render_pass, allocator);
var skybox = try Skybox.load(
"skybox.hdr",
engine,
&stbi,
512,
global_uniforms.buffer,
swapchain.render_pass,
allocator,
io,
);
errdefer skybox.deinit(engine);
return .{
.allocator = allocator,
.io = io,
.engine = engine,
.swapchain = swapchain,
.global_descriptor_set_layout = global_descriptor_set_layout,