diff options
| author | Yong He <yonghe@outlook.com> | 2021-02-12 12:20:17 -0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-02-12 12:20:17 -0800 |
| commit | a2401a6ae6c50aeb6ffc196144569bb5253cdf95 (patch) | |
| tree | b69f68b0d5f81ab2d782bfa3ad125637c8f39d96 /source/slang/slang-ir-layout.cpp | |
| parent | 369279e91dde1b056d8d0e3bb83e7ba3f96321af (diff) | |
Support `bit_cast` between complex types. (#1702)
* Support `bit_cast` between complex types.
* Fix vs project file
* Fix clang build error
* fix
* fix
* Fix
* FIx
* Fix
* Fix
* Fix
* Fix
* Fix linux compile error
Co-authored-by: Tim Foley <tfoleyNV@users.noreply.github.com>
Diffstat (limited to 'source/slang/slang-ir-layout.cpp')
| -rw-r--r-- | source/slang/slang-ir-layout.cpp | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/source/slang/slang-ir-layout.cpp b/source/slang/slang-ir-layout.cpp index 41b004372..ed3fff2c0 100644 --- a/source/slang/slang-ir-layout.cpp +++ b/source/slang/slang-ir-layout.cpp @@ -77,6 +77,12 @@ static Result _calcNaturalArraySizeAndAlignment( return SLANG_OK; } +IRIntegerValue getIntegerValueFromInst(IRInst* inst) +{ + SLANG_ASSERT(inst->op == kIROp_IntLit); + return as<IRIntLit>(inst)->value.intVal; +} + static Result _calcNaturalSizeAndAlignment( TargetRequest* target, IRType* type, @@ -192,6 +198,24 @@ static Result _calcNaturalSizeAndAlignment( } break; + case kIROp_MatrixType: + { + auto matType = cast<IRMatrixType>(type); + auto rowCount = getIntegerValueFromInst(matType->getRowCount()); + auto colCount = getIntegerValueFromInst(matType->getColumnCount()); + SharedIRBuilder sharedBuilder; + sharedBuilder.module = type->getModule(); + sharedBuilder.session = sharedBuilder.module->getSession(); + + IRBuilder builder; + builder.sharedBuilder = &sharedBuilder; + + return _calcNaturalArraySizeAndAlignment( + target, matType->getElementType(), + builder.getIntValue(builder.getUIntType(), rowCount * colCount), + outSizeAndAlignment); + } + break; default: break; } |
