replacing env vars by compile options

This commit is contained in:
2026-04-18 15:30:59 +02:00
parent 8f68ce4bf7
commit ac5e14f647
9 changed files with 29 additions and 61 deletions
+1 -1
View File
@@ -2,7 +2,7 @@ const std = @import("std");
const vk = @import("vulkan");
const base = @import("base");
const builtin = @import("builtin");
const config = @import("config");
const config = base.config;
const SoftQueue = @import("SoftQueue.zig");
+1 -1
View File
@@ -32,7 +32,7 @@ pub fn create(device: *base.Device, allocator: std.mem.Allocator, info: *const v
self.* = .{
.interface = interface,
.module = spv.Module.init(allocator, code, .{
.use_simd_vectors_specializations = !base.env.hasEnvVar(lib.NO_SHADER_SIMD_ENV_NAME),
.use_simd_vectors_specializations = base.config.shaders_simd,
}) catch |err| switch (err) {
spv.Module.ModuleError.OutOfMemory => return VkError.OutOfHostMemory,
else => {
+3 -16
View File
@@ -35,26 +35,13 @@ early_dump: ?u32,
final_dump: ?u32,
pub fn init(device: *SoftDevice, state: *PipelineState) Self {
const early_dumb_env_var = base.env.getEnvVar(lib.DUMP_EARLY_RESULT_TABLE_ENV_NAME);
const final_dumb_env_var = base.env.getEnvVar(lib.DUMP_FINAL_RESULT_TABLE_ENV_NAME);
return .{
.device = device,
.state = state,
.batch_size = 0,
.invocation_index = .init(0),
.early_dump = blk: {
if (early_dumb_env_var) |val| {
break :blk std.fmt.parseInt(u32, std.mem.span(val.ptr), 10) catch null;
}
break :blk null;
},
.final_dump = blk: {
if (final_dumb_env_var) |val| {
break :blk std.fmt.parseInt(u32, std.mem.span(val.ptr), 10) catch null;
}
break :blk null;
},
.early_dump = base.config.compute_dump_early_results_table,
.final_dump = base.config.compute_dump_final_results_table,
};
}
@@ -76,7 +63,7 @@ pub fn dispatch(self: *Self, group_count_x: u32, group_count_y: u32, group_count
var wg: std.Io.Group = .init;
for (0..@min(self.batch_size, group_count)) |batch_id| {
if (base.env.hasEnvVar(lib.SINGLE_THREAD_COMPUTE_EXECUTION_ENV_NAME)) {
if (base.config.single_threaded_compute) {
@branchHint(.cold); // Should only be reached for debugging
runWrapper(
-5
View File
@@ -40,11 +40,6 @@ pub const VULKAN_VERSION = vk.makeApiVersion(0, 1, 0, 0);
pub const DRIVER_VERSION = vk.makeApiVersion(0, 0, 0, 1);
pub const DEVICE_ID = 0x600DCAFE;
pub const NO_SHADER_SIMD_ENV_NAME = "STROLL_SOFT_NO_SIMD";
pub const SINGLE_THREAD_COMPUTE_EXECUTION_ENV_NAME = "STROLL_SOFT_SINGLE_THREAD_COMPUTE_EXECUTION";
pub const DUMP_EARLY_RESULT_TABLE_ENV_NAME = "STROLL_SOFT_DUMP_EARLY_RESULT_TABLE_FOR_INVOCATION";
pub const DUMP_FINAL_RESULT_TABLE_ENV_NAME = "STROLL_SOFT_DUMP_FINAL_RESULT_TABLE_FOR_INVOCATION";
/// Generic system memory.
pub const MEMORY_TYPE_GENERIC_BIT = 0;