base index draw
This commit is contained in:
+3
-2
@@ -31,11 +31,12 @@
|
|||||||
.hash = "zmath-0.11.0-dev-wjwivdMsAwD-xaLj76YHUq3t9JDH-X16xuMTmnDzqbu2",
|
.hash = "zmath-0.11.0-dev-wjwivdMsAwD-xaLj76YHUq3t9JDH-X16xuMTmnDzqbu2",
|
||||||
},
|
},
|
||||||
.SPIRV_Interpreter = .{
|
.SPIRV_Interpreter = .{
|
||||||
.url = "git+https://git.kbz8.me/kbz_8/SPIRV-Interpreter#ce172090044354d5ea70f1bf79bd077fb6722e29",
|
.url = "git+https://git.kbz8.me/kbz_8/SPIRV-Interpreter#5faf8fd30548f8bd96a18568fb21de698db64ca8",
|
||||||
.hash = "SPIRV_Interpreter-0.0.1-ajmpn2cbBQA67LOLx5fml7Uf7iRw32jwOZh0ZIX4YJyh",
|
.hash = "SPIRV_Interpreter-0.0.1-ajmpn_crBQAl1X8EYgNQjoTn_3XZ1DDOBCZMpfyD6MTu",
|
||||||
.lazy = true,
|
.lazy = true,
|
||||||
},
|
},
|
||||||
//.SPIRV_Interpreter = .{
|
//.SPIRV_Interpreter = .{
|
||||||
|
// // For development
|
||||||
// .path = "../SPIRV-Interpreter",
|
// .path = "../SPIRV-Interpreter",
|
||||||
// .lazy = true,
|
// .lazy = true,
|
||||||
//},
|
//},
|
||||||
|
|||||||
@@ -48,6 +48,7 @@ pub fn create(device: *base.Device, allocator: std.mem.Allocator, info: *const v
|
|||||||
.beginRenderPass = beginRenderPass,
|
.beginRenderPass = beginRenderPass,
|
||||||
.bindDescriptorSets = bindDescriptorSets,
|
.bindDescriptorSets = bindDescriptorSets,
|
||||||
.bindPipeline = bindPipeline,
|
.bindPipeline = bindPipeline,
|
||||||
|
.bindIndexBuffer = bindIndexBuffer,
|
||||||
.bindVertexBuffer = bindVertexBuffer,
|
.bindVertexBuffer = bindVertexBuffer,
|
||||||
.blitImage = blitImage,
|
.blitImage = blitImage,
|
||||||
.clearAttachment = clearAttachment,
|
.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;
|
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 {
|
pub fn bindVertexBuffer(interface: *Interface, index: usize, buffer: *base.Buffer, offset: usize) VkError!void {
|
||||||
const self: *Self = @alignCast(@fieldParentPtr("interface", interface));
|
const self: *Self = @alignCast(@fieldParentPtr("interface", interface));
|
||||||
const allocator = self.command_allocator.allocator();
|
const allocator = self.command_allocator.allocator();
|
||||||
|
|||||||
@@ -42,6 +42,7 @@ pub const DispatchTable = struct {
|
|||||||
beginRenderPass: *const fn (*Self, *RenderPass, *Framebuffer, vk.Rect2D, ?[]const vk.ClearValue) VkError!void,
|
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,
|
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,
|
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,
|
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,
|
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,
|
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);
|
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 {
|
pub inline fn bindVertexBuffer(self: *Self, index: usize, buffer: *Buffer, offset: usize) VkError!void {
|
||||||
try self.dispatch_table.bindVertexBuffer(self, index, buffer, offset);
|
try self.dispatch_table.bindVertexBuffer(self, index, buffer, offset);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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 cmd = Dispatchable(CommandBuffer).fromHandleObject(p_cmd) catch |err| return errorLogger(err);
|
||||||
const buffer = NonDispatchable(Buffer).fromHandleObject(p_buffer) catch |err| return errorLogger(err);
|
const buffer = NonDispatchable(Buffer).fromHandleObject(p_buffer) catch |err| return errorLogger(err);
|
||||||
|
cmd.bindIndexBuffer(buffer, offset, index_type) catch |err| return errorLogger(err);
|
||||||
notImplementedWarning();
|
|
||||||
|
|
||||||
_ = cmd;
|
|
||||||
_ = buffer;
|
|
||||||
_ = offset;
|
|
||||||
_ = index_type;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pub export fn strollCmdBindPipeline(p_cmd: vk.CommandBuffer, bind_point: vk.PipelineBindPoint, p_pipeline: vk.Pipeline) callconv(vk.vulkan_call_conv) void {
|
pub export fn strollCmdBindPipeline(p_cmd: vk.CommandBuffer, bind_point: vk.PipelineBindPoint, p_pipeline: vk.Pipeline) callconv(vk.vulkan_call_conv) void {
|
||||||
|
|||||||
Reference in New Issue
Block a user