@@ -179,11 +179,7 @@ bool string_ends_with(const std::string& str, const std::string& suffix) {
179
179
return std::equal (suffix.rbegin (), suffix.rend (), str.rbegin ());
180
180
}
181
181
182
- #ifdef _WIN32
183
- static const char path_separator = ' \\ ' ;
184
- #else
185
- static const char path_separator = ' /' ;
186
- #endif
182
+ static const char path_separator = ' /' ;
187
183
188
184
std::string join_paths (const std::string& path1, const std::string& path2) {
189
185
return path1 + path_separator + path2;
@@ -198,7 +194,11 @@ void string_to_spv(const std::string& _name, const std::string& in_fname, const
198
194
std::string out_fname = join_paths (output_dir, name + " .spv" );
199
195
std::string in_path = join_paths (input_dir, in_fname);
200
196
201
- std::vector<std::string> cmd = {GLSLC, " -fshader-stage=compute" , " --target-env=vulkan1.2" , " -O" , in_path, " -o" , out_fname};
197
+ #ifdef _WIN32
198
+ std::vector<std::string> cmd = {GLSLC, " -fshader-stage=compute" , " --target-env=vulkan1.2" , " -O" , " \" " + in_path + " \" " , " -o" , " \" " + out_fname + " \" " };
199
+ #else
200
+ std::vector<std::string> cmd = {GLSLC, " -fshader-stage=compute" , " --target-env=vulkan1.2" , " -O" , in_path, " -o" , out_fname};
201
+ #endif
202
202
for (const auto & define : defines) {
203
203
cmd.push_back (" -D" + define.first + " =" + define.second );
204
204
}
@@ -482,10 +482,16 @@ void write_output_files() {
482
482
483
483
for (const auto & pair : shader_fnames) {
484
484
const std::string& name = pair.first ;
485
- const std::string& path = pair.second ;
485
+ #ifdef _WIN32
486
+ std::string path = pair.second ;
487
+ std::replace (path.begin (), path.end (), ' /' , ' \\ ' );
488
+ #else
489
+ const std::string& path = pair.second ;
490
+ #endif
491
+
486
492
FILE* spv = fopen (path.c_str (), " rb" );
487
493
if (!spv) {
488
- std::cerr << " Error opening SPIR-V file: " << path << " \n " ;
494
+ std::cerr << " Error opening SPIR-V file: " << path << " ( " << strerror (errno) << " ) \n " ;
489
495
continue ;
490
496
}
491
497
@@ -497,7 +503,7 @@ void write_output_files() {
497
503
size_t read_size = fread (data.data (), 1 , size, spv);
498
504
fclose (spv);
499
505
if (read_size != size) {
500
- std::cerr << " Error reading SPIR-V file: " << path << " \n " ;
506
+ std::cerr << " Error reading SPIR-V file: " << path << " ( " << strerror (errno) << " ) \n " ;
501
507
continue ;
502
508
}
503
509
0 commit comments