From eebe849075c21d163739cbc5e976e7b5b6837e7f Mon Sep 17 00:00:00 2001 From: Yong He Date: Fri, 31 Jan 2025 05:02:26 -0800 Subject: Distribute slang-glsl-module.bin in release packages. (#6233) * Distribute slang-glsl-module.bin in release packages. * Fix. * fix2. * Build glsl modlue into a dll. --- source/slang/slang-options.cpp | 23 ++++++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-) (limited to 'source/slang/slang-options.cpp') diff --git a/source/slang/slang-options.cpp b/source/slang/slang-options.cpp index a0e8515eb..2b4d64cd9 100644 --- a/source/slang/slang-options.cpp +++ b/source/slang/slang-options.cpp @@ -888,6 +888,11 @@ void initCommandOptions(CommandOptions& options) "-save-core-module-bin-source ", "Same as -save-core-module but output " "the data as a C array.\n"}, + {OptionKind::SaveGLSLModuleBinSource, + "-save-glsl-module-bin-source", + "-save-glsl-module-bin-source ", + "Save the serialized glsl module " + "as a C array.\n"}, {OptionKind::TrackLiveness, "-track-liveness", nullptr, @@ -2203,14 +2208,24 @@ SlangResult OptionsParser::_parse(int argc, char const* const* argv) break; } case OptionKind::SaveCoreModuleBinSource: + case OptionKind::SaveGLSLModuleBinSource: { CommandLineArg fileName; SLANG_RETURN_ON_FAIL(m_reader.expectArg(fileName)); ComPtr blob; - SLANG_RETURN_ON_FAIL(m_session->saveCoreModule(m_archiveType, blob.writeRef())); - + if (optionKind == OptionKind::SaveCoreModuleBinSource) + { + SLANG_RETURN_ON_FAIL(m_session->saveCoreModule(m_archiveType, blob.writeRef())); + } + else + { + SLANG_RETURN_ON_FAIL(m_session->saveBuiltinModule( + slang::BuiltinModuleName::GLSL, + m_archiveType, + blob.writeRef())); + } StringBuilder builder; StringWriter writer(&builder, 0); @@ -2763,9 +2778,7 @@ SlangResult OptionsParser::_parse(int argc, char const* const* argv) case OptionKind::Help: { SLANG_RETURN_ON_FAIL(_parseHelp(arg)); - - // We retun an error so after this has successfully passed, we quit - return SLANG_FAIL; + return SLANG_OK; } case OptionKind::EmitSpirvViaGLSL: case OptionKind::EmitSpirvDirectly: -- cgit v1.2.3