{mach,gpu}: rename GPU_BACKEND -> MACH_GPU_BACKEND

Per https://github.com/hexops/mach/issues/376#issuecomment-1170374460

Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
This commit is contained in:
Stephen Gutekanst 2022-08-12 14:54:03 -07:00
parent 7dd1818e70
commit 78675470ae
3 changed files with 7 additions and 7 deletions

View file

@ -34,8 +34,8 @@ fn getEnvVarOwned(allocator: std.mem.Allocator, key: []const u8) error{ OutOfMem
} }
fn detectBackendType(allocator: std.mem.Allocator) !gpu.BackendType { fn detectBackendType(allocator: std.mem.Allocator) !gpu.BackendType {
const GPU_BACKEND = try getEnvVarOwned(allocator, "GPU_BACKEND"); const MACH_GPU_BACKEND = try getEnvVarOwned(allocator, "MACH_GPU_BACKEND");
if (GPU_BACKEND) |backend| { if (MACH_GPU_BACKEND) |backend| {
defer allocator.free(backend); defer allocator.free(backend);
if (std.ascii.eqlIgnoreCase(backend, "null")) return .nul; if (std.ascii.eqlIgnoreCase(backend, "null")) return .nul;
if (std.ascii.eqlIgnoreCase(backend, "webgpu")) return .nul; if (std.ascii.eqlIgnoreCase(backend, "webgpu")) return .nul;
@ -45,7 +45,7 @@ fn detectBackendType(allocator: std.mem.Allocator) !gpu.BackendType {
if (std.ascii.eqlIgnoreCase(backend, "vulkan")) return .vulkan; if (std.ascii.eqlIgnoreCase(backend, "vulkan")) return .vulkan;
if (std.ascii.eqlIgnoreCase(backend, "opengl")) return .opengl; if (std.ascii.eqlIgnoreCase(backend, "opengl")) return .opengl;
if (std.ascii.eqlIgnoreCase(backend, "opengles")) return .opengles; if (std.ascii.eqlIgnoreCase(backend, "opengles")) return .opengles;
@panic("unknown BACKEND type"); @panic("unknown MACH_GPU_BACKEND type");
} }
const target = @import("builtin").target; const target = @import("builtin").target;

View file

@ -95,7 +95,7 @@ pub const Platform = struct {
}, &response, util.requestAdapterCallback); }, &response, util.requestAdapterCallback);
if (response.?.status != .success) { if (response.?.status != .success) {
std.debug.print("mach: failed to create GPU adapter: {?s}\n", .{response.?.message}); std.debug.print("mach: failed to create GPU adapter: {?s}\n", .{response.?.message});
std.debug.print("-> maybe try GPU_BACKEND=opengl ?\n", .{}); std.debug.print("-> maybe try MACH_GPU_BACKEND=opengl ?\n", .{});
std.process.exit(1); std.process.exit(1);
} }

View file

@ -25,8 +25,8 @@ fn getEnvVarOwned(allocator: std.mem.Allocator, key: []const u8) error{ OutOfMem
} }
pub fn detectBackendType(allocator: std.mem.Allocator) !gpu.BackendType { pub fn detectBackendType(allocator: std.mem.Allocator) !gpu.BackendType {
const GPU_BACKEND = try getEnvVarOwned(allocator, "GPU_BACKEND"); const MACH_GPU_BACKEND = try getEnvVarOwned(allocator, "MACH_GPU_BACKEND");
if (GPU_BACKEND) |backend| { if (MACH_GPU_BACKEND) |backend| {
defer allocator.free(backend); defer allocator.free(backend);
if (std.ascii.eqlIgnoreCase(backend, "null")) return .nul; if (std.ascii.eqlIgnoreCase(backend, "null")) return .nul;
if (std.ascii.eqlIgnoreCase(backend, "d3d11")) return .d3d11; if (std.ascii.eqlIgnoreCase(backend, "d3d11")) return .d3d11;
@ -35,7 +35,7 @@ pub fn detectBackendType(allocator: std.mem.Allocator) !gpu.BackendType {
if (std.ascii.eqlIgnoreCase(backend, "vulkan")) return .vulkan; if (std.ascii.eqlIgnoreCase(backend, "vulkan")) return .vulkan;
if (std.ascii.eqlIgnoreCase(backend, "opengl")) return .opengl; if (std.ascii.eqlIgnoreCase(backend, "opengl")) return .opengl;
if (std.ascii.eqlIgnoreCase(backend, "opengles")) return .opengles; if (std.ascii.eqlIgnoreCase(backend, "opengles")) return .opengles;
@panic("unknown GPU_BACKEND type"); @panic("unknown MACH_GPU_BACKEND type");
} }
const target = @import("builtin").target; const target = @import("builtin").target;