adding image view

This commit is contained in:
2025-11-24 22:42:03 +01:00
parent 54e33e03ab
commit a106722bc4
11 changed files with 138 additions and 14 deletions

View File

@@ -39,6 +39,8 @@ fn clearColorImage(data: *const cmd.CommandClearColorImage) VkError!void {
_ = range;
_ = &memory_map;
std.log.scoped(.commandExecutor).warn("FIXME: implement image clear", .{});
memory.unmap();
}
}
@@ -60,6 +62,7 @@ fn copyBuffer(data: *const cmd.CommandCopyBuffer) VkError!void {
fn copyImage(data: *const cmd.CommandCopyImage) VkError!void {
_ = data;
std.log.scoped(.commandExecutor).warn("FIXME: implement image to image copy", .{});
}
fn fillBuffer(data: *const cmd.CommandFillBuffer) VkError!void {

View File

@@ -12,6 +12,7 @@ const SoftBuffer = @import("SoftBuffer.zig");
const SoftDeviceMemory = @import("SoftDeviceMemory.zig");
const SoftFence = @import("SoftFence.zig");
const SoftImage = @import("SoftImage.zig");
const SoftImageView = @import("SoftImageView.zig");
const VkError = base.VkError;
@@ -41,6 +42,7 @@ pub fn create(physical_device: *base.PhysicalDevice, allocator: std.mem.Allocato
.createCommandPool = createCommandPool,
.createFence = createFence,
.createImage = createImage,
.createImageView = createImageView,
.destroy = destroy,
};
@@ -98,3 +100,8 @@ pub fn createImage(interface: *Interface, allocator: std.mem.Allocator, info: *c
const image = try SoftImage.create(interface, allocator, info);
return &image.interface;
}
pub fn createImageView(interface: *Interface, allocator: std.mem.Allocator, info: *const vk.ImageViewCreateInfo) VkError!*base.ImageView {
const image_view = try SoftImageView.create(interface, allocator, info);
return &image_view.interface;
}

34
src/soft/SoftImageView.zig git.filemode.normal_file
View File

@@ -0,0 +1,34 @@
const std = @import("std");
const vk = @import("vulkan");
const base = @import("base");
const lib = @import("lib.zig");
const VkError = base.VkError;
const Device = base.Device;
const Self = @This();
pub const Interface = base.ImageView;
interface: Interface,
pub fn create(device: *base.Device, allocator: std.mem.Allocator, info: *const vk.ImageViewCreateInfo) VkError!*Self {
const self = allocator.create(Self) catch return VkError.OutOfHostMemory;
errdefer allocator.destroy(self);
var interface = try Interface.init(device, allocator, info);
interface.vtable = &.{
.destroy = destroy,
};
self.* = .{
.interface = interface,
};
return self;
}
pub fn destroy(interface: *Interface, allocator: std.mem.Allocator) void {
const self: *Self = @alignCast(@fieldParentPtr("interface", interface));
allocator.destroy(self);
}

View File

@@ -15,6 +15,7 @@ pub const SoftCommandPool = @import("SoftCommandPool.zig");
pub const SoftDeviceMemory = @import("SoftDeviceMemory.zig");
pub const SoftFence = @import("SoftFence.zig");
pub const SoftImage = @import("SoftImage.zig");
pub const SoftImageView = @import("SoftImageView.zig");
pub const Instance = SoftInstance;