Fix SPIR-V for HLSL EvaluateAttribute* of interpolants in structs
Generate load of interpolant for first operand to GLSLstd450 InterpolateAt* SPIR-V ops. This allows the interpolants to propagate from the input struct in the wrapper around main into the shader during HLSL legalization. A new pass has been added to legalization which will remove the load and replace with the pointer of the load to create valid external interpolate op. Fixes #2584
This commit is contained in:
parent
6dc24ffa47
commit
7fbaca0d06
8 changed files with 163 additions and 305 deletions
|
|
@ -6075,8 +6075,12 @@ void HlslParseContext::builtInOpCheck(const TSourceLoc& loc, const TFunction& fn
|
|||
case EOpInterpolateAtCentroid:
|
||||
case EOpInterpolateAtSample:
|
||||
case EOpInterpolateAtOffset:
|
||||
// TODO(greg-lunarg): Re-enable this check. It currently gives false errors for builtins
|
||||
// defined and passed as members of a struct. In this case the storage class is showing to be
|
||||
// Function. See glslang #2584
|
||||
|
||||
// Make sure the first argument is an interpolant, or an array element of an interpolant
|
||||
if (arg0->getType().getQualifier().storage != EvqVaryingIn) {
|
||||
// if (arg0->getType().getQualifier().storage != EvqVaryingIn) {
|
||||
// It might still be an array element.
|
||||
//
|
||||
// We could check more, but the semantics of the first argument are already met; the
|
||||
|
|
@ -6084,11 +6088,11 @@ void HlslParseContext::builtInOpCheck(const TSourceLoc& loc, const TFunction& fn
|
|||
//
|
||||
// ES and desktop 4.3 and earlier: swizzles may not be used
|
||||
// desktop 4.4 and later: swizzles may be used
|
||||
const TIntermTyped* base = TIntermediate::findLValueBase(arg0, true);
|
||||
if (base == nullptr || base->getType().getQualifier().storage != EvqVaryingIn)
|
||||
error(loc, "first argument must be an interpolant, or interpolant-array element",
|
||||
fnCandidate.getName().c_str(), "");
|
||||
}
|
||||
// const TIntermTyped* base = TIntermediate::findLValueBase(arg0, true);
|
||||
// if (base == nullptr || base->getType().getQualifier().storage != EvqVaryingIn)
|
||||
// error(loc, "first argument must be an interpolant, or interpolant-array element",
|
||||
// fnCandidate.getName().c_str(), "");
|
||||
// }
|
||||
break;
|
||||
|
||||
default:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue