summaryrefslogtreecommitdiff
path: root/source/slang/slang-emit-hlsl.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'source/slang/slang-emit-hlsl.cpp')
-rw-r--r--source/slang/slang-emit-hlsl.cpp33
1 files changed, 31 insertions, 2 deletions
diff --git a/source/slang/slang-emit-hlsl.cpp b/source/slang/slang-emit-hlsl.cpp
index 37411c93e..120e37f09 100644
--- a/source/slang/slang-emit-hlsl.cpp
+++ b/source/slang/slang-emit-hlsl.cpp
@@ -92,6 +92,7 @@ void HLSLSourceEmitter::_emitHLSLRegisterSemantic(LayoutResourceKind kind, EmitV
}
break;
+ case LayoutResourceKind::InputAttachmentIndex:
case LayoutResourceKind::RegisterSpace:
case LayoutResourceKind::GenericResource:
case LayoutResourceKind::ExistentialTypeParam:
@@ -304,6 +305,18 @@ void HLSLSourceEmitter::_emitHLSLTextureType(IRTextureTypeBase* texType)
m_writer->emit(" >");
}
+void HLSLSourceEmitter::_emitHLSLSubpassInputType(IRSubpassInputType* subpassType)
+{
+ m_writer->emit("SubpassInput");
+ if (subpassType->isMultisample())
+ {
+ m_writer->emit("MS");
+ }
+ m_writer->emit("<");
+ emitType(subpassType->getElementType());
+ m_writer->emit(">");
+}
+
void HLSLSourceEmitter::emitLayoutSemanticsImpl(IRInst* inst, char const* uniformSemanticSpelling)
{
auto layout = getVarLayout(inst);
@@ -981,6 +994,11 @@ void HLSLSourceEmitter::emitSimpleTypeImpl(IRType* type)
_emitHLSLTextureType(imageType);
return;
}
+ else if (auto subpassType = as<IRSubpassInputType>(type))
+ {
+ _emitHLSLSubpassInputType(subpassType);
+ return;
+ }
else if (auto structuredBufferType = as<IRHLSLStructuredBufferTypeBase>(type))
{
switch (structuredBufferType->getOp())
@@ -1246,9 +1264,20 @@ void HLSLSourceEmitter::emitMeshShaderModifiersImpl(IRInst* varInst)
void HLSLSourceEmitter::emitVarDecorationsImpl(IRInst* varDecl)
{
- if (varDecl->findDecoration<IRGloballyCoherentDecoration>())
+ for(auto decoration : varDecl->getDecorations())
{
- m_writer->emit("globallycoherent\n");
+ if (as<IRGloballyCoherentDecoration>(decoration))
+ {
+ m_writer->emit("globallycoherent\n");
+ continue;
+ }
+ else if(auto glslInputAttachmentIndex = as<IRGLSLInputAttachmentIndexDecoration>(decoration))
+ {
+ m_writer->emit("[[vk::input_attachment_index(");
+ m_writer->emit(glslInputAttachmentIndex->getIndex()->getValue());
+ m_writer->emit(")]]\n");
+ continue;
+ }
}
}