Skip to content

Commit ddff67a

Browse files
committed
Upgrade bgfx
1 parent b58eb1d commit ddff67a

File tree

330 files changed

+68066
-33306
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

330 files changed

+68066
-33306
lines changed

.zigversion

Lines changed: 0 additions & 1 deletion
This file was deleted.

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,9 @@ Minimal is `0.15.1`. But you know try your version and believe.
4141

4242
## Bgfx version
4343

44-
- [BX](https://github.com/bkaradzic/bx//compare/d858859d1724fc037129318330f9c5ee5e008a08...master)
45-
- [BImg](https://github.com/bkaradzic/bimg/compare/446b9eb11130821fd11607c2fc94aee80976e56a...master)
46-
- [BGFX](https://github.com/bkaradzic/bgfx/compare/14e0aa5aff65a12df621fbc9466b42d41d01f013...master)
44+
- [BX](https://github.com/bkaradzic/bx//compare/1dc8c4827087c5a6cde221b0978baa15533348fd...master)
45+
- [BImg](https://github.com/bkaradzic/bimg/compare/bf10ffbb3df1f9f12ad7a9105e5e96e11a9c5a0c...master)
46+
- [BGFX](https://github.com/bkaradzic/bgfx/compare/ee2072d02f59ffbd89ef79026474a5e5fa17f206...master)
4747

4848
## Getting started
4949

build.zig

Lines changed: 23 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,10 @@ pub fn build(b: *std.Build) !void {
4444
"-Wno-deprecated-declarations",
4545
"-Wno-tautological-constant-compare",
4646
"-Wno-error=date-time",
47+
"-Wno-error=unused-command-line-argument",
4748
};
4849
const cxx_options = common_options ++ [_][]const u8{
49-
"-std=c++17",
50+
"-std=c++20",
5051
};
5152
const c_options = common_options ++ [_][]const u8{};
5253
const mm_options = cxx_options ++ [_][]const u8{};
@@ -61,6 +62,7 @@ pub fn build(b: *std.Build) !void {
6162
.target = target,
6263
.optimize = optimize,
6364
}),
65+
.use_llvm = true,
6466
});
6567
const combine_bin_zig = b.addExecutable(.{
6668
.name = "combine_bin_zig",
@@ -69,6 +71,7 @@ pub fn build(b: *std.Build) !void {
6971
.target = target,
7072
.optimize = optimize,
7173
}),
74+
.use_llvm = true,
7275
});
7376

7477
b.installArtifact(combine_bin_zig);
@@ -83,6 +86,7 @@ pub fn build(b: *std.Build) !void {
8386
.target = target,
8487
.optimize = optimize,
8588
}),
89+
.use_llvm = true,
8690
});
8791
bx.addCSourceFiles(.{
8892
.flags = &cxx_options,
@@ -104,6 +108,7 @@ pub fn build(b: *std.Build) !void {
104108
.target = target,
105109
.optimize = optimize,
106110
}),
111+
.use_llvm = true,
107112
});
108113
bimg.addCSourceFiles(.{
109114
.flags = &cxx_options,
@@ -131,6 +136,7 @@ pub fn build(b: *std.Build) !void {
131136
.target = target,
132137
.optimize = optimize,
133138
}),
139+
.use_llvm = true,
134140
});
135141
b.installArtifact(bgfx);
136142
bxInclude(b, bgfx, target, optimize);
@@ -220,6 +226,7 @@ pub fn build(b: *std.Build) !void {
220226
.target = target,
221227
.optimize = optimize,
222228
}),
229+
.use_llvm = true,
223230
});
224231

