summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--source/slang/slang-ir-translate-glsl-global-var.cpp9
-rw-r--r--tests/bugs/gh-4345.slang32
2 files changed, 33 insertions, 8 deletions
diff --git a/source/slang/slang-ir-translate-glsl-global-var.cpp b/source/slang/slang-ir-translate-glsl-global-var.cpp
index d070cee68..42e70ac78 100644
--- a/source/slang/slang-ir-translate-glsl-global-var.cpp
+++ b/source/slang/slang-ir-translate-glsl-global-var.cpp
@@ -79,10 +79,6 @@ namespace Slang
auto inputType = cast<IRPtrTypeBase>(input->getDataType())->getValueType();
auto key = builder.createStructKey();
inputKeys.add(key);
- if (auto nameHint = input->findDecoration<IRNameHintDecoration>())
- {
- builder.addNameHintDecoration(key, nameHint->getName());
- }
builder.createStructField(inputStructType, key, inputType);
IRTypeLayout::Builder fieldTypeLayout(&builder);
IRVarLayout::Builder varLayoutBuilder(&builder, fieldTypeLayout.build());
@@ -151,10 +147,6 @@ namespace Slang
for (auto output : outputVars)
{
auto key = builder.createStructKey();
- if (auto nameHint = output->findDecoration<IRNameHintDecoration>())
- {
- builder.addNameHintDecoration(key, nameHint->getName());
- }
auto ptrType = as<IRPtrTypeBase>(output->getDataType());
builder.createStructField(resultType, key, ptrType->getValueType());
IRTypeLayout::Builder fieldTypeLayout(&builder);
@@ -183,6 +175,7 @@ namespace Slang
outputVarIndex++;
}
typeLayoutBuilder.addField(key, varLayoutBuilder.build());
+ output->transferDecorationsTo(key);
}
auto resultTypeLayout = typeLayoutBuilder.build();
IRVarLayout::Builder resultVarLayoutBuilder(&builder, resultTypeLayout);
diff --git a/tests/bugs/gh-4345.slang b/tests/bugs/gh-4345.slang
new file mode 100644
index 000000000..8761610a0
--- /dev/null
+++ b/tests/bugs/gh-4345.slang
@@ -0,0 +1,32 @@
+//TEST:SIMPLE(filecheck=CHECK):-target spirv-asm -entry main -stage vertex -allow-glsl
+
+// CHECK: OpDecorate %{{.*}} Flat
+
+#version 450
+layout(set = 1, binding = 0) uniform highp isampler1D texSampler[8];
+
+layout(location = 0) in highp vec4 a_position;
+layout(location = 1) in highp float a_coords;
+layout(location = 0) flat out highp ivec4 vtx_out_result0;
+layout(location = 1) flat out highp ivec4 vtx_out_result1;
+layout(location = 2) flat out highp ivec4 vtx_out_result2;
+layout(location = 3) flat out highp ivec4 vtx_out_result3;
+
+void main (void)
+{
+ gl_Position = a_position;
+ gl_PointSize = 1.0;
+ highp float coords = a_coords;
+ highp ivec4 result0;
+ highp ivec4 result1;
+ highp ivec4 result2;
+ highp ivec4 result3;
+ result0 = textureLod(texSampler[3], coords, 0.0);
+ result1 = textureLod(texSampler[2], coords, 0.0);
+ result2 = textureLod(texSampler[7], coords, 0.0);
+ result3 = textureLod(texSampler[2], coords, 0.0);
+ vtx_out_result0 = result0;
+ vtx_out_result1 = result1;
+ vtx_out_result2 = result2;
+ vtx_out_result3 = result3;
+} \ No newline at end of file