summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorjsmall-nvidia <jsmall@nvidia.com>2020-02-18 19:13:02 -0500
committerGitHub <noreply@github.com>2020-02-18 19:13:02 -0500
commit45d1a680634c59d1081ed09dddaa444695296492 (patch)
treeaf803579f32d1592a297d70e41f848184dea93ea /tools
parent8ee39e08c48a315163fe1850dbb12ca292020d4d (diff)
Added support for Targets to TypeTextUtil. (#1226)
* Added support for Targets to TypeTextUtil. * Made Function names 'get' and 'find' instead of 'as' in TypeTextUtil.
Diffstat (limited to 'tools')
-rw-r--r--tools/render-test/options.cpp2
-rw-r--r--tools/render-test/shader-input-layout.cpp2
-rw-r--r--tools/slang-test/slang-test-main.cpp41
3 files changed, 8 insertions, 37 deletions
diff --git a/tools/render-test/options.cpp b/tools/render-test/options.cpp
index 6591941e8..bd6d2b364 100644
--- a/tools/render-test/options.cpp
+++ b/tools/render-test/options.cpp
@@ -228,7 +228,7 @@ SlangResult parseOptions(int argc, const char*const* argv, Slang::WriterHelper s
}
UnownedStringSlice sourceLanguageText(*argCursor++);
- SlangSourceLanguage sourceLanguage = TypeTextUtil::asSourceLanguage(sourceLanguageText);
+ SlangSourceLanguage sourceLanguage = TypeTextUtil::findSourceLanguage(sourceLanguageText);
if (sourceLanguage == SLANG_SOURCE_LANGUAGE_UNKNOWN)
{
stdError.print("error: expecting unknown source language name '%s' for '%s'\n", String(sourceLanguageText).getBuffer(), arg);
diff --git a/tools/render-test/shader-input-layout.cpp b/tools/render-test/shader-input-layout.cpp
index d3c206b58..108483a2a 100644
--- a/tools/render-test/shader-input-layout.cpp
+++ b/tools/render-test/shader-input-layout.cpp
@@ -761,7 +761,7 @@ namespace renderer_test
if (scalarType != ScalarType::None && scalarType != ScalarType::Void)
{
- UnownedStringSlice text = TypeTextUtil::asText(scalarType);
+ UnownedStringSlice text = TypeTextUtil::getScalarTypeName(scalarType);
// Write out the type
writer.put("type: ");
writer.put(text);
diff --git a/tools/slang-test/slang-test-main.cpp b/tools/slang-test/slang-test-main.cpp
index 79cd6c1a7..9f9ad527a 100644
--- a/tools/slang-test/slang-test-main.cpp
+++ b/tools/slang-test/slang-test-main.cpp
@@ -545,35 +545,6 @@ static PassThroughFlags _getPassThroughFlagsForTarget(SlangCompileTarget target)
}
}
-static SlangCompileTarget _getCompileTarget(const UnownedStringSlice& name)
-{
-#define CASE(NAME, TARGET) if(name == NAME) return SLANG_##TARGET;
-
- CASE("hlsl", HLSL)
- CASE("glsl", GLSL)
- CASE("dxbc", DXBC)
- CASE("dxbc-assembly", DXBC_ASM)
- CASE("dxbc-asm", DXBC_ASM)
- CASE("spirv", SPIRV)
- CASE("spirv-assembly", SPIRV_ASM)
- CASE("spirv-asm", SPIRV_ASM)
- CASE("dxil", DXIL)
- CASE("dxil-assembly", DXIL_ASM)
- CASE("dxil-asm", DXIL_ASM)
- CASE("c", C_SOURCE)
- CASE("cpp", CPP_SOURCE)
- CASE("exe", EXECUTABLE)
- CASE("sharedlib", SHARED_LIBRARY)
- CASE("dll", SHARED_LIBRARY)
- CASE("callable", HOST_CALLABLE)
- CASE("host-callable", HOST_CALLABLE)
- CASE("ptx", PTX)
- CASE("cuda", CUDA_SOURCE)
-#undef CASE
-
- return SLANG_TARGET_UNKNOWN;
-}
-
static SlangResult _extractRenderTestRequirements(const CommandLine& cmdLine, TestRequirements* ioRequirements)
{
const auto& args = cmdLine.m_args;
@@ -709,7 +680,7 @@ static SlangResult _extractSlangCTestRequirements(const CommandLine& cmdLine, Te
String passThrough;
if (SLANG_SUCCEEDED(_extractArg(cmdLine, "-pass-through", passThrough)))
{
- ioRequirements->addUsedBackEnd(TypeTextUtil::asPassThrough(passThrough.getUnownedSlice()));
+ ioRequirements->addUsedBackEnd(TypeTextUtil::findPassThrough(passThrough.getUnownedSlice()));
}
}
@@ -718,7 +689,7 @@ static SlangResult _extractSlangCTestRequirements(const CommandLine& cmdLine, Te
String targetName;
if (SLANG_SUCCEEDED(_extractArg(cmdLine, "-target", targetName)))
{
- const SlangCompileTarget target = _getCompileTarget(targetName.getUnownedSlice());
+ const SlangCompileTarget target = TypeTextUtil::findCompileTargetFromName(targetName.getUnownedSlice());
ioRequirements->addUsedBackends(_getPassThroughFlagsForTarget(target));
}
}
@@ -1010,7 +981,7 @@ TestResult runSimpleTest(TestContext* context, TestInput& input)
const Index targetIndex = args.indexOf("-target");
if (targetIndex != Index(-1) && targetIndex + 1 < args.getCount())
{
- target = _getCompileTarget(args[targetIndex + 1].getUnownedSlice());
+ target = TypeTextUtil::findCompileTargetFromName(args[targetIndex + 1].getUnownedSlice());
}
}
@@ -1548,7 +1519,7 @@ TestResult runCrossCompilerTest(TestContext* context, TestInput& input)
const Index targetIndex = args.indexOf("-target");
if (targetIndex != Index(-1) && targetIndex + 1 < args.getCount())
{
- SlangCompileTarget target = _getCompileTarget(args[targetIndex + 1].getUnownedSlice());
+ const SlangCompileTarget target = TypeTextUtil::findCompileTargetFromName(args[targetIndex + 1].getUnownedSlice());
// Check the session supports it. If not we ignore it
if (SLANG_FAILED(spSessionCheckCompileTargetSupport(context->getSession(), target)))
@@ -2074,7 +2045,7 @@ static SlangResult _compareWithType(const UnownedStringSlice& actual, const Unow
return SLANG_FAIL;
}
- scalarType = TypeTextUtil::asScalarType(split[1].trim());
+ scalarType = TypeTextUtil::findScalarType(split[1].trim());
continue;
}
@@ -2637,7 +2608,7 @@ static void _calcSynthesizedTests(TestContext* context, RenderApiType synthRende
{
//
const auto& language = srcTest.options.args[index + 1];
- SlangSourceLanguage sourceLanguage = TypeTextUtil::asSourceLanguage(language.getUnownedSlice());
+ SlangSourceLanguage sourceLanguage = TypeTextUtil::findSourceLanguage(language.getUnownedSlice());
bool isCrossCompile = true;