feat(lang): support assembly sources and shader bundles
VoidBuildSystem CI / build-and-test-gcc16 (push) Failing after 9s
VoidBuildSystem CI / sanitizers-gcc16 (push) Failing after 8s
VoidBuildSystem CI / signing-openssl-gcc16 (push) Failing after 12s
VoidBuildSystem CI / fuzz-clang (push) Failing after 5s
VoidBuildSystem CI / wine-windows-gcc16 (push) Failing after 49s

This commit is contained in:
faumaray committed 2026-12-05 14:14:25 +03:00
1 parent ce041ace07
commit 0c1bf7e5b2
11 files changed
+519 -21

No files matched your search

+28 -5
View File
@@ -242,6 +242,21 @@ std::optional<ToolchainCapabilities> deserialize_capabilities(std::string_view t
}
}
// Shader compilers come from PATH and are intentionally not part of the toolchain identity:
// each shader action's key includes its exact command line.
void attach_shader_tools(ToolchainCapabilities &cap) {
const auto resolve = [](const char *name) { return Platform::resolve_executable(name); };
if (auto glslang = resolve("glslangValidator"); glslang) {
cap.glslang_validator = *glslang;
}
if (auto slangc = resolve("slangc"); slangc) {
cap.slangc = *slangc;
}
if (auto dxc = resolve("dxc"); dxc) {
cap.dxc = *dxc;
}
}
} // namespace
std::string host_os_name() {
@@ -386,6 +401,7 @@ discover_and_probe(const ProfileContext &context,
if (auto cached_text = Void::FileSystem::read_file(cache_file); cached_text) {
if (auto cached = deserialize_capabilities(*cached_text); cached) {
cached->relevant_env = relevant_env;
attach_shader_tools(*cached);
return *cached;
}
}
@@ -531,6 +547,7 @@ discover_and_probe(const ProfileContext &context,
(void)Platform::atomic_write_file(cache_file, serialize_capabilities(cap), false);
}
attach_shader_tools(cap);
return cap;
}
@@ -650,13 +667,19 @@ lower_compile_command(const ToolchainCapabilities &toolchain, const CompileReque
}
LoweredCommand cmd;
cmd.executable = request.is_c_source ? toolchain.c_compiler : toolchain.cxx_compiler;
cmd.executable =
request.is_asm_source
? (toolchain.c_compiler.empty() ? toolchain.cxx_compiler : toolchain.c_compiler)
: (request.is_c_source ? toolchain.c_compiler : toolchain.cxx_compiler);
std::vector<std::string> args;
if (!toolchain.sysroot.empty()) {
args.push_back("--sysroot=" + toolchain.sysroot);
}
if (request.is_c_source) {
if (request.is_asm_source) {
// Assembly takes no language standard; `.S` is run through the C preprocessor by the
// driver based on its extension.
} else if (request.is_c_source) {
if (const auto std_flag = c_standard_flag(request.c_standard); !std_flag.empty()) {
args.push_back(std_flag);
}
@@ -668,12 +691,12 @@ lower_compile_command(const ToolchainCapabilities &toolchain, const CompileReque
if (request.position_independent) {
args.push_back("-fPIC");
}
if (request.lto == LtoMode::Full) {
if (!request.is_asm_source && request.lto == LtoMode::Full) {
args.push_back("-flto");
} else if (request.lto == LtoMode::Thin) {
} else if (!request.is_asm_source && request.lto == LtoMode::Thin) {
args.push_back("-flto=thin");
}
if (!request.sanitizers.empty()) {
if (!request.is_asm_source && !request.sanitizers.empty()) {
std::string list;
for (std::size_t i = 0; i < request.sanitizers.size(); ++i) {
if (i > 0) {