|
@@ -107,6 +107,7 @@ const char *hlsl::GetValidationRuleText(ValidationRule value) {
|
|
case hlsl::ValidationRule::MetaTextureType: return "elements of typed buffers and textures must fit in four 32-bit quantities";
|
|
case hlsl::ValidationRule::MetaTextureType: return "elements of typed buffers and textures must fit in four 32-bit quantities";
|
|
case hlsl::ValidationRule::MetaBarycentricsInterpolation: return "SV_Barycentrics cannot be used with 'nointerpolation' type";
|
|
case hlsl::ValidationRule::MetaBarycentricsInterpolation: return "SV_Barycentrics cannot be used with 'nointerpolation' type";
|
|
case hlsl::ValidationRule::MetaBarycentricsFloat3: return "only 'float3' type is allowed for SV_Barycentrics.";
|
|
case hlsl::ValidationRule::MetaBarycentricsFloat3: return "only 'float3' type is allowed for SV_Barycentrics.";
|
|
|
|
+ case hlsl::ValidationRule::MetaBarycentricsTwoPerspectives: return "There can only be up to two input attributes of SV_Barycentrics with different perspective interpolation mode.";
|
|
case hlsl::ValidationRule::InstrOload: return "DXIL intrinsic overload must be valid";
|
|
case hlsl::ValidationRule::InstrOload: return "DXIL intrinsic overload must be valid";
|
|
case hlsl::ValidationRule::InstrCallOload: return "Call to DXIL intrinsic '%0' does not match an allowed overload signature";
|
|
case hlsl::ValidationRule::InstrCallOload: return "Call to DXIL intrinsic '%0' does not match an allowed overload signature";
|
|
case hlsl::ValidationRule::InstrPtrBitCast: return "Pointer type bitcast must be have same size";
|
|
case hlsl::ValidationRule::InstrPtrBitCast: return "Pointer type bitcast must be have same size";
|
|
@@ -3198,6 +3199,7 @@ static void ValidateSignatureElement(DxilSignatureElement &SE,
|
|
|
|
|
|
bool bIsClipCull = false;
|
|
bool bIsClipCull = false;
|
|
bool bIsTessfactor = false;
|
|
bool bIsTessfactor = false;
|
|
|
|
+ bool bIsBarycentric = false;
|
|
|
|
|
|
switch (semanticKind) {
|
|
switch (semanticKind) {
|
|
case DXIL::SemanticKind::Depth:
|
|
case DXIL::SemanticKind::Depth:
|
|
@@ -3276,6 +3278,7 @@ static void ValidateSignatureElement(DxilSignatureElement &SE,
|
|
DXASSERT(!bAllowedInSig, "else internal inconsistency between semantic interpretation table and validation code");
|
|
DXASSERT(!bAllowedInSig, "else internal inconsistency between semantic interpretation table and validation code");
|
|
break;
|
|
break;
|
|
case DXIL::SemanticKind::Barycentrics:
|
|
case DXIL::SemanticKind::Barycentrics:
|
|
|
|
+ bIsBarycentric = true;
|
|
if (compKind != DXIL::ComponentType::F32) {
|
|
if (compKind != DXIL::ComponentType::F32) {
|
|
ValCtx.EmitFormatError(ValidationRule::MetaSemanticCompType, {SE.GetSemantic()->GetName(), "float"});
|
|
ValCtx.EmitFormatError(ValidationRule::MetaSemanticCompType, {SE.GetSemantic()->GetName(), "float"});
|
|
}
|
|
}
|
|
@@ -3338,7 +3341,12 @@ static void ValidateSignatureElement(DxilSignatureElement &SE,
|
|
ValCtx.EmitFormatError(ValidationRule::MetaSemanticIndexMax, {"SV_Target", "7"});
|
|
ValCtx.EmitFormatError(ValidationRule::MetaSemanticIndexMax, {"SV_Target", "7"});
|
|
}
|
|
}
|
|
} else if (bAllowedInSig && semanticKind != DXIL::SemanticKind::Arbitrary) {
|
|
} else if (bAllowedInSig && semanticKind != DXIL::SemanticKind::Arbitrary) {
|
|
- if (!bIsClipCull && SE.GetSemanticStartIndex() > 0) {
|
|
|
|
|
|
+ if (bIsBarycentric) {
|
|
|
|
+ if (SE.GetSemanticStartIndex() > 1) {
|
|
|
|
+ ValCtx.EmitFormatError(ValidationRule::MetaSemanticIndexMax, { SE.GetSemantic()->GetName(), "1" });
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ else if (!bIsClipCull && SE.GetSemanticStartIndex() > 0) {
|
|
ValCtx.EmitFormatError(ValidationRule::MetaSemanticIndexMax, {SE.GetSemantic()->GetName(), "0"});
|
|
ValCtx.EmitFormatError(ValidationRule::MetaSemanticIndexMax, {SE.GetSemantic()->GetName(), "0"});
|
|
}
|
|
}
|
|
// Maximum rows is 1 for system values other than Target
|
|
// Maximum rows is 1 for system values other than Target
|
|
@@ -3454,10 +3462,12 @@ static void ValidateSignature(ValidationContext &ValCtx, const DxilSignature &S,
|
|
unsigned TargetMask = 0;
|
|
unsigned TargetMask = 0;
|
|
DXIL::SemanticKind DepthKind = DXIL::SemanticKind::Invalid;
|
|
DXIL::SemanticKind DepthKind = DXIL::SemanticKind::Invalid;
|
|
|
|
|
|
|
|
+ const InterpolationMode *prevBaryInterpMode = nullptr;
|
|
|
|
+ unsigned numBarycentrics = 0;
|
|
|
|
+
|
|
for (auto &E : S.GetElements()) {
|
|
for (auto &E : S.GetElements()) {
|
|
DXIL::SemanticKind semanticKind = E->GetSemantic()->GetKind();
|
|
DXIL::SemanticKind semanticKind = E->GetSemantic()->GetKind();
|
|
ValidateSignatureElement(*E, ValCtx);
|
|
ValidateSignatureElement(*E, ValCtx);
|
|
-
|
|
|
|
// Avoid OOB indexing on streamId.
|
|
// Avoid OOB indexing on streamId.
|
|
unsigned streamId = E->GetOutputStream();
|
|
unsigned streamId = E->GetOutputStream();
|
|
if (streamId >= DXIL::kNumOutputStreams ||
|
|
if (streamId >= DXIL::kNumOutputStreams ||
|
|
@@ -3523,6 +3533,23 @@ static void ValidateSignature(ValidationContext &ValCtx, const DxilSignature &S,
|
|
}
|
|
}
|
|
DepthKind = semanticKind;
|
|
DepthKind = semanticKind;
|
|
break;
|
|
break;
|
|
|
|
+ case DXIL::SemanticKind::Barycentrics: {
|
|
|
|
+ // There can only be up to two SV_Barycentrics
|
|
|
|
+ // with differeent perspective interpolation modes.
|
|
|
|
+ if (numBarycentrics++ > 1) {
|
|
|
|
+ ValCtx.EmitError(ValidationRule::MetaBarycentricsTwoPerspectives);
|
|
|
|
+ break;
|
|
|
|
+ }
|
|
|
|
+ const InterpolationMode *mode = E->GetInterpolationMode();
|
|
|
|
+ if (prevBaryInterpMode) {
|
|
|
|
+ if ((mode->IsAnyNoPerspective() && prevBaryInterpMode->IsAnyNoPerspective())
|
|
|
|
+ || (!mode->IsAnyNoPerspective() && !prevBaryInterpMode->IsAnyNoPerspective())) {
|
|
|
|
+ ValCtx.EmitError(ValidationRule::MetaBarycentricsTwoPerspectives);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ prevBaryInterpMode = mode;
|
|
|
|
+ break;
|
|
|
|
+ }
|
|
default:
|
|
default:
|
|
if (semanticUsageSet[streamId].count(semanticKind) > 0) {
|
|
if (semanticUsageSet[streamId].count(semanticKind) > 0) {
|
|
ValCtx.EmitFormatError(ValidationRule::MetaDuplicateSysValue,
|
|
ValCtx.EmitFormatError(ValidationRule::MetaDuplicateSysValue,
|