Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
1 change: 0 additions & 1 deletion .zigversion

This file was deleted.

6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,9 @@ Minimal is `0.15.1`. But you know try your version and believe.

## Bgfx version

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

## Getting started

Expand Down
30 changes: 26 additions & 4 deletions build.zig
Original file line number Diff line number Diff line change
Expand Up @@ -37,16 +37,17 @@ pub fn build(b: *std.Build) !void {
"-fno-exceptions",
"-fno-rtti",
"-ffast-math",
"-fomit-frame-pointer",
// "-fomit-frame-pointer",

"-Wno-microsoft-enum-value",
"-Wno-microsoft-const-init",
"-Wno-deprecated-declarations",
"-Wno-tautological-constant-compare",
"-Wno-error=date-time",
"-Wno-error=unused-command-line-argument",
};
const cxx_options = common_options ++ [_][]const u8{
"-std=c++17",
"-std=c++20",
};
const c_options = common_options ++ [_][]const u8{};
const mm_options = cxx_options ++ [_][]const u8{};
Expand All @@ -61,6 +62,7 @@ pub fn build(b: *std.Build) !void {
.target = target,
.optimize = optimize,
}),
.use_llvm = true,
});
const combine_bin_zig = b.addExecutable(.{
.name = "combine_bin_zig",
Expand All @@ -69,6 +71,7 @@ pub fn build(b: *std.Build) !void {
.target = target,
.optimize = optimize,
}),
.use_llvm = true,
});

b.installArtifact(combine_bin_zig);
Expand All @@ -83,6 +86,7 @@ pub fn build(b: *std.Build) !void {
.target = target,
.optimize = optimize,
}),
.use_llvm = true,
});
bx.addCSourceFiles(.{
.flags = &cxx_options,
Expand All @@ -104,6 +108,7 @@ pub fn build(b: *std.Build) !void {
.target = target,
.optimize = optimize,
}),
.use_llvm = true,
});
bimg.addCSourceFiles(.{
.flags = &cxx_options,
Expand Down Expand Up @@ -131,6 +136,7 @@ pub fn build(b: *std.Build) !void {
.target = target,
.optimize = optimize,
}),
.use_llvm = true,
});
b.installArtifact(bgfx);
bxInclude(b, bgfx, target, optimize);
Expand Down Expand Up @@ -220,6 +226,7 @@ pub fn build(b: *std.Build) !void {
.target = target,
.optimize = optimize,
}),
.use_llvm = true,
});

