summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorruki <[email protected]>2023-08-30 14:44:41 +0800
committerGitHub <[email protected]>2023-08-30 14:44:41 +0800
commita97b088a8a9c3e2a238ef5522d284f1819e53c9a (patch)
treed459c1daa946f3b8b36b44687ff42ad6a1f129b7 /tests
parent44c70cdcb4f28e2499fb893f4d2e1d17e79bac22 (diff)
parentdef8bf3dbbf85f7bca0b120f768808173ecb176c (diff)
Merge pull request #4149 from Latias94/add_hlsl2spv
Add `hlsl2spv` rule
Diffstat (limited to 'tests')
-rw-r--r--tests/projects/other/hlsl2spv/.gitignore8
-rw-r--r--tests/projects/other/hlsl2spv/src/main.c16
-rw-r--r--tests/projects/other/hlsl2spv/src/test.ps.hlsl10
-rw-r--r--tests/projects/other/hlsl2spv/src/test.vs.hlsl19
-rw-r--r--tests/projects/other/hlsl2spv/xmake.lua11
5 files changed, 64 insertions, 0 deletions
diff --git a/tests/projects/other/hlsl2spv/.gitignore b/tests/projects/other/hlsl2spv/.gitignore
new file mode 100644
index 000000000..152105761
--- /dev/null
+++ b/tests/projects/other/hlsl2spv/.gitignore
@@ -0,0 +1,8 @@
+# Xmake cache
+.xmake/
+build/
+
+# MacOS Cache
+.DS_Store
+
+
diff --git a/tests/projects/other/hlsl2spv/src/main.c b/tests/projects/other/hlsl2spv/src/main.c
new file mode 100644
index 000000000..29a65edb1
--- /dev/null
+++ b/tests/projects/other/hlsl2spv/src/main.c
@@ -0,0 +1,16 @@
+#include <stdio.h>
+
+static unsigned char g_test_vert_spv_data[] = {
+ #include "test.vs.spv.h"
+};
+
+static unsigned char g_test_frag_spv_data[] = {
+ #include "test.ps.spv.h"
+};
+
+int main(int argc, char** argv)
+{
+ printf("test.vert.spv: %s, size: %d\n", g_test_vert_spv_data, (int)sizeof(g_test_vert_spv_data));
+ printf("test.frag.spv: %s, size: %d\n", g_test_frag_spv_data, (int)sizeof(g_test_frag_spv_data));
+ return 0;
+}
diff --git a/tests/projects/other/hlsl2spv/src/test.ps.hlsl b/tests/projects/other/hlsl2spv/src/test.ps.hlsl
new file mode 100644
index 000000000..95c63d53c
--- /dev/null
+++ b/tests/projects/other/hlsl2spv/src/test.ps.hlsl
@@ -0,0 +1,10 @@
+struct PS_INPUT
+{
+ float4 pos : SV_POSITION;
+ float3 color : COLOR0;
+};
+
+float4 main(PS_INPUT input) : SV_Target
+{
+ return float4(input.color, 1.0);
+}
diff --git a/tests/projects/other/hlsl2spv/src/test.vs.hlsl b/tests/projects/other/hlsl2spv/src/test.vs.hlsl
new file mode 100644
index 000000000..97fab0408
--- /dev/null
+++ b/tests/projects/other/hlsl2spv/src/test.vs.hlsl
@@ -0,0 +1,19 @@
+struct VS_INPUT
+{
+ float2 pos : POSITION;
+ float3 color : COLOR0;
+};
+
+struct VS_OUTPUT
+{
+ float4 pos : SV_POSITION;
+ float3 color : COLOR0;
+};
+
+VS_OUTPUT main(VS_INPUT input)
+{
+ VS_OUTPUT output;
+ output.pos = float4(input.pos, 0.0, 1.0);
+ output.color = input.color;
+ return output;
+}
diff --git a/tests/projects/other/hlsl2spv/xmake.lua b/tests/projects/other/hlsl2spv/xmake.lua
new file mode 100644
index 000000000..0487fba5d
--- /dev/null
+++ b/tests/projects/other/hlsl2spv/xmake.lua
@@ -0,0 +1,11 @@
+add_rules("mode.debug", "mode.release")
+
+add_requires("glslang", {configs = {binaryonly = true}})
+
+target("test")
+ set_kind("binary")
+ add_rules("utils.hlsl2spv", {bin2c = true})
+ add_files("src/*.c")
+ add_files("src/*.hlsl", "src/*.hlsl")
+ add_packages("directxshadercompiler")
+