Files
VulkanDriver/src/phi/PhiBuffer.zig
T
kbz_8 d5a794aa64
Mirror Gitea refs to GitHub / mirror (push) Successful in 18s
Build / build (push) Failing after 58s
Test / build_and_test (push) Failing after 1m5s
[Phi] fixing device memory creation, implemented AVX copy and fill for
vkCmdCopyBuffers and vkCmdFillBuffer
2026-08-18 02:44:24 +02:00

38 lines
1.0 KiB
Zig

const std = @import("std");
const vk = @import("vulkan");
const base = @import("base");
const proto = @import("lib.zig").proto;
const VkError = base.VkError;
const Self = @This();
pub const Interface = base.Buffer;
interface: Interface,
pub fn create(device: *base.Device, allocator: std.mem.Allocator, info: *const vk.BufferCreateInfo) 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,
.getMemoryRequirements = getMemoryRequirements,
};
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);
}
pub fn getMemoryRequirements(_: *Interface, requirements: *vk.MemoryRequirements) void {
requirements.alignment = proto.PHI_MEMORY_ALIGNMENT;
}