|
@@ -205,6 +205,10 @@ private:
|
|
DxilParamInputQual paramQual,
|
|
DxilParamInputQual paramQual,
|
|
llvm::StringRef semFullName,
|
|
llvm::StringRef semFullName,
|
|
bool isPatchConstantFunction);
|
|
bool isPatchConstantFunction);
|
|
|
|
+
|
|
|
|
+ void RemapObsoleteSemantic(DxilParameterAnnotation ¶mInfo,
|
|
|
|
+ bool isPatchConstantFunction);
|
|
|
|
+
|
|
void SetEntryFunction();
|
|
void SetEntryFunction();
|
|
SourceLocation SetSemantic(const NamedDecl *decl,
|
|
SourceLocation SetSemantic(const NamedDecl *decl,
|
|
DxilParameterAnnotation ¶mInfo);
|
|
DxilParameterAnnotation ¶mInfo);
|
|
@@ -381,6 +385,7 @@ CGMSHLSLRuntime::CGMSHLSLRuntime(CodeGenModule &CGM)
|
|
opts.PackingStrategy = CGM.getCodeGenOpts().HLSLSignaturePackingStrategy;
|
|
opts.PackingStrategy = CGM.getCodeGenOpts().HLSLSignaturePackingStrategy;
|
|
|
|
|
|
opts.bUseMinPrecision = CGM.getLangOpts().UseMinPrecision;
|
|
opts.bUseMinPrecision = CGM.getLangOpts().UseMinPrecision;
|
|
|
|
+ opts.bBackCompatMode = CGM.getLangOpts().EnableBackCompatMode;
|
|
|
|
|
|
m_pHLModule->SetHLOptions(opts);
|
|
m_pHLModule->SetHLOptions(opts);
|
|
m_pHLModule->SetAutoBindingSpace(CGM.getCodeGenOpts().HLSLDefaultSpace);
|
|
m_pHLModule->SetAutoBindingSpace(CGM.getCodeGenOpts().HLSLDefaultSpace);
|
|
@@ -477,10 +482,9 @@ void CGMSHLSLRuntime::CheckParameterAnnotation(
|
|
Semantic::GetByName(semName, sigPoint, SM->GetMajor(), SM->GetMinor());
|
|
Semantic::GetByName(semName, sigPoint, SM->GetMajor(), SM->GetMinor());
|
|
if (pSemantic->IsInvalid()) {
|
|
if (pSemantic->IsInvalid()) {
|
|
DiagnosticsEngine &Diags = CGM.getDiags();
|
|
DiagnosticsEngine &Diags = CGM.getDiags();
|
|
- const ShaderModel *shader = m_pHLModule->GetShaderModel();
|
|
|
|
unsigned DiagID =
|
|
unsigned DiagID =
|
|
- Diags.getCustomDiagID(DiagnosticsEngine::Error, "invalid semantic '%0' for %1 %2.%3");
|
|
|
|
- Diags.Report(SLoc, DiagID) << semName << shader->GetKindName() << shader->GetMajor() << shader->GetMinor();
|
|
|
|
|
|
+ Diags.getCustomDiagID(DiagnosticsEngine::Error, "invalid semantic '%0' for %1 %2.%3");
|
|
|
|
+ Diags.Report(SLoc, DiagID) << semName << SM->GetKindName() << SM->GetMajor() << SM->GetMinor();
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
@@ -1555,6 +1559,9 @@ void CGMSHLSLRuntime::AddHLSLFunctionInfo(Function *F, const FunctionDecl *FD) {
|
|
SourceLocation retTySemanticLoc = SetSemantic(FD, retTyAnnotation);
|
|
SourceLocation retTySemanticLoc = SetSemantic(FD, retTyAnnotation);
|
|
retTyAnnotation.SetParamInputQual(DxilParamInputQual::Out);
|
|
retTyAnnotation.SetParamInputQual(DxilParamInputQual::Out);
|
|
if (isEntry) {
|
|
if (isEntry) {
|
|
|
|
+ if (CGM.getLangOpts().EnableBackCompatMode && retTyAnnotation.HasSemanticString()) {
|
|
|
|
+ RemapObsoleteSemantic(retTyAnnotation, /*isPatchConstantFunction*/ false);
|
|
|
|
+ }
|
|
CheckParameterAnnotation(retTySemanticLoc, retTyAnnotation,
|
|
CheckParameterAnnotation(retTySemanticLoc, retTyAnnotation,
|
|
/*isPatchConstantFunction*/ false);
|
|
/*isPatchConstantFunction*/ false);
|
|
}
|
|
}
|
|
@@ -1833,6 +1840,9 @@ void CGMSHLSLRuntime::AddHLSLFunctionInfo(Function *F, const FunctionDecl *FD) {
|
|
|
|
|
|
paramAnnotation.SetParamInputQual(dxilInputQ);
|
|
paramAnnotation.SetParamInputQual(dxilInputQ);
|
|
if (isEntry) {
|
|
if (isEntry) {
|
|
|
|
+ if (CGM.getLangOpts().EnableBackCompatMode && paramAnnotation.HasSemanticString()) {
|
|
|
|
+ RemapObsoleteSemantic(paramAnnotation, /*isPatchConstantFunction*/ false);
|
|
|
|
+ }
|
|
CheckParameterAnnotation(paramSemanticLoc, paramAnnotation,
|
|
CheckParameterAnnotation(paramSemanticLoc, paramAnnotation,
|
|
/*isPatchConstantFunction*/ false);
|
|
/*isPatchConstantFunction*/ false);
|
|
}
|
|
}
|
|
@@ -1930,6 +1940,15 @@ void CGMSHLSLRuntime::AddHLSLFunctionInfo(Function *F, const FunctionDecl *FD) {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+void CGMSHLSLRuntime::RemapObsoleteSemantic(DxilParameterAnnotation ¶mInfo, bool isPatchConstantFunction) {
|
|
|
|
+ DXASSERT(CGM.getLangOpts().EnableBackCompatMode, "should be used only in back-compat mode");
|
|
|
|
+
|
|
|
|
+ const ShaderModel *SM = m_pHLModule->GetShaderModel();
|
|
|
|
+ DXIL::SigPointKind sigPointKind = SigPointFromInputQual(paramInfo.GetParamInputQual(), SM->GetKind(), isPatchConstantFunction);
|
|
|
|
+
|
|
|
|
+ hlsl::RemapObsoleteSemantic(paramInfo, sigPointKind, CGM.getLLVMContext());
|
|
|
|
+}
|
|
|
|
+
|
|
void CGMSHLSLRuntime::EmitHLSLFunctionProlog(Function *F, const FunctionDecl *FD) {
|
|
void CGMSHLSLRuntime::EmitHLSLFunctionProlog(Function *F, const FunctionDecl *FD) {
|
|
// Support clip plane need debug info which not available when create function attribute.
|
|
// Support clip plane need debug info which not available when create function attribute.
|
|
if (const HLSLClipPlanesAttr *Attr = FD->getAttr<HLSLClipPlanesAttr>()) {
|
|
if (const HLSLClipPlanesAttr *Attr = FD->getAttr<HLSLClipPlanesAttr>()) {
|