Commit f0bc598d by John Kessenich

HLSL: Force flat interpolation for structure members. Fixes #940.

parent be1085cb
...@@ -58,7 +58,7 @@ gl_FragCoord origin is upper left ...@@ -58,7 +58,7 @@ gl_FragCoord origin is upper left
0:13 Constant: 0:13 Constant:
0:13 0 (const int) 0:13 0 (const int)
0:13 v: direct index for structure ( temp 2-component vector of float) 0:13 v: direct index for structure ( temp 2-component vector of float)
0:13 'i' (layout( location=0) in structure{ temp 2-component vector of float v, temp 2-component vector of int i2}) 0:13 'i' (layout( location=0) in structure{ temp 2-component vector of float v, flat temp 2-component vector of int i2})
0:13 Constant: 0:13 Constant:
0:13 0 (const int) 0:13 0 (const int)
0:13 move second child to first child ( temp 4-component vector of float) 0:13 move second child to first child ( temp 4-component vector of float)
...@@ -72,8 +72,8 @@ gl_FragCoord origin is upper left ...@@ -72,8 +72,8 @@ gl_FragCoord origin is upper left
0:? 'i' ( temp structure{ temp 2-component vector of float v, temp 4-component vector of float fragCoord, temp 2-component vector of int i2}) 0:? 'i' ( temp structure{ temp 2-component vector of float v, temp 4-component vector of float fragCoord, temp 2-component vector of int i2})
0:13 Constant: 0:13 Constant:
0:13 2 (const int) 0:13 2 (const int)
0:13 i2: direct index for structure ( temp 2-component vector of int) 0:13 i2: direct index for structure ( flat temp 2-component vector of int)
0:13 'i' (layout( location=0) in structure{ temp 2-component vector of float v, temp 2-component vector of int i2}) 0:13 'i' (layout( location=0) in structure{ temp 2-component vector of float v, flat temp 2-component vector of int i2})
0:13 Constant: 0:13 Constant:
0:13 1 (const int) 0:13 1 (const int)
0:13 move second child to first child ( temp 4-component vector of float) 0:13 move second child to first child ( temp 4-component vector of float)
...@@ -82,7 +82,7 @@ gl_FragCoord origin is upper left ...@@ -82,7 +82,7 @@ gl_FragCoord origin is upper left
0:? 'i' ( temp structure{ temp 2-component vector of float v, temp 4-component vector of float fragCoord, temp 2-component vector of int i2}) 0:? 'i' ( temp structure{ temp 2-component vector of float v, temp 4-component vector of float fragCoord, temp 2-component vector of int i2})
0:? Linker Objects 0:? Linker Objects
0:? '@entryPointOutput' (layout( location=0) out 4-component vector of float) 0:? '@entryPointOutput' (layout( location=0) out 4-component vector of float)
0:? 'i' (layout( location=0) in structure{ temp 2-component vector of float v, temp 2-component vector of int i2}) 0:? 'i' (layout( location=0) in structure{ temp 2-component vector of float v, flat temp 2-component vector of int i2})
0:? 'i_fragCoord' ( in 4-component vector of float FragCoord) 0:? 'i_fragCoord' ( in 4-component vector of float FragCoord)
...@@ -148,7 +148,7 @@ gl_FragCoord origin is upper left ...@@ -148,7 +148,7 @@ gl_FragCoord origin is upper left
0:13 Constant: 0:13 Constant:
0:13 0 (const int) 0:13 0 (const int)
0:13 v: direct index for structure ( temp 2-component vector of float) 0:13 v: direct index for structure ( temp 2-component vector of float)
0:13 'i' (layout( location=0) in structure{ temp 2-component vector of float v, temp 2-component vector of int i2}) 0:13 'i' (layout( location=0) in structure{ temp 2-component vector of float v, flat temp 2-component vector of int i2})
0:13 Constant: 0:13 Constant:
0:13 0 (const int) 0:13 0 (const int)
0:13 move second child to first child ( temp 4-component vector of float) 0:13 move second child to first child ( temp 4-component vector of float)
...@@ -162,8 +162,8 @@ gl_FragCoord origin is upper left ...@@ -162,8 +162,8 @@ gl_FragCoord origin is upper left
0:? 'i' ( temp structure{ temp 2-component vector of float v, temp 4-component vector of float fragCoord, temp 2-component vector of int i2}) 0:? 'i' ( temp structure{ temp 2-component vector of float v, temp 4-component vector of float fragCoord, temp 2-component vector of int i2})
0:13 Constant: 0:13 Constant:
0:13 2 (const int) 0:13 2 (const int)
0:13 i2: direct index for structure ( temp 2-component vector of int) 0:13 i2: direct index for structure ( flat temp 2-component vector of int)
0:13 'i' (layout( location=0) in structure{ temp 2-component vector of float v, temp 2-component vector of int i2}) 0:13 'i' (layout( location=0) in structure{ temp 2-component vector of float v, flat temp 2-component vector of int i2})
0:13 Constant: 0:13 Constant:
0:13 1 (const int) 0:13 1 (const int)
0:13 move second child to first child ( temp 4-component vector of float) 0:13 move second child to first child ( temp 4-component vector of float)
...@@ -172,7 +172,7 @@ gl_FragCoord origin is upper left ...@@ -172,7 +172,7 @@ gl_FragCoord origin is upper left
0:? 'i' ( temp structure{ temp 2-component vector of float v, temp 4-component vector of float fragCoord, temp 2-component vector of int i2}) 0:? 'i' ( temp structure{ temp 2-component vector of float v, temp 4-component vector of float fragCoord, temp 2-component vector of int i2})
0:? Linker Objects 0:? Linker Objects
0:? '@entryPointOutput' (layout( location=0) out 4-component vector of float) 0:? '@entryPointOutput' (layout( location=0) out 4-component vector of float)
0:? 'i' (layout( location=0) in structure{ temp 2-component vector of float v, temp 2-component vector of int i2}) 0:? 'i' (layout( location=0) in structure{ temp 2-component vector of float v, flat temp 2-component vector of int i2})
0:? 'i_fragCoord' ( in 4-component vector of float FragCoord) 0:? 'i_fragCoord' ( in 4-component vector of float FragCoord)
// Module Version 10000 // Module Version 10000
...@@ -207,6 +207,7 @@ gl_FragCoord origin is upper left ...@@ -207,6 +207,7 @@ gl_FragCoord origin is upper left
Name 63 "i_fragCoord" Name 63 "i_fragCoord"
Name 73 "@entryPointOutput" Name 73 "@entryPointOutput"
Name 74 "param" Name 74 "param"
MemberDecorate 54(InParam) 1 Flat
Decorate 56(i) Location 0 Decorate 56(i) Location 0
Decorate 63(i_fragCoord) BuiltIn FragCoord Decorate 63(i_fragCoord) BuiltIn FragCoord
Decorate 73(@entryPointOutput) Location 0 Decorate 73(@entryPointOutput) Location 0
......
...@@ -1349,7 +1349,6 @@ public: ...@@ -1349,7 +1349,6 @@ public:
case EbtInt16: case EbtInt16:
case EbtUint16: case EbtUint16:
#endif #endif
case EbtBool:
case EbtAtomicUint: case EbtAtomicUint:
return true; return true;
default: default:
...@@ -1469,9 +1468,9 @@ public: ...@@ -1469,9 +1468,9 @@ public:
case EbtUint16: case EbtUint16:
#endif #endif
case EbtBool: case EbtBool:
return true; return true;
default: default:
return false; return false;
} }
}; };
......
...@@ -791,7 +791,7 @@ TIntermTyped* HlslParseContext::handleBracketDereference(const TSourceLoc& loc, ...@@ -791,7 +791,7 @@ TIntermTyped* HlslParseContext::handleBracketDereference(const TSourceLoc& loc,
index = makeIntegerIndex(index); index = makeIntegerIndex(index);
if (index == nullptr) { if (index == nullptr) {
error(loc, " unknown undex type ", "", ""); error(loc, " unknown index type ", "", "");
return nullptr; return nullptr;
} }
...@@ -1554,11 +1554,20 @@ void HlslParseContext::assignToInterface(TVariable& variable) ...@@ -1554,11 +1554,20 @@ void HlslParseContext::assignToInterface(TVariable& variable)
nextOutLocation += size; nextOutLocation += size;
} }
} }
// Going into the fragment stage, integer-based stuff must be flat/nointerpolation if (qualifier.storage == EvqVaryingIn && language == EShLangFragment) {
if (type.isIntegerDomain() && qualifier.builtIn == EbvNone && // Going into the fragment stage, integer-based stuff must be flat/nointerpolation
qualifier.storage == EvqVaryingIn && language == EShLangFragment) { const auto fixQualifier = [](TType& type) {
qualifier.clearInterpolation(); if (type.getQualifier().builtIn == EbvNone &&
qualifier.flat = true; (type.isIntegerDomain() || type.getBasicType() == EbtBool)) {
type.getQualifier().clearInterpolation();
type.getQualifier().flat = true;
}
};
if (type.isStruct())
for (auto mem = (*type.getStruct()).begin(); mem != (*type.getStruct()).end(); ++mem)
fixQualifier(*mem->type);
else
fixQualifier(type);
} }
trackLinkage(variable); trackLinkage(variable);
} }
......
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