core: cleanup sysgpu feature flag logic
* `@import("mach").core.gpu` has been renamed to `@import("mach").gpu`
* `pub const SYSGPUInterface` now has a default value (i.e. you do not need to write it in your main.zig, if you were.)
* You can now check `if (comptime mach.use_sysgpu)` for any conditional code you might have that should only run with sysgpu.
This (old):
```
pub const mach_core_options = core.ComptimeOptions{
.use_wgpu = false,
.use_sysgpu = true,
};
```
Has been replaced by this:
```
pub const use_sysgpu = true;
```
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
This commit is contained in:
parent
6a2358baf8
commit
7a1efdaa69
32 changed files with 85 additions and 132 deletions
10
src/main.zig
10
src/main.zig
|
|
@ -4,7 +4,7 @@ const builtin = @import("builtin");
|
|||
// Core
|
||||
pub const core = if (build_options.want_core) @import("core/main.zig") else struct {};
|
||||
pub const Timer = if (build_options.want_core) core.Timer else struct {};
|
||||
pub const gpu = if (build_options.want_core) core.gpu else struct {};
|
||||
pub const wgpu = if (build_options.want_core) @import("gpu/main.zig") else struct {};
|
||||
pub const sysjs = if (build_options.want_core) @import("mach-sysjs") else struct {};
|
||||
pub const Core = if (build_options.want_core) @import("Core.zig") else struct {};
|
||||
|
||||
|
|
@ -32,6 +32,14 @@ pub const Mod = ModSet(modules).Mod;
|
|||
pub const EntityID = @import("module/main.zig").EntityID; // TODO: rename to just Entity?
|
||||
pub const Archetype = @import("module/main.zig").Archetype;
|
||||
|
||||
/// To use experimental sysgpu graphics API, you can write this in your main.zig:
|
||||
///
|
||||
/// ```
|
||||
/// pub const use_sysgpu = true;
|
||||
/// ```
|
||||
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;
|
||||
|
||||
test {
|
||||
const std = @import("std");
|
||||
// TODO: refactor code so we can use this here:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue