diff options
| author | jsmall-nvidia <jsmall@nvidia.com> | 2022-05-05 12:30:10 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-05-05 09:30:10 -0700 |
| commit | aa03cea0da38b2950e6f8694dc8b1405352eda66 (patch) | |
| tree | 755b275d7556fb48c40550603421e3483e26b24c /source/slang/slang-emit-glsl.cpp | |
| parent | e3e0132743ada1569cefe18bfbf54178330204c4 (diff) | |
Output SPIR-V lifetimes (#2221)
* #include an absolute path didn't work - because paths were taken to always be relative.
* WIP tracking liveness.
* Skeleton around adding liveness instructions.
* Calling into liveness tracking logic.
Adds live start to var insts.
* Liveness macros have initial output.
* Looking at different initialization scenarios.
* Some discussion around liveness.
* WIP for working out liveness end.
* WIP Updated liveness using use lists.
* Is now adding liveness information
* Some small fixes.
* WIP around liveness.
* Seems to output liveness correctly for current scenario.
* Tidy up liveness code.
* Update comment arounds liveness to current status.
* Small fixes to liveness test.
* Add support for call in liveness analysis.
* Improve liveness example with array access.
* Small updates to comments.
* Disable liveness test because inconsistencies with output on CI system.
* First pass support for GLSL SPIR-V liveness support.
* Add the SPIRVOpDecoration.
* Fix signature for OpLivenessStop.
* Simplified by having a Kind type.
* Fix some issues brought up in PR.
* Rename liveness instructions.
* Merge with var-lifetime.
Small improvements.
* Improvements to the documentation/naming in GLSL liveness pass.
Add comment around possible improvements to the liveness pass.
Diffstat (limited to 'source/slang/slang-emit-glsl.cpp')
| -rw-r--r-- | source/slang/slang-emit-glsl.cpp | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/source/slang/slang-emit-glsl.cpp b/source/slang/slang-emit-glsl.cpp index 3b39c1cb1..5b2ae6d19 100644 --- a/source/slang/slang-emit-glsl.cpp +++ b/source/slang/slang-emit-glsl.cpp @@ -1831,6 +1831,40 @@ void GLSLSourceEmitter::emitVectorTypeNameImpl(IRType* elementType, IRIntegerVal } } +void GLSLSourceEmitter::emitTypeImpl(IRType* type, const StringSliceLoc* nameAndLoc) +{ + if (auto refType = as<IRRefType>(type)) + { + m_writer->emit("spirv_by_reference "); + type = refType->getValueType(); + } + return Super::emitTypeImpl(type, nameAndLoc); +} + +void GLSLSourceEmitter::emitParamTypeImpl(IRType* type, String const& name) +{ + if (auto refType = as<IRRefType>(type)) + { + // + m_writer->emit("spirv_by_reference "); + type = refType->getValueType(); + } + Super::emitParamTypeImpl(type, name); +} + +void GLSLSourceEmitter::emitFuncDecorationImpl(IRDecoration* decoration) +{ + if (decoration->getOp() == kIROp_SPIRVOpDecoration) + { + m_writer->emit("spirv_instruction(id = "); + emitSimpleValue(decoration->getOperand(0)); + m_writer->emit(")\n"); + } + else + { + Super::emitFuncDecorationImpl(decoration); + } +} void GLSLSourceEmitter::emitSimpleTypeImpl(IRType* type) { |
