summaryrefslogtreecommitdiffstats
path: root/source/slang
diff options
context:
space:
mode:
Diffstat (limited to 'source/slang')
-rw-r--r--source/slang/emit.cpp31
-rw-r--r--source/slang/glsl.meta.slang.h2
-rw-r--r--source/slang/ir.cpp25
-rw-r--r--source/slang/slang.cpp1
4 files changed, 58 insertions, 1 deletions
diff --git a/source/slang/emit.cpp b/source/slang/emit.cpp
index 971f0345b..1b5db065f 100644
--- a/source/slang/emit.cpp
+++ b/source/slang/emit.cpp
@@ -5090,6 +5090,37 @@ emitDeclImpl(decl, nullptr);
EmitContext* context,
IRValue* inst)
{
+ // Don't emit semantics if we aren't translating down to HLSL
+ switch (context->shared->target)
+ {
+ case CodeGenTarget::HLSL:
+ break;
+
+ default:
+ return;
+ }
+
+ if(auto layoutDecoration = inst->findDecoration<IRLayoutDecoration>())
+ {
+ if(auto varLayout = layoutDecoration->layout.As<VarLayout>())
+ {
+ if(varLayout->flags & VarLayoutFlag::HasSemantic)
+ {
+ Emit(" : ");
+ emit(varLayout->semanticName);
+ if(varLayout->semanticIndex)
+ {
+ Emit(varLayout->semanticIndex);
+ }
+
+ return;
+ }
+ }
+ }
+
+ // TODO(tfoley): should we ever need to use the high-level declaration
+ // for this? It seems like the wrong approach...
+
auto decoration = inst->findDecoration<IRHighLevelDeclDecoration>();
if( decoration )
{
diff --git a/source/slang/glsl.meta.slang.h b/source/slang/glsl.meta.slang.h
index e43a51ea9..a4aade3c2 100644
--- a/source/slang/glsl.meta.slang.h
+++ b/source/slang/glsl.meta.slang.h
@@ -173,7 +173,7 @@ sb << "syntax patch : GLSLPatchModifier;\n";
// [GLSL 4.5] Interpolation Qualifiers
sb << "syntax smooth : SimpleModifier;\n";
sb << "syntax flat : SimpleModifier;\n";
-sb << "syntax noperspectie : SimpleModifier;\n";
+sb << "syntax noperspective : SimpleModifier;\n";
// [GLSL 4.3.2] Constant Qualifier
diff --git a/source/slang/ir.cpp b/source/slang/ir.cpp
index 5ace50397..4c01e4fc1 100644
--- a/source/slang/ir.cpp
+++ b/source/slang/ir.cpp
@@ -3094,6 +3094,31 @@ namespace Slang
clonedFunc,
entryPointLayout);
+ // We will also go on and attach layout information
+ // to the function parameters, so that we have it
+ // available directly on the parameters, rather
+ // than having to look it up on the original entry-point layout.
+ if( auto firstBlock = clonedFunc->getFirstBlock() )
+ {
+ UInt paramLayoutCount = entryPointLayout->fields.Count();
+ UInt paramCounter = 0;
+ for( auto pp = firstBlock->getFirstParam(); pp; pp = pp->getNextParam() )
+ {
+ UInt paramIndex = paramCounter++;
+ if( paramIndex < paramLayoutCount )
+ {
+ auto paramLayout = entryPointLayout->fields[paramIndex];
+ context->builder->addLayoutDecoration(
+ pp,
+ paramLayout);
+ }
+ else
+ {
+ SLANG_UNEXPECTED("too many parameters");
+ }
+ }
+ }
+
return clonedFunc;
}
diff --git a/source/slang/slang.cpp b/source/slang/slang.cpp
index dff322c29..da7601d41 100644
--- a/source/slang/slang.cpp
+++ b/source/slang/slang.cpp
@@ -918,6 +918,7 @@ SLANG_API int spCompile(
catch (...)
{
req->mSink.diagnose(Slang::SourceLoc(), Slang::Diagnostics::compilationAborted);
+ req->mDiagnosticOutput = req->mSink.outputBuffer.ProduceString();
return 1;
}
#else