From 4a94f39020dcc143f9a1d8f5c57ba77a828ead61 Mon Sep 17 00:00:00 2001 From: Tim Foley Date: Tue, 15 Aug 2017 09:29:52 -0700 Subject: Improve diagnostics for overlapping/conflicting bindings Closes #38 - Change overlapping bindings case from error to warning (it is *technically* allowed in HLSL/GLSL) - Make diagnostic messages for these cases include a note to point at the "other" declaration in each case, so that user can more easily isolate the problem - Unrelated fix: make sure `slangc` sets up its diagnostic callback *before* parsing command-line options so that error messages output during options parsing will be visible - Unrelated fix: make sure that formatting for diagnostic messages doesn't print diagnostic ID for notes (all have IDs < 0). - Note: eventually I'd like to not print diagnostic IDs at all (I think they are cluttering up our output), but doing that requires touching all the test cases... --- tests/diagnostics/gh-38-fs.hlsl | 9 +++++++++ tests/diagnostics/gh-38-vs.hlsl | 9 +++++++++ 2 files changed, 18 insertions(+) create mode 100644 tests/diagnostics/gh-38-fs.hlsl create mode 100644 tests/diagnostics/gh-38-vs.hlsl (limited to 'tests') diff --git a/tests/diagnostics/gh-38-fs.hlsl b/tests/diagnostics/gh-38-fs.hlsl new file mode 100644 index 000000000..61c8381e4 --- /dev/null +++ b/tests/diagnostics/gh-38-fs.hlsl @@ -0,0 +1,9 @@ +//TEST_IGNORE_FILE: + +// Companion file to `gh-38-fs.hlsl` + +Texture2D overlappingB : register(t0); + +Texture2D conflicting : register(t2); + +float4 main() : SV_Target { return 0; } diff --git a/tests/diagnostics/gh-38-vs.hlsl b/tests/diagnostics/gh-38-vs.hlsl new file mode 100644 index 000000000..7b23efdea --- /dev/null +++ b/tests/diagnostics/gh-38-vs.hlsl @@ -0,0 +1,9 @@ +//TEST:SIMPLE: -target dxbc-assembly -profile vs_5_0 -entry main tests/diagnostics/gh-38-fs.hlsl -profile ps_5_0 -entry main + +// Ensure that we catch errors with overlapping or conflicting parameter bindings. + +Texture2D overlappingA : register(t0); + +Texture2D conflicting : register(t1); + +float4 main() : SV_Position { return 0; } -- cgit v1.2.3 From f64bbf712e4e0719604d1e6728eef74539c9ceda Mon Sep 17 00:00:00 2001 From: Tim Foley Date: Tue, 15 Aug 2017 10:07:49 -0700 Subject: Add missing expected output file for test. --- tests/diagnostics/gh-38-vs.hlsl.expected | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 tests/diagnostics/gh-38-vs.hlsl.expected (limited to 'tests') diff --git a/tests/diagnostics/gh-38-vs.hlsl.expected b/tests/diagnostics/gh-38-vs.hlsl.expected new file mode 100644 index 000000000..05f455821 --- /dev/null +++ b/tests/diagnostics/gh-38-vs.hlsl.expected @@ -0,0 +1,9 @@ +result code = -1 +standard error = { +tests/diagnostics/gh-38-fs.hlsl(7): error 39999: conflicting explicit bindings for parameter 'conflicting' +tests/diagnostics/gh-38-vs.hlsl(7): note: see other declaration of 'conflicting' +tests/diagnostics/gh-38-fs.hlsl(5): warning 39999: explicit binding for parameter 'overlappingB' overlaps with parameter 'overlappingA' +tests/diagnostics/gh-38-vs.hlsl(5): note: see declaration of 'overlappingA' +} +standard output = { +} -- cgit v1.2.3