summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorYong He <yonghe@outlook.com>2018-01-17 14:48:07 -0500
committerYong He <yonghe@outlook.com>2018-01-17 20:54:56 -0500
commitcaf6f7a03793be3fc74683994414776f3604ad8a (patch)
treed9d3e3a4e4a45d5e09d613159be2faaf137e0e72 /tests
parent68f529af8d0eb8ec45a2d73e82c4ee372015ce01 (diff)
All compiler fixes to get ir branch work with falcor feature demo.
- support overloaded generic function. this involves adding a new expression type, `OverloadedExpr2` to hold the candidate expressions for the generic function decl being referenced. - make BitNot a normal IROp instead of an IRPseudoOp - make sure we clone the decorations of parameters when cloning ir functions - propagate geometry shader entry point attributes (`[maxvertexcount]` and `[instance]`) through HLSL emit - IR emit: handle geometry shader entry-point parameter decorations, such as 'triangle'. - IR emit: treat geometry shader stream output typed ir value as `should fold into use`.
Diffstat (limited to 'tests')
-rw-r--r--tests/compute/generics-overload.expected.txt4
-rw-r--r--tests/compute/generics-overload.slang32
2 files changed, 36 insertions, 0 deletions
diff --git a/tests/compute/generics-overload.expected.txt b/tests/compute/generics-overload.expected.txt
new file mode 100644
index 000000000..98798bd61
--- /dev/null
+++ b/tests/compute/generics-overload.expected.txt
@@ -0,0 +1,4 @@
+0
+3F800000
+40000000
+40400000 \ No newline at end of file
diff --git a/tests/compute/generics-overload.slang b/tests/compute/generics-overload.slang
new file mode 100644
index 000000000..e530acb59
--- /dev/null
+++ b/tests/compute/generics-overload.slang
@@ -0,0 +1,32 @@
+//TEST(smoke,compute):COMPARE_COMPUTE:-xslang -use-ir
+//TEST_INPUT:ubuffer(data=[0 0 0 0], stride=4):dxbinding(0),glbinding(0),out
+// Confirm that generics syntax can be used in user
+// code and generates valid output.
+
+RWStructuredBuffer<float> outputBuffer;
+
+
+__generic<T>
+T test(T val)
+{
+ return val;
+}
+
+__generic<T>
+T test(T val, int a)
+{
+ return val;
+}
+
+
+[numthreads(4, 1, 1)]
+void computeMain(uint3 dispatchThreadID : SV_DispatchThreadID)
+{
+ uint tid = dispatchThreadID.x;
+
+ float inVal = float(tid);
+
+ float outVal = test<float>(inVal, 0);
+
+ outputBuffer[tid] = outVal;
+} \ No newline at end of file