diff options
| author | Tim Foley <tfoleyNV@users.noreply.github.com> | 2017-10-20 15:16:10 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2017-10-20 15:16:10 -0700 |
| commit | 624d122a3a110922cd54aab7bbf13f1cac8fbbff (patch) | |
| tree | 098d3c7eb9e7561088f835c4bcea6efbacaf701c /tools | |
| parent | 7ba937faa3f72b0f319150c3dde041d8a353c007 (diff) | |
Fix up emission of shader parameter semantics when using IR (#226)
* Fix up emission of shader parameter semantics when using IR
- Make sure to propagate entry point parameter layouts down to IR parameters when doing the initial cloning to form target-specific IR
- When layout information is present on an IR node, prefer to use that over the original high-level declaration for outputting semantics in final HLSL
- Fix up test runner to generate `.actual` files when running compute tests, in cases where the `render-test` application errors out (e.g., because of a Slang compilation error)
- Add a first test of generics functionality, to show that they generate valid code through the IR
- Right now this test is *not* using any "interesting" operations on the type parameter, so this is not a test that can confirm that interface constraints work
* fixup: skip compute tests when running on Linux
Diffstat (limited to 'tools')
| -rw-r--r-- | tools/slang-test/main.cpp | 56 |
1 files changed, 38 insertions, 18 deletions
diff --git a/tools/slang-test/main.cpp b/tools/slang-test/main.cpp index fb10d46f6..d85a3856b 100644 --- a/tools/slang-test/main.cpp +++ b/tools/slang-test/main.cpp @@ -752,6 +752,28 @@ TestResult runReflectionTest(TestInput& input) return result; } +String getExpectedOutput(String const& outputStem) +{ + String expectedOutputPath = outputStem + ".expected"; + String expectedOutput; + try + { + expectedOutput = Slang::File::ReadAllText(expectedOutputPath); + } + catch (Slang::IOException) + { + } + + // If no expected output file was found, then we + // expect everything to be empty + if (expectedOutput.Length() == 0) + { + expectedOutput = "result code = 0\nstandard error = {\n}\nstandard output = {\n}\n"; + } + + return expectedOutput; +} + TestResult runEvalTest(TestInput& input) { // We are going to load and evaluate the code @@ -775,23 +797,7 @@ TestResult runEvalTest(TestInput& input) } String actualOutput = getOutput(spawner); - - String expectedOutputPath = outputStem + ".expected"; - String expectedOutput; - try - { - expectedOutput = Slang::File::ReadAllText(expectedOutputPath); - } - catch (Slang::IOException) - { - } - - // If no expected output file was found, then we - // expect everything to be empty - if (expectedOutput.Length() == 0) - { - expectedOutput = "result code = 0\nstandard error = {\n}\nstandard output = {\n}\n"; - } + String expectedOutput = getExpectedOutput(outputStem); TestResult result = kTestResult_Pass; @@ -1135,6 +1141,19 @@ TestResult doComputeComparisonTestRunImpl(TestInput& input, const char * langOpt return kTestResult_Fail; } + auto actualOutput = getOutput(spawner); + auto expectedOutput = getExpectedOutput(outputStem); + if(actualOutput != expectedOutput) + { + String actualOutputPath = outputStem + ".actual"; + Slang::File::WriteAllText(actualOutputPath, actualOutput); + + maybeDumpOutput(expectedOutput, actualOutput); + + return kTestResult_Fail; + } + + // check against reference output if (!File::Exists(outputStem + ".actual.txt")) return kTestResult_Fail; @@ -1358,14 +1377,15 @@ TestResult runTest( { "COMPARE_HLSL_RENDER", &runHLSLRenderComparisonTest }, { "COMPARE_HLSL_CROSS_COMPILE_RENDER", &runHLSLCrossCompileRenderComparisonTest}, { "COMPARE_HLSL_GLSL_RENDER", &runHLSLAndGLSLComparisonTest }, + { "COMPARE_COMPUTE", &doSlangComputeComparisonTest}, #else { "COMPARE_HLSL", &skipTest }, { "COMPARE_HLSL_RENDER", &skipTest }, { "COMPARE_HLSL_CROSS_COMPILE_RENDER", &skipTest}, { "COMPARE_HLSL_GLSL_RENDER", &skipTest }, + { "COMPARE_COMPUTE", &skipTest}, #endif { "COMPARE_GLSL", &runGLSLComparisonTest }, - { "COMPARE_COMPUTE", &doSlangComputeComparisonTest}, { "CROSS_COMPILE", &runCrossCompilerTest }, { "EVAL", &runEvalTest }, |
