|
@@ -387,7 +387,7 @@ struct ValidationContext {
|
|
|
}
|
|
|
|
|
|
void EmitGlobalValueError(GlobalValue *GV, ValidationRule rule) {
|
|
|
- EmitFormatError(rule, { GV->getName().str().c_str() });
|
|
|
+ EmitFormatError(rule, { GV->getName().str() });
|
|
|
}
|
|
|
|
|
|
// This is the least desirable mechanism, as it has no context.
|
|
@@ -396,12 +396,12 @@ struct ValidationContext {
|
|
|
Failed = true;
|
|
|
}
|
|
|
|
|
|
- void FormatRuleText(std::string &ruleText, ArrayRef<const char *> args) {
|
|
|
+ void FormatRuleText(std::string &ruleText, ArrayRef<StringRef> args) {
|
|
|
// Consider changing const char * to StringRef
|
|
|
for (unsigned i = 0; i < args.size(); i++) {
|
|
|
std::string argIdx = "%" + std::to_string(i);
|
|
|
- const char *pArg = args[i];
|
|
|
- if (pArg == nullptr)
|
|
|
+ StringRef pArg = args[i];
|
|
|
+ if (pArg == "")
|
|
|
pArg = "<null>";
|
|
|
|
|
|
std::string::size_type offset = ruleText.find(argIdx);
|
|
@@ -413,7 +413,7 @@ struct ValidationContext {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- void EmitFormatError(ValidationRule rule, ArrayRef<const char *> args) {
|
|
|
+ void EmitFormatError(ValidationRule rule, ArrayRef<StringRef> args) {
|
|
|
std::string ruleText = GetValidationRuleText(rule);
|
|
|
FormatRuleText(ruleText, args);
|
|
|
DiagPrinter << ruleText << '\n';
|
|
@@ -436,7 +436,7 @@ struct ValidationContext {
|
|
|
|
|
|
void EmitResourceFormatError(const hlsl::DxilResourceBase *Res,
|
|
|
ValidationRule rule,
|
|
|
- ArrayRef<const char *> args) {
|
|
|
+ ArrayRef<StringRef> args) {
|
|
|
std::string ruleText = GetValidationRuleText(rule);
|
|
|
FormatRuleText(ruleText, args);
|
|
|
DiagPrinter << ruleText;
|
|
@@ -516,7 +516,7 @@ struct ValidationContext {
|
|
|
Failed = true;
|
|
|
}
|
|
|
|
|
|
- void EmitInstrFormatError(Instruction *I, ValidationRule rule, ArrayRef<const char *> args) {
|
|
|
+ void EmitInstrFormatError(Instruction *I, ValidationRule rule, ArrayRef<StringRef> args) {
|
|
|
if (!EmitInstrLoc(I, rule)) return;
|
|
|
|
|
|
std::string ruleText = GetValidationRuleText(rule);
|
|
@@ -526,7 +526,7 @@ struct ValidationContext {
|
|
|
Failed = true;
|
|
|
}
|
|
|
|
|
|
- void EmitOperandOutOfRange(Instruction *I, const char *name, const char * range, const char * v) {
|
|
|
+ void EmitOperandOutOfRange(Instruction *I, StringRef name, StringRef range, StringRef v) {
|
|
|
if (!EmitInstrLoc(I, ValidationRule::InstrOperandRange)) return;
|
|
|
|
|
|
std::string ruleText = GetValidationRuleText(ValidationRule::InstrOperandRange);
|
|
@@ -544,7 +544,7 @@ struct ValidationContext {
|
|
|
std::string O;
|
|
|
raw_string_ostream OSS(O);
|
|
|
Ty->print(OSS);
|
|
|
- EmitFormatError(rule, { OSS.str().c_str() });
|
|
|
+ EmitFormatError(rule, { OSS.str() });
|
|
|
}
|
|
|
};
|
|
|
|
|
@@ -573,12 +573,12 @@ static bool ValidateOpcodeInProfile(DXIL::OpCode opcode,
|
|
|
// Instructions: StorePatchConstant=106, OutputControlPointID=107
|
|
|
if (106 <= op && op <= 107)
|
|
|
return pSM->IsHS();
|
|
|
- // Instructions: Sample=60, SampleBias=61, SampleCmp=64, SampleCmpLevelZero=65,
|
|
|
+ // Instructions: Sample=60, SampleBias=61, SampleCmp=64,
|
|
|
// RenderTargetGetSamplePosition=76, RenderTargetGetSampleCount=77,
|
|
|
// CalculateLOD=81, Discard=82, DerivCoarseX=83, DerivCoarseY=84,
|
|
|
// DerivFineX=85, DerivFineY=86, EvalSnapped=87, EvalSampleIndex=88,
|
|
|
// EvalCentroid=89, SampleIndex=90, Coverage=91, InnerCoverage=92
|
|
|
- if (60 <= op && op <= 61 || 64 <= op && op <= 65 || 76 <= op && op <= 77 || 81 <= op && op <= 92)
|
|
|
+ if (60 <= op && op <= 61 || op == 64 || 76 <= op && op <= 77 || 81 <= op && op <= 92)
|
|
|
return pSM->IsPS();
|
|
|
return true;
|
|
|
// VALOPCODESM-TEXT:END
|
|
@@ -1160,8 +1160,8 @@ static void ValidateDxilOperationCallInProfile(CallInst *CI,
|
|
|
if (immVertexID < low || immVertexID >= high) {
|
|
|
std::string range = std::to_string(low)+"~"+
|
|
|
std::to_string(high);
|
|
|
- ValCtx.EmitOperandOutOfRange(CI, "VertexID", range.c_str(),
|
|
|
- std::to_string(immVertexID).c_str());
|
|
|
+ ValCtx.EmitOperandOutOfRange(CI, "VertexID", range,
|
|
|
+ std::to_string(immVertexID));
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -1460,9 +1460,9 @@ static void ValidateDxilOperationCallInProfile(CallInst *CI,
|
|
|
if (fBias < DXIL::kMinMipLodBias || fBias > DXIL::kMaxMipLodBias) {
|
|
|
ValCtx.EmitInstrFormatError(
|
|
|
CI, ValidationRule::InstrImmBiasForSampleB,
|
|
|
- {std::to_string(DXIL::kMinMipLodBias).c_str(),
|
|
|
- std::to_string(DXIL::kMaxMipLodBias).c_str(),
|
|
|
- std::to_string(cBias->getValueAPF().convertToFloat()).c_str()});
|
|
|
+ {std::to_string(DXIL::kMinMipLodBias),
|
|
|
+ std::to_string(DXIL::kMaxMipLodBias),
|
|
|
+ std::to_string(cBias->getValueAPF().convertToFloat())});
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -1554,7 +1554,7 @@ static void ValidateDxilOperationCallInProfile(CallInst *CI,
|
|
|
if (stValMask != uMask) {
|
|
|
ValCtx.EmitInstrFormatError(
|
|
|
CI, ValidationRule::InstrWriteMaskMatchValueForUAVStore,
|
|
|
- {std::to_string(uMask).c_str(), std::to_string(stValMask).c_str()});
|
|
|
+ {std::to_string(uMask), std::to_string(stValMask)});
|
|
|
}
|
|
|
|
|
|
Value *offset = bufSt.get_coord1();
|
|
@@ -1620,8 +1620,9 @@ static void ValidateDxilOperationCallInProfile(CallInst *CI,
|
|
|
texSt.get_value2(), texSt.get_value3()});
|
|
|
|
|
|
if (stValMask != uMask) {
|
|
|
- ValCtx.EmitInstrError(
|
|
|
- CI, ValidationRule::InstrWriteMaskMatchValueForUAVStore);
|
|
|
+ ValCtx.EmitInstrFormatError(
|
|
|
+ CI, ValidationRule::InstrWriteMaskMatchValueForUAVStore,
|
|
|
+ {std::to_string(uMask), std::to_string(stValMask)});
|
|
|
}
|
|
|
|
|
|
switch (resKind) {
|
|
@@ -1733,7 +1734,7 @@ static void ValidateDxilOperationCallInProfile(CallInst *CI,
|
|
|
int immStreamID = cStreamID->getValue().getLimitedValue();
|
|
|
if (cStreamID->getValue().isNegative() || immStreamID >= 4) {
|
|
|
ValCtx.EmitOperandOutOfRange(CI, "StreamID","0~4",
|
|
|
- std::to_string(immStreamID).c_str());
|
|
|
+ std::to_string(immStreamID));
|
|
|
} else {
|
|
|
unsigned immMask = 1 << immStreamID;
|
|
|
if ((streamMask & immMask) == 0) {
|
|
@@ -1743,8 +1744,8 @@ static void ValidateDxilOperationCallInProfile(CallInst *CI,
|
|
|
range += std::to_string(i) + " ";
|
|
|
}
|
|
|
}
|
|
|
- ValCtx.EmitOperandOutOfRange(CI, "StreamID", range.c_str(),
|
|
|
- std::to_string(immStreamID).c_str());
|
|
|
+ ValCtx.EmitOperandOutOfRange(CI, "StreamID", range,
|
|
|
+ std::to_string(immStreamID));
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -2538,13 +2539,13 @@ static void ValidateFunction(Function &F, ValidationContext &ValCtx) {
|
|
|
} else {
|
|
|
if (!F.arg_empty())
|
|
|
ValCtx.EmitFormatError(ValidationRule::FlowFunctionCall,
|
|
|
- {F.getName().str().c_str()});
|
|
|
+ {F.getName().str()});
|
|
|
|
|
|
DxilFunctionAnnotation *funcAnnotation =
|
|
|
ValCtx.DxilMod.GetTypeSystem().GetFunctionAnnotation(&F);
|
|
|
if (!funcAnnotation) {
|
|
|
ValCtx.EmitFormatError(ValidationRule::MetaFunctionAnnotation,
|
|
|
- {F.getName().str().c_str()});
|
|
|
+ {F.getName().str()});
|
|
|
return;
|
|
|
}
|
|
|
|
|
@@ -2565,11 +2566,11 @@ static void ValidateFunction(Function &F, ValidationContext &ValCtx) {
|
|
|
if (arg.hasName())
|
|
|
ValCtx.EmitFormatError(
|
|
|
ValidationRule::DeclFnFlattenParam,
|
|
|
- {arg.getName().str().c_str(), F.getName().str().c_str()});
|
|
|
+ {arg.getName().str(), F.getName().str()});
|
|
|
else
|
|
|
ValCtx.EmitFormatError(ValidationRule::DeclFnFlattenParam,
|
|
|
- {std::to_string(arg.getArgNo()).c_str(),
|
|
|
- F.getName().str().c_str()});
|
|
|
+ {std::to_string(arg.getArgNo()),
|
|
|
+ F.getName().str()});
|
|
|
break;
|
|
|
}
|
|
|
}
|
|
@@ -2680,8 +2681,8 @@ static void ValidateGlobalVariables(ValidationContext &ValCtx) {
|
|
|
|
|
|
if (TGSMSize > DXIL::kMaxTGSMSize) {
|
|
|
ValCtx.EmitFormatError(ValidationRule::SmMaxTGSMSize,
|
|
|
- {std::to_string(TGSMSize).c_str(),
|
|
|
- std::to_string(DXIL::kMaxTGSMSize).c_str()});
|
|
|
+ {std::to_string(TGSMSize),
|
|
|
+ std::to_string(DXIL::kMaxTGSMSize)});
|
|
|
}
|
|
|
if (!fixAddrTGSMList.empty()) {
|
|
|
ValidateTGSMRaceCondition(fixAddrTGSMList, ValCtx);
|
|
@@ -2717,7 +2718,7 @@ static void ValidateMetadata(ValidationContext &ValCtx) {
|
|
|
Module *pModule = &ValCtx.M;
|
|
|
const std::string &target = pModule->getTargetTriple();
|
|
|
if (target != "dxil-ms-dx") {
|
|
|
- ValCtx.EmitFormatError(ValidationRule::MetaTarget, {target.c_str()});
|
|
|
+ ValCtx.EmitFormatError(ValidationRule::MetaTarget, {target});
|
|
|
}
|
|
|
|
|
|
// The llvm.dbg.(cu/contents/defines/mainFileName/arg) named metadata nodes
|
|
@@ -2733,11 +2734,11 @@ static void ValidateMetadata(ValidationContext &ValCtx) {
|
|
|
if (!DxilModule::IsKnownNamedMetaData(NamedMetaNode)) {
|
|
|
StringRef name = NamedMetaNode.getName();
|
|
|
if (!name.startswith_lower("llvm."))
|
|
|
- ValCtx.EmitFormatError(ValidationRule::MetaKnown, {name.str().c_str()});
|
|
|
+ ValCtx.EmitFormatError(ValidationRule::MetaKnown, {name.str()});
|
|
|
else {
|
|
|
if (llvmNamedMeta.count(name) == 0) {
|
|
|
ValCtx.EmitFormatError(ValidationRule::MetaKnown,
|
|
|
- {name.str().c_str()});
|
|
|
+ {name.str()});
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -2769,11 +2770,11 @@ static void ValidateResourceOverlap(
|
|
|
if (conflictRes) {
|
|
|
ValCtx.EmitFormatError(
|
|
|
ValidationRule::SmResourceRangeOverlap,
|
|
|
- {res.GetGlobalName().c_str(), std::to_string(base).c_str(),
|
|
|
- std::to_string(size).c_str(),
|
|
|
- std::to_string(conflictRes->GetLowerBound()).c_str(),
|
|
|
- std::to_string(conflictRes->GetRangeSize()).c_str(),
|
|
|
- std::to_string(space).c_str()});
|
|
|
+ {res.GetGlobalName(), std::to_string(base),
|
|
|
+ std::to_string(size),
|
|
|
+ std::to_string(conflictRes->GetLowerBound()),
|
|
|
+ std::to_string(conflictRes->GetRangeSize()),
|
|
|
+ std::to_string(space)});
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -2828,13 +2829,13 @@ static void ValidateResource(hlsl::DxilResource &res,
|
|
|
if (!alignedTo4Bytes) {
|
|
|
ValCtx.EmitResourceFormatError(
|
|
|
&res, ValidationRule::MetaStructBufAlignment,
|
|
|
- {std::to_string(4).c_str(), std::to_string(stride).c_str()});
|
|
|
+ {std::to_string(4), std::to_string(stride)});
|
|
|
}
|
|
|
if (stride > DXIL::kMaxStructBufferStride) {
|
|
|
ValCtx.EmitResourceFormatError(
|
|
|
&res, ValidationRule::MetaStructBufAlignmentOutOfBound,
|
|
|
- {std::to_string(DXIL::kMaxStructBufferStride).c_str(),
|
|
|
- std::to_string(stride).c_str()});
|
|
|
+ {std::to_string(DXIL::kMaxStructBufferStride),
|
|
|
+ std::to_string(stride)});
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -2850,7 +2851,7 @@ static void ValidateResource(hlsl::DxilResource &res,
|
|
|
static void
|
|
|
CollectCBufferRanges(DxilStructAnnotation *annotation,
|
|
|
SpanAllocator<unsigned, DxilFieldAnnotation> &constAllocator,
|
|
|
- unsigned base, DxilTypeSystem &typeSys, const char *cbName,
|
|
|
+ unsigned base, DxilTypeSystem &typeSys, StringRef cbName,
|
|
|
ValidationContext &ValCtx) {
|
|
|
unsigned cbSize = annotation->GetCBufferSize();
|
|
|
|
|
@@ -2873,7 +2874,7 @@ CollectCBufferRanges(DxilStructAnnotation *annotation,
|
|
|
base + offset + EltSize - 1)) {
|
|
|
ValCtx.EmitFormatError(
|
|
|
ValidationRule::SmCBufferOffsetOverlap,
|
|
|
- {cbName, std::to_string(base + offset).c_str()});
|
|
|
+ {cbName, std::to_string(base + offset)});
|
|
|
}
|
|
|
}
|
|
|
} else if (isa<ArrayType>(EltTy)) {
|
|
@@ -2904,7 +2905,7 @@ CollectCBufferRanges(DxilStructAnnotation *annotation,
|
|
|
arrayBase + EltSize - 1)) {
|
|
|
ValCtx.EmitFormatError(
|
|
|
ValidationRule::SmCBufferOffsetOverlap,
|
|
|
- {cbName, std::to_string(base + offset).c_str()});
|
|
|
+ {cbName, std::to_string(base + offset)});
|
|
|
}
|
|
|
|
|
|
} else {
|
|
@@ -2921,7 +2922,7 @@ CollectCBufferRanges(DxilStructAnnotation *annotation,
|
|
|
|
|
|
if (bOutOfBound) {
|
|
|
ValCtx.EmitFormatError(ValidationRule::SmCBufferElementOverflow,
|
|
|
- {cbName, std::to_string(base + offset).c_str()});
|
|
|
+ {cbName, std::to_string(base + offset)});
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -2949,7 +2950,7 @@ static void ValidateCBuffer(DxilCBuffer &cb, ValidationContext &ValCtx) {
|
|
|
DXIL::kMaxCBufferSize << 4);
|
|
|
CollectCBufferRanges(annotation, constAllocator,
|
|
|
0, typeSys,
|
|
|
- cb.GetGlobalName().c_str(), ValCtx);
|
|
|
+ cb.GetGlobalName(), ValCtx);
|
|
|
}
|
|
|
|
|
|
static void ValidateResources(ValidationContext &ValCtx) {
|
|
@@ -3114,7 +3115,7 @@ static void ValidateSignatureElement(DxilSignatureElement &SE,
|
|
|
if (!bAllowedInSig) {
|
|
|
ValCtx.EmitFormatError(
|
|
|
ValidationRule::SmSemantic,
|
|
|
- {SE.GetName(), ValCtx.DxilMod.GetShaderModel()->GetKindName().c_str(), inputOutput});
|
|
|
+ {SE.GetName(), ValCtx.DxilMod.GetShaderModel()->GetKindName(), inputOutput});
|
|
|
} else if (bShouldBeAllocated && !SE.IsAllocated()) {
|
|
|
ValCtx.EmitFormatError(ValidationRule::MetaSemanticShouldBeAllocated,
|
|
|
{inputOutput, SE.GetName()});
|
|
@@ -3210,13 +3211,13 @@ static void ValidateSignatureElement(DxilSignatureElement &SE,
|
|
|
if (ValCtx.DxilMod.GetShaderModel()->IsGS() && SE.IsOutput()) {
|
|
|
if (SE.GetOutputStream() >= DXIL::kNumOutputStreams) {
|
|
|
ValCtx.EmitFormatError(ValidationRule::SmStreamIndexRange,
|
|
|
- {std::to_string(SE.GetOutputStream()).c_str(),
|
|
|
- std::to_string(DXIL::kNumOutputStreams - 1).c_str()});
|
|
|
+ {std::to_string(SE.GetOutputStream()),
|
|
|
+ std::to_string(DXIL::kNumOutputStreams - 1)});
|
|
|
}
|
|
|
} else {
|
|
|
if (SE.GetOutputStream() > 0) {
|
|
|
ValCtx.EmitFormatError(ValidationRule::SmStreamIndexRange,
|
|
|
- {std::to_string(SE.GetOutputStream()).c_str(),
|
|
|
+ {std::to_string(SE.GetOutputStream()),
|
|
|
"0"});
|
|
|
}
|
|
|
}
|
|
@@ -3263,9 +3264,9 @@ static void ValidateSignatureElement(DxilSignatureElement &SE,
|
|
|
unsigned size = (SE.GetRows() - 1) * 4 + SE.GetCols();
|
|
|
ValCtx.EmitFormatError(ValidationRule::MetaSignatureOutOfRange,
|
|
|
{SE.GetName(),
|
|
|
- std::to_string(SE.GetStartRow()).c_str(),
|
|
|
- std::to_string(SE.GetStartCol()).c_str(),
|
|
|
- std::to_string(size).c_str()});
|
|
|
+ std::to_string(SE.GetStartRow()),
|
|
|
+ std::to_string(SE.GetStartCol()),
|
|
|
+ std::to_string(size)});
|
|
|
}
|
|
|
|
|
|
if (!SE.GetInterpolationMode()->IsValid()) {
|
|
@@ -3300,26 +3301,26 @@ static void ValidateSignatureOverlap(
|
|
|
case DxilSignatureAllocator::kConflictsWithIndexed:
|
|
|
ValCtx.EmitFormatError(ValidationRule::MetaSignatureIndexConflict,
|
|
|
{E.GetName(),
|
|
|
- std::to_string(E.GetStartRow()).c_str(),
|
|
|
- std::to_string(E.GetStartCol()).c_str(),
|
|
|
- std::to_string(E.GetRows()).c_str(),
|
|
|
- std::to_string(E.GetCols()).c_str()});
|
|
|
+ std::to_string(E.GetStartRow()),
|
|
|
+ std::to_string(E.GetStartCol()),
|
|
|
+ std::to_string(E.GetRows()),
|
|
|
+ std::to_string(E.GetCols())});
|
|
|
break;
|
|
|
case DxilSignatureAllocator::kConflictsWithIndexedTessFactor:
|
|
|
ValCtx.EmitFormatError(ValidationRule::MetaSignatureIndexConflict,
|
|
|
{E.GetName(),
|
|
|
- std::to_string(E.GetStartRow()).c_str(),
|
|
|
- std::to_string(E.GetStartCol()).c_str(),
|
|
|
- std::to_string(E.GetRows()).c_str(),
|
|
|
- std::to_string(E.GetCols()).c_str()});
|
|
|
+ std::to_string(E.GetStartRow()),
|
|
|
+ std::to_string(E.GetStartCol()),
|
|
|
+ std::to_string(E.GetRows()),
|
|
|
+ std::to_string(E.GetCols())});
|
|
|
break;
|
|
|
case DxilSignatureAllocator::kConflictsWithInterpolationMode:
|
|
|
ValCtx.EmitFormatError(ValidationRule::MetaInterpModeInOneRow,
|
|
|
{E.GetName(),
|
|
|
- std::to_string(E.GetStartRow()).c_str(),
|
|
|
- std::to_string(E.GetStartCol()).c_str(),
|
|
|
- std::to_string(E.GetRows()).c_str(),
|
|
|
- std::to_string(E.GetCols()).c_str()});
|
|
|
+ std::to_string(E.GetStartRow()),
|
|
|
+ std::to_string(E.GetStartCol()),
|
|
|
+ std::to_string(E.GetRows()),
|
|
|
+ std::to_string(E.GetCols())});
|
|
|
break;
|
|
|
case DxilSignatureAllocator::kInsufficientFreeComponents:
|
|
|
DXASSERT(false, "otherwise, conflict not translated");
|
|
@@ -3327,26 +3328,26 @@ static void ValidateSignatureOverlap(
|
|
|
case DxilSignatureAllocator::kOverlapElement:
|
|
|
ValCtx.EmitFormatError(ValidationRule::MetaSignatureOverlap,
|
|
|
{E.GetName(),
|
|
|
- std::to_string(E.GetStartRow()).c_str(),
|
|
|
- std::to_string(E.GetStartCol()).c_str(),
|
|
|
- std::to_string(E.GetRows()).c_str(),
|
|
|
- std::to_string(E.GetCols()).c_str()});
|
|
|
+ std::to_string(E.GetStartRow()),
|
|
|
+ std::to_string(E.GetStartCol()),
|
|
|
+ std::to_string(E.GetRows()),
|
|
|
+ std::to_string(E.GetCols())});
|
|
|
break;
|
|
|
case DxilSignatureAllocator::kIllegalComponentOrder:
|
|
|
ValCtx.EmitFormatError(ValidationRule::MetaSignatureIllegalComponentOrder,
|
|
|
{E.GetName(),
|
|
|
- std::to_string(E.GetStartRow()).c_str(),
|
|
|
- std::to_string(E.GetStartCol()).c_str(),
|
|
|
- std::to_string(E.GetRows()).c_str(),
|
|
|
- std::to_string(E.GetCols()).c_str()});
|
|
|
+ std::to_string(E.GetStartRow()),
|
|
|
+ std::to_string(E.GetStartCol()),
|
|
|
+ std::to_string(E.GetRows()),
|
|
|
+ std::to_string(E.GetCols())});
|
|
|
break;
|
|
|
case DxilSignatureAllocator::kConflictFit:
|
|
|
ValCtx.EmitFormatError(ValidationRule::MetaSignatureOutOfRange,
|
|
|
{E.GetName(),
|
|
|
- std::to_string(E.GetStartRow()).c_str(),
|
|
|
- std::to_string(E.GetStartCol()).c_str(),
|
|
|
- std::to_string(E.GetRows()).c_str(),
|
|
|
- std::to_string(E.GetCols()).c_str()});
|
|
|
+ std::to_string(E.GetStartRow()),
|
|
|
+ std::to_string(E.GetStartCol()),
|
|
|
+ std::to_string(E.GetRows()),
|
|
|
+ std::to_string(E.GetCols())});
|
|
|
break;
|
|
|
default:
|
|
|
DXASSERT(false, "otherwise, unrecognized conflict type from DxilSignatureAllocator");
|
|
@@ -3384,7 +3385,7 @@ static void ValidateSignature(ValidationContext &ValCtx, const DxilSignature &S,
|
|
|
for (unsigned semIdx : E->GetSemanticIndexVec()) {
|
|
|
if (semIdxSet.count(semIdx) > 0) {
|
|
|
ValCtx.EmitFormatError(ValidationRule::MetaNoSemanticOverlap,
|
|
|
- {E->GetName(), std::to_string(semIdx).c_str()});
|
|
|
+ {E->GetName(), std::to_string(semIdx)});
|
|
|
return;
|
|
|
} else
|
|
|
semIdxSet.insert(semIdx);
|
|
@@ -3397,7 +3398,7 @@ static void ValidateSignature(ValidationContext &ValCtx, const DxilSignature &S,
|
|
|
unsigned mask = ((1 << E->GetRows()) - 1) << E->GetStartRow();
|
|
|
if (TargetMask & mask) {
|
|
|
ValCtx.EmitFormatError(ValidationRule::MetaNoSemanticOverlap,
|
|
|
- {"SV_Target", std::to_string(E->GetStartRow()).c_str()});
|
|
|
+ {"SV_Target", std::to_string(E->GetStartRow())});
|
|
|
}
|
|
|
TargetMask = TargetMask | mask;
|
|
|
}
|
|
@@ -3567,10 +3568,10 @@ static void ValidateSignatures(ValidationContext &ValCtx) {
|
|
|
if (totalOutputScalars > DXIL::kMaxGSOutputTotalScalars) {
|
|
|
ValCtx.EmitFormatError(
|
|
|
ValidationRule::SmGSTotalOutputVertexDataRange,
|
|
|
- {std::to_string(maxVertexCount).c_str(),
|
|
|
- std::to_string(outputScalarCount).c_str(),
|
|
|
- std::to_string(totalOutputScalars).c_str(),
|
|
|
- std::to_string(DXIL::kMaxGSOutputTotalScalars).c_str()});
|
|
|
+ {std::to_string(maxVertexCount),
|
|
|
+ std::to_string(outputScalarCount),
|
|
|
+ std::to_string(totalOutputScalars),
|
|
|
+ std::to_string(DXIL::kMaxGSOutputTotalScalars)});
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -3643,19 +3644,19 @@ static void CheckPatchConstantSemantic(ValidationContext &ValCtx)
|
|
|
bFoundEdgeSemantic = true;
|
|
|
if (SE->GetRows() != edgeSize || SE->GetCols() > 1) {
|
|
|
ValCtx.EmitFormatError(ValidationRule::SmTessFactorSizeMatchDomain,
|
|
|
- {std::to_string(SE->GetRows()).c_str(),
|
|
|
- std::to_string(SE->GetCols()).c_str(),
|
|
|
+ {std::to_string(SE->GetRows()),
|
|
|
+ std::to_string(SE->GetCols()),
|
|
|
domainName,
|
|
|
- std::to_string(edgeSize).c_str()});
|
|
|
+ std::to_string(edgeSize)});
|
|
|
}
|
|
|
} else if (kind == kInsideSemantic) {
|
|
|
bFoundInsideSemantic = true;
|
|
|
if (SE->GetRows() != insideSize || SE->GetCols() > 1) {
|
|
|
ValCtx.EmitFormatError(ValidationRule::SmInsideTessFactorSizeMatchDomain,
|
|
|
- {std::to_string(SE->GetRows()).c_str(),
|
|
|
- std::to_string(SE->GetCols()).c_str(),
|
|
|
+ {std::to_string(SE->GetRows()),
|
|
|
+ std::to_string(SE->GetCols()),
|
|
|
domainName,
|
|
|
- std::to_string(insideSize).c_str()});
|
|
|
+ std::to_string(insideSize)});
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -3684,30 +3685,30 @@ static void ValidateShaderState(ValidationContext &ValCtx) {
|
|
|
if ((x < DXIL::kMinCSThreadGroupX) || (x > DXIL::kMaxCSThreadGroupX)) {
|
|
|
ValCtx.EmitFormatError(
|
|
|
ValidationRule::SmThreadGroupChannelRange,
|
|
|
- {"X", std::to_string(x).c_str(),
|
|
|
- std::to_string(DXIL::kMinCSThreadGroupX).c_str(),
|
|
|
- std::to_string(DXIL::kMaxCSThreadGroupX).c_str()});
|
|
|
+ {"X", std::to_string(x),
|
|
|
+ std::to_string(DXIL::kMinCSThreadGroupX),
|
|
|
+ std::to_string(DXIL::kMaxCSThreadGroupX)});
|
|
|
}
|
|
|
if ((y < DXIL::kMinCSThreadGroupY) || (y > DXIL::kMaxCSThreadGroupY)) {
|
|
|
ValCtx.EmitFormatError(
|
|
|
ValidationRule::SmThreadGroupChannelRange,
|
|
|
- {"Y", std::to_string(y).c_str(),
|
|
|
- std::to_string(DXIL::kMinCSThreadGroupY).c_str(),
|
|
|
- std::to_string(DXIL::kMaxCSThreadGroupY).c_str()});
|
|
|
+ {"Y", std::to_string(y),
|
|
|
+ std::to_string(DXIL::kMinCSThreadGroupY),
|
|
|
+ std::to_string(DXIL::kMaxCSThreadGroupY)});
|
|
|
}
|
|
|
if ((z < DXIL::kMinCSThreadGroupZ) || (z > DXIL::kMaxCSThreadGroupZ)) {
|
|
|
ValCtx.EmitFormatError(
|
|
|
ValidationRule::SmThreadGroupChannelRange,
|
|
|
- {"Z", std::to_string(z).c_str(),
|
|
|
- std::to_string(DXIL::kMinCSThreadGroupZ).c_str(),
|
|
|
- std::to_string(DXIL::kMaxCSThreadGroupZ).c_str()});
|
|
|
+ {"Z", std::to_string(z),
|
|
|
+ std::to_string(DXIL::kMinCSThreadGroupZ),
|
|
|
+ std::to_string(DXIL::kMaxCSThreadGroupZ)});
|
|
|
}
|
|
|
|
|
|
if (threadsInGroup > DXIL::kMaxCSThreadsPerGroup) {
|
|
|
ValCtx.EmitFormatError(
|
|
|
ValidationRule::SmMaxTheadGroup,
|
|
|
- {std::to_string(threadsInGroup).c_str(),
|
|
|
- std::to_string(DXIL::kMaxCSThreadsPerGroup).c_str()});
|
|
|
+ {std::to_string(threadsInGroup),
|
|
|
+ std::to_string(DXIL::kMaxCSThreadsPerGroup)});
|
|
|
}
|
|
|
|
|
|
// type of threadID, thread group ID take care by DXIL operation overload
|
|
@@ -3721,8 +3722,8 @@ static void ValidateShaderState(ValidationContext &ValCtx) {
|
|
|
if (inputControlPointCount > DXIL::kMaxIAPatchControlPointCount) {
|
|
|
ValCtx.EmitFormatError(
|
|
|
ValidationRule::SmDSInputControlPointCountRange,
|
|
|
- {std::to_string(DXIL::kMaxIAPatchControlPointCount).c_str(),
|
|
|
- std::to_string(inputControlPointCount).c_str()});
|
|
|
+ {std::to_string(DXIL::kMaxIAPatchControlPointCount),
|
|
|
+ std::to_string(inputControlPointCount)});
|
|
|
}
|
|
|
if (domain == DXIL::TessellatorDomain::Undefined) {
|
|
|
ValCtx.EmitError(ValidationRule::SmValidDomain);
|
|
@@ -3741,8 +3742,8 @@ static void ValidateShaderState(ValidationContext &ValCtx) {
|
|
|
} else if (inputControlPointCount > DXIL::kMaxIAPatchControlPointCount) {
|
|
|
ValCtx.EmitFormatError(
|
|
|
ValidationRule::SmHSInputControlPointCountRange,
|
|
|
- {std::to_string(DXIL::kMaxIAPatchControlPointCount).c_str(),
|
|
|
- std::to_string(inputControlPointCount).c_str()});
|
|
|
+ {std::to_string(DXIL::kMaxIAPatchControlPointCount),
|
|
|
+ std::to_string(inputControlPointCount)});
|
|
|
}
|
|
|
if (domain == DXIL::TessellatorDomain::Undefined) {
|
|
|
ValCtx.EmitError(ValidationRule::SmValidDomain);
|
|
@@ -3764,9 +3765,9 @@ static void ValidateShaderState(ValidationContext &ValCtx) {
|
|
|
maxTessFactor > DXIL::kHSMaxTessFactorUpperBound) {
|
|
|
ValCtx.EmitFormatError(
|
|
|
ValidationRule::MetaMaxTessFactor,
|
|
|
- {std::to_string(DXIL::kHSMaxTessFactorLowerBound).c_str(),
|
|
|
- std::to_string(DXIL::kHSMaxTessFactorUpperBound).c_str(),
|
|
|
- std::to_string(maxTessFactor).c_str()});
|
|
|
+ {std::to_string(DXIL::kHSMaxTessFactorLowerBound),
|
|
|
+ std::to_string(DXIL::kHSMaxTessFactorUpperBound),
|
|
|
+ std::to_string(maxTessFactor)});
|
|
|
}
|
|
|
// Domain and OutPrimivtive match.
|
|
|
switch (domain) {
|
|
@@ -3827,15 +3828,15 @@ static void ValidateShaderState(ValidationContext &ValCtx) {
|
|
|
if (maxVertexCount > DXIL::kMaxGSOutputVertexCount) {
|
|
|
ValCtx.EmitFormatError(
|
|
|
ValidationRule::SmGSOutputVertexCountRange,
|
|
|
- {std::to_string(DXIL::kMaxGSOutputVertexCount).c_str(),
|
|
|
- std::to_string(maxVertexCount).c_str()});
|
|
|
+ {std::to_string(DXIL::kMaxGSOutputVertexCount),
|
|
|
+ std::to_string(maxVertexCount)});
|
|
|
}
|
|
|
|
|
|
unsigned instanceCount = M.GetGSInstanceCount();
|
|
|
if (instanceCount > DXIL::kMaxGSInstanceCount || instanceCount < 1) {
|
|
|
ValCtx.EmitFormatError(ValidationRule::SmGSInstanceCountRange,
|
|
|
- {std::to_string(DXIL::kMaxGSInstanceCount).c_str(),
|
|
|
- std::to_string(instanceCount).c_str()});
|
|
|
+ {std::to_string(DXIL::kMaxGSInstanceCount),
|
|
|
+ std::to_string(instanceCount)});
|
|
|
}
|
|
|
|
|
|
DXIL::PrimitiveTopology topo = M.GetStreamPrimitiveTopology();
|
|
@@ -3860,8 +3861,8 @@ static void ValidateShaderState(ValidationContext &ValCtx) {
|
|
|
if (outputControlPointCount > DXIL::kMaxIAPatchControlPointCount) {
|
|
|
ValCtx.EmitFormatError(
|
|
|
ValidationRule::SmOutputControlPointCountRange,
|
|
|
- {std::to_string(DXIL::kMaxIAPatchControlPointCount).c_str(),
|
|
|
- std::to_string(outputControlPointCount).c_str()});
|
|
|
+ {std::to_string(DXIL::kMaxIAPatchControlPointCount),
|
|
|
+ std::to_string(outputControlPointCount)});
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -4044,13 +4045,13 @@ static void VerifyBlobPartMatches(_In_ ValidationContext &ValCtx,
|
|
|
_In_ uint32_t Size) {
|
|
|
if (!pData && pWriter->size()) {
|
|
|
// No blob part, but writer says non-zero size is expected.
|
|
|
- ValCtx.EmitFormatError(ValidationRule::ContainerPartMissing, pName);
|
|
|
+ ValCtx.EmitFormatError(ValidationRule::ContainerPartMissing, {pName});
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
// Compare sizes
|
|
|
if (pWriter->size() != Size) {
|
|
|
- ValCtx.EmitFormatError(ValidationRule::ContainerPartMatches, pName);
|
|
|
+ ValCtx.EmitFormatError(ValidationRule::ContainerPartMatches, {pName});
|
|
|
return;
|
|
|
}
|
|
|
|
|
@@ -4068,7 +4069,7 @@ static void VerifyBlobPartMatches(_In_ ValidationContext &ValCtx,
|
|
|
DXASSERT(pOutputStream->GetPtrSize() == Size, "otherwise, DxilPartWriter misreported size");
|
|
|
|
|
|
if (memcmp(pData, pOutputStream->GetPtr(), Size)) {
|
|
|
- ValCtx.EmitFormatError(ValidationRule::ContainerPartMatches, pName);
|
|
|
+ ValCtx.EmitFormatError(ValidationRule::ContainerPartMatches, {pName});
|
|
|
return;
|
|
|
}
|
|
|
|
|
@@ -4196,7 +4197,7 @@ HRESULT ValidateDxilContainerParts(llvm::Module *pModule,
|
|
|
PartKindToCharArray(pPart->PartFourCC, szFourCC);
|
|
|
if (FourCCFound.find(pPart->PartFourCC) != FourCCFound.end()) {
|
|
|
// Two parts with same FourCC found
|
|
|
- ValCtx.EmitFormatError(ValidationRule::ContainerPartRepeated, szFourCC);
|
|
|
+ ValCtx.EmitFormatError(ValidationRule::ContainerPartRepeated, {szFourCC});
|
|
|
continue;
|
|
|
}
|
|
|
FourCCFound.insert(pPart->PartFourCC);
|
|
@@ -4213,7 +4214,7 @@ HRESULT ValidateDxilContainerParts(llvm::Module *pModule,
|
|
|
if (bTess) {
|
|
|
VerifySignatureMatches(ValCtx, DXIL::SignatureKind::PatchConstant, GetDxilPartData(pPart), pPart->PartSize);
|
|
|
} else {
|
|
|
- ValCtx.EmitFormatError(ValidationRule::ContainerPartMatches, "Program Patch Constant Signature");
|
|
|
+ ValCtx.EmitFormatError(ValidationRule::ContainerPartMatches, {"Program Patch Constant Signature"});
|
|
|
}
|
|
|
break;
|
|
|
case DFCC_FeatureInfo:
|
|
@@ -4237,7 +4238,7 @@ HRESULT ValidateDxilContainerParts(llvm::Module *pModule,
|
|
|
|
|
|
case DFCC_Container:
|
|
|
default:
|
|
|
- ValCtx.EmitFormatError(ValidationRule::ContainerPartInvalid, szFourCC);
|
|
|
+ ValCtx.EmitFormatError(ValidationRule::ContainerPartInvalid, {szFourCC});
|
|
|
break;
|
|
|
}
|
|
|
}
|
|
@@ -4252,11 +4253,11 @@ HRESULT ValidateDxilContainerParts(llvm::Module *pModule,
|
|
|
if (bTess && FourCCFound.find(DFCC_PatchConstantSignature) == FourCCFound.end() &&
|
|
|
pDxilModule->GetPatchConstantSignature().GetElements().size())
|
|
|
{
|
|
|
- ValCtx.EmitFormatError(ValidationRule::ContainerPartMissing, "Program Patch Constant Signature");
|
|
|
+ ValCtx.EmitFormatError(ValidationRule::ContainerPartMissing, {"Program Patch Constant Signature"});
|
|
|
}
|
|
|
if (FourCCFound.find(DFCC_FeatureInfo) == FourCCFound.end()) {
|
|
|
// Could be optional, but RS1 runtime doesn't handle this case properly.
|
|
|
- ValCtx.EmitFormatError(ValidationRule::ContainerPartMissing, "Feature Info");
|
|
|
+ ValCtx.EmitFormatError(ValidationRule::ContainerPartMissing, {"Feature Info"});
|
|
|
}
|
|
|
|
|
|
// Validate Root Signature
|
|
@@ -4275,7 +4276,7 @@ HRESULT ValidateDxilContainerParts(llvm::Module *pModule,
|
|
|
}
|
|
|
}
|
|
|
} else {
|
|
|
- ValCtx.EmitFormatError(ValidationRule::ContainerPartMissing, "Pipeline State Validation");
|
|
|
+ ValCtx.EmitFormatError(ValidationRule::ContainerPartMissing, {"Pipeline State Validation"});
|
|
|
}
|
|
|
|
|
|
if (ValCtx.Failed) {
|