summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/cross-compile/compile-time-loop.slang14
-rw-r--r--tests/cross-compile/compile-time-loop.slang.glsl33
2 files changed, 47 insertions, 0 deletions
diff --git a/tests/cross-compile/compile-time-loop.slang b/tests/cross-compile/compile-time-loop.slang
new file mode 100644
index 000000000..aae35f09e
--- /dev/null
+++ b/tests/cross-compile/compile-time-loop.slang
@@ -0,0 +1,14 @@
+//TEST:CROSS_COMPILE: -profile ps_5_0 -entry main -target spirv-assembly
+
+Texture2D t;
+SamplerState s;
+
+float4 main(float2 uv) : SV_Target
+{
+ float4 result = 0;
+ $for(i in Range(0,5))
+ {
+ result += t.Sample(s, uv, int2(i - 2, 0));
+ }
+ return result;
+}
diff --git a/tests/cross-compile/compile-time-loop.slang.glsl b/tests/cross-compile/compile-time-loop.slang.glsl
new file mode 100644
index 000000000..a1f87be65
--- /dev/null
+++ b/tests/cross-compile/compile-time-loop.slang.glsl
@@ -0,0 +1,33 @@
+//TEST_IGNORE_FILE:
+
+layout(binding = 0)
+uniform texture2D t;
+
+layout(binding = 1)
+uniform sampler s;
+
+vec4 main_(vec2 uv)
+{
+ vec4 result = vec4(0);
+
+ result += textureOffset(sampler2D(t,s), uv, ivec2(0 - 2, 0));
+ result += textureOffset(sampler2D(t,s), uv, ivec2(1 - 2, 0));
+ result += textureOffset(sampler2D(t,s), uv, ivec2(2 - 2, 0));
+ result += textureOffset(sampler2D(t,s), uv, ivec2(3 - 2, 0));
+ result += textureOffset(sampler2D(t,s), uv, ivec2(4 - 2, 0));
+
+ return result;
+}
+
+layout(location = 0)
+in vec2 SLANG_in_uv;
+
+layout(location = 0)
+out vec4 SLANG_out_main_result;
+
+void main()
+{
+ vec2 uv = SLANG_in_uv;
+ vec4 main_result = main_(uv);
+ SLANG_out_main_result = main_result;
+} \ No newline at end of file