11const std = @import ("std" );
2- const zbgfx = @import ("src/zbgfx.zig" );
32
4- pub const build_shader = zbgfx . build ;
3+ pub const build_step = @import ( "src/build_step.zig" ) ;
54
65pub fn build (b : * std.Build ) ! void {
76 const target = b .standardTargetOptions (.{});
@@ -207,9 +206,31 @@ pub fn build(b: *std.Build) !void {
207206 });
208207 }
209208
210- const zbgfx_module = b .addModule ("zbgfx" , .{
211- .root_source_file = b .path ("src/zbgfx.zig" ),
212- });
209+ const zbgfx_module = b .addModule (
210+ "zbgfx" ,
211+ .{
212+ .root_source_file = b .path ("src/zbgfx.zig" ),
213+ .imports = &.{
214+ .{
215+ .name = "bgfx" ,
216+ .module = b .createModule (.{ .root_source_file = b .path ("libs/bgfx/bindings/zig/bgfx.zig" ) }),
217+ },
218+
219+ // .{
220+ // .name = "embed_bgfx_shader_sh",
221+ // .module = b.createModule(.{ .root_source_file = b.path("libs/bgfx/src/bgfx_shader.sh") }),
222+ // },
223+ // .{
224+ // .name = "embed_bgfx_compute_sh",
225+ // .module = b.createModule(.{ .root_source_file = b.path("libs/bgfx/src/bgfx_compute.sh") }),
226+ // },
227+ // .{
228+ // .name = "embed_shaderlib_sh",
229+ // .module = b.createModule(.{ .root_source_file = b.path("libs/bgfx/examples/common/shaderlib.sh") }),
230+ // },
231+ },
232+ },
233+ );
213234 _ = zbgfx_module ; // autofix
214235
215236 //
@@ -274,7 +295,7 @@ pub fn build(b: *std.Build) !void {
274295 // Imgui .bin.h shader embeding step.
275296 //
276297 const shader_includes = b .path ("shaders" );
277- const fs_imgui_image_bin_h = try zbgfx . build .compileBasicBinH (
298+ const fs_imgui_image_bin_h = try build_step .compileBasicBinH (
278299 b ,
279300 target ,
280301 shaderc ,
@@ -291,7 +312,7 @@ pub fn build(b: *std.Build) !void {
291312 );
292313
293314 //
294- const fs_ocornut_imgui_bin_h = try zbgfx . build .compileBasicBinH (
315+ const fs_ocornut_imgui_bin_h = try build_step .compileBasicBinH (
295316 b ,
296317 target ,
297318 shaderc ,
@@ -307,7 +328,7 @@ pub fn build(b: *std.Build) !void {
307328 },
308329 );
309330
310- const vs_imgui_image_bin_h = try zbgfx . build .compileBasicBinH (
331+ const vs_imgui_image_bin_h = try build_step .compileBasicBinH (
311332 b ,
312333 target ,
313334 shaderc ,
@@ -323,7 +344,7 @@ pub fn build(b: *std.Build) !void {
323344 },
324345 );
325346
326- const vs_ocornut_imgui_bin_h = try zbgfx . build .compileBasicBinH (
347+ const vs_ocornut_imgui_bin_h = try build_step .compileBasicBinH (
327348 b ,
328349 target ,
329350 shaderc ,
@@ -839,6 +860,23 @@ const spirv_opt_files = .{
839860 spirv_opt_path ++ "source/opcode.cpp" ,
840861 spirv_opt_path ++ "source/operand.cpp" ,
841862 spirv_opt_path ++ "source/to_string.cpp" ,
863+ spirv_opt_path ++ "source/software_version.cpp" ,
864+ spirv_opt_path ++ "source/spirv_endian.cpp" ,
865+ spirv_opt_path ++ "source/spirv_optimizer_options.cpp" ,
866+ spirv_opt_path ++ "source/spirv_reducer_options.cpp" ,
867+ spirv_opt_path ++ "source/spirv_target_env.cpp" ,
868+ spirv_opt_path ++ "source/spirv_validator_options.cpp" ,
869+ spirv_opt_path ++ "source/table.cpp" ,
870+ spirv_opt_path ++ "source/table2.cpp" ,
871+ spirv_opt_path ++ "source/text.cpp" ,
872+ spirv_opt_path ++ "source/text_handler.cpp" ,
873+ spirv_opt_path ++ "source/parsed_operand.cpp" ,
874+ spirv_opt_path ++ "source/print.cpp" ,
875+
876+ spirv_opt_path ++ "source/util/bit_vector.cpp" ,
877+ spirv_opt_path ++ "source/util/parse_number.cpp" ,
878+ spirv_opt_path ++ "source/util/string_utils.cpp" ,
879+
842880 spirv_opt_path ++ "source/opt/graph.cpp" ,
843881 spirv_opt_path ++ "source/opt/aggressive_dead_code_elim_pass.cpp" ,
844882 spirv_opt_path ++ "source/opt/amd_ext_to_khr.cpp" ,
@@ -963,8 +1001,7 @@ const spirv_opt_files = .{
9631001 spirv_opt_path ++ "source/opt/split_combined_image_sampler_pass.cpp" ,
9641002 spirv_opt_path ++ "source/opt/resolve_binding_conflicts_pass.cpp" ,
9651003 spirv_opt_path ++ "source/opt/canonicalize_ids_pass.cpp" ,
966- spirv_opt_path ++ "source/parsed_operand.cpp" ,
967- spirv_opt_path ++ "source/print.cpp" ,
1004+
9681005 spirv_opt_path ++ "source/reduce/change_operand_reduction_opportunity.cpp" ,
9691006 spirv_opt_path ++ "source/reduce/change_operand_to_undef_reduction_opportunity.cpp" ,
9701007 spirv_opt_path ++ "source/reduce/conditional_branch_to_simple_conditional_branch_opportunity_finder.cpp" ,
@@ -996,19 +1033,7 @@ const spirv_opt_files = .{
9961033 spirv_opt_path ++ "source/reduce/structured_construct_to_block_reduction_opportunity_finder.cpp" ,
9971034 spirv_opt_path ++ "source/reduce/structured_loop_to_selection_reduction_opportunity.cpp" ,
9981035 spirv_opt_path ++ "source/reduce/structured_loop_to_selection_reduction_opportunity_finder.cpp" ,
999- spirv_opt_path ++ "source/software_version.cpp" ,
1000- spirv_opt_path ++ "source/spirv_endian.cpp" ,
1001- spirv_opt_path ++ "source/spirv_optimizer_options.cpp" ,
1002- spirv_opt_path ++ "source/spirv_reducer_options.cpp" ,
1003- spirv_opt_path ++ "source/spirv_target_env.cpp" ,
1004- spirv_opt_path ++ "source/spirv_validator_options.cpp" ,
1005- spirv_opt_path ++ "source/table.cpp" ,
1006- spirv_opt_path ++ "source/table2.cpp" ,
1007- spirv_opt_path ++ "source/text.cpp" ,
1008- spirv_opt_path ++ "source/text_handler.cpp" ,
1009- spirv_opt_path ++ "source/util/bit_vector.cpp" ,
1010- spirv_opt_path ++ "source/util/parse_number.cpp" ,
1011- spirv_opt_path ++ "source/util/string_utils.cpp" ,
1036+
10121037 spirv_opt_path ++ "source/val/basic_block.cpp" ,
10131038 spirv_opt_path ++ "source/val/construct.cpp" ,
10141039 spirv_opt_path ++ "source/val/function.cpp" ,
@@ -1057,4 +1082,5 @@ const spirv_opt_files = .{
10571082 spirv_opt_path ++ "source/val/validate_tensor.cpp" ,
10581083 spirv_opt_path ++ "source/val/validate_invalid_type.cpp" ,
10591084 spirv_opt_path ++ "source/val/validate_graph.cpp" ,
1085+ spirv_opt_path ++ "source/val/validate_logical_pointers.cpp" ,
10601086};
0 commit comments