From 86e11e0e111fab60b9517056ac049bfac6e3bd25 Mon Sep 17 00:00:00 2001 From: jsmall-nvidia Date: Wed, 16 Jan 2019 13:31:42 -0500 Subject: Feature/external compiler reporting (#776) * Added support for converting SlangResult to string in PlatformUtil. * * Added reportExternalCompilerError * Made external compilers use this * Made DiagnosticSink accept UnownedStringSlice * Made emitXXX compiler functions return SlangError * Use smart pointers to handle life of Com interfaces * * Make SlangResult compatible with HRESULT for some common cases. * Make PlatformUtil::appendResult return SlangResult * Compile check SLANG_RESULT. * Add tests for checking diagnostics from external compilers. * * Make external compiler tests only run on windows for now. * Added 'windows' and 'unix' categories * Added categories based on what backends are available. Will make more tests run on linux and handle case where dxcompiler is not available on appveyor. * * Added spSessionCheckPassThroughSupport * Use to determine whats available for categories for tests * Add support for outputting source filename/s when using pass through. --- tests/cross-compile/dxc-error.hlsl | 9 +++++++++ tests/cross-compile/dxc-error.hlsl.expected | 8 ++++++++ tests/cross-compile/fxc-error.hlsl | 9 +++++++++ tests/cross-compile/fxc-error.hlsl.expected | 6 ++++++ tests/cross-compile/glslang-error.glsl | 7 +++++++ tests/cross-compile/glslang-error.glsl.expected | 8 ++++++++ 6 files changed, 47 insertions(+) create mode 100644 tests/cross-compile/dxc-error.hlsl create mode 100644 tests/cross-compile/dxc-error.hlsl.expected create mode 100644 tests/cross-compile/fxc-error.hlsl create mode 100644 tests/cross-compile/fxc-error.hlsl.expected create mode 100644 tests/cross-compile/glslang-error.glsl create mode 100644 tests/cross-compile/glslang-error.glsl.expected (limited to 'tests/cross-compile') diff --git a/tests/cross-compile/dxc-error.hlsl b/tests/cross-compile/dxc-error.hlsl new file mode 100644 index 000000000..fb22907c6 --- /dev/null +++ b/tests/cross-compile/dxc-error.hlsl @@ -0,0 +1,9 @@ +//TEST(dxc):SIMPLE:-pass-through dxc -target dxil -entry computeMain -stage compute -profile sm_6_1 + +[numthreads(4, 1, 1)] +void computeMain(uint3 dispatchThreadID : SV_DispatchThreadID) +{ + uint tid = dispatchThreadID.x; + // Error should be here... as gOutputBuffer is not defined... + gOutputBuffer[tid] = dispatchThreadID.x * 0.5f; +} \ No newline at end of file diff --git a/tests/cross-compile/dxc-error.hlsl.expected b/tests/cross-compile/dxc-error.hlsl.expected new file mode 100644 index 000000000..f9f565393 --- /dev/null +++ b/tests/cross-compile/dxc-error.hlsl.expected @@ -0,0 +1,8 @@ +result code = -1 +standard error = { +dxc: tests/cross-compile/dxc-error.hlsl:9:2: error: use of undeclared identifier 'gOutputBuffer' + gOutputBuffer[tid] = dispatchThreadID.x * 0.5f; + ^ +} +standard output = { +} diff --git a/tests/cross-compile/fxc-error.hlsl b/tests/cross-compile/fxc-error.hlsl new file mode 100644 index 000000000..a8d55fbe7 --- /dev/null +++ b/tests/cross-compile/fxc-error.hlsl @@ -0,0 +1,9 @@ +//TEST(fxc):SIMPLE:-pass-through fxc -target dxbc -entry computeMain -stage compute -profile sm_5_1 + +[numthreads(4, 1, 1)] +void computeMain(uint3 dispatchThreadID : SV_DispatchThreadID) +{ + uint tid = dispatchThreadID.x; + // Error should be here... as gOutputBuffer is not defined... + gOutputBuffer[tid] = dispatchThreadID.x * 0.5f; +} \ No newline at end of file diff --git a/tests/cross-compile/fxc-error.hlsl.expected b/tests/cross-compile/fxc-error.hlsl.expected new file mode 100644 index 000000000..b3fa55696 --- /dev/null +++ b/tests/cross-compile/fxc-error.hlsl.expected @@ -0,0 +1,6 @@ +result code = -1 +standard error = { +fxc: tests/cross-compile/fxc-error.hlsl(8,2-14): error X3004: undeclared identifier 'gOutputBuffer' +} +standard output = { +} diff --git a/tests/cross-compile/glslang-error.glsl b/tests/cross-compile/glslang-error.glsl new file mode 100644 index 000000000..c7d709442 --- /dev/null +++ b/tests/cross-compile/glslang-error.glsl @@ -0,0 +1,7 @@ +//TEST(glslang):SIMPLE:-pass-through glslang -target spirv -entry compute -stage compute -profile sm_5_1 +#version 450 + +void main() +{ + int a = !; +} diff --git a/tests/cross-compile/glslang-error.glsl.expected b/tests/cross-compile/glslang-error.glsl.expected new file mode 100644 index 000000000..9a11a6967 --- /dev/null +++ b/tests/cross-compile/glslang-error.glsl.expected @@ -0,0 +1,8 @@ +result code = -1 +standard error = { +glslang: ERROR: tests/cross-compile/glslang-error.glsl:6: '' : syntax error, unexpected SEMICOLON +ERROR: 1 compilation errors. No code generated. + +} +standard output = { +} -- cgit v1.2.3