diff options
| author | jsmall-nvidia <jsmall@nvidia.com> | 2019-11-13 13:35:56 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2019-11-13 13:35:56 -0500 |
| commit | 9604118401f185c0e1a213b8e99dad060c6263bc (patch) | |
| tree | b2a651f72f8f6f10afad74ba7cdc91376aa0f2d5 /tools | |
| parent | 166a7387cb3a83b24dd4b9279877338c758eb8b6 (diff) | |
* Added getCStr(Name*) (#1121)
* Added the name to the EntryPointLayout so is always available
* Made spReflectionEntryPoint_getName use name
* Improved checking for entry point name in render-test
* Improved COMPILE test type to allow failure and output of failure.
Diffstat (limited to 'tools')
| -rw-r--r-- | tools/render-test/slang-support.cpp | 27 | ||||
| -rw-r--r-- | tools/slang-test/slang-test-main.cpp | 12 |
2 files changed, 35 insertions, 4 deletions
diff --git a/tools/render-test/slang-support.cpp b/tools/render-test/slang-support.cpp index 06284e1e3..5b038d208 100644 --- a/tools/render-test/slang-support.cpp +++ b/tools/render-test/slang-support.cpp @@ -149,20 +149,22 @@ static const char computeEntryPointName[] = "computeMain"; if (request.computeShader.name) { - int computeEntryPoint = 0; + int computeEntryPointIndex = 0; if(!gOptions.dontAddDefaultEntryPoints) { - computeEntryPoint = spAddEntryPointEx(slangRequest, computeTranslationUnit, + computeEntryPointIndex = spAddEntryPointEx(slangRequest, computeTranslationUnit, computeEntryPointName, SLANG_STAGE_COMPUTE, (int)rawEntryPointTypeNames.getCount(), rawEntryPointTypeNames.getBuffer()); - setEntryPointExistentialTypeArgs(computeEntryPoint); + setEntryPointExistentialTypeArgs(computeEntryPointIndex); } spSetLineDirectiveMode(slangRequest, SLANG_LINE_DIRECTIVE_MODE_NONE); + const SlangResult res = spCompile(slangRequest); + if (auto diagnostics = spGetDiagnosticOutput(slangRequest)) { fprintf(stderr, "%s", diagnostics); @@ -170,9 +172,26 @@ static const char computeEntryPointName[] = "computeMain"; SLANG_RETURN_ON_FAIL(res); + // We are going to get the entry point count... lets check what we have + { + auto reflection = spGetReflection(slangRequest); + // Get the amount of entry points in reflection + const int entryPointCount = int(spReflection_getEntryPointCount(reflection)); + + // Above code assumes there is an entry point + SLANG_ASSERT(entryPointCount && computeEntryPointIndex < entryPointCount); + + auto entryPoint = spReflection_getEntryPointByIndex(reflection, computeEntryPointIndex); + + // Get the entry point name + const char* entryPointName = spReflectionEntryPoint_getName(entryPoint); + + SLANG_ASSERT(entryPointName); + } + { size_t codeSize = 0; - char const* code = (char const*) spGetEntryPointCode(slangRequest, computeEntryPoint, &codeSize); + char const* code = (char const*) spGetEntryPointCode(slangRequest, computeEntryPointIndex, &codeSize); ShaderProgram::KernelDesc kernelDesc; kernelDesc.stage = StageType::Compute; diff --git a/tools/slang-test/slang-test-main.cpp b/tools/slang-test/slang-test-main.cpp index 2000bf617..e0474ebe6 100644 --- a/tools/slang-test/slang-test-main.cpp +++ b/tools/slang-test/slang-test-main.cpp @@ -1106,6 +1106,18 @@ TestResult runCompile(TestContext* context, TestInput& input) return TestResult::Pass; } + if (exeRes.resultCode != 0) + { + auto reporter = context->reporter; + if (reporter) + { + auto output = getOutput(exeRes); + reporter->message(TestMessageType::TestFailure, output); + } + + return TestResult::Fail; + } + return TestResult::Pass; } |
