summaryrefslogtreecommitdiffstats
path: root/tools/render-test
diff options
context:
space:
mode:
authorjsmall-nvidia <jsmall@nvidia.com>2019-11-13 13:35:56 -0500
committerGitHub <noreply@github.com>2019-11-13 13:35:56 -0500
commit9604118401f185c0e1a213b8e99dad060c6263bc (patch)
treeb2a651f72f8f6f10afad74ba7cdc91376aa0f2d5 /tools/render-test
parent166a7387cb3a83b24dd4b9279877338c758eb8b6 (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/render-test')
-rw-r--r--tools/render-test/slang-support.cpp27
1 files changed, 23 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;