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:
Joshua Batista 2022-07-19 23:49:25 -07:00 коммит произвёл GitHub
Родитель 267f84cc57
Коммит 7a45cbbf8b
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
3 изменённых файлов: 16 добавлений и 3 удалений

Просмотреть файл

@ -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));
}