b.installArtifact(shaderc);
Expand Down Expand Up @@ -427,6 +434,7 @@ pub fn build(b: *std.Build) !void {
.target = target,
.optimize = optimize,
}),
.use_llvm = true,
});
spirv_cross_lib.addIncludePath(b.path(spirv_cross_path ++ "include"));
spirv_cross_lib.addCSourceFiles(.{
Expand Down Expand Up @@ -465,6 +473,7 @@ pub fn build(b: *std.Build) !void {
.target = target,
.optimize = optimize,
}),
.use_llvm = true,
});
glslang_lib.addIncludePath(b.path("libs/bgfx/3rdparty"));
glslang_lib.addIncludePath(b.path(glslang_path));
Expand Down Expand Up @@ -500,7 +509,8 @@ pub fn build(b: *std.Build) !void {
"-MP",
"-Wall",
"-Wextra",
"-ffast-math",
// https://github.com/bkaradzic/bgfx/commit/b4dbc129f3b69b0d6a9093f2d579b883396a839f
// "-ffast-math",
"-fomit-frame-pointer",
"-g",
"-m64",
Expand All @@ -519,7 +529,8 @@ pub fn build(b: *std.Build) !void {
"-MP",
"-Wall",
"-Wextra",
"-ffast-math",
// https://github.com/bkaradzic/bgfx/commit/b4dbc129f3b69b0d6a9093f2d579b883396a839f
// "-ffast-math",
"-fomit-frame-pointer",
"-g",
"-m64",
Expand All @@ -535,6 +546,7 @@ pub fn build(b: *std.Build) !void {
.target = target,
.optimize = optimize,
}),
.use_llvm = true,
});
glsl_optimizer_lib.addIncludePath(b.path(glsl_optimizer_path ++ "include"));
glsl_optimizer_lib.addIncludePath(b.path(glsl_optimizer_path ++ "src"));
Expand Down Expand Up @@ -580,6 +592,13 @@ fn bxInclude(b: *std.Build, step: *std.Build.Step.Compile, target: std.Build.Res
step.root_module.addCMacro("__STDC_FORMAT_MACROS", "1");
step.root_module.addCMacro("__STDC_CONSTANT_MACROS", "1");

// FIXME: problem with compile with zig.
if (target.result.os.tag == .windows) {
step.root_module.addCMacro("BX_CONFIG_EXCEPTION_HANDLING_USE_WINDOWS_SEH", "0");
} else if (target.result.os.tag == .linux) {
step.root_module.addCMacro("BX_CONFIG_EXCEPTION_HANDLING_USE_POSIX_SIGNALS", "0");
}

step.root_module.addCMacro("BX_CONFIG_DEBUG", if (optimize == .Debug) "1" else "0");

switch (target.result.os.tag) {
Expand Down Expand Up @@ -820,6 +839,7 @@ const spirv_opt_files = .{
spirv_opt_path ++ "source/opcode.cpp",
spirv_opt_path ++ "source/operand.cpp",
spirv_opt_path ++ "source/to_string.cpp",
spirv_opt_path ++ "source/opt/graph.cpp",
spirv_opt_path ++ "source/opt/aggressive_dead_code_elim_pass.cpp",
spirv_opt_path ++ "source/opt/amd_ext_to_khr.cpp",
spirv_opt_path ++ "source/opt/analyze_live_input_pass.cpp",
Expand Down Expand Up @@ -942,6 +962,7 @@ const spirv_opt_files = .{
spirv_opt_path ++ "source/opt/struct_packing_pass.cpp",
spirv_opt_path ++ "source/opt/split_combined_image_sampler_pass.cpp",
spirv_opt_path ++ "source/opt/resolve_binding_conflicts_pass.cpp",
spirv_opt_path ++ "source/opt/canonicalize_ids_pass.cpp",
spirv_opt_path ++ "source/parsed_operand.cpp",
spirv_opt_path ++ "source/print.cpp",
spirv_opt_path ++ "source/reduce/change_operand_reduction_opportunity.cpp",
Expand Down Expand Up @@ -1035,4 +1056,5 @@ const spirv_opt_files = .{
spirv_opt_path ++ "source/val/validate_tensor_layout.cpp",
spirv_opt_path ++ "source/val/validate_tensor.cpp",
spirv_opt_path ++ "source/val/validate_invalid_type.cpp",
spirv_opt_path ++ "source/val/validate_graph.cpp",
};
2 changes: 1 addition & 1 deletion build.zig.zon
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
.name = .zbgfx,
.fingerprint = 0xc48ed871c4086e4a,
.version = "0.5.0",
.minimum_zig_version = "0.15.1",
.minimum_zig_version = "0.15.2",
.paths = .{
"includes",
"libs",
Expand Down
4 changes: 2 additions & 2 deletions examples/00-minimal/src/main.zig
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ pub fn main() anyerror!u8 {
//
// Reset and clear
//
bgfx.reset(@intCast(framebufferSize[0]), @intCast(framebufferSize[1]), reset_flags, bgfx_init.resolution.format);
bgfx.reset(@intCast(framebufferSize[0]), @intCast(framebufferSize[1]), reset_flags, bgfx_init.resolution.formatColor);

// Set view 0 clear state.
bgfx.setViewClear(0, bgfx.ClearFlags_Color | bgfx.ClearFlags_Depth, 0x303030ff, 1.0, 0);
Expand Down Expand Up @@ -262,7 +262,7 @@ pub fn main() anyerror!u8 {
@intCast(size[0]),
@intCast(size[1]),
reset_flags,
bgfx_init.resolution.format,
bgfx_init.resolution.formatColor,
);
old_size = size;
old_flags = reset_flags;
Expand Down
4 changes: 2 additions & 2 deletions examples/01-zgui/src/main.zig
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ pub fn main() anyerror!u8 {
//
// Reset and clear
//
bgfx.reset(@intCast(framebufferSize[0]), @intCast(framebufferSize[1]), reset_flags, bgfx_init.resolution.format);
bgfx.reset(@intCast(framebufferSize[0]), @intCast(framebufferSize[1]), reset_flags, bgfx_init.resolution.formatColor);

// Set view 0 clear state.
bgfx.setViewClear(0, bgfx.ClearFlags_Color | bgfx.ClearFlags_Depth, 0x303030ff, 1.0, 0);
Expand Down Expand Up @@ -184,7 +184,7 @@ pub fn main() anyerror!u8 {
@intCast(size[0]),
@intCast(size[1]),
reset_flags,
bgfx_init.resolution.format,
bgfx_init.resolution.formatColor,
);
old_size = size;
old_flags = reset_flags;
Expand Down
4 changes: 2 additions & 2 deletions examples/02-runtime-shaderc/src/main.zig
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ pub fn main() anyerror!u8 {
//
// Reset and clear
//
bgfx.reset(@intCast(framebufferSize[0]), @intCast(framebufferSize[1]), reset_flags, bgfx_init.resolution.format);
bgfx.reset(@intCast(framebufferSize[0]), @intCast(framebufferSize[1]), reset_flags, bgfx_init.resolution.formatColor);

// Set view 0 clear state.
bgfx.setViewClear(0, bgfx.ClearFlags_Color | bgfx.ClearFlags_Depth, 0x303030ff, 1.0, 0);
Expand Down Expand Up @@ -323,7 +323,7 @@ pub fn main() anyerror!u8 {
@intCast(size[0]),
@intCast(size[1]),
reset_flags,
bgfx_init.resolution.format,
bgfx_init.resolution.formatColor,
);
old_size = size;
old_flags = reset_flags;
Expand Down
4 changes: 2 additions & 2 deletions examples/03-debugdraw/src/main.zig
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ pub fn main() anyerror!u8 {
//
// Reset and clear
//
bgfx.reset(@intCast(framebufferSize[0]), @intCast(framebufferSize[1]), reset_flags, bgfx_init.resolution.format);
bgfx.reset(@intCast(framebufferSize[0]), @intCast(framebufferSize[1]), reset_flags, bgfx_init.resolution.formatColor);

// Set view 0 clear state.
bgfx.setViewClear(0, bgfx.ClearFlags_Color | bgfx.ClearFlags_Depth, 0x303030ff, 1.0, 0);
Expand Down Expand Up @@ -178,7 +178,7 @@ pub fn main() anyerror!u8 {
@intCast(size[0]),
@intCast(size[1]),
reset_flags,
bgfx_init.resolution.format,
bgfx_init.resolution.formatColor,
);
old_size = size;
old_flags = reset_flags;
Expand Down
Loading
Loading