diff --git a/build.zig b/build.zig index 9c739388..90aab69b 100644 --- a/build.zig +++ b/build.zig @@ -38,7 +38,6 @@ pub fn build_exe( "reflection.cc", "spirv.cc", "spirvcross.cc", - "util.cc", "formats/bare.cc", "formats/sokol.cc", "formats/sokolnim.cc", @@ -46,6 +45,7 @@ pub fn build_exe( "formats/sokolrust.cc", "formats/sokolzig.cc", "formats/yaml.cc", + "formats/util.cc", }; const incl_dirs = [_][]const u8{ "src/shdc", diff --git a/src/shdc/formats/bare.cc b/src/shdc/formats/bare.cc index 6246480a..976fba01 100644 --- a/src/shdc/formats/bare.cc +++ b/src/shdc/formats/bare.cc @@ -52,8 +52,8 @@ static ErrMsg write_shader_sources_and_blobs(const Args& args, const BytecodeBlob* fs_blob = find_bytecode_blob_by_shader_name(prog.fs_name, inp, bytecode); const std::string file_path_base = fmt::format("{}_{}{}_{}", args.output, mod_prefix(inp), prog.name, Slang::to_str(slang)); - const std::string file_path_vs = fmt::format("{}_vs{}", file_path_base, util::slang_file_extension(slang, vs_blob)); - const std::string file_path_fs = fmt::format("{}_fs{}", file_path_base, util::slang_file_extension(slang, fs_blob)); + const std::string file_path_vs = fmt::format("{}_vs{}", file_path_base, util::slang_file_extension(slang, vs_blob != nullptr)); + const std::string file_path_fs = fmt::format("{}_fs{}", file_path_base, util::slang_file_extension(slang, fs_blob != nullptr)); ErrMsg err; err = write_stage(file_path_vs, vs_src, vs_blob); diff --git a/src/shdc/util.cc b/src/shdc/formats/util.cc similarity index 99% rename from src/shdc/util.cc rename to src/shdc/formats/util.cc index 3ccaa69b..31f189dd 100644 --- a/src/shdc/util.cc +++ b/src/shdc/formats/util.cc @@ -5,7 +5,7 @@ #include "fmt/format.h" #include "pystring.h" -namespace shdc::util { +namespace shdc::formats::util { using namespace refl; diff --git a/src/shdc/util.h b/src/shdc/formats/util.h similarity index 96% rename from src/shdc/util.h rename to src/shdc/formats/util.h index 82816040..309d552b 100644 --- a/src/shdc/util.h +++ b/src/shdc/formats/util.h @@ -6,7 +6,7 @@ #include "types/slang.h" #include "types/reflection/uniform.h" -namespace shdc::util { +namespace shdc::formats::util { // utility functions for generators ErrMsg check_errors(const Input& inp, const Spirvcross& spirvcross, Slang::Enum slang); diff --git a/src/shdc/formats/yaml.cc b/src/shdc/formats/yaml.cc index 7b9272fa..ee9aac59 100644 --- a/src/shdc/formats/yaml.cc +++ b/src/shdc/formats/yaml.cc @@ -179,8 +179,8 @@ static ErrMsg write_shader_sources_and_blobs(const Args& args, const BytecodeBlob* fs_blob = find_bytecode_blob_by_shader_name(prog.fs_name, inp, bytecode); const std::string file_path_base = fmt::format("{}_{}{}_{}", args.output, mod_prefix(inp), prog.name, Slang::to_str(slang)); - const std::string file_path_vs = fmt::format("{}_vs{}", file_path_base, util::slang_file_extension(slang, vs_blob)); - const std::string file_path_fs = fmt::format("{}_fs{}", file_path_base, util::slang_file_extension(slang, fs_blob)); + const std::string file_path_vs = fmt::format("{}_vs{}", file_path_base, util::slang_file_extension(slang, vs_blob != nullptr)); + const std::string file_path_fs = fmt::format("{}_fs{}", file_path_base, util::slang_file_extension(slang, fs_blob != nullptr)); L(" -\n"); L(" name: {}\n", prog.name);