Commit 34e7ee79 by John Kessenich

HLSL: Improve setting and testing of interpolation qualifiers.

Notably, use of 'linear' on a non-input could mark it as an input.
parent d21baed6
......@@ -16,7 +16,7 @@ struct {
float4 i;
} s2;
struct {
struct IN_S {
linear float4 a;
nointerpolation bool b;
noperspective centroid float1 c;
......@@ -25,19 +25,19 @@ struct {
bool ff2 : packoffset(c0.y);
bool ff3 : packoffset(c0.y) : register(ps_5_0, s0) ;
float4 ff4 : VPOS : packoffset(c0.y) : register(ps_5_0, s0) <int bambam=30;> ;
} s4;
};
float3 ff5 : packoffset(c1.y) : register(ps_5_0, s[5]);
float3 ff6 : packoffset(c2.y) : register(s3[5]);
float4 PixelShaderFunction(float4 input) : COLOR0
float4 PixelShaderFunction(float4 input, IN_S s) : COLOR0
{
struct FS {
bool3 b3;
} s3;
s3 == s3;
s2.i = s4.ff4;
s2.i = s.ff4;
return input;
}
\ No newline at end of file
struct VI {
float4 m[2];
uint2 coord;
linear float4 b;
};
float4 main(float4 d, VI vi, float4 e) : SV_POSITION
VI main(float4 d, VI vi, float4 e) : SV_POSITION
{
return vi.m[1] + vi.m[0] + float4(vi.coord.x) + d + e;
VI local;
local.b = vi.m[1] + vi.m[0] + float4(vi.coord.x) + d + e;
return local;
}
\ No newline at end of file
......@@ -2,5 +2,5 @@
// For the version, it uses the latest git tag followed by the number of commits.
// For the date, it uses the current date (when then script is run).
#define GLSLANG_REVISION "Overload400-PrecQual.1489"
#define GLSLANG_REVISION "Overload400-PrecQual.1490"
#define GLSLANG_DATE "16-Sep-2016"
......@@ -435,7 +435,7 @@ bool HlslGrammar::acceptFullySpecifiedType(TType& type)
return false;
if (type.getBasicType() == EbtBlock) {
// the type was a block, which set some parts of the qualifier
parseContext.mergeQualifiers(loc, type.getQualifier(), qualifier, true);
parseContext.mergeQualifiers(type.getQualifier(), qualifier);
// further, it can create an anonymous instance of the block
if (peekTokenClass(EHTokSemicolon))
parseContext.declareBlock(loc, type);
......@@ -476,7 +476,6 @@ bool HlslGrammar::acceptQualifier(TQualifier& qualifier)
qualifier.volatil = true;
break;
case EHTokLinear:
qualifier.storage = EvqVaryingIn;
qualifier.smooth = true;
break;
case EHTokCentroid:
......
......@@ -728,7 +728,7 @@ void HlslParseContext::flattenStruct(const TVariable& variable)
for (int member = 0; member < (int)members.size(); ++member) {
TVariable* memberVariable = makeInternalVariable(members[member].type->getFieldName().c_str(),
*members[member].type);
memberVariable->getWritableType().getQualifier().storage = variable.getType().getQualifier().storage;
mergeQualifiers(memberVariable->getWritableType().getQualifier(), variable.getType().getQualifier());
memberVariables.push_back(memberVariable);
}
......@@ -3049,7 +3049,7 @@ void HlslParseContext::globalQualifierFix(const TSourceLoc&, TQualifier& qualifi
// 'dst', for the purpose of error checking order for versions
// that require specific orderings of qualifiers.
//
void HlslParseContext::mergeQualifiers(const TSourceLoc& loc, TQualifier& dst, const TQualifier& src, bool force)
void HlslParseContext::mergeQualifiers(TQualifier& dst, const TQualifier& src)
{
// Storage qualification
if (dst.storage == EvqTemporary || dst.storage == EvqGlobal)
......@@ -3060,8 +3060,6 @@ void HlslParseContext::mergeQualifiers(const TSourceLoc& loc, TQualifier& dst, c
else if ((dst.storage == EvqIn && src.storage == EvqConst) ||
(dst.storage == EvqConst && src.storage == EvqIn))
dst.storage = EvqConstReadOnly;
else if (src.storage != EvqTemporary && src.storage != EvqGlobal)
error(loc, "too many storage qualifiers", GetStorageQualifierString(src.storage), "");
// Layout qualifiers
mergeObjectLayoutQualifiers(dst, src, false);
......@@ -4586,7 +4584,7 @@ void HlslParseContext::declareBlock(const TSourceLoc& loc, TType& type, const TS
}
TQualifier newMemberQualification = defaultQualification;
mergeQualifiers(memberLoc, newMemberQualification, memberQualifier, false);
mergeQualifiers(newMemberQualification, memberQualifier);
memberQualifier = newMemberQualification;
}
......
......@@ -129,7 +129,7 @@ public:
void boolCheck(const TSourceLoc&, const TIntermTyped*);
void globalQualifierFix(const TSourceLoc&, TQualifier&);
bool structQualifierErrorCheck(const TSourceLoc&, const TPublicType& pType);
void mergeQualifiers(const TSourceLoc&, TQualifier& dst, const TQualifier& src, bool force);
void mergeQualifiers(TQualifier& dst, const TQualifier& src);
int computeSamplerTypeIndex(TSampler&);
TSymbol* redeclareBuiltinVariable(const TSourceLoc&, const TString&, const TQualifier&, const TShaderQualifiers&, bool& newDeclaration);
void redeclareBuiltinBlock(const TSourceLoc&, TTypeList& typeList, const TString& blockName, const TString* instanceName, TArraySizes* arraySizes);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment