improving CTS support

This commit is contained in:
2025-12-07 22:04:42 +01:00
parent fb4d130d9d
commit 4ca671366d
9 changed files with 229 additions and 59 deletions

View File

@@ -21,6 +21,8 @@ pub fn create(device: *SoftDevice, allocator: std.mem.Allocator, size: vk.Device
.destroy = destroy,
.map = map,
.unmap = unmap,
.flushRange = flushRange,
.invalidateRange = invalidateRange,
};
self.* = .{
@@ -37,6 +39,20 @@ pub fn destroy(interface: *Interface, allocator: std.mem.Allocator) void {
allocator.destroy(self);
}
pub fn flushRange(interface: *Interface, offset: vk.DeviceSize, size: vk.DeviceSize) VkError!void {
// No-op, host and device memory are the same for software driver
_ = interface;
_ = offset;
_ = size;
}
pub fn invalidateRange(interface: *Interface, offset: vk.DeviceSize, size: vk.DeviceSize) VkError!void {
// No-op, host and device memory are the same for software driver
_ = interface;
_ = offset;
_ = size;
}
pub fn map(interface: *Interface, offset: vk.DeviceSize, size: vk.DeviceSize) VkError!?*anyopaque {
const self: *Self = @alignCast(@fieldParentPtr("interface", interface));
if (offset >= self.data.len or (size != vk.WHOLE_SIZE and offset + size > self.data.len)) {