diff options
| author | ArielG-NV <159081215+ArielG-NV@users.noreply.github.com> | 2024-06-28 04:07:12 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-06-28 04:07:12 -0400 |
| commit | e49419b0637a357d2e713a0435f0c5ad0c102487 (patch) | |
| tree | 61f815078f7b3b6187abd28101cea76f611462a2 /source/slang/slang-emit-glsl.cpp | |
| parent | fd32b1879c8a4de7e97a99be7e0e8093ade8b340 (diff) | |
Implement HLSL resource bindings and default type `float4` to `SubpassInput<T>` (#4462)
* Add case to `emitVectorReshape` for `vector<>` type, `scalar` value
1. Add new case
2. Add test
* fix warning
* fix warning
* Implement HLSL resource bindings and default type `float4` to `SubpassInput<T>`
fixes: #4440
1. Removed GLSLInputAttachmentIndexLayout modifier and the somewhat 'hacky' binding model 'Input Attachment' previously relied upon. This was changed to work with the slang-type-layout rules system. This change allows Slang automatic bindings, HLSL bindings, GLSL bindings, and translation of GLSL to and from HLSL bindings to work.
2. Added default argument `float4` to SubpassInput<T>.
3. Merged glsl.meta and hlsl.meta SubpassInput logic.
* fix InputAttachment attribute checks
fix InputAttachment attribute checks for HLSL and GLSL syntax
* remove unused var
* validate attribute correctly
Attributes do not have type information. We must check the type expression to validate attribute usage.
* remove hacky validation
type based validation before types are fully resolved is quite hacky and unstable to changes and wrapped types
* fix warning
* remove redundant `!= nullptr`
* remove extra `!= nullptr`
* fix some warnings/errors
* subpass capability to limit to dxc & remove default values in some functions
* revert logic to previous logic
revert logic to return if we have a binding regardless of if a VarDecl is given the binding
Diffstat (limited to 'source/slang/slang-emit-glsl.cpp')
| -rw-r--r-- | source/slang/slang-emit-glsl.cpp | 17 |
1 files changed, 6 insertions, 11 deletions
diff --git a/source/slang/slang-emit-glsl.cpp b/source/slang/slang-emit-glsl.cpp index b6c3c0d67..7cf478c36 100644 --- a/source/slang/slang-emit-glsl.cpp +++ b/source/slang/slang-emit-glsl.cpp @@ -751,6 +751,11 @@ bool GLSLSourceEmitter::_emitGLSLLayoutQualifierWithBindingKinds(LayoutResourceK m_writer->emit("layout(shaderRecordEXT)\n"); break; + case LayoutResourceKind::InputAttachmentIndex: + m_writer->emit("layout(input_attachment_index = "); + m_writer->emit(index); + m_writer->emit(")\n"); + break; } return true; } @@ -1338,7 +1343,7 @@ void GLSLSourceEmitter::_emitGLSLPerVertexVaryingFragmentInput(IRGlobalParam* pa emitSemantics(param, false); - emitLayoutSemantics(param); + emitLayoutSemantics(param, "register"); m_writer->emit(";\n\n"); } @@ -2825,16 +2830,6 @@ void GLSLSourceEmitter::emitVarDecorationsImpl(IRInst* varDecl) break; } - // non raytracing decorations - for (auto decoration : varDecl->getDecorations()) - { - if (auto glslInputAttachment = as<IRGLSLInputAttachmentIndexDecoration>(decoration)) - { - m_writer->emit(toSlice("layout(input_attachment_index = ")); - m_writer->emit(glslInputAttachment->getIndex()->getValue()); - m_writer->emit(toSlice(")\n")); - } - } } void GLSLSourceEmitter::emitMatrixLayoutModifiersImpl(IRVarLayout* layout) |
