From 34a1ff5226a526cc17c5baecd63637f69c324fc7 Mon Sep 17 00:00:00 2001 From: jsmall-nvidia Date: Sat, 22 May 2021 16:03:30 -0400 Subject: Improvements in -X support (#1852) * #include an absolute path didn't work - because paths were taken to always be relative. * Added SourceLoc handling for command line parsing. * Fix typo in debug. * Fix issue around the DiagnosticSink used in options parsing not having a writer available - by having DiagnosticSink parenting. * Small rename for clarity. * WIP extracting command line args for downstream tools. * Unit tests/bug fixes around extracting args. * Use DownstreamArgs in the EndToEndCompileRequest * Passing downstream compiler options downstream. * Fix issue with endToEndReq being nullptr. * Fix issue with diagnostics number change. * Small improvements to how the source line is displayed if it's too long. Default to 120, as suggested in previous review. * Make render test use x-args parsing and CommandArgReader. * Added missing diagnostics. * More DownstreamArgs to linkage so can be seen by 'components'. Added dxc-x-arg test. * Used combination of name and args instead of two Lists, which whilst equivalent was perhaps a little confusing. * Added documentation for -X support. * Added test for x-args parsing diagnostic. Improved diagnostic with list of known names. * Fix issues from merge. * Fix lookup for -matrix-layout-column-major in render test. * Remove commented out line. --- tools/render-test/options.h | 26 ++++++++++---------------- 1 file changed, 10 insertions(+), 16 deletions(-) (limited to 'tools/render-test/options.h') diff --git a/tools/render-test/options.h b/tools/render-test/options.h index 2945113fe..7940d0d42 100644 --- a/tools/render-test/options.h +++ b/tools/render-test/options.h @@ -12,6 +12,8 @@ #include "../../source/core/slang-process-util.h" +#include "../../source/compiler-core/slang-command-line-args.h" + #include "../../slang-gfx.h" namespace renderer_test { @@ -20,12 +22,6 @@ using namespace gfx; struct Options { - enum - { - // maximum number of command-line arguments to pass along to slang - kMaxSlangArgs = 16, - }; - enum class InputLanguageID { // Slang being used as an HLSL-ish compiler @@ -35,7 +31,6 @@ struct Options Native, }; - enum class ShaderProgramType { Graphics, @@ -44,9 +39,9 @@ struct Options RayTracing, }; - char const* appName = "render-test"; - char const* sourcePath = nullptr; - char const* outputPath = nullptr; + Slang::String appName = "render-test"; + Slang::String sourcePath; + Slang::String outputPath; ShaderProgramType shaderType = ShaderProgramType::Graphics; /// The renderer type inferred from the target language type. Used if a rendererType is not explicitly set. @@ -57,10 +52,7 @@ struct Options SlangSourceLanguage sourceLanguage = SLANG_SOURCE_LANGUAGE_UNKNOWN; /// Can be used for overriding the profile - const char* profileName = nullptr; - - char const* slangArgs[kMaxSlangArgs]; - int slangArgCount = 0; + Slang::String profileName; bool outputUsingType = false; @@ -73,14 +65,16 @@ struct Options Slang::List renderFeatures; /// Required render features for this test to run - Slang::List compileArgs; - Slang::String adapter; ///< The adapter to use either name or index uint32_t computeDispatchSize[3] = { 1, 1, 1 }; Slang::String nvapiExtnSlot; ///< The nvapiRegister to use. + Slang::DownstreamArgs downstreamArgs; ///< Args to downstream tools. Here it's just slang + + Options() { downstreamArgs.addName("slang"); } + static SlangResult parse(int argc, const char*const* argv, Slang::WriterHelper stdError, Options& outOptions); }; -- cgit v1.2.3