From 69cb6e8f300d77e74bd2c7dfe15d12e10b38f512 Mon Sep 17 00:00:00 2001 From: Alexey Panteleev Date: Wed, 18 May 2022 10:57:37 -0700 Subject: Support for querying which parameters are used in emitted code (#2239) See https://github.com/shader-slang/slang/issues/2213 --- slang.h | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) (limited to 'slang.h') diff --git a/slang.h b/slang.h index a2623bdd3..d08c6be34 100644 --- a/slang.h +++ b/slang.h @@ -1355,6 +1355,10 @@ extern "C" SlangCompileRequest* request, SlangCompileFlags flags); + /*! @see slang::ICompileRequest::getCompileFlags */ + SLANG_API SlangCompileFlags spGetCompileFlags( + SlangCompileRequest* request); + /*! @see slang::ICompileRequest::setDumpIntermediates */ SLANG_API void spSetDumpIntermediates( SlangCompileRequest* request, @@ -2147,6 +2151,15 @@ extern "C" SLANG_API unsigned spReflectionParameter_GetBindingIndex(SlangReflectionParameter* parameter); SLANG_API unsigned spReflectionParameter_GetBindingSpace(SlangReflectionParameter* parameter); + SLANG_API SlangResult spIsParameterLocationUsed( + SlangCompileRequest* request, + SlangInt entryPointIndex, + SlangInt targetIndex, + 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); + // Entry Point Reflection SLANG_API char const* spReflectionEntryPoint_getName( @@ -3370,6 +3383,11 @@ namespace slang virtual SLANG_NO_THROW void SLANG_MCALL setCompileFlags( SlangCompileFlags flags) = 0; + /*! + @brief Returns the compilation flags previously set with `setCompileFlags` + */ + virtual SLANG_NO_THROW SlangCompileFlags SLANG_MCALL getCompileFlags() = 0; + /*! @brief Set whether to dump intermediate results (for debugging) or not. */ @@ -3892,6 +3910,14 @@ namespace slang virtual SLANG_NO_THROW SlangResult SLANG_MCALL getProgramWithEntryPoints( slang::IComponentType** outProgram) = 0; + virtual SLANG_NO_THROW SlangResult SLANG_MCALL isParameterLocationUsed( + SlangInt entryPointIndex, + SlangInt targetIndex, + SlangParameterCategory category, + SlangUInt spaceIndex, + SlangUInt registerIndex, + bool& outUsed) = 0; + /** Set the line directive mode for a target. */ virtual SLANG_NO_THROW void SLANG_MCALL setTargetLineDirectiveMode( -- cgit v1.2.3