adding base Image and ICD file generation

This commit is contained in:
2025-11-23 02:39:56 +01:00
parent b586ff18e1
commit b65d5cf183
17 changed files with 438 additions and 48 deletions
+11 -6
View File
@@ -11,10 +11,9 @@ const SoftQueue = @import("SoftQueue.zig");
const SoftBuffer = @import("SoftBuffer.zig");
const SoftDeviceMemory = @import("SoftDeviceMemory.zig");
const SoftFence = @import("SoftFence.zig");
const SoftImage = @import("SoftImage.zig");
const VkError = base.VkError;
const Dispatchable = base.Dispatchable;
const NonDispatchable = base.NonDispatchable;
const Self = @This();
pub const Interface = base.Device;
@@ -41,6 +40,7 @@ pub fn create(physical_device: *base.PhysicalDevice, allocator: std.mem.Allocato
.createBuffer = createBuffer,
.createCommandPool = createCommandPool,
.createFence = createFence,
.createImage = createImage,
.destroy = destroy,
};
@@ -73,6 +73,12 @@ pub fn destroy(interface: *Interface, allocator: std.mem.Allocator) VkError!void
allocator.destroy(self);
}
pub fn allocateMemory(interface: *Interface, allocator: std.mem.Allocator, info: *const vk.MemoryAllocateInfo) VkError!*base.DeviceMemory {
const self: *Self = @alignCast(@fieldParentPtr("interface", interface));
const device_memory = try SoftDeviceMemory.create(self, allocator, info.allocation_size, info.memory_type_index);
return &device_memory.interface;
}
pub fn createBuffer(interface: *Interface, allocator: std.mem.Allocator, info: *const vk.BufferCreateInfo) VkError!*base.Buffer {
const buffer = try SoftBuffer.create(interface, allocator, info);
return &buffer.interface;
@@ -88,8 +94,7 @@ pub fn createCommandPool(interface: *Interface, allocator: std.mem.Allocator, in
return &pool.interface;
}
pub fn allocateMemory(interface: *Interface, allocator: std.mem.Allocator, info: *const vk.MemoryAllocateInfo) VkError!*base.DeviceMemory {
const self: *Self = @alignCast(@fieldParentPtr("interface", interface));
const device_memory = try SoftDeviceMemory.create(self, allocator, info.allocation_size, info.memory_type_index);
return &device_memory.interface;
pub fn createImage(interface: *Interface, allocator: std.mem.Allocator, info: *const vk.ImageCreateInfo) VkError!*base.Image {
const image = try SoftImage.create(interface, allocator, info);
return &image.interface;
}