Add semantic clarification to error on missing output semantic (#4562)
* test that when output of entry point function is missing semantic, the output is specified in the error message * remove old comment * add alternate error output message among the set of expected errors
This commit is contained in:
Родитель
267f84cc57
Коммит
7a45cbbf8b
|
@ -270,9 +270,12 @@ void HLSignatureLower::ProcessArgument(Function *func,
|
|||
|
||||
llvm::StringRef semanticStr = paramAnnotation.GetSemanticString();
|
||||
if (semanticStr.empty()) {
|
||||
dxilutil::EmitErrorOnFunction(HLM.GetModule()->getContext(), func,
|
||||
"Semantic must be defined for all parameters of an entry function or "
|
||||
"patch constant function");
|
||||
|
||||
std::string msg = "Semantic must be defined for all ";
|
||||
msg += (qual == DxilParamInputQual::Out) ? "outputs " : "parameters ";
|
||||
msg += "of an entry function or patch constant function";
|
||||
|
||||
dxilutil::EmitErrorOnFunction(HLM.GetModule()->getContext(), func, msg);
|
||||
return;
|
||||
}
|
||||
UpdateSemanticAndInterpMode(semanticStr, interpMode, sigPoint->GetKind(),
|
||||
|
|
|
@ -0,0 +1,8 @@
|
|||
// RUN: %dxc /Tps_6_0 %s | FileCheck %s
|
||||
// CHECK: error: Semantic must be defined for all outputs of an entry function or patch constant function
|
||||
|
||||
[RootSignature("")]
|
||||
float main(float a : A, uint b : SV_Coverage)
|
||||
{
|
||||
return a;
|
||||
}
|
|
@ -535,11 +535,13 @@ TEST_F(SystemValueTest, VerifyMissingSemanticFailure) {
|
|||
// TODO: add tests for mesh/amplification shaders to system-values.hlsl
|
||||
continue;
|
||||
}
|
||||
|
||||
std::wstring sigDefValue(L"Def_Arb_NoSem(uint, arb0)");
|
||||
CComPtr<IDxcOperationResult> pResult;
|
||||
CompileHLSLTemplate(pResult, sp, sigDefValue);
|
||||
const char *Errors[] = {
|
||||
"error: Semantic must be defined for all parameters of an entry function or patch constant function",
|
||||
"error: Semantic must be defined for all outputs of an entry function or patch constant function"
|
||||
};
|
||||
CheckAnyOperationResultMsg(pResult, Errors, _countof(Errors));
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче