HLSL: add optional position.Y inversion
Adds command line options:
--invert-y
--iy
(synonyms) which invert position.Y on vertex shader output. Handles these cases:
* Direct single variable return
* Member of direct returned struct
* Single variable output parameter
* Member of struct output parameter
API:
// Enables position.Y output negation in vertex shader
void TShader::setInvertY(bool invert);
Fixes #1173
This commit is contained in:
@@ -98,6 +98,7 @@ enum TOptions {
|
||||
EOptionStdin = (1 << 27),
|
||||
EOptionOptimizeDisable = (1 << 28),
|
||||
EOptionOptimizeSize = (1 << 29),
|
||||
EOptionInvertY = (1 << 30),
|
||||
};
|
||||
|
||||
//
|
||||
@@ -519,6 +520,9 @@ void ProcessArguments(std::vector<std::unique_ptr<glslang::TWorkItem>>& workItem
|
||||
variableName = argv[1];
|
||||
bumpArg();
|
||||
break;
|
||||
} else if (lowerword == "invert-y" || // synonyms
|
||||
lowerword == "iy") {
|
||||
Options |= EOptionInvertY;
|
||||
} else {
|
||||
usage();
|
||||
}
|
||||
@@ -840,6 +844,9 @@ void CompileAndLinkShaderUnits(std::vector<ShaderCompUnit> compUnits)
|
||||
if (Options & EOptionAutoMapLocations)
|
||||
shader->setAutoMapLocations(true);
|
||||
|
||||
if (Options & EOptionInvertY)
|
||||
shader->setInvertY(true);
|
||||
|
||||
// Set up the environment, some subsettings take precedence over earlier
|
||||
// ways of setting things.
|
||||
if (Options & EOptionSpv) {
|
||||
@@ -1359,6 +1366,7 @@ void usage()
|
||||
" uint32_t array named <name>\n"
|
||||
" initialized with the shader binary code.\n"
|
||||
" --vn <name> synonym for --variable-name <name>\n"
|
||||
" --invert-y | --iy invert position.Y output in vertex shader\n"
|
||||
);
|
||||
|
||||
exit(EFailUsage);
|
||||
|
||||
Reference in New Issue
Block a user