summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorTim Foley <tfoleyNV@users.noreply.github.com>2017-07-19 10:20:12 -0700
committerGitHub <noreply@github.com>2017-07-19 10:20:12 -0700
commitc5ed9e8d6bc1668d6075b42b17d65a97c168c98b (patch)
treef8016cf92678a6dfaa1903a161ebcad78f0f42d0 /tests
parenta727017340165d02977387e1e1a2a7e328308295 (diff)
parent55a29042a2826f26272c9e1b65cd3745bad3ee31 (diff)
Merge pull request #124 from tfoleyNV/gh-122
Fix up translation of `GetDimensions()`
Diffstat (limited to 'tests')
-rw-r--r--tests/bugs/gh-122.slang15
-rw-r--r--tests/bugs/gh-122.slang.glsl32
2 files changed, 47 insertions, 0 deletions
diff --git a/tests/bugs/gh-122.slang b/tests/bugs/gh-122.slang
new file mode 100644
index 000000000..1a011df37
--- /dev/null
+++ b/tests/bugs/gh-122.slang
@@ -0,0 +1,15 @@
+//TEST:CROSS_COMPILE: -profile ps_5_0 -entry main -target spirv-assembly
+
+// Ensure that `GetDimensions` with `mipCount` output works
+// on a `Texture2D`
+
+layout(binding = 1)
+Texture2D t;
+
+float4 main() : SV_Target
+{
+ uint x, y, mipCount;
+ t.GetDimensions(0, x, y, mipCount);
+
+ return float4(x, y, mipCount, 0);
+}
diff --git a/tests/bugs/gh-122.slang.glsl b/tests/bugs/gh-122.slang.glsl
new file mode 100644
index 000000000..a6f43256e
--- /dev/null
+++ b/tests/bugs/gh-122.slang.glsl
@@ -0,0 +1,32 @@
+#version 450
+//TEST_IGNORE_FILE:
+
+layout(binding = 0)
+uniform sampler SLANG_hack_samplerForTexelFetch;
+
+layout(binding = 1)
+uniform texture2D t;
+
+vec4 main_()
+{
+ uint x, y, mipCount;
+
+ x = textureSize(sampler2D(t,SLANG_hack_samplerForTexelFetch), 0).x;
+ y = textureSize(sampler2D(t,SLANG_hack_samplerForTexelFetch), 0).y;
+ mipCount = textureQueryLevels(sampler2D(t,SLANG_hack_samplerForTexelFetch));
+
+ return vec4(
+ float(x),
+ float(y),
+ float(mipCount),
+ 0.0);
+}
+
+layout(location = 0)
+out vec4 SLANG_out_main_result;
+
+void main()
+{
+ vec4 main_result = main_();
+ SLANG_out_main_result = main_result;
+}