HLSL: Format updates and some minor adjustments to SV_ handling
This commit is contained in:
parent
deec03cfca
commit
26aa8a4b16
@ -756,18 +756,14 @@ TIntermAggregate* HlslParseContext::handleFunctionDefinition(const TSourceLoc& l
|
|||||||
if (inEntrypoint) {
|
if (inEntrypoint) {
|
||||||
// parameters are actually shader-level inputs
|
// parameters are actually shader-level inputs
|
||||||
unsigned int inCount = 0, outCount = 0;
|
unsigned int inCount = 0, outCount = 0;
|
||||||
for (int i = 0; i < function.getParamCount(); i++)
|
for (int i = 0; i < function.getParamCount(); i++) {
|
||||||
{
|
|
||||||
// Fragment programs do not use ordering for the output layout position, rather it is
|
// Fragment programs do not use ordering for the output layout position, rather it is
|
||||||
// embedded in the semantic
|
// embedded in the semantic
|
||||||
if (function[i].type->getQualifier().isParamOutput() && language != EShLangFragment)
|
if (function[i].type->getQualifier().isParamOutput() ) {
|
||||||
{
|
if (function[i].type->getQualifier().builtIn == EbvNone && language != EShLangFragment)
|
||||||
if (function[i].type->getQualifier().builtIn == EbvNone)
|
|
||||||
function[i].type->getQualifier().layoutLocation = outCount++;
|
function[i].type->getQualifier().layoutLocation = outCount++;
|
||||||
function[i].type->getQualifier().storage = EvqVaryingOut;
|
function[i].type->getQualifier().storage = EvqVaryingOut;
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
if (function[i].type->getQualifier().builtIn == EbvNone)
|
if (function[i].type->getQualifier().builtIn == EbvNone)
|
||||||
function[i].type->getQualifier().layoutLocation = inCount++;
|
function[i].type->getQualifier().layoutLocation = inCount++;
|
||||||
function[i].type->getQualifier().storage = EvqVaryingIn;
|
function[i].type->getQualifier().storage = EvqVaryingIn;
|
||||||
@ -2277,6 +2273,8 @@ void HlslParseContext::handleSemantic(TType& type, const TString& semantic)
|
|||||||
// The following sketches what needs to be done, but can't be right
|
// The following sketches what needs to be done, but can't be right
|
||||||
// without taking into account stage and input/output.
|
// without taking into account stage and input/output.
|
||||||
|
|
||||||
|
TString semanticUpperCase = semantic;
|
||||||
|
std::transform(semanticUpperCase.begin(), semanticUpperCase.end(), semanticUpperCase.begin(), ::toupper);
|
||||||
// in DX9, all outputs had to have a semantic associated with them, that was either consumed
|
// in DX9, all outputs had to have a semantic associated with them, that was either consumed
|
||||||
// by the system or was a specific register assignment
|
// by the system or was a specific register assignment
|
||||||
// in DX10+, only semantics with the SV_ prefix have any meaning beyond decoration
|
// in DX10+, only semantics with the SV_ prefix have any meaning beyond decoration
|
||||||
@ -2284,24 +2282,23 @@ void HlslParseContext::handleSemantic(TType& type, const TString& semantic)
|
|||||||
// Also, in DX10 if a SV value is present as the input of a stage, but isn't appropriate for that
|
// Also, in DX10 if a SV value is present as the input of a stage, but isn't appropriate for that
|
||||||
// stage, it would just be ignored as it is likely there as part of an output struct from one stage
|
// stage, it would just be ignored as it is likely there as part of an output struct from one stage
|
||||||
// to the next
|
// to the next
|
||||||
bool bParseDX9 = false;
|
|
||||||
|
|
||||||
|
|
||||||
|
bool bParseDX9 = false;
|
||||||
if (bParseDX9)
|
if (bParseDX9)
|
||||||
{
|
{
|
||||||
if (semantic == "PSIZE")
|
if (semanticUpperCase == "PSIZE")
|
||||||
type.getQualifier().builtIn = EbvPointSize;
|
type.getQualifier().builtIn = EbvPointSize;
|
||||||
else if (semantic == "FOG")
|
else if (semantic == "FOG")
|
||||||
type.getQualifier().builtIn = EbvFogFragCoord;
|
type.getQualifier().builtIn = EbvFogFragCoord;
|
||||||
else if (semantic == "DEPTH" || semantic == "SV_Depth")
|
else if (semanticUpperCase == "DEPTH")
|
||||||
type.getQualifier().builtIn = EbvFragDepth;
|
type.getQualifier().builtIn = EbvFragDepth;
|
||||||
else if (semantic == "VFACE" || semantic == "SV_IsFrontFace")
|
else if (semanticUpperCase == "VFACE")
|
||||||
type.getQualifier().builtIn = EbvFace;
|
type.getQualifier().builtIn = EbvFace;
|
||||||
else if (semantic == "VPOS" || semantic == "SV_Position")
|
else if (semanticUpperCase == "VPOS")
|
||||||
type.getQualifier().builtIn = EbvFragCoord;
|
type.getQualifier().builtIn = EbvFragCoord;
|
||||||
}
|
}
|
||||||
|
|
||||||
TString semanticUpperCase = semantic;
|
|
||||||
std::transform(semanticUpperCase.begin(), semanticUpperCase.end(), semanticUpperCase.begin(), ::toupper);
|
|
||||||
{
|
{
|
||||||
//SV Position has a different meaning in vertex vs fragment
|
//SV Position has a different meaning in vertex vs fragment
|
||||||
if (semanticUpperCase == "SV_POSITION" && language != EShLangFragment)
|
if (semanticUpperCase == "SV_POSITION" && language != EShLangFragment)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user