Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
glslang
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Chen Yisong
glslang
Commits
c30d3353
Commit
c30d3353
authored
Jun 10, 2020
by
John Kessenich
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix #2264: OpEntryPoint incorrectly including function parameters.
parent
68b2e15e
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
102 additions
and
10 deletions
+102
-10
GlslangToSpv.cpp
SPIRV/GlslangToSpv.cpp
+13
-10
spv.1.4.OpEntryPoint.opaqueParams.vert.out
Test/baseResults/spv.1.4.OpEntryPoint.opaqueParams.vert.out
+72
-0
spv.1.4.OpEntryPoint.opaqueParams.vert
Test/spv.1.4.OpEntryPoint.opaqueParams.vert
+16
-0
Spv.FromFile.cpp
gtests/Spv.FromFile.cpp
+1
-0
No files found.
SPIRV/GlslangToSpv.cpp
View file @
c30d3353
...
...
@@ -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
);
}
}
}
...
...
Test/baseResults/spv.1.4.OpEntryPoint.opaqueParams.vert.out
0 → 100755
View file @
c30d3353
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
Test/spv.1.4.OpEntryPoint.opaqueParams.vert
0 → 100644
View file @
c30d3353
#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
);
}
\ No newline at end of file
gtests/Spv.FromFile.cpp
View file @
c30d3353
...
...
@@ -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"
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment