This commit is contained in:
peterino2 2025-11-02 00:55:21 -07:00
parent 35562ab6d7
commit 55e7c955c1
12 changed files with 13 additions and 13 deletions

View File

@ -90,7 +90,7 @@ pub fn main() !void {
\\ pub fn startEngine(vtable: *core.EngineObjectVTable, spec: *core.SpecVariantMap) bool { \\ pub fn startEngine(vtable: *core.EngineObjectVTable, spec: *core.SpecVariantMap) bool {
\\ const args = getArgs() catch return false; \\ const args = getArgs() catch return false;
\\ \\
\\ var backingAllocator: std.mem.Allocator = std.heap.c_allocator; \\ var backingAllocator: std.mem.Allocator = std.heap.smp_allocator;
\\ var gpa: std.heap.GeneralPurposeAllocator(.{ \\ var gpa: std.heap.GeneralPurposeAllocator(.{
\\ .stack_trace_frames = 20, \\ .stack_trace_frames = 20,
\\ }) = .{}; \\ }) = .{};
@ -162,7 +162,7 @@ pub fn main() !void {
try writer.print(allocator, ".{s} = true,\n", .{mod}); try writer.print(allocator, ".{s} = true,\n", .{mod});
} }
try writer.print(allocator, "}}, std.heap.c_allocator); }}\n", .{}); try writer.print(allocator, "}}, std.heap.smp_allocator); }}\n", .{});
try writer.print(allocator, "const std = @import(\"std\");\n\n", .{}); try writer.print(allocator, "const std = @import(\"std\");\n\n", .{});

View File

@ -156,7 +156,7 @@ pub const createSpecVariant = core.createSpecVariant;
pub export fn initAndRun(vtable: *core.EngineObjectVTable, spec: *core.SpecVariantMap) bool { pub export fn initAndRun(vtable: *core.EngineObjectVTable, spec: *core.SpecVariantMap) bool {
const args = getArgs() catch return false; const args = getArgs() catch return false;
var backingAllocator: std.mem.Allocator = std.heap.c_allocator; var backingAllocator: std.mem.Allocator = std.heap.smp_allocator;
var gpa: std.heap.GeneralPurposeAllocator(.{ var gpa: std.heap.GeneralPurposeAllocator(.{
.stack_trace_frames = 20, .stack_trace_frames = 20,
}) = .{}; }) = .{};

View File

@ -4,7 +4,7 @@ const std = @import("std");
pub fn ParseArgs(comptime T: type) !T { pub fn ParseArgs(comptime T: type) !T {
// I think i am actually totally cool with leaking this one and leaving it around... just dont spam call this function // I think i am actually totally cool with leaking this one and leaving it around... just dont spam call this function
var iter = try std.process.argsWithAllocator(std.heap.c_allocator); var iter = try std.process.argsWithAllocator(std.heap.smp_allocator);
var args: T = .{}; var args: T = .{};
const shortBuf: [32]u8 = undefined; const shortBuf: [32]u8 = undefined;

View File

@ -141,7 +141,7 @@ pub const StackCompactor = struct {
var stackCompactor: *core.StackCompactor = undefined; var stackCompactor: *core.StackCompactor = undefined;
pub fn initStackCompactor() void { pub fn initStackCompactor() void {
stackCompactor = core.StackCompactor.create(std.heap.c_allocator) catch unreachable; stackCompactor = core.StackCompactor.create(std.heap.smp_allocator) catch unreachable;
} }
pub inline fn pushCallStack() void { pub inline fn pushCallStack() void {

View File

@ -141,7 +141,7 @@ pub const PhysicsRuntime = struct {
pub fn init(allocator: std.mem.Allocator) !*@This() { pub fn init(allocator: std.mem.Allocator) !*@This() {
const self = try allocator.create(@This()); const self = try allocator.create(@This());
try zphysics.init(std.heap.c_allocator, .{}); try zphysics.init(std.heap.smp_allocator, .{});
//try zphysics.init(allocator, .{}); //try zphysics.init(allocator, .{});
self.* = .{ self.* = .{

View File

@ -218,7 +218,7 @@ pub fn tick(self: *@This(), dt: f64) void {
while (offset < count) { while (offset < count) {
var next = self.debugTextQueue.popFromUnlocked().?; var next = self.debugTextQueue.popFromUnlocked().?;
next.duration -= fdt; next.duration -= @min(fdt, 0.3);
if (next.duration >= 0) { if (next.duration >= 0) {
self.debugTextQueue.queue.push(next) catch {}; self.debugTextQueue.queue.push(next) catch {};

View File

@ -164,7 +164,7 @@ pub fn count(comptime n: anytype) [n]u0 {
test "Perf test sparse vs hashmap" { test "Perf test sparse vs hashmap" {
// this test does NOT care about freeing memory, just gonna let the arena hit it. // this test does NOT care about freeing memory, just gonna let the arena hit it.
var arena = std.heap.ArenaAllocator.init(std.heap.c_allocator); var arena = std.heap.ArenaAllocator.init(std.heap.smp_allocator);
defer arena.deinit(); defer arena.deinit();
const arenaAlloc = arena.allocator(); const arenaAlloc = arena.allocator();

View File

@ -235,7 +235,7 @@ pub fn destroy(self: *@This()) void {
pub fn main() !void { pub fn main() !void {
print("hello world... n", .{}); print("hello world... n", .{});
const app = try create(std.heap.c_allocator); const app = try create(std.heap.smp_allocator);
try app.loop(); try app.loop();
defer app.destroy(); defer app.destroy();
} }

View File

@ -93,7 +93,7 @@ pub fn destroy(self: *@This()) void {
pub fn main() !void { pub fn main() !void {
std.debug.print("lmao?\n", .{}); std.debug.print("lmao?\n", .{});
print("hello world... n", .{}); print("hello world... n", .{});
const app = try create(std.heap.c_allocator); const app = try create(std.heap.smp_allocator);
try app.loop(); try app.loop();
defer app.destroy(); defer app.destroy();
} }

2
lib/spng/test.zig vendored
View File

@ -23,7 +23,7 @@ pub fn main() !void {
try stdout.print("Run `zig build test` to run the tests.\n", .{}); try stdout.print("Run `zig build test` to run the tests.\n", .{});
try bw.flush(); // don't forget to flush! try bw.flush(); // don't forget to flush!
var allocator = std.heap.c_allocator; var allocator = std.heap.smp_allocator;
const pngBuffer = try allocator.alloc(u8, 1000 * 1000 * 100); const pngBuffer = try allocator.alloc(u8, 1000 * 1000 * 100);
defer allocator.free(pngBuffer); defer allocator.free(pngBuffer);

View File

@ -157,7 +157,7 @@ pub fn testThing(self: *@This()) !void {
core.setBarrierCount(workerCount); core.setBarrierCount(workerCount);
for (0..workerCount) |i| { for (0..workerCount) |i| {
const name = try std.fmt.allocPrintSentinel(std.heap.c_allocator, "MultiJob{d}", .{i}, 0); const name = try std.fmt.allocPrintSentinel(std.heap.smp_allocator, "MultiJob{d}", .{i}, 0);
_ = name; _ = name;
// try core.dispatchJob(MultiJob{ .threadName = name, .threadId = @intCast(i), .threadCount = workerCount }); // try core.dispatchJob(MultiJob{ .threadName = name, .threadId = @intCast(i), .threadCount = workerCount });
} }

View File

@ -33,7 +33,7 @@ pub fn start_module(args: core.ModuleLoaderArgs) !void {
core.PatchOrCreateObject(imgui.utils.ConsoleWindow, .{}); core.PatchOrCreateObject(imgui.utils.ConsoleWindow, .{});
core.PatchOrCreateObject(@import("fpgame/fpgame.zig"), .{}); core.PatchOrCreateObject(@import("fpgame/fpgame.zig"), .{});
core.engine_log("hmm", .{}); core.engine_log("this change definitely happened :^) ", .{});
_ = args; _ = args;
core.logDisplay("externGame", "accessing old object at {x} same object? {d}", .{ @intFromPtr(core.EngineObject(ExternGameObject).get()), @sizeOf(ExternGameObject) }); core.logDisplay("externGame", "accessing old object at {x} same object? {d}", .{ @intFromPtr(core.EngineObject(ExternGameObject).get()), @sizeOf(ExternGameObject) });