adding specialization management to compute pipelines
All checks were successful
Build / build (push) Successful in 1m53s
Test / build_and_test (push) Successful in 56m23s

This commit is contained in:
2026-03-30 04:48:05 +02:00
parent c0e2451f5f
commit 95c6af284e
2 changed files with 14 additions and 2 deletions

View File

@@ -59,8 +59,8 @@
.lazy = true,
},
.SPIRV_Interpreter = .{
.url = "git+https://git.kbz8.me/kbz_8/SPIRV-Interpreter#6c8b364c7d6fd8a4b199649011487a7c243cb849",
.hash = "SPIRV_Interpreter-0.0.1-ajmpn20rBACYd5tvl13JKU_MWx1ZmCClKKFIq5QF8jA1",
.url = "git+https://git.kbz8.me/kbz_8/SPIRV-Interpreter#8072d671af8423e8dc70c27caf386f2b206c17e2",
.hash = "SPIRV_Interpreter-0.0.1-ajmpn5wyBADtKrr1Dt1tl8XuhdSNaXpfO4-QrLa1lDSS",
},
},

View File

@@ -70,6 +70,18 @@ pub fn createCompute(device: *base.Device, allocator: std.mem.Allocator, cache:
std.log.scoped(.SpvRuntimeInit).err("SPIR-V Runtime failed to initialize, {s}", .{@errorName(err)});
return VkError.Unknown;
};
if (info.stage.p_specialization_info) |specialization| {
if (specialization.p_map_entries) |map| {
const data: []const u8 = @as([*]const u8, @ptrCast(@alignCast(specialization.p_data)))[0..specialization.data_size];
for (map[0..], 0..specialization.map_entry_count) |entry, _| {
runtime.addSpecializationInfo(device_allocator, .{
.id = @intCast(entry.constant_id),
.offset = @intCast(entry.offset),
.size = @intCast(entry.size),
}, data) catch return VkError.OutOfHostMemory;
}
}
}
}
shader.runtimes = runtimes;