diff options
| author | Ellie Hermaszewska <ellieh@nvidia.com> | 2022-11-16 09:49:06 +0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-11-16 09:49:06 +0800 |
| commit | 1643471da0d6239177d11b0301c26d1adf95c0fb (patch) | |
| tree | 9b8fddf92a5f817541e055a2657f9b0a00f90069 /source/slang/slang-ir.cpp | |
| parent | 4917d71100aafcc38a81cd99d2a44a4cb3a89a0c (diff) | |
Mesh shader support (#2464)
* Add gdb generated files to .gitignore
* Switch to c++17
TODO: Ellie update coding style doc
* WIP mesh shaders
* Add MeshOutputType and mesh output decorations
* Lift array type layout creation out of _createTypeLayout
in preparation for sharing it elsewhere
* Initial pass at GLSL legalization for mesh shaders
* Create output types for builtin mesh outputs
This should be rendered as an out paramter block
* Handle writes to member fields in mesh shader output
* Per primitive output from mesh shaders
* Add mesh shader tests
* Redeclare mesh output builtins
* Remove unused instruction
* Emit explicit mesh output max max size
* Add unimplemented warning for array members in mesh output
* Implement mesh output splitting for GLSL in terms of getSubscriptVal
* Allow HLSL syntax for mesh output modifiers
* Improve error messages for mesh output
* Add test for HLSL style mesh output syntax
* Emit explicit mesh output indices max size
* HLSL generation support for mesh shaders
* Better errors for mesh shader misuse
* Neaten comments
* Regenerate vs2019 project files
* Fix build on vs2019
* Retreat on c++17
Will make the change in a separate PR
* slang-glslang binary dep 11.10.0 -> 11.12.0-32
* Fixes for msvc compiler
* Update msvc project
Diffstat (limited to 'source/slang/slang-ir.cpp')
| -rw-r--r-- | source/slang/slang-ir.cpp | 47 |
1 files changed, 46 insertions, 1 deletions
diff --git a/source/slang/slang-ir.cpp b/source/slang/slang-ir.cpp index 7aa51f31b..1a8f20f1a 100644 --- a/source/slang/slang-ir.cpp +++ b/source/slang/slang-ir.cpp @@ -2029,6 +2029,19 @@ namespace Slang } } + void IRBuilder::setInsertAfter(IRInst* insertAfter) + { + auto next = insertAfter->getNextInst(); + if(next) + { + setInsertBefore(next); + } + else + { + setInsertInto(insertAfter->parent); + } + } + IRConstant* IRBuilder::_findOrEmitConstant( IRConstant& keyInst) { @@ -2853,6 +2866,15 @@ namespace Slang operands); } + IRGLSLOutputParameterGroupType* IRBuilder::getGLSLOutputParameterGroupType(IRType* elementType) + { + IRInst* operands[] = { elementType }; + return (IRGLSLOutputParameterGroupType*) getType( + kIROp_GLSLOutputParameterGroupType, + 1, + operands); + } + IRConstExprRate* IRBuilder::getConstExprRate() { return (IRConstExprRate*)getType(kIROp_ConstExprRate); @@ -5836,7 +5858,29 @@ namespace Slang // _isTypeOperandEqual handles comparison of types so can defer to it return _isTypeOperandEqual(a, b); } - + + bool isIntegralType(IRType *t) + { + if(auto basic = as<IRBasicType>(t)) + { + switch(basic->getBaseType()) + { + case BaseType::Int8: + case BaseType::Int16: + case BaseType::Int: + case BaseType::Int64: + case BaseType::UInt8: + case BaseType::UInt16: + case BaseType::UInt: + case BaseType::UInt64: + return true; + default: + return false; + } + } + return false; + } + void findAllInstsBreadthFirst(IRInst* inst, List<IRInst*>& outInsts) { Index index = outInsts.getCount(); @@ -6275,6 +6319,7 @@ namespace Slang case kIROp_FieldAddress: case kIROp_getElement: case kIROp_getElementPtr: + case kIROp_MeshOutputRef: case kIROp_constructVectorFromScalar: case kIROp_swizzle: case kIROp_swizzleSet: // Doesn't actually "set" anything - just returns the resulting vector |
