Skip to content

Commit 2ead452

Browse files
committed
Add option --no-suffix, @axmol-bot [release 1.8.1]
1 parent 5c1b616 commit 2ead452

File tree

3 files changed

+13
-4
lines changed

3 files changed

+13
-4
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ Thumbs.db
3131
/.idea/libraries
3232
/build
3333
/build-*
34+
/build_*
3435
/captures
3536

3637

README.md

+1
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ I'll have to write a more detailed documentation but for these are the arguments
7272
-o --output=<Filepath> : Output file
7373
-l --lang=<essl/msl/hlsl/glsl/spirv> : Convert to shader language
7474
-a --automap : This option remove binding and location requirement in shader
75+
-u --no-suffix : This option is for don't add _fs or _vs suffix in output file
7576
-D --defines(=Defines) : Preprocessor definitions, seperated by comma or ';'
7677
-Y --invert-y : Invert position.y in vertex shader
7778
-p --profile=<ProfileVersion> : Shader profile version (HLSL: 40, 50, 60), (ES: 200, 300), (GLSL: 330, 400, 420)

src/glslcc.cpp

+11-4
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@
4040
// Indent with spaces instead Tab when output cvar header file
4141
// Rename shader lang `gles` to `essl`
4242
// 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
4344
//
4445
#define _ALLOW_KEYWORD_MACROS
4546

@@ -321,6 +322,7 @@ struct cmd_args {
321322
int preprocess;
322323
int flatten_ubos;
323324
int automap;
325+
int no_suffix;
324326
int sgs_file;
325327
int reflect;
326328
int compile_bin;
@@ -1314,10 +1316,14 @@ static int cross_compile(const cmd_args& args, std::vector<uint32_t>& spirv,
13141316
cvar_code += get_stage_name(stage);
13151317
filepath = args.out_filepath;
13161318
} 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+
}
13211327
}
13221328
bool append = !cvar_code.empty() && (file_index > 0);
13231329

@@ -1794,6 +1800,7 @@ int main(int argc, char* argv[])
17941800
{ "output", 'o', SX_CMDLINE_OPTYPE_REQUIRED, 0x0, 'o', "Output file", "Filepath" },
17951801
{ "lang", 'l', SX_CMDLINE_OPTYPE_REQUIRED, 0x0, 'l', "Convert to shader language", "essl/msl/hlsl/glsl/spirv" },
17961802
{ "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 },
17971804
{ "defines", 'D', SX_CMDLINE_OPTYPE_OPTIONAL, 0x0, 'D', "Preprocessor definitions, seperated by comma or ';'", "Defines" },
17981805
{ "invert-y", 'Y', SX_CMDLINE_OPTYPE_FLAG_SET, &args.invert_y, 1, "Invert position.y in vertex shader", 0x0 },
17991806
{ "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

Comments
 (0)