summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorLatias94 <[email protected]>2023-08-30 14:06:31 +0800
committerLatias94 <[email protected]>2023-08-30 14:06:31 +0800
commitdb699f189067513da3b591e9d9a1edeb59ade8b4 (patch)
tree60ef1fd5045c22a1ac7ea86cdaa9934f6973e518 /tests
parent44c70cdcb4f28e2499fb893f4d2e1d17e79bac22 (diff)
feat: add hlsl2spv
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.hlsl20
-rw-r--r--tests/projects/other/hlsl2spv/xmake.lua11
5 files changed, 65 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..ca2cf875d
--- /dev/null
+++ b/tests/projects/other/hlsl2spv/src/test.vs.hlsl
@@ -0,0 +1,20 @@
+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")
+