mirror of
https://github.com/KhronosGroup/glslang
synced 2024-11-08 11:30:06 +00:00
Fix #2264: OpEntryPoint incorrectly including function parameters.
This commit is contained in:
parent
68b2e15ee0
commit
c30d335377
@ -1711,16 +1711,19 @@ void TGlslangToSpvTraverser::visitSymbol(glslang::TIntermSymbol* symbol)
|
||||
spv::Id id = getSymbolId(symbol);
|
||||
|
||||
if (builder.isPointer(id)) {
|
||||
// Include all "static use" and "linkage only" interface variables on the OpEntryPoint instruction
|
||||
// Consider adding to the OpEntryPoint interface list.
|
||||
// Only looking at structures if they have at least one member.
|
||||
if (!symbol->getType().isStruct() || symbol->getType().getStruct()->size() > 0) {
|
||||
spv::StorageClass sc = builder.getStorageClass(id);
|
||||
// Before SPIR-V 1.4, we only want to include Input and Output.
|
||||
// Starting with SPIR-V 1.4, we want all globals.
|
||||
if ((glslangIntermediate->getSpv().spv >= glslang::EShTargetSpv_1_4 && sc != spv::StorageClassFunction) ||
|
||||
(sc == spv::StorageClassInput || sc == spv::StorageClassOutput)) {
|
||||
iOSet.insert(id);
|
||||
if (!symbol->getType().getQualifier().isParamInput() &&
|
||||
!symbol->getType().getQualifier().isParamOutput()) {
|
||||
// Include all "static use" and "linkage only" interface variables on the OpEntryPoint instruction
|
||||
// Consider adding to the OpEntryPoint interface list.
|
||||
// Only looking at structures if they have at least one member.
|
||||
if (!symbol->getType().isStruct() || symbol->getType().getStruct()->size() > 0) {
|
||||
spv::StorageClass sc = builder.getStorageClass(id);
|
||||
// Before SPIR-V 1.4, we only want to include Input and Output.
|
||||
// Starting with SPIR-V 1.4, we want all globals.
|
||||
if ((glslangIntermediate->getSpv().spv >= glslang::EShTargetSpv_1_4 && sc != spv::StorageClassFunction) ||
|
||||
(sc == spv::StorageClassInput || sc == spv::StorageClassOutput)) {
|
||||
iOSet.insert(id);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
72
Test/baseResults/spv.1.4.OpEntryPoint.opaqueParams.vert.out
Executable file
72
Test/baseResults/spv.1.4.OpEntryPoint.opaqueParams.vert.out
Executable file
@ -0,0 +1,72 @@
|
||||
spv.1.4.OpEntryPoint.opaqueParams.vert
|
||||
// Module Version 10400
|
||||
// Generated by (magic number): 80008
|
||||
// Id's are bound by 45
|
||||
|
||||
Capability Shader
|
||||
Capability ImageQuery
|
||||
1: ExtInstImport "GLSL.std.450"
|
||||
MemoryModel Logical GLSL450
|
||||
EntryPoint Vertex 4 "main" 41 42 43
|
||||
Source GLSL 450
|
||||
Name 4 "main"
|
||||
Name 18 "funOpaque(s21;t21;p1;"
|
||||
Name 15 "s2D"
|
||||
Name 16 "t2D"
|
||||
Name 17 "s"
|
||||
Name 40 "size"
|
||||
Name 41 "s2D"
|
||||
Name 42 "t2D"
|
||||
Name 43 "s"
|
||||
Decorate 41(s2D) DescriptorSet 0
|
||||
Decorate 41(s2D) Binding 0
|
||||
Decorate 42(t2D) DescriptorSet 0
|
||||
Decorate 42(t2D) Binding 1
|
||||
Decorate 43(s) DescriptorSet 0
|
||||
Decorate 43(s) Binding 3
|
||||
2: TypeVoid
|
||||
3: TypeFunction 2
|
||||
6: TypeFloat 32
|
||||
7: TypeImage 6(float) 2D sampled format:Unknown
|
||||
8: TypeSampledImage 7
|
||||
9: TypePointer UniformConstant 8
|
||||
10: TypePointer UniformConstant 7
|
||||
11: TypeSampler
|
||||
12: TypePointer UniformConstant 11
|
||||
13: TypeVector 6(float) 2
|
||||
14: TypeFunction 13(fvec2) 9(ptr) 10(ptr) 12(ptr)
|
||||
21: TypeInt 32 1
|
||||
22: 21(int) Constant 0
|
||||
24: TypeVector 21(int) 2
|
||||
30: 6(float) Constant 1056964608
|
||||
31: 13(fvec2) ConstantComposite 30 30
|
||||
32: TypeVector 6(float) 4
|
||||
33: 6(float) Constant 0
|
||||
39: TypePointer Function 13(fvec2)
|
||||
41(s2D): 9(ptr) Variable UniformConstant
|
||||
42(t2D): 10(ptr) Variable UniformConstant
|
||||
43(s): 12(ptr) Variable UniformConstant
|
||||
4(main): 2 Function None 3
|
||||
5: Label
|
||||
40(size): 39(ptr) Variable Function
|
||||
44: 13(fvec2) FunctionCall 18(funOpaque(s21;t21;p1;) 41(s2D) 42(t2D) 43(s)
|
||||
Store 40(size) 44
|
||||
Return
|
||||
FunctionEnd
|
||||
18(funOpaque(s21;t21;p1;): 13(fvec2) Function None 14
|
||||
15(s2D): 9(ptr) FunctionParameter
|
||||
16(t2D): 10(ptr) FunctionParameter
|
||||
17(s): 12(ptr) FunctionParameter
|
||||
19: Label
|
||||
20: 8 Load 15(s2D)
|
||||
23: 7 Image 20
|
||||
25: 24(ivec2) ImageQuerySizeLod 23 22
|
||||
26: 13(fvec2) ConvertSToF 25
|
||||
27: 7 Load 16(t2D)
|
||||
28: 11 Load 17(s)
|
||||
29: 8 SampledImage 27 28
|
||||
34: 32(fvec4) ImageSampleExplicitLod 29 31 Lod 33
|
||||
35: 13(fvec2) VectorShuffle 34 34 0 1
|
||||
36: 13(fvec2) FMul 26 35
|
||||
ReturnValue 36
|
||||
FunctionEnd
|
15
Test/spv.1.4.OpEntryPoint.opaqueParams.vert
Normal file
15
Test/spv.1.4.OpEntryPoint.opaqueParams.vert
Normal file
@ -0,0 +1,15 @@
|
||||
#version 450
|
||||
|
||||
layout(binding = 0) uniform sampler2D s2D;
|
||||
layout(binding = 1) uniform texture2D t2D;
|
||||
layout(binding = 3) uniform sampler s;
|
||||
|
||||
vec2 funOpaque(in sampler2D s2D, texture2D t2D, sampler s)
|
||||
{
|
||||
return textureSize(s2D, 0) * texture(sampler2D(t2D, s), vec2(0.5)).xy;
|
||||
}
|
||||
|
||||
void main()
|
||||
{
|
||||
vec2 size = funOpaque(s2D, t2D, s);
|
||||
}
|
@ -534,6 +534,7 @@ INSTANTIATE_TEST_CASE_P(
|
||||
"spv.1.4.LoopControl.frag",
|
||||
"spv.1.4.NonWritable.frag",
|
||||
"spv.1.4.OpEntryPoint.frag",
|
||||
"spv.1.4.OpEntryPoint.opaqueParams.vert",
|
||||
"spv.1.4.OpSelect.frag",
|
||||
"spv.1.4.OpCopyLogical.comp",
|
||||
"spv.1.4.OpCopyLogicalBool.comp",
|
||||
|
Loading…
Reference in New Issue
Block a user