From e67af5b1a3993529c702ff2924dea11fd1017d2e Mon Sep 17 00:00:00 2001 From: Yong He Date: Wed, 2 Jun 2021 16:58:25 -0700 Subject: Various Fixes to gfx, reflection and emit. (#1867) * Various Fixes to gfx, reflection and emit. - Fix GLSL emit to properly output `*bitsTo*` functions for `IRBitCast` insts. - Add line directive mode setting for `ISession`. - Extend `TypeLayout::getElementStride` to handle `VectorType` case. - Fix `IDevice::readBufferResource` 's D3D12 implementation to copy only the requested bytes out. - Fix `render-test` to use the `ISession` from `gfx` instead of creating its own `ISession` to make sure `gfx` and `render-test` agree on WitnessTable and RTTI IDs. - Extend `render-test` to support filling vector and matrix values in the new `set x = ...` TEST_INPUT syntax. - Add a `dynamic-dispatch-15` test case to make sure packing / unpacking works correctly across all targets, and to make sure render-test's RTTI/WitnessTable ID filling logic is correct for non-trivial cases. * Remove default-major test * Fix cyclic reference in `ExtendedTypeLayout`. * Move `lineDirectiveMode` setting to `TargetDesc`. Add `structureSize` to `TargetDesc` and `SessionDesc` for future binary compatibility. * Cleanup. Co-authored-by: Yong He --- source/slang/slang-reflection-api.cpp | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) (limited to 'source/slang/slang-reflection-api.cpp') diff --git a/source/slang/slang-reflection-api.cpp b/source/slang/slang-reflection-api.cpp index 059de0be8..00ecfdbc1 100644 --- a/source/slang/slang-reflection-api.cpp +++ b/source/slang/slang-reflection-api.cpp @@ -946,6 +946,12 @@ SLANG_API size_t spReflectionTypeLayout_GetElementStride(SlangReflectionTypeLayo return 0; } } + else if (auto vectorTypeLayout = as(typeLayout)) + { + auto resInfo = vectorTypeLayout->elementTypeLayout->FindResourceInfo(LayoutResourceKind::Uniform); + if (!resInfo) return 0; + return resInfo->count.getFiniteValue(); + } return 0; } @@ -971,7 +977,14 @@ SLANG_API SlangReflectionTypeLayout* spReflectionTypeLayout_GetElementTypeLayout { return convert(specializedTypeLayout->baseTypeLayout.Ptr()); } - + else if (auto vectorTypeLayout = as(typeLayout)) + { + return convert(vectorTypeLayout->elementTypeLayout); + } + else if (auto matrixTypeLayout = as(typeLayout)) + { + return convert(matrixTypeLayout->elementTypeLayout); + } return nullptr; } -- cgit v1.2.3