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
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ jobs:
- name: Install Zig
uses: mlugg/setup-zig@v2
- name: Lint
run: zig fmt --check .
run: zig fmt --check . --exclude libs/

build-examples:
needs: ["validation"]
Expand All @@ -58,7 +58,7 @@ jobs:
os:
# FIXME: Problem with x11 in CI (latest ubuntu). But it works on linux
#- linux-large
- macos-13-large
- macos-15-large
- windows-large

runs-on: ${{matrix.os}}
Expand Down
4 changes: 2 additions & 2 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/1dc8c4827087c5a6cde221b0978baa15533348fd...master)
- [BX](https://github.com/bkaradzic/bx//compare/5dc415ee2e9935089b21186518436681c2d03b47...master)
- [BImg](https://github.com/bkaradzic/bimg/compare/bf10ffbb3df1f9f12ad7a9105e5e96e11a9c5a0c...master)
- [BGFX](https://github.com/bkaradzic/bgfx/compare/ee2072d02f59ffbd89ef79026474a5e5fa17f206...master)
- [BGFX](https://github.com/bkaradzic/bgfx/compare/8a60697cfdfe6181b87ea0c49dff58e43448f712...master)

## Getting started

Expand Down
76 changes: 50 additions & 26 deletions build.zig
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
const std = @import("std");
const zbgfx = @import("src/zbgfx.zig");

pub const build_shader = zbgfx.build;
pub const build_step = @import("src/build_step.zig");

pub fn build(b: *std.Build) !void {
const target = b.standardTargetOptions(.{});
Expand Down Expand Up @@ -207,9 +206,31 @@ pub fn build(b: *std.Build) !void {
});
}

const zbgfx_module = b.addModule("zbgfx", .{
.root_source_file = b.path("src/zbgfx.zig"),
});
const zbgfx_module = b.addModule(
"zbgfx",
.{
.root_source_file = b.path("src/zbgfx.zig"),
.imports = &.{
.{
.name = "bgfx",
.module = b.createModule(.{ .root_source_file = b.path("libs/bgfx/bindings/zig/bgfx.zig") }),
},

// .{
// .name = "embed_bgfx_shader_sh",
// .module = b.createModule(.{ .root_source_file = b.path("libs/bgfx/src/bgfx_shader.sh") }),
// },
// .{
// .name = "embed_bgfx_compute_sh",
// .module = b.createModule(.{ .root_source_file = b.path("libs/bgfx/src/bgfx_compute.sh") }),
// },
// .{
// .name = "embed_shaderlib_sh",
// .module = b.createModule(.{ .root_source_file = b.path("libs/bgfx/examples/common/shaderlib.sh") }),
// },
},
},
);
_ = zbgfx_module; // autofix

//
Expand Down Expand Up @@ -274,7 +295,7 @@ pub fn build(b: *std.Build) !void {
// Imgui .bin.h shader embeding step.
//
const shader_includes = b.path("shaders");
const fs_imgui_image_bin_h = try zbgfx.build.compileBasicBinH(
const fs_imgui_image_bin_h = try build_step.compileBasicBinH(
b,
target,
shaderc,
Expand All @@ -291,7 +312,7 @@ pub fn build(b: *std.Build) !void {
);

//
const fs_ocornut_imgui_bin_h = try zbgfx.build.compileBasicBinH(
const fs_ocornut_imgui_bin_h = try build_step.compileBasicBinH(
b,
target,
shaderc,
Expand All @@ -307,7 +328,7 @@ pub fn build(b: *std.Build) !void {
},
);

const vs_imgui_image_bin_h = try zbgfx.build.compileBasicBinH(
const vs_imgui_image_bin_h = try build_step.compileBasicBinH(
b,
target,
shaderc,
Expand All @@ -323,7 +344,7 @@ pub fn build(b: *std.Build) !void {
},
);

const vs_ocornut_imgui_bin_h = try zbgfx.build.compileBasicBinH(
const vs_ocornut_imgui_bin_h = try build_step.compileBasicBinH(
b,
target,
shaderc,
Expand Down Expand Up @@ -595,8 +616,6 @@ fn bxInclude(b: *std.Build, step: *std.Build.Step.Compile, target: std.Build.Res
// 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");
Expand Down Expand Up @@ -839,6 +858,23 @@ 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/software_version.cpp",
spirv_opt_path ++ "source/spirv_endian.cpp",
spirv_opt_path ++ "source/spirv_optimizer_options.cpp",
spirv_opt_path ++ "source/spirv_reducer_options.cpp",
spirv_opt_path ++ "source/spirv_target_env.cpp",
spirv_opt_path ++ "source/spirv_validator_options.cpp",
spirv_opt_path ++ "source/table.cpp",
spirv_opt_path ++ "source/table2.cpp",
spirv_opt_path ++ "source/text.cpp",
spirv_opt_path ++ "source/text_handler.cpp",
spirv_opt_path ++ "source/parsed_operand.cpp",
spirv_opt_path ++ "source/print.cpp",

spirv_opt_path ++ "source/util/bit_vector.cpp",
spirv_opt_path ++ "source/util/parse_number.cpp",
spirv_opt_path ++ "source/util/string_utils.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",
Expand Down Expand Up @@ -963,8 +999,7 @@ const spirv_opt_files = .{
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",
spirv_opt_path ++ "source/reduce/change_operand_to_undef_reduction_opportunity.cpp",
spirv_opt_path ++ "source/reduce/conditional_branch_to_simple_conditional_branch_opportunity_finder.cpp",
Expand Down Expand Up @@ -996,19 +1031,7 @@ const spirv_opt_files = .{
spirv_opt_path ++ "source/reduce/structured_construct_to_block_reduction_opportunity_finder.cpp",
spirv_opt_path ++ "source/reduce/structured_loop_to_selection_reduction_opportunity.cpp",
spirv_opt_path ++ "source/reduce/structured_loop_to_selection_reduction_opportunity_finder.cpp",
spirv_opt_path ++ "source/software_version.cpp",
spirv_opt_path ++ "source/spirv_endian.cpp",
spirv_opt_path ++ "source/spirv_optimizer_options.cpp",
spirv_opt_path ++ "source/spirv_reducer_options.cpp",
spirv_opt_path ++ "source/spirv_target_env.cpp",
spirv_opt_path ++ "source/spirv_validator_options.cpp",
spirv_opt_path ++ "source/table.cpp",
spirv_opt_path ++ "source/table2.cpp",
spirv_opt_path ++ "source/text.cpp",
spirv_opt_path ++ "source/text_handler.cpp",
spirv_opt_path ++ "source/util/bit_vector.cpp",
spirv_opt_path ++ "source/util/parse_number.cpp",
spirv_opt_path ++ "source/util/string_utils.cpp",

spirv_opt_path ++ "source/val/basic_block.cpp",
spirv_opt_path ++ "source/val/construct.cpp",
spirv_opt_path ++ "source/val/function.cpp",
Expand Down Expand Up @@ -1057,4 +1080,5 @@ const spirv_opt_files = .{
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",
spirv_opt_path ++ "source/val/validate_logical_pointers.cpp",
};
4 changes: 2 additions & 2 deletions examples/00-minimal/build_sample.zig
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ pub fn build(
const combine_bin_zig = zbgfx_dep.artifact("combine_bin_zig");
const shader_includes = zbgfx_dep.path("shaders");

const fs_cubes_zig = try zbgfx.build_shader.compileBasicBinZig(
const fs_cubes_zig = try zbgfx.build_step.compileBasicBinZig(
b,
target,
shaderc,
Expand All @@ -62,7 +62,7 @@ pub fn build(
.includes = &.{shader_includes},
},
);
const vs_cubes_zig = try zbgfx.build_shader.compileBasicBinZig(
const vs_cubes_zig = try zbgfx.build_step.compileBasicBinZig(
b,
target,
shaderc,
Expand Down
2 changes: 2 additions & 0 deletions libs/bgfx/3rdparty/glslang/SPIRV/GLSL.ext.EXT.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,5 +42,7 @@ static const char* const E_SPV_EXT_shader_image_int64 = "SPV_EXT_shader_image_in
static const char* const E_SPV_EXT_shader_tile_image = "SPV_EXT_shader_tile_image";
static const char* const E_SPV_EXT_mesh_shader = "SPV_EXT_mesh_shader";
static const char* const E_SPV_EXT_float8 = "SPV_EXT_float8";
static const char* const E_SPV_EXT_shader_64bit_indexing = "SPV_EXT_shader_64bit_indexing";
static const char* const E_SPV_EXT_shader_invocation_reorder = "SPV_EXT_shader_invocation_reorder";

#endif // #ifndef GLSLextEXT_H
Loading