mach: add centralized is_debug flag
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
This commit is contained in:
parent
b72f0e11b6
commit
316f2354d1
4 changed files with 12 additions and 5 deletions
|
|
@ -50,6 +50,8 @@ pub const Entities = @import("module/main.zig").Entities;
|
|||
pub const use_sysgpu = if (@hasDecl(@import("root"), "use_sysgpu")) @import("root").use_sysgpu else false;
|
||||
pub const gpu = if (use_sysgpu) sysgpu.sysgpu else wgpu;
|
||||
|
||||
pub const is_debug = builtin.mode == .Debug;
|
||||
|
||||
test {
|
||||
const std = @import("std");
|
||||
// TODO: refactor code so we can use this here:
|
||||
|
|
|
|||
|
|
@ -9,6 +9,9 @@ const Allocator = std.mem.Allocator;
|
|||
const testing = std.testing;
|
||||
const assert = std.debug.assert;
|
||||
const builtin = @import("builtin");
|
||||
|
||||
const is_debug = @import("../main.zig").is_debug;
|
||||
|
||||
const StringTable = @import("StringTable.zig");
|
||||
const ComponentTypesByName = @import("module.zig").ComponentTypesByName;
|
||||
|
||||
|
|
@ -234,8 +237,6 @@ pub fn debugPrint(storage: *Archetype) void {
|
|||
}
|
||||
}
|
||||
|
||||
pub const is_debug = builtin.mode == .Debug;
|
||||
|
||||
/// Returns a unique comptime usize integer representing the type T. Value will change across
|
||||
/// different compilations.
|
||||
pub fn typeId(comptime T: type) u32 {
|
||||
|
|
|
|||
|
|
@ -3,6 +3,9 @@ const Allocator = std.mem.Allocator;
|
|||
const testing = std.testing;
|
||||
const builtin = @import("builtin");
|
||||
const assert = std.debug.assert;
|
||||
|
||||
const is_debug = @import("../main.zig").is_debug;
|
||||
|
||||
const Archetype = @import("Archetype.zig");
|
||||
const StringTable = @import("StringTable.zig");
|
||||
const ComponentTypesByName = @import("module.zig").ComponentTypesByName;
|
||||
|
|
@ -885,7 +888,7 @@ pub fn Database(comptime modules: anytype) type {
|
|||
}
|
||||
|
||||
fn applyDeferredActions(e: *Self) !void {
|
||||
if (comptime Archetype.is_debug) if (e.active_queries.items.len != 0) @panic("application may result in active query iterators being invalidated");
|
||||
if (is_debug) if (e.active_queries.items.len != 0) @panic("application may result in active query iterators being invalidated");
|
||||
while (true) {
|
||||
const ev = e.deferred_queue.readItem() orelse return;
|
||||
switch (ev) {
|
||||
|
|
|
|||
|
|
@ -1,10 +1,11 @@
|
|||
const builtin = @import("builtin");
|
||||
const std = @import("std");
|
||||
const testing = @import("../testing.zig");
|
||||
|
||||
const is_debug = @import("../main.zig").is_debug;
|
||||
const testing = @import("../main.zig").testing;
|
||||
|
||||
const Database = @import("entities.zig").Database;
|
||||
const EntityID = @import("entities.zig").EntityID;
|
||||
const is_debug = @import("Archetype.zig").is_debug;
|
||||
const builtin_modules = @import("main.zig").builtin_modules;
|
||||
|
||||
const log = std.log.scoped(.mach);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue