adding image view
This commit is contained in:
@@ -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 {
|
||||
|
||||
@@ -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
34
src/soft/SoftImageView.zig
git.filemode.normal_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);
|
||||
}
|
||||
@@ -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;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user