Skip to content

Commit

Permalink
gpu-dawn: remove now-unused spirv-cross compilation
Browse files Browse the repository at this point in the history
Dawn no longer uses spirv-cross for OpenGL backends:

hexops-graveyard/dawn@a52abab

Hence, we no longer need to compile it.

Helps #124

Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
  • Loading branch information
emidoots committed Feb 27, 2022
1 parent 983edf7 commit 262422e
Showing 1 changed file with 0 additions and 53 deletions.
53 changes: 0 additions & 53 deletions gpu-dawn/build.zig
Original file line number Diff line number Diff line change
Expand Up @@ -135,10 +135,6 @@ fn linkFromSource(b: *Builder, step: *std.build.LibExeObjStep, options: Options)
step.linkLibrary(lib_abseil_cpp);
const lib_dawn_native = buildLibDawnNative(b, step, options);
step.linkLibrary(lib_dawn_native);
if (options.desktop_gl.?) {
const lib_spirv_cross = buildLibSPIRVCross(b, step, options);
step.linkLibrary(lib_spirv_cross);
}

const lib_dawn_wire = buildLibDawnWire(b, step, options);
step.linkLibrary(lib_dawn_wire);
Expand Down Expand Up @@ -167,9 +163,6 @@ fn linkFromSource(b: *Builder, step: *std.build.LibExeObjStep, options: Options)
_ = buildLibDawnPlatform(b, lib_dawn, options);
_ = buildLibAbseilCpp(b, lib_dawn, options);
_ = buildLibDawnNative(b, lib_dawn, options);
if (options.desktop_gl.?) {
_ = buildLibSPIRVCross(b, lib_dawn, options);
}
_ = buildLibDawnWire(b, lib_dawn, options);
_ = buildLibDawnUtils(b, lib_dawn, options);
_ = buildLibSPIRVTools(b, lib_dawn, options);
Expand Down Expand Up @@ -511,11 +504,6 @@ fn buildLibDawnNative(b: *Builder, step: *std.build.LibExeObjStep, options: Opti

var flags = std.ArrayList([]const u8).init(b.allocator);
appendDawnEnableBackendTypeFlags(&flags, options) catch unreachable;
if (options.desktop_gl.?) {
// OpenGL requires spriv-cross until Dawn moves OpenGL shader generation to Tint.
// TODO: need to verify this is still accurate, do we need spirv-cross at all anymore?
flags.append(include("libs/dawn/third_party/vulkan-deps/spirv-cross/src")) catch unreachable;
}
flags.appendSlice(&.{
include("libs/dawn"),
include("libs/dawn/src"),
Expand Down Expand Up @@ -978,47 +966,6 @@ fn buildLibSPIRVTools(b: *Builder, step: *std.build.LibExeObjStep, options: Opti
return lib;
}

// Builds third_party/vulkan-deps/spirv-tools sources; derived from third_party/vulkan-deps/spirv-tools/src/BUILD.gn
fn buildLibSPIRVCross(b: *Builder, step: *std.build.LibExeObjStep, options: Options) *std.build.LibExeObjStep {
const lib = if (!options.separate_libs) step else blk: {
var main_abs = std.fs.path.join(b.allocator, &.{ thisDir(), "src/dawn/dummy.zig" }) catch unreachable;
const separate_lib = b.addStaticLibrary("spirv-cross", main_abs);
separate_lib.install();
separate_lib.setBuildMode(step.build_mode);
separate_lib.setTarget(step.target);
separate_lib.linkLibCpp();
break :blk separate_lib;
};

var flags = std.ArrayList([]const u8).init(b.allocator);
flags.appendSlice(&.{
"-DSPIRV_CROSS_EXCEPTIONS_TO_ASSERTIONS",
include("libs/dawn/third_party/vulkan-deps/spirv-cross/src"),
include("libs/dawn"),
"-Wno-extra-semi",
"-Wno-ignored-qualifiers",
"-Wno-implicit-fallthrough",
"-Wno-inconsistent-missing-override",
"-Wno-missing-field-initializers",
"-Wno-newline-eof",
"-Wno-sign-compare",
"-Wno-unused-variable",
}) catch unreachable;

const target = (std.zig.system.NativeTargetInfo.detect(b.allocator, step.target) catch unreachable).target;
if (target.os.tag != .windows) flags.append("-fno-exceptions") catch unreachable;

// spirv_cross
appendLangScannedSources(b, lib, options, .{
.rel_dirs = &.{
"libs/dawn/third_party/vulkan-deps/spirv-cross/src/",
},
.flags = flags.items,
.excluding_contains = &.{ "test", "benchmark", "main.cpp" },
}) catch unreachable;
return lib;
}

// Builds third_party/abseil sources; derived from:
//
// ```
Expand Down

0 comments on commit 262422e

Please sign in to comment.