From 15d1c6c51c5f24663d2567d7e56da62a2bca1c22 Mon Sep 17 00:00:00 2001 From: Yong He Date: Mon, 30 Sep 2024 12:50:30 -0700 Subject: Add COM API for querying metadata. (#5168) * Add COM API for querying metadata. * Fix tests. * fix test. --- include/slang.h | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) (limited to 'include') diff --git a/include/slang.h b/include/slang.h index 8e42632ff..81b3ac1cb 100644 --- a/include/slang.h +++ b/include/slang.h @@ -5280,6 +5280,22 @@ namespace slang #define SLANG_UUID_ISession ISession::getTypeGuid() + struct IMetadata : public ISlangCastable + { + SLANG_COM_INTERFACE(0x8044a8a3, 0xddc0, 0x4b7f, { 0xaf, 0x8e, 0x2, 0x6e, 0x90, 0x5d, 0x73, 0x32 }) + + /* + Returns whether a resource parameter at the specifieid binding location is actually being used + in the compiled shader. + */ + virtual SlangResult isParameterLocationUsed( + SlangParameterCategory category, // is this a `t` register? `s` register? + SlangUInt spaceIndex, // `space` for D3D12, `set` for Vulkan + SlangUInt registerIndex, // `register` for D3D12, `binding` for Vulkan + bool& outUsed) = 0; + }; + #define SLANG_UUID_IMetadata IMetadata::getTypeGuid() + /** A component type is a unit of shader code layout, reflection, and linking. A component type is a unit of shader code that can be included into @@ -5492,6 +5508,17 @@ namespace slang SlangInt targetIndex, IBlob** outCode, IBlob** outDiagnostics = nullptr) = 0; + + virtual SLANG_NO_THROW SlangResult SLANG_MCALL getTargetMetadata( + SlangInt targetIndex, + IMetadata** outMetadata, + IBlob** outDiagnostics = nullptr) = 0; + + virtual SLANG_NO_THROW SlangResult SLANG_MCALL getEntryPointMetadata( + SlangInt entryPointIndex, + SlangInt targetIndex, + IMetadata** outMetadata, + IBlob** outDiagnostics = nullptr) = 0; }; #define SLANG_UUID_IComponentType IComponentType::getTypeGuid() -- cgit v1.2.3