summaryrefslogtreecommitdiff
path: root/tests/bugs
diff options
context:
space:
mode:
authorTim Foley <tfoleyNV@users.noreply.github.com>2018-10-29 14:44:39 -0700
committerGitHub <noreply@github.com>2018-10-29 14:44:39 -0700
commit725985528f77ba939a5cddc71e5006fee7638465 (patch)
tree9b5d4d90a02e38a7c564e6df1fa2944616cf7913 /tests/bugs
parent56c9de0ae0f0b37d0c5f50f2b39d6c18362642bb (diff)
Rework command-line options handling for entry points and targets (#697)
* Rework command-line options handling for entry points and targets Overview: * The biggest functionality change is that the implicit ordering constraints when multiple `-entry` options are reversed: any `-stage` option affects the `-entry` to its *left* instead of to its *right* as it used to. This is technically a breaking change, but I expect most users aren't using this feature. * The options parsing tries to handle profile versions and stages as distinct data (rather than using the combined `Profile` type all over), and treats a `-profile` option that specifies both a profile version and a stage (e.g., `-profile ps_5_0`) as if it were sugar for both a `-profile` and a `-stage` (e.g., `-profile sm_5_0 -stage fragment`). * We now technically handle multiple `-target` options in one invocation of `-slangc`, but do not advertise that fact in the documentation because it might be confusing for users. Similar to the relationship between `-stage` and `-entry`, any `-profile` option affects the most recent `-target` option unless there is only one `-target`. * The logic for associating `-o` options with corresponding entry points and targets has been beefed up. The rule is that a `-o` option for a compiled kernel binds to the entry point to its left, unless there is only one entry point (just like for `-stage`). The associated target for a `-o` option is found via a search, however, because otherwise it would be impossible to specify `-o` options for both SPIR-V and DXIL in one pass. * The handling of output paths for entry points in the internal compiler structures was changed, because previously it could only handle one output path per entry point (even when there are multiple targets). The new logic builds up a per-target mapping from an entry point to its desired output path (if any). Details: * Support for formatting profile versions, stages, and compile targets (formats) was added to diagnostic printing, so that we can make better error messages. This is fairly ad hoc, and it would be nice to have all of the string<->enum stuff be more data-driven throughout the codebase. * Test cases were added for (almost) all of the error conditions in the current options validation. The main one that is missing is around specifying an `-entry` option before any source file when compiling multiple files. This is because the test runner is putting the source file name first on the command line automatically, so we can't reproduce that case. * Several reflection-related tests now reflect entry points where they didn't before, because the logic for detecting when to infer a default `main` entry point have been made more loose * On the dxc path, beefed up the handling of mapping from Slang `Profile`s to the coresponding string to use when invoking dxc. * A bunch of tests cases were in violation of the newly imposed rules, so those needed to be cleaned up. * There were also a bunch of test cases that had accidentally gotten "disabled" at some point because there were comparing output from `slangc` both with and without a `-pass-through` option, but that meant that any errors in command-line parsing produced the *same* error output in both the Slang and pass-through cases. This change updates `slang-test` to always expect a successful run for these tests, and then manually updates or disables the various test cases that are affected. * When merging the updated test for matrix layout mode, I found that the new command-line logic was failing to propagate a matrix layout mode passed to `render-test` into the compiler. This was because the `-matrix-layout*` options were implemented as per-target, but the target was being set by API while the option came in via command line (passed through the API). It seems like we want matrix layout mode to be a global option anyway (rather than per-target), so I made that change here. * Add missing expected output files * A 64-bit fix * Remove commented-out code noted in review
Diffstat (limited to 'tests/bugs')
-rw-r--r--tests/bugs/array-size-static-const.hlsl2
-rw-r--r--tests/bugs/cbuffer-member-init.hlsl7
-rw-r--r--tests/bugs/do-loop.hlsl2
-rw-r--r--tests/bugs/gh-171.slang10
-rw-r--r--tests/bugs/gh-172.slang18
-rw-r--r--tests/bugs/gh-295.hlsl5
-rw-r--r--tests/bugs/gh-34.hlsl6
-rw-r--r--tests/bugs/implicit-conversion-binary-op.hlsl2
-rw-r--r--tests/bugs/import-overload-error.hlsl4
-rw-r--r--tests/bugs/matrix-mult.glsl4
-rw-r--r--tests/bugs/split-nested-types.hlsl2
-rw-r--r--tests/bugs/uav-write-index.hlsl9
-rw-r--r--tests/bugs/vec-init-list.hlsl2
13 files changed, 45 insertions, 28 deletions
diff --git a/tests/bugs/array-size-static-const.hlsl b/tests/bugs/array-size-static-const.hlsl
index fe15d402d..643d4733e 100644
--- a/tests/bugs/array-size-static-const.hlsl
+++ b/tests/bugs/array-size-static-const.hlsl
@@ -1,5 +1,5 @@
// array-size-static-const.hlsl
-//TEST:COMPARE_HLSL: -profile cs_5_0 -target dxbc-assembly
+//TEST:COMPARE_HLSL: -profile cs_5_0
// The bug in this case is that were have a (hidden)
// cast from the `uint` constant to `int` to get
diff --git a/tests/bugs/cbuffer-member-init.hlsl b/tests/bugs/cbuffer-member-init.hlsl
index fe6db8af0..fbfa3f220 100644
--- a/tests/bugs/cbuffer-member-init.hlsl
+++ b/tests/bugs/cbuffer-member-init.hlsl
@@ -1,4 +1,4 @@
-//TEST:COMPARE_HLSL: -profile vs_5_0 -target dxbc-assembly -no-checking
+//TEST:COMPARE_HLSL: -profile vs_5_0
// Allow (but ignore) initializer on `cbuffer` member
@@ -7,7 +7,8 @@ cbuffer C : register(b0)
int a = -1;
};
-float4 main() : SV_Position
+float4 main() : SV_POSITION
{
- return a;
+ return 0;
+// return a;
}
diff --git a/tests/bugs/do-loop.hlsl b/tests/bugs/do-loop.hlsl
index de98a9765..e293258b2 100644
--- a/tests/bugs/do-loop.hlsl
+++ b/tests/bugs/do-loop.hlsl
@@ -1,4 +1,4 @@
-//TEST_DISABLED:COMPARE_HLSL: -profile vs_5_0 -target dxbc-assembly
+//TEST_DISABLED:COMPARE_HLSL: -profile vs_5_0
// Check output for `do` loops
diff --git a/tests/bugs/gh-171.slang b/tests/bugs/gh-171.slang
index 1df82501e..647f6a6a2 100644
--- a/tests/bugs/gh-171.slang
+++ b/tests/bugs/gh-171.slang
@@ -1,4 +1,4 @@
-//TEST:COMPARE_HLSL: -profile ps_5_0 -entry main -target dxbc-assembly -split-mixed-types
+//TEST:COMPARE_HLSL: -profile ps_5_0 -entry main
// Make sure we don't crash when desugaring resources
// in structs when a `cbuffer` only contains resources.
@@ -17,12 +17,12 @@ float4 main(float2 uv: UV) : SV_Target
#else
-Texture2D SLANG_parameterGroup_C_t : register(t0);
-SamplerState SLANG_parameterGroup_C_s : register(s0);
+Texture2D C_t_0 : register(t0);
+SamplerState C_s_0 : register(s0);
-float4 main(float2 uv: UV) : SV_Target
+float4 main(float2 uv: UV) : SV_TARGET
{
- return SLANG_parameterGroup_C_t.Sample(SLANG_parameterGroup_C_s, uv);
+ return C_t_0.Sample(C_s_0, uv);
}
#endif
diff --git a/tests/bugs/gh-172.slang b/tests/bugs/gh-172.slang
index f959c7ac6..dd5f4d47a 100644
--- a/tests/bugs/gh-172.slang
+++ b/tests/bugs/gh-172.slang
@@ -1,4 +1,4 @@
-//TEST:COMPARE_HLSL: -profile ps_5_0 -entry main -target dxbc-assembly -split-mixed-types
+//TEST:COMPARE_HLSL: -profile ps_5_0 -entry main
// Make sure we don't crash when desugaring resource in structs,
// when the user also declares multiple variables with a
@@ -21,19 +21,19 @@ float4 main() : SV_Target
#else
-cbuffer C : register(b0)
+cbuffer C_0 : register(b0)
{
- float2 uv;
+ float2 uv_0;
};
-Texture2D SLANG_parameterGroup_C_t0 : register(t0);
-Texture2D SLANG_parameterGroup_C_t1 : register(t1);
-SamplerState SLANG_parameterGroup_C_s : register(s0);
+Texture2D C_t0_0 : register(t0);
+Texture2D C_t1_0 : register(t1);
+SamplerState C_s_0 : register(s0);
-float4 main() : SV_Target
+float4 main() : SV_TARGET
{
- return SLANG_parameterGroup_C_t0.Sample(SLANG_parameterGroup_C_s, uv)
- + SLANG_parameterGroup_C_t1.Sample(SLANG_parameterGroup_C_s, uv);
+ return C_t0_0.Sample(C_s_0, uv_0)
+ + C_t1_0.Sample(C_s_0, uv_0);
}
#endif
diff --git a/tests/bugs/gh-295.hlsl b/tests/bugs/gh-295.hlsl
index 724684662..73b5f071e 100644
--- a/tests/bugs/gh-295.hlsl
+++ b/tests/bugs/gh-295.hlsl
@@ -1,4 +1,7 @@
-//TEST:COMPARE_HLSL: -profile vs_4_0 -target dxbc-assembly -no-checking
+// Disabled because Slang IR path is missing support for [fastopt]
+//TEST_IGNORE_FILE
+
+//TEST:COMPARE_HLSL: -profile vs_4_0
// Confirm that we pass through `[fastopt]` attributes
//
diff --git a/tests/bugs/gh-34.hlsl b/tests/bugs/gh-34.hlsl
index feaddb2ab..d43ea75d9 100644
--- a/tests/bugs/gh-34.hlsl
+++ b/tests/bugs/gh-34.hlsl
@@ -1,4 +1,4 @@
-//TEST:COMPARE_HLSL: -profile gs_5_0 -target dxbc-assembly -no-checking
+//TEST:COMPARE_HLSL: -profile gs_5_0
struct VS_OUT { float3 p : POSITION; };
@@ -6,8 +6,10 @@ struct VS_OUT { float3 p : POSITION; };
void main(InputPatch<VS_OUT, 3> input, inout TriangleStream<VS_OUT> outStream)
{
VS_OUT output;
- for (uint i = 0; i < 3; i += 1)
+ for (uint i = 0;; i += 1)
{
+ if(i < 3) {} else break;
+
output = input[i];
outStream.Append(output);
}
diff --git a/tests/bugs/implicit-conversion-binary-op.hlsl b/tests/bugs/implicit-conversion-binary-op.hlsl
index b9a558474..ac952902f 100644
--- a/tests/bugs/implicit-conversion-binary-op.hlsl
+++ b/tests/bugs/implicit-conversion-binary-op.hlsl
@@ -1,5 +1,5 @@
// implicit-conversion-binary-op.hlsl
-//TEST:COMPARE_HLSL: -profile ps_5_0 -target dxbc-assembly
+//TEST:COMPARE_HLSL: -profile ps_5_0
// Make sure that we can pick resolve the right overload
// to call when applying a binary operator to vectors
diff --git a/tests/bugs/import-overload-error.hlsl b/tests/bugs/import-overload-error.hlsl
index 328bb5b26..21b9a7c8f 100644
--- a/tests/bugs/import-overload-error.hlsl
+++ b/tests/bugs/import-overload-error.hlsl
@@ -1,4 +1,6 @@
-//TEST:COMPARE_HLSL: -profile cs_5_0 -target dxbc-assembly -no-checking
+// Disbaled because Slang should perform its own semantic checking now
+//TEST_IGNORE_FILE
+//TEST:COMPARE_HLSL: -profile cs_5_0
#ifdef __SLANG__
__import import_overload_error;
diff --git a/tests/bugs/matrix-mult.glsl b/tests/bugs/matrix-mult.glsl
index b427dee14..58285c541 100644
--- a/tests/bugs/matrix-mult.glsl
+++ b/tests/bugs/matrix-mult.glsl
@@ -1,4 +1,6 @@
-//TEST:COMPARE_GLSL:-profile glsl_fragment_450 -no-checking
+// Disabled because Slang compiler doesn't support GLSL as an input language
+//TEST_IGNORE_FILE
+//TEST:COMPARE_GLSL:-profile glsl_fragment_450
// matrix-mult.glsl
#version 450
diff --git a/tests/bugs/split-nested-types.hlsl b/tests/bugs/split-nested-types.hlsl
index dc8756ba2..577f64a75 100644
--- a/tests/bugs/split-nested-types.hlsl
+++ b/tests/bugs/split-nested-types.hlsl
@@ -1,4 +1,4 @@
-//TEST:COMPARE_HLSL:-no-mangle -profile ps_5_0 -target dxbc-assembly
+//TEST:COMPARE_HLSL:-no-mangle -profile ps_5_0
#ifdef __SLANG__
import split_nested_types;
diff --git a/tests/bugs/uav-write-index.hlsl b/tests/bugs/uav-write-index.hlsl
index 667c73e89..7dac172fa 100644
--- a/tests/bugs/uav-write-index.hlsl
+++ b/tests/bugs/uav-write-index.hlsl
@@ -1,4 +1,4 @@
-//TEST:COMPARE_HLSL: -profile cs_5_0 -target dxbc-assembly -no-checking
+//TEST:COMPARE_HLSL: -profile cs_5_0
// Make sure we handle complex UAV write patterns
@@ -6,6 +6,13 @@
// checking takes place:
#ifdef __SLANG__
__import empty;
+#else
+
+#define Bar Bar_0
+#define bar bar_0
+#define gUAV gUAV_0
+#define gUAV2 gUAV2_0
+
#endif
struct Bar
diff --git a/tests/bugs/vec-init-list.hlsl b/tests/bugs/vec-init-list.hlsl
index d957548e6..2f82a96b0 100644
--- a/tests/bugs/vec-init-list.hlsl
+++ b/tests/bugs/vec-init-list.hlsl
@@ -1,4 +1,4 @@
-//TEST:COMPARE_HLSL: -profile vs_5_0 -target dxbc-assembly
+//TEST:COMPARE_HLSL: -profile vs_5_0
// Check handling of initializer list for vector