summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRobert Stepinski <rob.stepinski@gmail.com>2019-08-16 11:30:48 -0400
committerTim Foley <tfoleyNV@users.noreply.github.com>2019-08-16 08:30:48 -0700
commitc4541e83b4a57d8317932bc4277ee6a2d45bb2f6 (patch)
tree2e6add905907d22e003c173fb3b0d3eda9485972
parent77fe3dd74446fb07dd0de31114f7033f111ef868 (diff)
Fix a typo in core.meta.slang which was causing an assert when (#1024)
compiling shaders that used texture2DMS Load() operations
-rw-r--r--source/slang/core.meta.slang2
-rw-r--r--source/slang/core.meta.slang.h2
-rw-r--r--tests/bugs/texture2d-ms.hlsl10
-rw-r--r--tests/bugs/texture2d-ms.hlsl.expected55
-rw-r--r--tests/bugs/texture2d-ms.hlsl.glsl16
5 files changed, 83 insertions, 2 deletions
diff --git a/source/slang/core.meta.slang b/source/slang/core.meta.slang
index f61f00d64..3b94c4e05 100644
--- a/source/slang/core.meta.slang
+++ b/source/slang/core.meta.slang
@@ -705,7 +705,7 @@ for (int tt = 0; tt < kBaseTextureTypeCount; ++tt)
if (isMultisample)
{
sb << "__glsl_extension(GL_EXT_samplerless_texture_functions)";
- sb << "__target_intrinsic(glsl, \"$c" << glslFuncName << "($0, $1, $3)$z\")\n";
+ sb << "__target_intrinsic(glsl, \"$c" << glslFuncName << "($0, $1, $2)$z\")\n";
}
else
{
diff --git a/source/slang/core.meta.slang.h b/source/slang/core.meta.slang.h
index 0e24dd711..cc8b796e0 100644
--- a/source/slang/core.meta.slang.h
+++ b/source/slang/core.meta.slang.h
@@ -723,7 +723,7 @@ for (int tt = 0; tt < kBaseTextureTypeCount; ++tt)
if (isMultisample)
{
sb << "__glsl_extension(GL_EXT_samplerless_texture_functions)";
- sb << "__target_intrinsic(glsl, \"$c" << glslFuncName << "($0, $1, $3)$z\")\n";
+ sb << "__target_intrinsic(glsl, \"$c" << glslFuncName << "($0, $1, $2)$z\")\n";
}
else
{
diff --git a/tests/bugs/texture2d-ms.hlsl b/tests/bugs/texture2d-ms.hlsl
new file mode 100644
index 000000000..8a898b299
--- /dev/null
+++ b/tests/bugs/texture2d-ms.hlsl
@@ -0,0 +1,10 @@
+//TEST:CROSS_COMPILE: -profile lib_6_3 -entry main -stage compute -target spirv-assembly
+
+[[vk::binding(0, 0)]]
+Texture2DMS tex : register(t1);
+
+[numthreads(4, 4, 1)]
+void main(uint3 groupId : SV_GroupID)
+{
+ tex.Load(groupId.xy, 0);
+}
diff --git a/tests/bugs/texture2d-ms.hlsl.expected b/tests/bugs/texture2d-ms.hlsl.expected
new file mode 100644
index 000000000..2202bbbec
--- /dev/null
+++ b/tests/bugs/texture2d-ms.hlsl.expected
@@ -0,0 +1,55 @@
+result code = 0
+standard error = {
+}
+standard output = {
+// Module Version 10000
+// Generated by (magic number): 80007
+// Id's are bound by 30
+
+ Capability Shader
+ 1: ExtInstImport "GLSL.std.450"
+ MemoryModel Logical GLSL450
+ EntryPoint GLCompute 4 "main" 17
+ ExecutionMode 4 LocalSize 4 4 1
+ Source GLSL 450
+ SourceExtension "GL_EXT_samplerless_texture_functions"
+ SourceExtension "GL_GOOGLE_cpp_style_line_directive"
+ Name 4 "main"
+ Name 9 "_S1"
+ Name 12 "tex_0"
+ Name 17 "gl_WorkGroupID"
+ Decorate 12(tex_0) DescriptorSet 0
+ Decorate 12(tex_0) Binding 0
+ Decorate 17(gl_WorkGroupID) BuiltIn WorkgroupId
+ Decorate 29 BuiltIn WorkgroupSize
+ 2: TypeVoid
+ 3: TypeFunction 2
+ 6: TypeFloat 32
+ 7: TypeVector 6(float) 4
+ 8: TypePointer Function 7(fvec4)
+ 10: TypeImage 6(float) 2D multi-sampled sampled format:Unknown
+ 11: TypePointer UniformConstant 10
+ 12(tex_0): 11(ptr) Variable UniformConstant
+ 14: TypeInt 32 0
+ 15: TypeVector 14(int) 3
+ 16: TypePointer Input 15(ivec3)
+17(gl_WorkGroupID): 16(ptr) Variable Input
+ 18: TypeVector 14(int) 2
+ 21: TypeInt 32 1
+ 22: TypeVector 21(int) 2
+ 24: 21(int) Constant 0
+ 27: 14(int) Constant 4
+ 28: 14(int) Constant 1
+ 29: 15(ivec3) ConstantComposite 27 27 28
+ 4(main): 2 Function None 3
+ 5: Label
+ 9(_S1): 8(ptr) Variable Function
+ 13: 10 Load 12(tex_0)
+ 19: 15(ivec3) Load 17(gl_WorkGroupID)
+ 20: 18(ivec2) VectorShuffle 19 19 0 1
+ 23: 22(ivec2) Bitcast 20
+ 25: 7(fvec4) ImageFetch 13 23 Sample 24
+ Store 9(_S1) 25
+ Return
+ FunctionEnd
+}
diff --git a/tests/bugs/texture2d-ms.hlsl.glsl b/tests/bugs/texture2d-ms.hlsl.glsl
new file mode 100644
index 000000000..ba0d571dd
--- /dev/null
+++ b/tests/bugs/texture2d-ms.hlsl.glsl
@@ -0,0 +1,16 @@
+// texture2d-ms.hlsl.glsl
+//TEST_IGNORE_FILE:
+
+#version 450
+layout(row_major) uniform;
+layout(row_major) buffer;
+#extension GL_EXT_samplerless_texture_functions : require
+layout(binding = 0)
+uniform texture2DMS tex_0;
+
+layout(local_size_x = 4, local_size_y = 4, local_size_z = 1) in;void main()
+{
+ vec4 _S1 = (texelFetch((tex_0), (ivec2(gl_WorkGroupID.xy)), (0)));
+ return;
+}
+