summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorTim Foley <tfoleyNV@users.noreply.github.com>2017-10-05 12:24:30 -0700
committerGitHub <noreply@github.com>2017-10-05 12:24:30 -0700
commit33de7156d0cc57e70423ad69bfad33488f96134a (patch)
tree9351b1540d357d73cfb477ab4e2947548e6dff9d /tests
parent54f016e7ef36b7505bf47d188cf4b7e1fdc443a4 (diff)
Working on better handling of builtin functions in IR (#196)
The main change I was working on here was to start having more of the builtin functions (in this case, `cos`, `sin`, and `saturate`) just lower to the IR as calls to builtin functions (with declarations but no definition), rather than expect/require them to map to individual IR opcodes in every case. The main change there was the removal of some `intrinsic_op` modifiers in the stdlib. This then requires the `isTargetInstrinsic` logic in IR-based code emit to avoid emitting declarations for these intrinsics. The corresponding logic for emitting *calls* to these intrinsics is currently being skipped. Along the way, a variety of fixups were added: - In order to support lowering to GLSL, we need to handle cases where a variable/function name uses a GLSL reserved word. The right long-term fix there is to always use generated or mangled names, but for now I'm hacking it by adding a `_s` prefix to all names during IR-based emit. - This needs a flag to disable it, since some of our tests currently rely on checking binding information from generated HLSL/SPIR-V that will include these mangled/modified names. - Emit matrix layout modifiers appropriately for GLSL - Specialize IR parameter-block emission between GLSL and HLSL - Fix up argument count/index logic for a couple of opcodes that weren't fixed when removing the types from the explicit operand list - Fix up IR generation for calls to declarations with generic arguments. We were briefly adding the generic args to the ordinary argument list, which added complexity in several places. We now rely on the declaration-reference nodes in the IR to carry that extra info. - TODO: We actually need to make sure that this is the case, since we don't currently correctly generated specialized decl-refs when building IR for function calls The main test that would have been affected by this is `cross-compile-entry-point`, but I was not able to get that working fully with the IR. The main problem in this case was that when emitting GLSL we will need to perform certain required transformations on the IR to get legal code for GLSL. Notably: - We need to hoist entry-point parameters away from being function parameters, and make them be global variables. This is currently being hand-waved during the emit logic, but it seems way better to have it all get cleaned up in the IR first. - We need to scalarize entry-point parameters, because structure input/output is not supported as vertex input or fragment output (and it may be best to always scalarize anyway, to match HLSL semantics). (Note: "scalarize" here means to bust up structures, but not matrices/vectors)
Diffstat (limited to 'tests')
-rw-r--r--tests/bindings/binding0.hlsl2
-rw-r--r--tests/bindings/binding1.hlsl2
-rw-r--r--tests/bindings/explicit-binding.hlsl2
-rw-r--r--tests/bindings/multi-file.hlsl2
-rw-r--r--tests/bindings/packoffset.hlsl2
-rw-r--r--tests/bindings/resources-in-cbuffer.hlsl2
-rw-r--r--tests/bindings/targets-and-uavs-structure.hlsl2
-rw-r--r--tests/bindings/targets-and-uavs.hlsl2
-rw-r--r--tests/bugs/gh-103.slang2
-rw-r--r--tests/hlsl/dxsdk/AdaptiveTessellationCS40/Render.hlsl2
10 files changed, 10 insertions, 10 deletions
diff --git a/tests/bindings/binding0.hlsl b/tests/bindings/binding0.hlsl
index 7505640ae..fde91c280 100644
--- a/tests/bindings/binding0.hlsl
+++ b/tests/bindings/binding0.hlsl
@@ -1,4 +1,4 @@
-//TEST:COMPARE_HLSL: -use-ir -target dxbc-assembly -profile ps_4_0 -entry main
+//TEST:COMPARE_HLSL:-no-mangle -use-ir -target dxbc-assembly -profile ps_4_0 -entry main
// Let's first confirm that Spire can reproduce what the
// HLSL compiler would already do in the simple case (when
diff --git a/tests/bindings/binding1.hlsl b/tests/bindings/binding1.hlsl
index b35e4cce1..5d4f99064 100644
--- a/tests/bindings/binding1.hlsl
+++ b/tests/bindings/binding1.hlsl
@@ -1,4 +1,4 @@
-//TEST:COMPARE_HLSL: -use-ir -target dxbc-assembly -profile ps_4_0 -entry main
+//TEST:COMPARE_HLSL:-no-mangle -use-ir -target dxbc-assembly -profile ps_4_0 -entry main
// We want to make sure that the registers that Spire generates
// are used, even if there are "dead" parameter earlier in the program.
diff --git a/tests/bindings/explicit-binding.hlsl b/tests/bindings/explicit-binding.hlsl
index b1307ce04..90091f16f 100644
--- a/tests/bindings/explicit-binding.hlsl
+++ b/tests/bindings/explicit-binding.hlsl
@@ -1,4 +1,4 @@
-//TEST:COMPARE_HLSL: -use-ir -target dxbc-assembly -profile ps_4_0 -entry main
+//TEST:COMPARE_HLSL:-no-mangle -use-ir -target dxbc-assembly -profile ps_4_0 -entry main
// We need to allow the user to add explicit bindings to their parameters,
// and we can't go and auto-assign anything to use the same locations.
diff --git a/tests/bindings/multi-file.hlsl b/tests/bindings/multi-file.hlsl
index 6b5848cc8..aad842a02 100644
--- a/tests/bindings/multi-file.hlsl
+++ b/tests/bindings/multi-file.hlsl
@@ -1,4 +1,4 @@
-//TEST:COMPARE_HLSL: -use-ir -target dxbc-assembly -profile vs_4_0 -entry main Tests/bindings/multi-file-extra.hlsl -profile ps_4_0 -entry main
+//TEST:COMPARE_HLSL:-no-mangle -use-ir -target dxbc-assembly -profile vs_4_0 -entry main Tests/bindings/multi-file-extra.hlsl -profile ps_4_0 -entry main
// Here we are going to test that we can correctly generating bindings when we
// are presented with a program spanning multiple input files (and multiple entry points)
diff --git a/tests/bindings/packoffset.hlsl b/tests/bindings/packoffset.hlsl
index 8361d754e..80fcd3e8a 100644
--- a/tests/bindings/packoffset.hlsl
+++ b/tests/bindings/packoffset.hlsl
@@ -1,4 +1,4 @@
-//TEST:COMPARE_HLSL: -use-ir -target dxbc-assembly -profile ps_4_0 -entry main
+//TEST:COMPARE_HLSL:-no-mangle -use-ir -target dxbc-assembly -profile ps_4_0 -entry main
// Let's make sure we generate correct output in cases
// where there are non-trivial `packoffset`s needed
diff --git a/tests/bindings/resources-in-cbuffer.hlsl b/tests/bindings/resources-in-cbuffer.hlsl
index 080f4e2eb..a515b343e 100644
--- a/tests/bindings/resources-in-cbuffer.hlsl
+++ b/tests/bindings/resources-in-cbuffer.hlsl
@@ -1,4 +1,4 @@
-//TEST:COMPARE_HLSL: -use-ir -target dxbc-assembly -profile ps_4_0 -entry main
+//TEST:COMPARE_HLSL:-no-mangle -use-ir -target dxbc-assembly -profile ps_4_0 -entry main
// Confirm that resources inside constant buffers get correct locations,
// including the case where there are *multiple* constant buffers
diff --git a/tests/bindings/targets-and-uavs-structure.hlsl b/tests/bindings/targets-and-uavs-structure.hlsl
index ffe8ab2a6..06398a481 100644
--- a/tests/bindings/targets-and-uavs-structure.hlsl
+++ b/tests/bindings/targets-and-uavs-structure.hlsl
@@ -1,4 +1,4 @@
-//TEST(smoke):COMPARE_HLSL: -use-ir -target dxbc-assembly -profile ps_5_0 -entry main
+//TEST(smoke):COMPARE_HLSL:-no-mangle -use-ir -target dxbc-assembly -profile ps_5_0 -entry main
// Handle the case where the fragment shader output is
// defined a structure, and the semantics are on the sub-fields
diff --git a/tests/bindings/targets-and-uavs.hlsl b/tests/bindings/targets-and-uavs.hlsl
index 674a93050..c307bfdeb 100644
--- a/tests/bindings/targets-and-uavs.hlsl
+++ b/tests/bindings/targets-and-uavs.hlsl
@@ -1,4 +1,4 @@
-//TEST:COMPARE_HLSL: -use-ir -target dxbc-assembly -profile ps_5_0 -entry main
+//TEST:COMPARE_HLSL:-no-mangle -use-ir -target dxbc-assembly -profile ps_5_0 -entry main
// Render target outputs (`SV_Target`) and UAVs are treated
// as sharing the same binding slots in HLSL, so we need to
diff --git a/tests/bugs/gh-103.slang b/tests/bugs/gh-103.slang
index c810afc05..4e9765fb3 100644
--- a/tests/bugs/gh-103.slang
+++ b/tests/bugs/gh-103.slang
@@ -1,4 +1,4 @@
-//TEST:COMPARE_HLSL: -use-ir -profile ps_4_0 -entry main
+//TEST:COMPARE_HLSL:-no-mangle -use-ir -profile ps_4_0 -entry main
// Ensure that matrix-times-scalar works
diff --git a/tests/hlsl/dxsdk/AdaptiveTessellationCS40/Render.hlsl b/tests/hlsl/dxsdk/AdaptiveTessellationCS40/Render.hlsl
index 2fc3536c1..315291826 100644
--- a/tests/hlsl/dxsdk/AdaptiveTessellationCS40/Render.hlsl
+++ b/tests/hlsl/dxsdk/AdaptiveTessellationCS40/Render.hlsl
@@ -1,4 +1,4 @@
-//TEST(smoke):COMPARE_HLSL: -use-ir -profile vs_4_0 -entry RenderBaseVS -profile ps_4_0 -entry RenderPS -target dxbc-assembly
+//TEST(smoke):COMPARE_HLSL:-no-mangle -use-ir -profile vs_4_0 -entry RenderBaseVS -profile ps_4_0 -entry RenderPS -target dxbc-assembly
//--------------------------------------------------------------------------------------
// File: Render.hlsl
//