From fdc17a974970559d8ff76d52c3ce40aaa056d441 Mon Sep 17 00:00:00 2001 From: Yong He Date: Fri, 19 Jan 2024 18:02:40 -0800 Subject: Add `-fspv-reflect` support. (#3464) * Add `-fspv-reflect` support. Closes #3462. * Fix. * Fix. * Remove use of `SPV_GOOGLE_hlsl_functionality1`. * Fix spirv validation error. * Fix test. * Update typename hints. * Update commandline options doc. * Remove superfluous empty lines. --------- Co-authored-by: Yong He --- source/slang/slang-options.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'source/slang/slang-options.cpp') diff --git a/source/slang/slang-options.cpp b/source/slang/slang-options.cpp index 7c442a9d2..c9527bf5e 100644 --- a/source/slang/slang-options.cpp +++ b/source/slang/slang-options.cpp @@ -95,6 +95,7 @@ enum class OptionKind VulkanInvertY, VulkanUseEntryPointName, VulkanUseGLLayout, + VulkanEmitReflection, GLSLForceScalarLayout, EnableEffectAnnotations, @@ -512,6 +513,7 @@ void initCommandOptions(CommandOptions& options) { OptionKind::VulkanInvertY, "-fvk-invert-y", nullptr, "Negates (additively inverts) SV_Position.y before writing to stage output."}, { OptionKind::VulkanUseEntryPointName, "-fvk-use-entrypoint-name", nullptr, "Uses the entrypoint name from the source instead of 'main' in the spirv output."}, { OptionKind::VulkanUseGLLayout, "-fvk-use-gl-layout", nullptr, "Use std430 layout instead of D3D buffer layout for raw buffer load/stores."}, + { OptionKind::VulkanEmitReflection, "-fspv-reflect", nullptr, "Include reflection decorations in the resulting SPIRV for shader parameters."}, { OptionKind::EnableEffectAnnotations, "-enable-effect-annotations", nullptr, "Enables support for legacy effect annotation syntax."}, @@ -2100,6 +2102,12 @@ SlangResult OptionsParser::_parse( m_hlslToVulkanLayoutOptions->setUseGLLayout(true); break; } + case OptionKind::VulkanEmitReflection: + { + // -fvk-invert-y + m_hlslToVulkanLayoutOptions->setEmitSPIRVReflectionInfo(true); + break; + } case OptionKind::Profile: SLANG_RETURN_ON_FAIL(_parseProfile(arg)); break; case OptionKind::Capability: { -- cgit v1.2.3