summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorYong He <yonghe@outlook.com>2022-08-16 17:11:54 -0700
committerGitHub <noreply@github.com>2022-08-16 17:11:54 -0700
commit42f49937ffa69c82e333e886952eed027e12340e (patch)
tree08e3e9821dd40e23476060215d589e29092adb53 /tests
parente68fab2bda5d979f8d991fc41122bb9aa71849a6 (diff)
Add gfx interface definition in Slang. (#2364)
* Add gfx interface definition in Slang. - add gfx interface definitons in Slang. - fix slang compiler to correctly type-check `out` interface argument. - modify gfx interface to be fully COM compatible - add convenient ShaderProgram creation methods to gfx. * Fix compile errors and warnings. * Update project files * Fix cuda. * Properly implement queryInterface in command encoder impls. Co-authored-by: Yong He <yhe@nvidia.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/bugs/interface-lvalue.slang36
-rw-r--r--tests/bugs/interface-lvalue.slang.expected6
2 files changed, 42 insertions, 0 deletions
diff --git a/tests/bugs/interface-lvalue.slang b/tests/bugs/interface-lvalue.slang
new file mode 100644
index 000000000..87cfa54ed
--- /dev/null
+++ b/tests/bugs/interface-lvalue.slang
@@ -0,0 +1,36 @@
+//TEST:EXECUTABLE:
+__target_intrinsic(cpp, "printf(\"%s\\n\", ($0).getBuffer())")
+void writeln(String text);
+
+[COM("BE18F5D2-4522-4AB0-A6EE-1D157FA2B083")]
+interface IFoo
+{
+ int method();
+};
+
+class Impl : IFoo
+{
+ __init() { }
+ int method()
+ {
+ return 0;
+ }
+}
+
+void createFoo(out IFoo val)
+{
+ Impl resuult = new Impl();
+ val = resuult;
+}
+
+public __extern_cpp int main()
+{
+ IFoo v;
+ createFoo(v);
+
+ if (v.method() == 0)
+ writeln("succ");
+ else
+ writeln("fail");
+ return 0;
+}
diff --git a/tests/bugs/interface-lvalue.slang.expected b/tests/bugs/interface-lvalue.slang.expected
new file mode 100644
index 000000000..981dcfc29
--- /dev/null
+++ b/tests/bugs/interface-lvalue.slang.expected
@@ -0,0 +1,6 @@
+result code = 0
+standard error = {
+}
+standard output = {
+succ
+}