From 075e6c25826cd0a1df26bd36af4afe865673a790 Mon Sep 17 00:00:00 2001 From: Yong He Date: Tue, 31 Dec 2024 17:47:20 -0800 Subject: Fix reflection for metal vector [[id]] location. (#5943) --- source/slang/slang-type-layout.cpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'source') diff --git a/source/slang/slang-type-layout.cpp b/source/slang/slang-type-layout.cpp index c6acf5250..98a324d96 100644 --- a/source/slang/slang-type-layout.cpp +++ b/source/slang/slang-type-layout.cpp @@ -1898,6 +1898,19 @@ struct MetalArgumentBufferElementLayoutRulesImpl : ObjectLayoutRulesImpl, Defaul return SimpleLayoutInfo(LayoutResourceKind::MetalArgumentBufferElement, 1); } + SimpleLayoutInfo GetVectorLayout( + BaseType elementType, + SimpleLayoutInfo elementInfo, + size_t elementCount) override + { + SLANG_UNUSED(elementType); + SLANG_UNUSED(elementInfo); + SLANG_UNUSED(elementCount); + + // A vector occupies one [[id]] slot in a metal argument buffer. + return SimpleLayoutInfo(LayoutResourceKind::MetalArgumentBufferElement, 1); + } + virtual ObjectLayoutInfo GetObjectLayout(ShaderParameterKind kind, const Options& /* options */) override { -- cgit v1.2.3