|
40 | 40 | // Indent with spaces instead Tab when output cvar header file
|
41 | 41 | // Rename shader lang `gles` to `essl`
|
42 | 42 | // Add option -a --automap to remove binding and location requirement in shader
|
| 43 | +// 1.8.1 Add option -n --no-suffix for don't add _fs or _vs suffix in output files |
43 | 44 | //
|
44 | 45 | #define _ALLOW_KEYWORD_MACROS
|
45 | 46 |
|
@@ -321,6 +322,7 @@ struct cmd_args {
|
321 | 322 | int preprocess;
|
322 | 323 | int flatten_ubos;
|
323 | 324 | int automap;
|
| 325 | + int no_suffix; |
324 | 326 | int sgs_file;
|
325 | 327 | int reflect;
|
326 | 328 | int compile_bin;
|
@@ -1314,10 +1316,14 @@ static int cross_compile(const cmd_args& args, std::vector<uint32_t>& spirv,
|
1314 | 1316 | cvar_code += get_stage_name(stage);
|
1315 | 1317 | filepath = args.out_filepath;
|
1316 | 1318 | } else {
|
1317 |
| - char ext[32]; |
1318 |
| - char basename[512]; |
1319 |
| - sx_os_path_splitext(ext, sizeof(ext), basename, sizeof(basename), args.out_filepath); |
1320 |
| - filepath = std::string(basename) + std::string("_") + std::string(get_stage_name(stage)) + std::string(ext); |
| 1319 | + if (!args.no_suffix) { |
| 1320 | + char ext[32]; |
| 1321 | + char basename[512]; |
| 1322 | + sx_os_path_splitext(ext, sizeof(ext), basename, sizeof(basename), args.out_filepath); |
| 1323 | + filepath = std::string(basename) + std::string("_") + std::string(get_stage_name(stage)) + std::string(ext); |
| 1324 | + } else { |
| 1325 | + filepath = args.out_filepath; |
| 1326 | + } |
1321 | 1327 | }
|
1322 | 1328 | bool append = !cvar_code.empty() && (file_index > 0);
|
1323 | 1329 |
|
@@ -1794,6 +1800,7 @@ int main(int argc, char* argv[])
|
1794 | 1800 | { "output", 'o', SX_CMDLINE_OPTYPE_REQUIRED, 0x0, 'o', "Output file", "Filepath" },
|
1795 | 1801 | { "lang", 'l', SX_CMDLINE_OPTYPE_REQUIRED, 0x0, 'l', "Convert to shader language", "essl/msl/hlsl/glsl/spirv" },
|
1796 | 1802 | { "automap", 'a', SX_CMDLINE_OPTYPE_FLAG_SET, &args.automap, 1, "This option remove binding and location requirement in shader", 0x0 },
|
| 1803 | + { "no-suffix", 'u', SX_CMDLINE_OPTYPE_FLAG_SET, &args.no_suffix, 1, "This option is for don't add _fs or _vs suffix in output file", 0x0 }, |
1797 | 1804 | { "defines", 'D', SX_CMDLINE_OPTYPE_OPTIONAL, 0x0, 'D', "Preprocessor definitions, seperated by comma or ';'", "Defines" },
|
1798 | 1805 | { "invert-y", 'Y', SX_CMDLINE_OPTYPE_FLAG_SET, &args.invert_y, 1, "Invert position.y in vertex shader", 0x0 },
|
1799 | 1806 | { "profile", 'p', SX_CMDLINE_OPTYPE_REQUIRED, 0x0, 'p', "Shader profile version (HLSL: 40, 50, 60), (ES: 200, 300), (GLSL: 330, 400, 420)", "ProfileVersion" },
|
|
0 commit comments