From dff216cc5ddb073e5bffdd4550eda208b7527676 Mon Sep 17 00:00:00 2001 From: jsmall-nvidia Date: Wed, 25 Jul 2018 11:57:44 -0400 Subject: Improved command line control for apis and synthesized tests (#616) * Parsing of control of api parameters no longer needs comma separator. Parsing of API list now can take an initial state. Document the command line option. * * Proper handling of 'default' (or initialFlags) - by using if the first token is an operator. * Clarified parsing of api flags. * Now 'vk' will mean just use vk. +vk will mean the defaults plus vk, and -vk is the defaults -vk. * Improve README.md on api expressions. Improve error text for failure to parse api expressions. --- tools/slang-test/render-api-util.h | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'tools/slang-test/render-api-util.h') diff --git a/tools/slang-test/render-api-util.h b/tools/slang-test/render-api-util.h index a44528faf..1c3c81254 100644 --- a/tools/slang-test/render-api-util.h +++ b/tools/slang-test/render-api-util.h @@ -43,14 +43,16 @@ struct RenderApiUtil /// Returns a combination of RenderApiFlag bits which if set indicates that the API is available. static int getAvailableApis(); - /// Returns -1 if unknown + /// Returns RenderApiType::Unknown if not found static RenderApiType findApiTypeByName(const Slang::UnownedStringSlice& name); - /// Returns 0 if none found. - static int findApiFlagsByName(const Slang::UnownedStringSlice& name); + /// FlagsOut will have flag/flags specified by a name if returns with successful result code. + static Slang::Result findApiFlagsByName(const Slang::UnownedStringSlice& name, RenderApiFlags* flagsOut); - /// Parse api flags string (comma delimited list of api names, or 'all' for all) - /// For example "all,-dx12" would be all apis, except dx12 - static Slang::Result parseApiFlags(const Slang::UnownedStringSlice& text, int* apiBitsOut); + /// Parse api flags string, returning SLANG_OK on success. + /// If first character is + or - the flags will be applied to initialFlags, else initialFlags is ignored. + /// For example "all-dx12" would be all apis, except dx12 + /// -vk would be whatever is in initial flags, but not vulkan. + static Slang::Result parseApiFlags(const Slang::UnownedStringSlice& text, RenderApiFlags initialFlags, RenderApiFlags* apiBitsOut); /// Get information about a render API static const Info& getInfo(RenderApiType type) { return s_infos[int(type)]; } -- cgit v1.2.3