implementing push constants
This commit is contained in:
@@ -22,6 +22,7 @@ pub const COMPUTE_PIPELINE_STATE = 1;
|
||||
pub const PipelineState = struct {
|
||||
pipeline: ?*SoftPipeline,
|
||||
sets: [base.VULKAN_MAX_DESCRIPTOR_SETS]?*SoftDescriptorSet,
|
||||
push_constant_blob: [lib.PUSH_CONSTANT_SIZE]u8,
|
||||
data: union {
|
||||
compute: struct {},
|
||||
graphics: struct {
|
||||
@@ -43,6 +44,7 @@ pub fn init(self: *Self, device: *SoftDevice) void {
|
||||
state.* = .{
|
||||
.pipeline = null,
|
||||
.sets = [_]?*SoftDescriptorSet{null} ** base.VULKAN_MAX_DESCRIPTOR_SETS,
|
||||
.push_constant_blob = @splat(0),
|
||||
.data = switch (i) {
|
||||
GRAPHICS_PIPELINE_STATE => .{
|
||||
.graphics = .{
|
||||
|
||||
@@ -21,6 +21,8 @@ fn interpolateF32x4(value0: F32x4, value1: F32x4, value2: F32x4, b0: f32, b1: f3
|
||||
return (value0 * @as(F32x4, @splat(b0))) + (value1 * @as(F32x4, @splat(b1))) + (value2 * @as(F32x4, @splat(b2)));
|
||||
}
|
||||
|
||||
var calls: usize = 0;
|
||||
|
||||
fn interpolateVertexOutputs(
|
||||
allocator: std.mem.Allocator,
|
||||
v0: *const Renderer.Vertex,
|
||||
@@ -43,6 +45,8 @@ fn interpolateVertexOutputs(
|
||||
}
|
||||
|
||||
const len = @min(out0.blob.len, out1.blob.len, out2.blob.len);
|
||||
calls += 1;
|
||||
std.debug.print("test {d}\n", .{calls});
|
||||
const input = allocator.alloc(u8, len) catch return VkError.OutOfDeviceMemory;
|
||||
|
||||
var byte_index: usize = 0;
|
||||
|
||||
@@ -39,6 +39,7 @@ inline fn run(data: RunData) !void {
|
||||
|
||||
const shader = data.pipeline.stages.getPtrAssertContains(.vertex);
|
||||
const rt = &shader.runtimes[data.batch_id];
|
||||
try rt.populatePushConstants(data.renderer.state.push_constant_blob[0..]);
|
||||
|
||||
const entry = try rt.getEntryPointByName(shader.entry);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user