225232
b.installArtifact(shaderc);
@@ -427,6 +434,7 @@ pub fn build(b: *std.Build) !void {
427434
.target = target,
428435
.optimize = optimize,
429436
}),
437+
.use_llvm = true,
430438
});
431439
spirv_cross_lib.addIncludePath(b.path(spirv_cross_path ++ "include"));
432440
spirv_cross_lib.addCSourceFiles(.{
@@ -465,6 +473,7 @@ pub fn build(b: *std.Build) !void {
465473
.target = target,
466474
.optimize = optimize,
467475
}),
476+
.use_llvm = true,
468477
});
469478
glslang_lib.addIncludePath(b.path("libs/bgfx/3rdparty"));
470479
glslang_lib.addIncludePath(b.path(glslang_path));
@@ -500,7 +509,8 @@ pub fn build(b: *std.Build) !void {
500509
"-MP",
501510
"-Wall",
502511
"-Wextra",
503-
"-ffast-math",
512+
// https://github.com/bkaradzic/bgfx/commit/b4dbc129f3b69b0d6a9093f2d579b883396a839f
513+
// "-ffast-math",
504514
"-fomit-frame-pointer",
505515
"-g",
506516
"-m64",
@@ -519,7 +529,8 @@ pub fn build(b: *std.Build) !void {
519529
"-MP",
520530
"-Wall",
521531
"-Wextra",
522-
"-ffast-math",
532+
// https://github.com/bkaradzic/bgfx/commit/b4dbc129f3b69b0d6a9093f2d579b883396a839f
533+
// "-ffast-math",
523534
"-fomit-frame-pointer",
524535
"-g",
525536
"-m64",
@@ -535,6 +546,7 @@ pub fn build(b: *std.Build) !void {
535546
.target = target,
536547
.optimize = optimize,
537548
}),
549+
.use_llvm = true,
538550
});
539551
glsl_optimizer_lib.addIncludePath(b.path(glsl_optimizer_path ++ "include"));
540552
glsl_optimizer_lib.addIncludePath(b.path(glsl_optimizer_path ++ "src"));
@@ -580,7 +592,11 @@ fn bxInclude(b: *std.Build, step: *std.Build.Step.Compile, target: std.Build.Res
580592
step.root_module.addCMacro("__STDC_FORMAT_MACROS", "1");
581593
step.root_module.addCMacro("__STDC_CONSTANT_MACROS", "1");
582594

583-
step.root_module.addCMacro("BX_CONFIG_DEBUG", if (optimize == .Debug) "1" else "0");
595+
// if (target.result.os.tag == .windows) {
596+
// step.root_module.addCMacro("BX_CONFIG_EXCEPTION_HANDLING_USE_WINDOWS_SEH", "0");
597+
// }
598+
599+
step.root_module.addCMacro("BX_CONFIG_DEBUG", if (optimize == .Debug) "0" else "0"); // FIXME: ZIG bug
584600

585601
switch (target.result.os.tag) {
586602
.freebsd => step.addIncludePath(b.path("libs/bx/include/compat/freebsd")),
@@ -820,6 +836,7 @@ const spirv_opt_files = .{
820836
spirv_opt_path ++ "source/opcode.cpp",
821837
spirv_opt_path ++ "source/operand.cpp",
822838
spirv_opt_path ++ "source/to_string.cpp",
839+
spirv_opt_path ++ "source/opt/graph.cpp",
823840
spirv_opt_path ++ "source/opt/aggressive_dead_code_elim_pass.cpp",
824841
spirv_opt_path ++ "source/opt/amd_ext_to_khr.cpp",
825842
spirv_opt_path ++ "source/opt/analyze_live_input_pass.cpp",
@@ -942,6 +959,7 @@ const spirv_opt_files = .{
942959
spirv_opt_path ++ "source/opt/struct_packing_pass.cpp",
943960
spirv_opt_path ++ "source/opt/split_combined_image_sampler_pass.cpp",
944961
spirv_opt_path ++ "source/opt/resolve_binding_conflicts_pass.cpp",
962+
spirv_opt_path ++ "source/opt/canonicalize_ids_pass.cpp",
945963
spirv_opt_path ++ "source/parsed_operand.cpp",
946964
spirv_opt_path ++ "source/print.cpp",
947965
spirv_opt_path ++ "source/reduce/change_operand_reduction_opportunity.cpp",
@@ -1035,4 +1053,5 @@ const spirv_opt_files = .{
10351053
spirv_opt_path ++ "source/val/validate_tensor_layout.cpp",
10361054
spirv_opt_path ++ "source/val/validate_tensor.cpp",
10371055
spirv_opt_path ++ "source/val/validate_invalid_type.cpp",
1056+
spirv_opt_path ++ "source/val/validate_graph.cpp",
10381057
};

build.zig.zon

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
.name = .zbgfx,
33
.fingerprint = 0xc48ed871c4086e4a,
44
.version = "0.5.0",
5-
.minimum_zig_version = "0.15.1",
5+
.minimum_zig_version = "0.15.2",
66
.paths = .{
77
"includes",
88
"libs",

examples/00-minimal/src/main.zig

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,7 @@ pub fn main() anyerror!u8 {
190190
//
191191
// Reset and clear
192192
//
193-
bgfx.reset(@intCast(framebufferSize[0]), @intCast(framebufferSize[1]), reset_flags, bgfx_init.resolution.format);
193+
bgfx.reset(@intCast(framebufferSize[0]), @intCast(framebufferSize[1]), reset_flags, bgfx_init.resolution.formatColor);
194194

195195
// Set view 0 clear state.
196196
bgfx.setViewClear(0, bgfx.ClearFlags_Color | bgfx.ClearFlags_Depth, 0x303030ff, 1.0, 0);
@@ -262,7 +262,7 @@ pub fn main() anyerror!u8 {
262262
@intCast(size[0]),
263263
@intCast(size[1]),
264264
reset_flags,
265-
bgfx_init.resolution.format,
265+
bgfx_init.resolution.formatColor,
266266
);
267267
old_size = size;
268268
old_flags = reset_flags;

examples/01-zgui/src/main.zig

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ pub fn main() anyerror!u8 {
100100
//
101101
// Reset and clear
102102
//
103-
bgfx.reset(@intCast(framebufferSize[0]), @intCast(framebufferSize[1]), reset_flags, bgfx_init.resolution.format);
103+
bgfx.reset(@intCast(framebufferSize[0]), @intCast(framebufferSize[1]), reset_flags, bgfx_init.resolution.formatColor);
104104

105105
// Set view 0 clear state.
106106
bgfx.setViewClear(0, bgfx.ClearFlags_Color | bgfx.ClearFlags_Depth, 0x303030ff, 1.0, 0);
@@ -184,7 +184,7 @@ pub fn main() anyerror!u8 {
184184
@intCast(size[0]),
185185
@intCast(size[1]),
186186
reset_flags,
187-
bgfx_init.resolution.format,
187+
bgfx_init.resolution.formatColor,
188188
);
189189
old_size = size;
190190
old_flags = reset_flags;

examples/02-runtime-shaderc/src/main.zig

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -241,7 +241,7 @@ pub fn main() anyerror!u8 {
241241
//
242242
// Reset and clear
243243
//
244-
bgfx.reset(@intCast(framebufferSize[0]), @intCast(framebufferSize[1]), reset_flags, bgfx_init.resolution.format);
244+
bgfx.reset(@intCast(framebufferSize[0]), @intCast(framebufferSize[1]), reset_flags, bgfx_init.resolution.formatColor);
245245

246246
// Set view 0 clear state.
247247
bgfx.setViewClear(0, bgfx.ClearFlags_Color | bgfx.ClearFlags_Depth, 0x303030ff, 1.0, 0);
@@ -323,7 +323,7 @@ pub fn main() anyerror!u8 {
323323
@intCast(size[0]),
324324
@intCast(size[1]),
325325
reset_flags,
326-
bgfx_init.resolution.format,
326+
bgfx_init.resolution.formatColor,
327327
);
328328
old_size = size;
329329
old_flags = reset_flags;

examples/03-debugdraw/src/main.zig

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ pub fn main() anyerror!u8 {
9696
//
9797
// Reset and clear
9898
//
99-
bgfx.reset(@intCast(framebufferSize[0]), @intCast(framebufferSize[1]), reset_flags, bgfx_init.resolution.format);
99+
bgfx.reset(@intCast(framebufferSize[0]), @intCast(framebufferSize[1]), reset_flags, bgfx_init.resolution.formatColor);
100100

101101
// Set view 0 clear state.
102102
bgfx.setViewClear(0, bgfx.ClearFlags_Color | bgfx.ClearFlags_Depth, 0x303030ff, 1.0, 0);
@@ -178,7 +178,7 @@ pub fn main() anyerror!u8 {
178178
@intCast(size[0]),
179179
@intCast(size[1]),
180180
reset_flags,
181-
bgfx_init.resolution.format,
181+
bgfx_init.resolution.formatColor,
182182
);
183183
old_size = size;
184184
old_flags = reset_flags;

0 commit comments

Comments
 (0)