gpu-dawn: update to generated-2022-02-17

Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
This commit is contained in:
Stephen Gutekanst 2022-02-18 00:55:00 -07:00 committed by Stephen Gutekanst
parent 0b5b832549
commit 83f3f3452e
3 changed files with 324 additions and 306 deletions

View file

@ -103,12 +103,11 @@ pub const Options = struct {
return options; return options;
} }
pub fn appendFlags(self: Options, flags: *std.ArrayList([]const u8), zero_debug_symbols: bool) !void { pub fn appendFlags(self: Options, flags: *std.ArrayList([]const u8), zero_debug_symbols: bool, is_cpp: bool) !void {
if (self.minimal_debug_symbols) { if (self.minimal_debug_symbols) {
if (zero_debug_symbols) try flags.append("-g0") else try flags.append("-g1"); if (zero_debug_symbols) try flags.append("-g0") else try flags.append("-g1");
} }
// TODO: this flag is illegal for C sources! if (is_cpp) try flags.append("-std=c++17");
try flags.append("-std=c++17");
} }
}; };
@ -367,10 +366,10 @@ fn buildLibMachDawnNative(b: *Builder, step: *std.build.LibExeObjStep, options:
// TODO(build-system): pass system SDK options through // TODO(build-system): pass system SDK options through
glfw.link(b, lib, .{ .system_sdk = .{ .set_sysroot = false } }); glfw.link(b, lib, .{ .system_sdk = .{ .set_sysroot = false } });
var flags = std.ArrayList([]const u8).init(b.allocator); var cpp_flags = std.ArrayList([]const u8).init(b.allocator);
options.appendFlags(&flags, false) catch unreachable; options.appendFlags(&cpp_flags, false, true) catch unreachable;
appendDawnEnableBackendTypeFlags(&flags, options) catch unreachable; appendDawnEnableBackendTypeFlags(&cpp_flags, options) catch unreachable;
flags.appendSlice(&.{ cpp_flags.appendSlice(&.{
include("libs/mach-glfw/upstream/glfw/include"), include("libs/mach-glfw/upstream/glfw/include"),
include("libs/dawn/out/Debug/gen/include"), include("libs/dawn/out/Debug/gen/include"),
include("libs/dawn/out/Debug/gen/src"), include("libs/dawn/out/Debug/gen/src"),
@ -378,7 +377,7 @@ fn buildLibMachDawnNative(b: *Builder, step: *std.build.LibExeObjStep, options:
include("libs/dawn/src"), include("libs/dawn/src"),
}) catch unreachable; }) catch unreachable;
lib.addCSourceFile("src/dawn/dawn_native_mach.cpp", flags.items); lib.addCSourceFile("src/dawn/dawn_native_mach.cpp", cpp_flags.items);
return lib; return lib;
} }
@ -395,33 +394,32 @@ fn buildLibDawnCommon(b: *Builder, step: *std.build.LibExeObjStep, options: Opti
}; };
var flags = std.ArrayList([]const u8).init(b.allocator); var flags = std.ArrayList([]const u8).init(b.allocator);
options.appendFlags(&flags, false) catch unreachable;
flags.append(include("libs/dawn/src")) catch unreachable; flags.append(include("libs/dawn/src")) catch unreachable;
appendLangScannedSources(b, lib, options, .{
var sources = std.ArrayList([]const u8).init(b.allocator); .rel_dirs = &.{"libs/dawn/src/dawn/common/"},
scanSources( .flags = flags.items,
b, .excluding_contains = &.{
&sources,
"libs/dawn/src/dawn/common/",
&.{ ".cpp", ".c", ".cc" },
&.{},
&.{
"test", "test",
"benchmark", "benchmark",
"mock", "mock",
"WindowsUtils.cpp", "WindowsUtils.cpp",
}, },
) catch unreachable; }) catch unreachable;
var cpp_sources = std.ArrayList([]const u8).init(b.allocator);
const target = (std.zig.system.NativeTargetInfo.detect(b.allocator, step.target) catch unreachable).target; const target = (std.zig.system.NativeTargetInfo.detect(b.allocator, step.target) catch unreachable).target;
if (target.os.tag == .macos) { if (target.os.tag == .macos) {
// TODO(build-system): pass system SDK options through // TODO(build-system): pass system SDK options through
system_sdk.include(b, lib, .{}); system_sdk.include(b, lib, .{});
lib.linkFramework("Foundation"); lib.linkFramework("Foundation");
var abs_path = std.fs.path.join(b.allocator, &.{ thisDir(), "libs/dawn/src/dawn/common/SystemUtils_mac.mm" }) catch unreachable; var abs_path = std.fs.path.join(b.allocator, &.{ thisDir(), "libs/dawn/src/dawn/common/SystemUtils_mac.mm" }) catch unreachable;
sources.append(abs_path) catch unreachable; cpp_sources.append(abs_path) catch unreachable;
} }
addCSourceFiles(b, lib, sources.items, flags.items);
var cpp_flags = std.ArrayList([]const u8).init(b.allocator);
cpp_flags.appendSlice(flags.items) catch unreachable;
options.appendFlags(&cpp_flags, false, true) catch unreachable;
addCSourceFiles(b, lib, cpp_sources.items, cpp_flags.items);
return lib; return lib;
} }
@ -437,25 +435,26 @@ fn buildLibDawnPlatform(b: *Builder, step: *std.build.LibExeObjStep, options: Op
break :blk separate_lib; break :blk separate_lib;
}; };
var flags = std.ArrayList([]const u8).init(b.allocator); var cpp_flags = std.ArrayList([]const u8).init(b.allocator);
options.appendFlags(&flags, false) catch unreachable; options.appendFlags(&cpp_flags, false, true) catch unreachable;
flags.appendSlice(&.{ cpp_flags.appendSlice(&.{
include("libs/dawn/src"), include("libs/dawn/src"),
include("libs/dawn/include"), include("libs/dawn/include"),
include("libs/dawn/out/Debug/gen/include"), include("libs/dawn/out/Debug/gen/include"),
}) catch unreachable; }) catch unreachable;
var sources = std.ArrayList([]const u8).init(b.allocator); var cpp_sources = std.ArrayList([]const u8).init(b.allocator);
for ([_][]const u8{ for ([_][]const u8{
"src/dawn/platform/DawnPlatform.cpp", "src/dawn/platform/DawnPlatform.cpp",
"src/dawn/platform/WorkerThread.cpp", "src/dawn/platform/WorkerThread.cpp",
"src/dawn/platform/tracing/EventTracer.cpp", "src/dawn/platform/tracing/EventTracer.cpp",
}) |path| { }) |path| {
var abs_path = std.fs.path.join(b.allocator, &.{ thisDir(), "libs/dawn", path }) catch unreachable; var abs_path = std.fs.path.join(b.allocator, &.{ thisDir(), "libs/dawn", path }) catch unreachable;
sources.append(abs_path) catch unreachable; cpp_sources.append(abs_path) catch unreachable;
} }
addCSourceFiles(b, lib, sources.items, flags.items);
addCSourceFiles(b, lib, cpp_sources.items, cpp_flags.items);
return lib; return lib;
} }
@ -490,7 +489,6 @@ fn buildLibDawnNative(b: *Builder, step: *std.build.LibExeObjStep, options: Opti
system_sdk.include(b, lib, .{}); system_sdk.include(b, lib, .{});
var flags = std.ArrayList([]const u8).init(b.allocator); var flags = std.ArrayList([]const u8).init(b.allocator);
options.appendFlags(&flags, false) catch unreachable;
appendDawnEnableBackendTypeFlags(&flags, options) catch unreachable; appendDawnEnableBackendTypeFlags(&flags, options) catch unreachable;
if (options.desktop_gl.?) { if (options.desktop_gl.?) {
// OpenGL requires spriv-cross until Dawn moves OpenGL shader generation to Tint. // OpenGL requires spriv-cross until Dawn moves OpenGL shader generation to Tint.
@ -518,29 +516,30 @@ fn buildLibDawnNative(b: *Builder, step: *std.build.LibExeObjStep, options: Opti
include("libs/dawn/out/Debug/gen/src"), include("libs/dawn/out/Debug/gen/src"),
}) catch unreachable; }) catch unreachable;
var sources = std.ArrayList([]const u8).init(b.allocator); appendLangScannedSources(b, lib, options, .{
inline for (&[_][]const u8{ .rel_dirs = &.{
"out/Debug/gen/src/dawn/", "libs/dawn/out/Debug/gen/src/dawn/",
"src/dawn/native/", "libs/dawn/src/dawn/native/",
"src/dawn/native/utils/", "libs/dawn/src/dawn/native/utils/",
}) |dir| scanSources( },
b, .flags = flags.items,
&sources, .excluding_contains = &.{
"libs/dawn/" ++ dir, "test",
&.{ ".cpp", ".c", ".cc" }, "benchmark",
&.{}, "mock",
&.{ "test", "benchmark", "mock", "SpirvValidation.cpp", "XlibXcbFunctions.cpp" }, "SpirvValidation.cpp",
) catch unreachable; "XlibXcbFunctions.cpp",
},
}) catch unreachable;
// dawn_native_gen // dawn_native_gen
scanSources( appendLangScannedSources(b, lib, options, .{
b, .rel_dirs = &.{
&sources, "libs/dawn/out/Debug/gen/src/dawn/native/",
"libs/dawn/out/Debug/gen/src/dawn/native/", },
&.{ ".cpp", ".c", ".cc" }, .flags = flags.items,
&.{}, .excluding_contains = &.{ "test", "benchmark", "mock" },
&.{ "test", "benchmark", "mock" }, }) catch unreachable;
) catch unreachable;
// TODO(build-system): could allow enable_vulkan_validation_layers here. See src/dawn/native/BUILD.gn // TODO(build-system): could allow enable_vulkan_validation_layers here. See src/dawn/native/BUILD.gn
// TODO(build-system): allow use_angle here. See src/dawn/native/BUILD.gn // TODO(build-system): allow use_angle here. See src/dawn/native/BUILD.gn
@ -549,14 +548,13 @@ fn buildLibDawnNative(b: *Builder, step: *std.build.LibExeObjStep, options: Opti
if (options.d3d12.?) { if (options.d3d12.?) {
// TODO(build-system): windows // TODO(build-system): windows
// libs += [ "dxguid.lib" ] // libs += [ "dxguid.lib" ]
scanSources( appendLangScannedSources(b, lib, options, .{
b, .rel_dirs = &.{
&sources, "libs/dawn/src/dawn/native/d3d12/",
"libs/dawn/src/dawn/native/d3d12/", },
&.{ ".cpp", ".c", ".cc" }, .flags = flags.items,
&.{}, .excluding_contains = &.{ "test", "benchmark", "mock" },
&.{ "test", "benchmark", "mock" }, }) catch unreachable;
) catch unreachable;
} }
if (options.metal.?) { if (options.metal.?) {
lib.linkFramework("Metal"); lib.linkFramework("Metal");
@ -566,31 +564,25 @@ fn buildLibDawnNative(b: *Builder, step: *std.build.LibExeObjStep, options: Opti
lib.linkFramework("IOSurface"); lib.linkFramework("IOSurface");
lib.linkFramework("QuartzCore"); lib.linkFramework("QuartzCore");
scanSources( appendLangScannedSources(b, lib, options, .{
b, .objc = true,
&sources, .rel_dirs = &.{
"libs/dawn/src/dawn/native/metal/", "libs/dawn/src/dawn/native/metal/",
&.{ ".cpp", ".c", ".cc", ".m", ".mm" }, "libs/dawn/src/dawn/native/",
&.{}, },
&.{ "test", "benchmark", "mock" }, .flags = flags.items,
) catch unreachable; .excluding_contains = &.{ "test", "benchmark", "mock" },
scanSources( }) catch unreachable;
b,
&sources,
"libs/dawn/src/dawn/native/",
&.{ ".m", ".mm" },
&.{},
&.{ "test", "benchmark", "mock" },
) catch unreachable;
} }
var cpp_sources = std.ArrayList([]const u8).init(b.allocator);
if (options.linux_window_manager != null and options.linux_window_manager.? == .X11) { if (options.linux_window_manager != null and options.linux_window_manager.? == .X11) {
lib.linkSystemLibrary("X11"); lib.linkSystemLibrary("X11");
for ([_][]const u8{ for ([_][]const u8{
"src/dawn/native/XlibXcbFunctions.cpp", "src/dawn/native/XlibXcbFunctions.cpp",
}) |path| { }) |path| {
var abs_path = std.fs.path.join(b.allocator, &.{ thisDir(), "libs/dawn", path }) catch unreachable; var abs_path = std.fs.path.join(b.allocator, &.{ thisDir(), "libs/dawn", path }) catch unreachable;
sources.append(abs_path) catch unreachable; cpp_sources.append(abs_path) catch unreachable;
} }
} }
@ -598,7 +590,7 @@ fn buildLibDawnNative(b: *Builder, step: *std.build.LibExeObjStep, options: Opti
"src/dawn/native/null/DeviceNull.cpp", "src/dawn/native/null/DeviceNull.cpp",
}) |path| { }) |path| {
var abs_path = std.fs.path.join(b.allocator, &.{ thisDir(), "libs/dawn", path }) catch unreachable; var abs_path = std.fs.path.join(b.allocator, &.{ thisDir(), "libs/dawn", path }) catch unreachable;
sources.append(abs_path) catch unreachable; cpp_sources.append(abs_path) catch unreachable;
} }
if (options.desktop_gl.? or options.vulkan.?) { if (options.desktop_gl.? or options.vulkan.?) {
@ -606,40 +598,30 @@ fn buildLibDawnNative(b: *Builder, step: *std.build.LibExeObjStep, options: Opti
"src/dawn/native/SpirvValidation.cpp", "src/dawn/native/SpirvValidation.cpp",
}) |path| { }) |path| {
var abs_path = std.fs.path.join(b.allocator, &.{ thisDir(), "libs/dawn", path }) catch unreachable; var abs_path = std.fs.path.join(b.allocator, &.{ thisDir(), "libs/dawn", path }) catch unreachable;
sources.append(abs_path) catch unreachable; cpp_sources.append(abs_path) catch unreachable;
} }
} }
if (options.desktop_gl.?) { if (options.desktop_gl.?) {
scanSources( appendLangScannedSources(b, lib, options, .{
b, .rel_dirs = &.{
&sources, "libs/dawn/out/Debug/gen/src/dawn/native/opengl/",
"libs/dawn/out/Debug/gen/src/dawn/native/opengl/", "libs/dawn/src/dawn/native/opengl/",
&.{ ".cpp", ".c", ".cc" }, },
&.{}, .flags = flags.items,
&.{ "test", "benchmark", "mock" }, .excluding_contains = &.{ "test", "benchmark", "mock" },
) catch unreachable; }) catch unreachable;
scanSources(
b,
&sources,
"libs/dawn/src/dawn/native/opengl/",
&.{ ".cpp", ".c", ".cc" },
&.{},
&.{ "test", "benchmark", "mock" },
) catch unreachable;
} }
const target = (std.zig.system.NativeTargetInfo.detect(b.allocator, step.target) catch unreachable).target; const target = (std.zig.system.NativeTargetInfo.detect(b.allocator, step.target) catch unreachable).target;
if (options.vulkan.?) { if (options.vulkan.?) {
scanSources( appendLangScannedSources(b, lib, options, .{
b, .rel_dirs = &.{
&sources, "libs/dawn/src/dawn/native/vulkan/",
"libs/dawn/src/dawn/native/vulkan/", },
&.{ ".cpp", ".c", ".cc" }, .flags = flags.items,
&.{}, .excluding_contains = &.{ "test", "benchmark", "mock" },
&.{ "test", "benchmark", "mock" }, }) catch unreachable;
) catch unreachable;
if (isLinuxDesktopLike(target)) { if (isLinuxDesktopLike(target)) {
for ([_][]const u8{ for ([_][]const u8{
@ -647,8 +629,7 @@ fn buildLibDawnNative(b: *Builder, step: *std.build.LibExeObjStep, options: Opti
"src/dawn/native/vulkan/external_semaphore/SemaphoreServiceFD.cpp", "src/dawn/native/vulkan/external_semaphore/SemaphoreServiceFD.cpp",
}) |path| { }) |path| {
var abs_path = std.fs.path.join(b.allocator, &.{ thisDir(), "libs/dawn", path }) catch unreachable; var abs_path = std.fs.path.join(b.allocator, &.{ thisDir(), "libs/dawn", path }) catch unreachable;
lib.addCSourceFile(abs_path, flags.items); cpp_sources.append(abs_path) catch unreachable;
sources.append(abs_path) catch unreachable;
} }
} else if (target.os.tag == .fuchsia) { } else if (target.os.tag == .fuchsia) {
for ([_][]const u8{ for ([_][]const u8{
@ -656,7 +637,7 @@ fn buildLibDawnNative(b: *Builder, step: *std.build.LibExeObjStep, options: Opti
"src/dawn/native/vulkan/external_semaphore/SemaphoreServiceZirconHandle.cpp", "src/dawn/native/vulkan/external_semaphore/SemaphoreServiceZirconHandle.cpp",
}) |path| { }) |path| {
var abs_path = std.fs.path.join(b.allocator, &.{ thisDir(), "libs/dawn", path }) catch unreachable; var abs_path = std.fs.path.join(b.allocator, &.{ thisDir(), "libs/dawn", path }) catch unreachable;
sources.append(abs_path) catch unreachable; cpp_sources.append(abs_path) catch unreachable;
} }
} else { } else {
for ([_][]const u8{ for ([_][]const u8{
@ -664,7 +645,7 @@ fn buildLibDawnNative(b: *Builder, step: *std.build.LibExeObjStep, options: Opti
"src/dawn/native/vulkan/external_semaphore/SemaphoreServiceNull.cpp", "src/dawn/native/vulkan/external_semaphore/SemaphoreServiceNull.cpp",
}) |path| { }) |path| {
var abs_path = std.fs.path.join(b.allocator, &.{ thisDir(), "libs/dawn", path }) catch unreachable; var abs_path = std.fs.path.join(b.allocator, &.{ thisDir(), "libs/dawn", path }) catch unreachable;
sources.append(abs_path) catch unreachable; cpp_sources.append(abs_path) catch unreachable;
} }
} }
} }
@ -712,7 +693,7 @@ fn buildLibDawnNative(b: *Builder, step: *std.build.LibExeObjStep, options: Opti
"src/dawn/native/null/NullBackend.cpp", "src/dawn/native/null/NullBackend.cpp",
}) |path| { }) |path| {
var abs_path = std.fs.path.join(b.allocator, &.{ thisDir(), "libs/dawn", path }) catch unreachable; var abs_path = std.fs.path.join(b.allocator, &.{ thisDir(), "libs/dawn", path }) catch unreachable;
sources.append(abs_path) catch unreachable; cpp_sources.append(abs_path) catch unreachable;
} }
if (options.d3d12.?) { if (options.d3d12.?) {
@ -720,7 +701,7 @@ fn buildLibDawnNative(b: *Builder, step: *std.build.LibExeObjStep, options: Opti
"src/dawn/native/d3d12/D3D12Backend.cpp", "src/dawn/native/d3d12/D3D12Backend.cpp",
}) |path| { }) |path| {
var abs_path = std.fs.path.join(b.allocator, &.{ thisDir(), "libs/dawn", path }) catch unreachable; var abs_path = std.fs.path.join(b.allocator, &.{ thisDir(), "libs/dawn", path }) catch unreachable;
sources.append(abs_path) catch unreachable; cpp_sources.append(abs_path) catch unreachable;
} }
} }
if (options.desktop_gl.?) { if (options.desktop_gl.?) {
@ -728,7 +709,7 @@ fn buildLibDawnNative(b: *Builder, step: *std.build.LibExeObjStep, options: Opti
"src/dawn/native/opengl/OpenGLBackend.cpp", "src/dawn/native/opengl/OpenGLBackend.cpp",
}) |path| { }) |path| {
var abs_path = std.fs.path.join(b.allocator, &.{ thisDir(), "libs/dawn", path }) catch unreachable; var abs_path = std.fs.path.join(b.allocator, &.{ thisDir(), "libs/dawn", path }) catch unreachable;
sources.append(abs_path) catch unreachable; cpp_sources.append(abs_path) catch unreachable;
} }
} }
if (options.vulkan.?) { if (options.vulkan.?) {
@ -736,7 +717,7 @@ fn buildLibDawnNative(b: *Builder, step: *std.build.LibExeObjStep, options: Opti
"src/dawn/native/vulkan/VulkanBackend.cpp", "src/dawn/native/vulkan/VulkanBackend.cpp",
}) |path| { }) |path| {
var abs_path = std.fs.path.join(b.allocator, &.{ thisDir(), "libs/dawn", path }) catch unreachable; var abs_path = std.fs.path.join(b.allocator, &.{ thisDir(), "libs/dawn", path }) catch unreachable;
sources.append(abs_path) catch unreachable; cpp_sources.append(abs_path) catch unreachable;
} }
// TODO(build-system): vulkan // TODO(build-system): vulkan
// if (enable_vulkan_validation_layers) { // if (enable_vulkan_validation_layers) {
@ -748,7 +729,11 @@ fn buildLibDawnNative(b: *Builder, step: *std.build.LibExeObjStep, options: Opti
// } // }
// } // }
} }
addCSourceFiles(b, lib, sources.items, flags.items);
var cpp_flags = std.ArrayList([]const u8).init(b.allocator);
cpp_flags.appendSlice(flags.items) catch unreachable;
options.appendFlags(&cpp_flags, false, true) catch unreachable;
addCSourceFiles(b, lib, cpp_sources.items, cpp_flags.items);
return lib; return lib;
} }
@ -765,7 +750,6 @@ fn buildLibTint(b: *Builder, step: *std.build.LibExeObjStep, options: Options) *
}; };
var flags = std.ArrayList([]const u8).init(b.allocator); var flags = std.ArrayList([]const u8).init(b.allocator);
options.appendFlags(&flags, true) catch unreachable;
flags.appendSlice(&.{ flags.appendSlice(&.{
// TODO(build-system): make these optional // TODO(build-system): make these optional
"-DTINT_BUILD_SPV_READER=1", "-DTINT_BUILD_SPV_READER=1",
@ -790,116 +774,121 @@ fn buildLibTint(b: *Builder, step: *std.build.LibExeObjStep, options: Options) *
}) catch unreachable; }) catch unreachable;
// libtint_core_all_src // libtint_core_all_src
var sources = std.ArrayList([]const u8).init(b.allocator); appendLangScannedSources(b, lib, options, .{
inline for (&[_][]const u8{ .rel_dirs = &.{
"third_party/tint/src/ast/", "libs/dawn/third_party/tint/src/ast/",
"third_party/tint/src/", "libs/dawn/third_party/tint/src/",
"third_party/tint/src/diagnostic/", "libs/dawn/third_party/tint/src/diagnostic/",
"third_party/tint/src/inspector/", "libs/dawn/third_party/tint/src/inspector/",
"third_party/tint/src/reader/", "libs/dawn/third_party/tint/src/reader/",
"third_party/tint/src/resolver/", "libs/dawn/third_party/tint/src/resolver/",
"third_party/tint/src/transform/", "libs/dawn/third_party/tint/src/utils",
"third_party/tint/src/writer/", "libs/dawn/third_party/tint/src/text/",
"third_party/tint/src/ast/", "libs/dawn/third_party/tint/src/transform/",
}) |dir| scanSources( "libs/dawn/third_party/tint/src/transform/utils",
b, "libs/dawn/third_party/tint/src/writer/",
&sources, "libs/dawn/third_party/tint/src/ast/",
"libs/dawn/" ++ dir, "libs/dawn/third_party/tint/src/val/",
&.{ ".cpp", ".c", ".cc" }, },
&.{}, .flags = flags.items,
&.{ "test", "bench", "printer_windows", "printer_linux", "printer_other" }, .excluding_contains = &.{ "test", "bench", "printer_windows", "printer_linux", "printer_other", "glsl.cc" },
) catch unreachable; }) catch unreachable;
var cpp_sources = std.ArrayList([]const u8).init(b.allocator);
const target = (std.zig.system.NativeTargetInfo.detect(b.allocator, step.target) catch unreachable).target; const target = (std.zig.system.NativeTargetInfo.detect(b.allocator, step.target) catch unreachable).target;
switch (target.os.tag) { switch (target.os.tag) {
.windows => sources.append(thisDir() ++ "/libs/dawn/third_party/tint/src/diagnostic/printer_windows.cc") catch unreachable, .windows => cpp_sources.append(thisDir() ++ "/libs/dawn/third_party/tint/src/diagnostic/printer_windows.cc") catch unreachable,
.linux => sources.append(thisDir() ++ "/libs/dawn/third_party/tint/src/diagnostic/printer_linux.cc") catch unreachable, .linux => cpp_sources.append(thisDir() ++ "/libs/dawn/third_party/tint/src/diagnostic/printer_linux.cc") catch unreachable,
else => sources.append(thisDir() ++ "/libs/dawn/third_party/tint/src/diagnostic/printer_other.cc") catch unreachable, else => cpp_sources.append(thisDir() ++ "/libs/dawn/third_party/tint/src/diagnostic/printer_other.cc") catch unreachable,
} }
// libtint_sem_src // libtint_sem_src
scanSources( appendLangScannedSources(b, lib, options, .{
b, .rel_dirs = &.{
&sources, "libs/dawn/third_party/tint/src/sem/",
"libs/dawn/third_party/tint/src/sem/", },
&.{ ".cpp", ".c", ".cc" }, .flags = flags.items,
&.{}, .excluding_contains = &.{ "test", "benchmark" },
&.{ "test", "benchmark" }, }) catch unreachable;
) catch unreachable;
// libtint_spv_reader_src // libtint_spv_reader_src
scanSources( appendLangScannedSources(b, lib, options, .{
b, .rel_dirs = &.{
&sources, "libs/dawn/third_party/tint/src/reader/spirv/",
"libs/dawn/third_party/tint/src/reader/spirv/", },
&.{ ".cpp", ".c", ".cc" }, .flags = flags.items,
&.{}, .excluding_contains = &.{ "test", "benchmark" },
&.{ "test", "benchmark" }, }) catch unreachable;
) catch unreachable;
// libtint_spv_writer_src // libtint_spv_writer_src
scanSources( appendLangScannedSources(b, lib, options, .{
b, .rel_dirs = &.{
&sources, "libs/dawn/third_party/tint/src/writer/spirv/",
"libs/dawn/third_party/tint/src/writer/spirv/", },
&.{ ".cpp", ".c", ".cc" }, .flags = flags.items,
&.{}, .excluding_contains = &.{ "test", "bench" },
&.{ "test", "bench" }, }) catch unreachable;
) catch unreachable;
// TODO(build-system): make optional // TODO(build-system): make optional
// libtint_wgsl_reader_src // libtint_wgsl_reader_src
for ([_][]const u8{ appendLangScannedSources(b, lib, options, .{
"third_party/tint/src/reader/wgsl/lexer.cc", .rel_dirs = &.{
"third_party/tint/src/reader/wgsl/parser.cc", "libs/dawn/third_party/tint/src/reader/wgsl/",
"third_party/tint/src/reader/wgsl/parser_impl.cc", },
"third_party/tint/src/reader/wgsl/token.cc", .flags = flags.items,
}) |path| { .excluding_contains = &.{ "test", "bench" },
var abs_path = std.fs.path.join(b.allocator, &.{ thisDir(), "libs/dawn", path }) catch unreachable; }) catch unreachable;
sources.append(abs_path) catch unreachable;
}
// TODO(build-system): make optional // TODO(build-system): make optional
// libtint_wgsl_writer_src // libtint_wgsl_writer_src
for ([_][]const u8{ appendLangScannedSources(b, lib, options, .{
"third_party/tint/src/writer/wgsl/generator.cc", .rel_dirs = &.{
"third_party/tint/src/writer/wgsl/generator_impl.cc", "libs/dawn/third_party/tint/src/writer/wgsl/",
}) |path| { },
var abs_path = std.fs.path.join(b.allocator, &.{ thisDir(), "libs/dawn", path }) catch unreachable; .flags = flags.items,
sources.append(abs_path) catch unreachable; .excluding_contains = &.{ "test", "bench" },
} }) catch unreachable;
// TODO(build-system): make optional // TODO(build-system): make optional
// libtint_msl_writer_src // libtint_msl_writer_src
for ([_][]const u8{ appendLangScannedSources(b, lib, options, .{
"third_party/tint/src/writer/msl/generator.cc", .rel_dirs = &.{
"third_party/tint/src/writer/msl/generator_impl.cc", "libs/dawn/third_party/tint/src/writer/msl/",
}) |path| { },
var abs_path = std.fs.path.join(b.allocator, &.{ thisDir(), "libs/dawn", path }) catch unreachable; .flags = flags.items,
sources.append(abs_path) catch unreachable; .excluding_contains = &.{ "test", "bench" },
} }) catch unreachable;
// TODO(build-system): make optional // TODO(build-system): make optional
// libtint_hlsl_writer_src // libtint_hlsl_writer_src
for ([_][]const u8{ appendLangScannedSources(b, lib, options, .{
"third_party/tint/src/writer/hlsl/generator.cc", .rel_dirs = &.{
"third_party/tint/src/writer/hlsl/generator_impl.cc", "libs/dawn/third_party/tint/src/writer/hlsl/",
}) |path| { },
var abs_path = std.fs.path.join(b.allocator, &.{ thisDir(), "libs/dawn", path }) catch unreachable; .flags = flags.items,
sources.append(abs_path) catch unreachable; .excluding_contains = &.{ "test", "bench" },
} }) catch unreachable;
// TODO(build-system): make optional // TODO(build-system): make optional
// libtint_glsl_writer_src // libtint_glsl_writer_src
appendLangScannedSources(b, lib, options, .{
.rel_dirs = &.{
"libs/dawn/third_party/tint/src/writer/glsl/",
},
.flags = flags.items,
.excluding_contains = &.{ "test", "bench" },
}) catch unreachable;
for ([_][]const u8{ for ([_][]const u8{
"third_party/tint/src/transform/glsl.cc", "third_party/tint/src/transform/glsl.cc",
"third_party/tint/src/writer/glsl/generator.cc",
"third_party/tint/src/writer/glsl/generator_impl.cc",
}) |path| { }) |path| {
var abs_path = std.fs.path.join(b.allocator, &.{ thisDir(), "libs/dawn", path }) catch unreachable; var abs_path = std.fs.path.join(b.allocator, &.{ thisDir(), "libs/dawn", path }) catch unreachable;
sources.append(abs_path) catch unreachable; cpp_sources.append(abs_path) catch unreachable;
} }
addCSourceFiles(b, lib, sources.items, flags.items);
var cpp_flags = std.ArrayList([]const u8).init(b.allocator);
cpp_flags.appendSlice(flags.items) catch unreachable;
options.appendFlags(&cpp_flags, false, true) catch unreachable;
addCSourceFiles(b, lib, cpp_sources.items, cpp_flags.items);
return lib; return lib;
} }
@ -916,7 +905,6 @@ fn buildLibSPIRVTools(b: *Builder, step: *std.build.LibExeObjStep, options: Opti
}; };
var flags = std.ArrayList([]const u8).init(b.allocator); var flags = std.ArrayList([]const u8).init(b.allocator);
options.appendFlags(&flags, true) catch unreachable;
flags.appendSlice(&.{ flags.appendSlice(&.{
include("libs/dawn"), include("libs/dawn"),
include("libs/dawn/third_party/vulkan-deps/spirv-tools/src"), include("libs/dawn/third_party/vulkan-deps/spirv-tools/src"),
@ -928,47 +916,41 @@ fn buildLibSPIRVTools(b: *Builder, step: *std.build.LibExeObjStep, options: Opti
}) catch unreachable; }) catch unreachable;
// spvtools // spvtools
var sources = std.ArrayList([]const u8).init(b.allocator); appendLangScannedSources(b, lib, options, .{
inline for (&[_][]const u8{ .rel_dirs = &.{
"third_party/vulkan-deps/spirv-tools/src/source/", "libs/dawn/third_party/vulkan-deps/spirv-tools/src/source/",
"third_party/vulkan-deps/spirv-tools/src/source/util/", "libs/dawn/third_party/vulkan-deps/spirv-tools/src/source/util/",
}) |dir| scanSources( },
b, .flags = flags.items,
&sources, .excluding_contains = &.{ "test", "benchmark" },
"libs/dawn/" ++ dir, }) catch unreachable;
&.{ ".cpp", ".c", ".cc" },
&.{},
&.{ "test", "benchmark" },
) catch unreachable;
// spvtools_val // spvtools_val
scanSources( appendLangScannedSources(b, lib, options, .{
b, .rel_dirs = &.{
&sources, "libs/dawn/third_party/vulkan-deps/spirv-tools/src/source/val/",
"libs/dawn/third_party/vulkan-deps/spirv-tools/src/source/val/", },
&.{ ".cpp", ".c", ".cc" }, .flags = flags.items,
&.{}, .excluding_contains = &.{ "test", "benchmark" },
&.{ "test", "benchmark" }, }) catch unreachable;
) catch unreachable;
// spvtools_opt // spvtools_opt
scanSources( appendLangScannedSources(b, lib, options, .{
b, .rel_dirs = &.{
&sources, "libs/dawn/third_party/vulkan-deps/spirv-tools/src/source/opt/",
"libs/dawn/third_party/vulkan-deps/spirv-tools/src/source/opt/", },
&.{ ".cpp", ".c", ".cc" }, .flags = flags.items,
&.{}, .excluding_contains = &.{ "test", "benchmark" },
&.{ "test", "benchmark" }, }) catch unreachable;
) catch unreachable;
// spvtools_link // spvtools_link
for ([_][]const u8{ appendLangScannedSources(b, lib, options, .{
"third_party/vulkan-deps/spirv-tools/src/source/link/linker.cpp", .rel_dirs = &.{
}) |path| { "libs/dawn/third_party/vulkan-deps/spirv-tools/src/source/link/",
var abs_path = std.fs.path.join(b.allocator, &.{ thisDir(), "libs/dawn", path }) catch unreachable; },
sources.append(abs_path) catch unreachable; .flags = flags.items,
} .excluding_contains = &.{ "test", "benchmark" },
addCSourceFiles(b, lib, sources.items, flags.items); }) catch unreachable;
return lib; return lib;
} }
@ -985,7 +967,6 @@ fn buildLibSPIRVCross(b: *Builder, step: *std.build.LibExeObjStep, options: Opti
}; };
var flags = std.ArrayList([]const u8).init(b.allocator); var flags = std.ArrayList([]const u8).init(b.allocator);
options.appendFlags(&flags, false) catch unreachable;
flags.appendSlice(&.{ flags.appendSlice(&.{
"-DSPIRV_CROSS_EXCEPTIONS_TO_ASSERTIONS", "-DSPIRV_CROSS_EXCEPTIONS_TO_ASSERTIONS",
include("libs/dawn/third_party/vulkan-deps/spirv-cross/src"), include("libs/dawn/third_party/vulkan-deps/spirv-cross/src"),
@ -1004,16 +985,13 @@ fn buildLibSPIRVCross(b: *Builder, step: *std.build.LibExeObjStep, options: Opti
if (target.os.tag != .windows) flags.append("-fno-exceptions") catch unreachable; if (target.os.tag != .windows) flags.append("-fno-exceptions") catch unreachable;
// spirv_cross // spirv_cross
var sources = std.ArrayList([]const u8).init(b.allocator); appendLangScannedSources(b, lib, options, .{
scanSources( .rel_dirs = &.{
b, "libs/dawn/third_party/vulkan-deps/spirv-cross/src/",
&sources, },
"libs/dawn/third_party/vulkan-deps/spirv-cross/src/", .flags = flags.items,
&.{ ".cpp", ".c", ".cc" }, .excluding_contains = &.{ "test", "benchmark", "main.cpp" },
&.{}, }) catch unreachable;
&.{ "test", "benchmark", "main.cpp" },
) catch unreachable;
addCSourceFiles(b, lib, sources.items, flags.items);
return lib; return lib;
} }
@ -1039,47 +1017,38 @@ fn buildLibAbseilCpp(b: *Builder, step: *std.build.LibExeObjStep, options: Optio
if (target.os.tag == .macos) lib.linkFramework("CoreFoundation"); if (target.os.tag == .macos) lib.linkFramework("CoreFoundation");
var flags = std.ArrayList([]const u8).init(b.allocator); var flags = std.ArrayList([]const u8).init(b.allocator);
options.appendFlags(&flags, false) catch unreachable;
flags.appendSlice(&.{ flags.appendSlice(&.{
include("libs/dawn"), include("libs/dawn"),
include("libs/dawn/third_party/abseil-cpp"), include("libs/dawn/third_party/abseil-cpp"),
}) catch unreachable; }) catch unreachable;
// absl // absl
const source_dirs = &[_][]const u8{ appendLangScannedSources(b, lib, options, .{
"third_party/abseil-cpp/absl/strings/", .rel_dirs = &.{
"third_party/abseil-cpp/absl/strings/internal/", "libs/dawn/third_party/abseil-cpp/absl/strings/",
"third_party/abseil-cpp/absl/strings/internal/str_format/", "libs/dawn/third_party/abseil-cpp/absl/strings/internal/",
"third_party/abseil-cpp/absl/types/", "libs/dawn/third_party/abseil-cpp/absl/strings/internal/str_format/",
"third_party/abseil-cpp/absl/flags/internal/", "libs/dawn/third_party/abseil-cpp/absl/types/",
"third_party/abseil-cpp/absl/flags/", "libs/dawn/third_party/abseil-cpp/absl/flags/internal/",
"third_party/abseil-cpp/absl/synchronization/", "libs/dawn/third_party/abseil-cpp/absl/flags/",
"third_party/abseil-cpp/absl/synchronization/internal/", "libs/dawn/third_party/abseil-cpp/absl/synchronization/",
"third_party/abseil-cpp/absl/hash/internal/", "libs/dawn/third_party/abseil-cpp/absl/synchronization/internal/",
"third_party/abseil-cpp/absl/debugging/", "libs/dawn/third_party/abseil-cpp/absl/hash/internal/",
"third_party/abseil-cpp/absl/debugging/internal/", "libs/dawn/third_party/abseil-cpp/absl/debugging/",
"third_party/abseil-cpp/absl/status/", "libs/dawn/third_party/abseil-cpp/absl/debugging/internal/",
"third_party/abseil-cpp/absl/time/internal/cctz/src/", "libs/dawn/third_party/abseil-cpp/absl/status/",
"third_party/abseil-cpp/absl/time/", "libs/dawn/third_party/abseil-cpp/absl/time/internal/cctz/src/",
"third_party/abseil-cpp/absl/container/internal/", "libs/dawn/third_party/abseil-cpp/absl/time/",
"third_party/abseil-cpp/absl/numeric/", "libs/dawn/third_party/abseil-cpp/absl/container/internal/",
"third_party/abseil-cpp/absl/random/", "libs/dawn/third_party/abseil-cpp/absl/numeric/",
"third_party/abseil-cpp/absl/random/internal/", "libs/dawn/third_party/abseil-cpp/absl/random/",
"third_party/abseil-cpp/absl/base/internal/", "libs/dawn/third_party/abseil-cpp/absl/random/internal/",
"third_party/abseil-cpp/absl/base/", "libs/dawn/third_party/abseil-cpp/absl/base/internal/",
}; "libs/dawn/third_party/abseil-cpp/absl/base/",
var sources = std.ArrayList([]const u8).init(b.allocator); },
inline for (source_dirs) |dir| { .flags = flags.items,
scanSources( .excluding_contains = &.{ "_test", "_testing", "benchmark", "print_hash_of.cc", "gaussian_distribution_gentables.cc" },
b, }) catch unreachable;
&sources,
"libs/dawn/" ++ dir,
&.{ ".cpp", ".c", ".cc" },
&.{},
&.{ "_test", "_testing", "benchmark", "print_hash_of.cc", "gaussian_distribution_gentables.cc" },
) catch unreachable;
}
addCSourceFiles(b, lib, sources.items, flags.items);
return lib; return lib;
} }
@ -1096,7 +1065,6 @@ fn buildLibDawnWire(b: *Builder, step: *std.build.LibExeObjStep, options: Option
}; };
var flags = std.ArrayList([]const u8).init(b.allocator); var flags = std.ArrayList([]const u8).init(b.allocator);
options.appendFlags(&flags, false) catch unreachable;
flags.appendSlice(&.{ flags.appendSlice(&.{
include("libs/dawn"), include("libs/dawn"),
include("libs/dawn/src"), include("libs/dawn/src"),
@ -1105,23 +1073,18 @@ fn buildLibDawnWire(b: *Builder, step: *std.build.LibExeObjStep, options: Option
include("libs/dawn/out/Debug/gen/src"), include("libs/dawn/out/Debug/gen/src"),
}) catch unreachable; }) catch unreachable;
var sources = std.ArrayList([]const u8).init(b.allocator); appendLangScannedSources(b, lib, options, .{
inline for (&[_][]const u8{ .rel_dirs = &.{
"out/Debug/gen/src/dawn/wire/", "libs/dawn/out/Debug/gen/src/dawn/wire/",
"out/Debug/gen/src/dawn/wire/client/", "libs/dawn/out/Debug/gen/src/dawn/wire/client/",
"out/Debug/gen/src/dawn/wire/server/", "libs/dawn/out/Debug/gen/src/dawn/wire/server/",
"src/dawn/wire/", "libs/dawn/src/dawn/wire/",
"src/dawn/wire/client/", "libs/dawn/src/dawn/wire/client/",
"src/dawn/wire/server/", "libs/dawn/src/dawn/wire/server/",
}) |dir| scanSources( },
b, .flags = flags.items,
&sources, .excluding_contains = &.{ "test", "benchmark", "mock" },
"libs/dawn/" ++ dir, }) catch unreachable;
&.{ ".cpp", ".c", ".cc" },
&.{},
&.{ "test", "benchmark", "mock" },
) catch unreachable;
addCSourceFiles(b, lib, sources.items, flags.items);
return lib; return lib;
} }
@ -1139,7 +1102,6 @@ fn buildLibDawnUtils(b: *Builder, step: *std.build.LibExeObjStep, options: Optio
glfw.link(b, lib, .{ .system_sdk = .{ .set_sysroot = false } }); glfw.link(b, lib, .{ .system_sdk = .{ .set_sysroot = false } });
var flags = std.ArrayList([]const u8).init(b.allocator); var flags = std.ArrayList([]const u8).init(b.allocator);
options.appendFlags(&flags, false) catch unreachable;
appendDawnEnableBackendTypeFlags(&flags, options) catch unreachable; appendDawnEnableBackendTypeFlags(&flags, options) catch unreachable;
flags.appendSlice(&.{ flags.appendSlice(&.{
include("libs/mach-glfw/upstream/glfw/include"), include("libs/mach-glfw/upstream/glfw/include"),
@ -1148,13 +1110,13 @@ fn buildLibDawnUtils(b: *Builder, step: *std.build.LibExeObjStep, options: Optio
include("libs/dawn/out/Debug/gen/include"), include("libs/dawn/out/Debug/gen/include"),
}) catch unreachable; }) catch unreachable;
var sources = std.ArrayList([]const u8).init(b.allocator); var cpp_sources = std.ArrayList([]const u8).init(b.allocator);
for ([_][]const u8{ for ([_][]const u8{
"src/dawn/utils/BackendBinding.cpp", "src/dawn/utils/BackendBinding.cpp",
"src/dawn/utils/NullBinding.cpp", "src/dawn/utils/NullBinding.cpp",
}) |path| { }) |path| {
var abs_path = std.fs.path.join(b.allocator, &.{ thisDir(), "libs/dawn", path }) catch unreachable; var abs_path = std.fs.path.join(b.allocator, &.{ thisDir(), "libs/dawn", path }) catch unreachable;
sources.append(abs_path) catch unreachable; cpp_sources.append(abs_path) catch unreachable;
} }
if (options.d3d12.?) { if (options.d3d12.?) {
@ -1162,7 +1124,7 @@ fn buildLibDawnUtils(b: *Builder, step: *std.build.LibExeObjStep, options: Optio
"src/dawn/utils/D3D12Binding.cpp", "src/dawn/utils/D3D12Binding.cpp",
}) |path| { }) |path| {
var abs_path = std.fs.path.join(b.allocator, &.{ thisDir(), "libs/dawn", path }) catch unreachable; var abs_path = std.fs.path.join(b.allocator, &.{ thisDir(), "libs/dawn", path }) catch unreachable;
sources.append(abs_path) catch unreachable; cpp_sources.append(abs_path) catch unreachable;
} }
} }
if (options.metal.?) { if (options.metal.?) {
@ -1170,7 +1132,7 @@ fn buildLibDawnUtils(b: *Builder, step: *std.build.LibExeObjStep, options: Optio
"src/dawn/utils/MetalBinding.mm", "src/dawn/utils/MetalBinding.mm",
}) |path| { }) |path| {
var abs_path = std.fs.path.join(b.allocator, &.{ thisDir(), "libs/dawn", path }) catch unreachable; var abs_path = std.fs.path.join(b.allocator, &.{ thisDir(), "libs/dawn", path }) catch unreachable;
sources.append(abs_path) catch unreachable; cpp_sources.append(abs_path) catch unreachable;
} }
} }
@ -1179,7 +1141,7 @@ fn buildLibDawnUtils(b: *Builder, step: *std.build.LibExeObjStep, options: Optio
"src/dawn/utils/OpenGLBinding.cpp", "src/dawn/utils/OpenGLBinding.cpp",
}) |path| { }) |path| {
var abs_path = std.fs.path.join(b.allocator, &.{ thisDir(), "libs/dawn", path }) catch unreachable; var abs_path = std.fs.path.join(b.allocator, &.{ thisDir(), "libs/dawn", path }) catch unreachable;
sources.append(abs_path) catch unreachable; cpp_sources.append(abs_path) catch unreachable;
} }
} }
@ -1188,10 +1150,14 @@ fn buildLibDawnUtils(b: *Builder, step: *std.build.LibExeObjStep, options: Optio
"src/dawn/utils/VulkanBinding.cpp", "src/dawn/utils/VulkanBinding.cpp",
}) |path| { }) |path| {
var abs_path = std.fs.path.join(b.allocator, &.{ thisDir(), "libs/dawn", path }) catch unreachable; var abs_path = std.fs.path.join(b.allocator, &.{ thisDir(), "libs/dawn", path }) catch unreachable;
sources.append(abs_path) catch unreachable; cpp_sources.append(abs_path) catch unreachable;
} }
} }
addCSourceFiles(b, lib, sources.items, flags.items);
var cpp_flags = std.ArrayList([]const u8).init(b.allocator);
cpp_flags.appendSlice(flags.items) catch unreachable;
options.appendFlags(&cpp_flags, false, true) catch unreachable;
addCSourceFiles(b, lib, cpp_sources.items, cpp_flags.items);
return lib; return lib;
} }
@ -1226,18 +1192,70 @@ fn divideSources(b: *Builder, sources: []const []const u8) ![]const []const []co
return divided.items; return divided.items;
} }
fn appendLangScannedSources(
b: *Builder,
step: *std.build.LibExeObjStep,
options: Options,
args: struct {
zero_debug_symbols: bool = false,
flags: []const []const u8,
rel_dirs: []const []const u8 = &.{},
objc: bool = false,
excluding: []const []const u8 = &.{},
excluding_contains: []const []const u8 = &.{},
},
) !void {
var cpp_flags = std.ArrayList([]const u8).init(b.allocator);
try cpp_flags.appendSlice(args.flags);
options.appendFlags(&cpp_flags, args.zero_debug_symbols, true) catch unreachable;
const cpp_extensions: []const []const u8 = if (args.objc) &.{".mm"} else &.{ ".cpp", ".cc" };
try appendScannedSources(b, step, .{
.flags = cpp_flags.items,
.rel_dirs = args.rel_dirs,
.extensions = cpp_extensions,
.excluding = args.excluding,
.excluding_contains = args.excluding_contains,
});
var flags = std.ArrayList([]const u8).init(b.allocator);
try flags.appendSlice(args.flags);
options.appendFlags(&flags, args.zero_debug_symbols, false) catch unreachable;
const c_extensions: []const []const u8 = if (args.objc) &.{".m"} else &.{".c"};
try appendScannedSources(b, step, .{
.flags = flags.items,
.rel_dirs = args.rel_dirs,
.extensions = c_extensions,
.excluding = args.excluding,
.excluding_contains = args.excluding_contains,
});
}
fn appendScannedSources(b: *Builder, step: *std.build.LibExeObjStep, args: struct {
flags: []const []const u8,
rel_dirs: []const []const u8 = &.{},
extensions: []const []const u8,
excluding: []const []const u8 = &.{},
excluding_contains: []const []const u8 = &.{},
}) !void {
var sources = std.ArrayList([]const u8).init(b.allocator);
for (args.rel_dirs) |rel_dir| {
try scanSources(b, &sources, rel_dir, args.extensions, args.excluding, args.excluding_contains);
}
addCSourceFiles(b, step, sources.items, args.flags);
}
/// Scans rel_dir for sources ending with one of the provided extensions, excluding relative paths /// Scans rel_dir for sources ending with one of the provided extensions, excluding relative paths
/// listed in the excluded list. /// listed in the excluded list.
/// Results are appended to the dst ArrayList. /// Results are appended to the dst ArrayList.
fn scanSources( fn scanSources(
b: *Builder, b: *Builder,
dst: *std.ArrayList([]const u8), dst: *std.ArrayList([]const u8),
comptime rel_dir: []const u8, rel_dir: []const u8,
extensions: []const []const u8, extensions: []const []const u8,
excluding: []const []const u8, excluding: []const []const u8,
excluding_contains: []const []const u8, excluding_contains: []const []const u8,
) !void { ) !void {
const abs_dir = thisDir() ++ "/" ++ rel_dir; const abs_dir = try std.mem.concat(b.allocator, u8, &.{ thisDir(), "/", rel_dir });
var dir = try std.fs.openDirAbsolute(abs_dir, .{ .iterate = true }); var dir = try std.fs.openDirAbsolute(abs_dir, .{ .iterate = true });
defer dir.close(); defer dir.close();
var dir_it = dir.iterate(); var dir_it = dir.iterate();

View file

@ -1,8 +1,8 @@
#include <dawn_native/DawnNative.h> #include <dawn/native/DawnNative.h>
#include <dawn_native/wgpu_structs_autogen.h> #include <dawn/native/wgpu_structs_autogen.h>
#include "utils/BackendBinding.h" #include "dawn/utils/BackendBinding.h"
#if defined(DAWN_ENABLE_BACKEND_OPENGL) #if defined(DAWN_ENABLE_BACKEND_OPENGL)
#include <dawn_native/OpenGLBackend.h> #include <dawn/native/OpenGLBackend.h>
#endif #endif
#include "dawn_native_mach.h" #include "dawn_native_mach.h"

View file

@ -157,7 +157,7 @@ fn frame(params: FrameParams) !void {
const pass = c.wgpuCommandEncoderBeginRenderPass(encoder, &render_pass_info); const pass = c.wgpuCommandEncoderBeginRenderPass(encoder, &render_pass_info);
c.wgpuRenderPassEncoderSetPipeline(pass, params.pipeline); c.wgpuRenderPassEncoderSetPipeline(pass, params.pipeline);
c.wgpuRenderPassEncoderDraw(pass, 3, 1, 0, 0); c.wgpuRenderPassEncoderDraw(pass, 3, 1, 0, 0);
c.wgpuRenderPassEncoderEndPass(pass); c.wgpuRenderPassEncoderEnd(pass);
c.wgpuRenderPassEncoderRelease(pass); c.wgpuRenderPassEncoderRelease(pass);
const commands = c.wgpuCommandEncoderFinish(encoder, null); const commands = c.wgpuCommandEncoderFinish(encoder, null);