|
|
@@ -179,11 +179,7 @@ bool string_ends_with(const std::string& str, const std::string& suffix) {
|
|
|
return std::equal(suffix.rbegin(), suffix.rend(), str.rbegin());
|
|
|
}
|
|
|
|
|
|
-#ifdef _WIN32
|
|
|
- static const char path_separator = '\\';
|
|
|
-#else
|
|
|
- static const char path_separator = '/';
|
|
|
-#endif
|
|
|
+static const char path_separator = '/';
|
|
|
|
|
|
std::string join_paths(const std::string& path1, const std::string& path2) {
|
|
|
return path1 + path_separator + path2;
|
|
|
@@ -198,7 +194,11 @@ void string_to_spv(const std::string& _name, const std::string& in_fname, const
|
|
|
std::string out_fname = join_paths(output_dir, name + ".spv");
|
|
|
std::string in_path = join_paths(input_dir, in_fname);
|
|
|
|
|
|
- std::vector<std::string> cmd = {GLSLC, "-fshader-stage=compute", "--target-env=vulkan1.2", "-O", in_path, "-o", out_fname};
|
|
|
+ #ifdef _WIN32
|
|
|
+ std::vector<std::string> cmd = {GLSLC, "-fshader-stage=compute", "--target-env=vulkan1.2", "-O", "\"" + in_path + "\"", "-o", "\"" + out_fname + "\""};
|
|
|
+ #else
|
|
|
+ std::vector<std::string> cmd = {GLSLC, "-fshader-stage=compute", "--target-env=vulkan1.2", "-O", in_path, "-o", out_fname};
|
|
|
+ #endif
|
|
|
for (const auto& define : defines) {
|
|
|
cmd.push_back("-D" + define.first + "=" + define.second);
|
|
|
}
|
|
|
@@ -482,10 +482,16 @@ void write_output_files() {
|
|
|
|
|
|
for (const auto& pair : shader_fnames) {
|
|
|
const std::string& name = pair.first;
|
|
|
- const std::string& path = pair.second;
|
|
|
+ #ifdef _WIN32
|
|
|
+ std::string path = pair.second;
|
|
|
+ std::replace(path.begin(), path.end(), '/', '\\' );
|
|
|
+ #else
|
|
|
+ const std::string& path = pair.second;
|
|
|
+ #endif
|
|
|
+
|
|
|
FILE* spv = fopen(path.c_str(), "rb");
|
|
|
if (!spv) {
|
|
|
- std::cerr << "Error opening SPIR-V file: " << path << "\n";
|
|
|
+ std::cerr << "Error opening SPIR-V file: " << path << " (" << strerror(errno) << ")\n";
|
|
|
continue;
|
|
|
}
|
|
|
|
|
|
@@ -497,7 +503,7 @@ void write_output_files() {
|
|
|
size_t read_size = fread(data.data(), 1, size, spv);
|
|
|
fclose(spv);
|
|
|
if (read_size != size) {
|
|
|
- std::cerr << "Error reading SPIR-V file: " << path << "\n";
|
|
|
+ std::cerr << "Error reading SPIR-V file: " << path << " (" << strerror(errno) << ")\n";
|
|
|
continue;
|
|
|
}
|
|
|
|