[Flint] moving ir gen specific code to separate file
This commit is contained in:
@@ -39,12 +39,16 @@ scratch: []u32,
|
||||
pub fn init(allocator: std.mem.Allocator, program: *const Program) !Self {
|
||||
const registers = try allocator.alloc(u32, program.register_count);
|
||||
errdefer allocator.free(registers);
|
||||
|
||||
const scratch = try allocator.alloc(u32, program.scratch_count);
|
||||
errdefer allocator.free(scratch);
|
||||
|
||||
@memset(registers, 0);
|
||||
@memset(scratch, 0);
|
||||
|
||||
for (program.initializers) |initializer|
|
||||
registers[initializer.register] = initializer.value;
|
||||
|
||||
return .{ .allocator = allocator, .registers = registers, .scratch = scratch };
|
||||
}
|
||||
|
||||
|
||||
@@ -1,7 +1,4 @@
|
||||
//! Software bytecode interpreter for the backend-agnostic shader IR.
|
||||
//!
|
||||
//! This first slice supports allocation-free scalar execution of 32-bit scalar
|
||||
//! and vector arithmetic, interface I/O, control flow, and block parameters.
|
||||
|
||||
pub const bytecode = @import("bytecode.zig");
|
||||
pub const Program = @import("Program.zig");
|
||||
|
||||
Reference in New Issue
Block a user