base index draw
Build / build (push) Successful in 1m4s
Test / build_and_test (push) Successful in 29m15s

This commit is contained in:
2026-04-30 00:26:50 +02:00
parent b9ce18ca8e
commit 621be5db35
4 changed files with 38 additions and 9 deletions
+29
View File
@@ -48,6 +48,7 @@ pub fn create(device: *base.Device, allocator: std.mem.Allocator, info: *const v
.beginRenderPass = beginRenderPass,
.bindDescriptorSets = bindDescriptorSets,
.bindPipeline = bindPipeline,
.bindIndexBuffer = bindIndexBuffer,
.bindVertexBuffer = bindVertexBuffer,
.blitImage = blitImage,
.clearAttachment = clearAttachment,
@@ -226,6 +227,34 @@ pub fn bindPipeline(interface: *Interface, bind_point: vk.PipelineBindPoint, pip
self.commands.append(allocator, .{ .ptr = cmd, .vtable = &.{ .execute = CommandImpl.execute } }) catch return VkError.OutOfHostMemory;
}
pub fn bindIndexBuffer(interface: *Interface, buffer: *base.Buffer, offset: usize, index_type: vk.IndexType) VkError!void {
const self: *Self = @alignCast(@fieldParentPtr("interface", interface));
const allocator = self.command_allocator.allocator();
const CommandImpl = struct {
const Impl = @This();
buffer: *const SoftBuffer,
offset: usize,
index_type: vk.IndexType,
pub fn execute(context: *anyopaque, device: *ExecutionDevice) VkError!void {
const impl: *Impl = @ptrCast(@alignCast(context));
_ = impl;
_ = device;
}
};
const cmd = allocator.create(CommandImpl) catch return VkError.OutOfHostMemory;
errdefer allocator.destroy(cmd);
cmd.* = .{
.buffer = @alignCast(@fieldParentPtr("interface", buffer)),
.offset = offset,
.index_type = index_type,
};
self.commands.append(allocator, .{ .ptr = cmd, .vtable = &.{ .execute = CommandImpl.execute } }) catch return VkError.OutOfHostMemory;
}
pub fn bindVertexBuffer(interface: *Interface, index: usize, buffer: *base.Buffer, offset: usize) VkError!void {
const self: *Self = @alignCast(@fieldParentPtr("interface", interface));
const allocator = self.command_allocator.allocator();
+5
View File
@@ -42,6 +42,7 @@ pub const DispatchTable = struct {
beginRenderPass: *const fn (*Self, *RenderPass, *Framebuffer, vk.Rect2D, ?[]const vk.ClearValue) VkError!void,
bindDescriptorSets: *const fn (*Self, vk.PipelineBindPoint, u32, [lib.VULKAN_MAX_DESCRIPTOR_SETS]?*DescriptorSet, []const u32) VkError!void,
bindPipeline: *const fn (*Self, vk.PipelineBindPoint, *Pipeline) VkError!void,
bindIndexBuffer: *const fn (*Self, *Buffer, usize, vk.IndexType) VkError!void,
bindVertexBuffer: *const fn (*Self, usize, *Buffer, usize) VkError!void,
blitImage: *const fn (*Self, *Image, vk.ImageLayout, *Image, vk.ImageLayout, []const vk.ImageBlit, vk.Filter) VkError!void,
clearAttachment: *const fn (*Self, vk.ClearAttachment, vk.ClearRect) VkError!void,
@@ -163,6 +164,10 @@ pub inline fn bindPipeline(self: *Self, bind_point: vk.PipelineBindPoint, pipeli
try self.dispatch_table.bindPipeline(self, bind_point, pipeline);
}
pub inline fn bindIndexBuffer(self: *Self, buffer: *Buffer, offset: usize, index_type: vk.IndexType) VkError!void {
try self.dispatch_table.bindIndexBuffer(self, buffer, offset, index_type);
}
pub inline fn bindVertexBuffer(self: *Self, index: usize, buffer: *Buffer, offset: usize) VkError!void {
try self.dispatch_table.bindVertexBuffer(self, index, buffer, offset);
}
+1 -7
View File
@@ -1651,13 +1651,7 @@ pub export fn strollCmdBindIndexBuffer(p_cmd: vk.CommandBuffer, p_buffer: vk.Buf
const cmd = Dispatchable(CommandBuffer).fromHandleObject(p_cmd) catch |err| return errorLogger(err);
const buffer = NonDispatchable(Buffer).fromHandleObject(p_buffer) catch |err| return errorLogger(err);
notImplementedWarning();
_ = cmd;
_ = buffer;
_ = offset;
_ = index_type;
cmd.bindIndexBuffer(buffer, offset, index_type) catch |err| return errorLogger(err);
}
pub export fn strollCmdBindPipeline(p_cmd: vk.CommandBuffer, bind_point: vk.PipelineBindPoint, p_pipeline: vk.Pipeline) callconv(vk.vulkan_call_conv) void {