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
2e0f0a05
Commit
2e0f0a05
authored
May 20, 2020
by
John Kessenich
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix #2227, which was coded incorrectly, to be simpler/safer.
parent
9514c6be
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
19 deletions
+15
-19
iomapper.cpp
glslang/MachineIndependent/iomapper.cpp
+14
-18
iomapper.h
glslang/MachineIndependent/iomapper.h
+1
-1
No files found.
glslang/MachineIndependent/iomapper.cpp
View file @
2e0f0a05
...
...
@@ -579,7 +579,7 @@ TDefaultGlslIoResolver::TDefaultGlslIoResolver(const TIntermediate& intermediate
int
TDefaultGlslIoResolver
::
resolveInOutLocation
(
EShLanguage
stage
,
TVarEntryInfo
&
ent
)
{
const
TType
&
type
=
ent
.
symbol
->
getType
();
TString
&
name
=
getAccessName
(
ent
.
symbol
);
const
TString
&
name
=
getAccessName
(
ent
.
symbol
);
if
(
currentStage
!=
stage
)
{
preStage
=
currentStage
;
currentStage
=
stage
;
...
...
@@ -627,7 +627,7 @@ int TDefaultGlslIoResolver::resolveInOutLocation(EShLanguage stage, TVarEntryInf
TVarSlotMap
::
iterator
iter
=
storageSlotMap
[
resourceKey
].
find
(
name
);
if
(
iter
!=
storageSlotMap
[
resourceKey
].
end
())
{
// If interface resource be found, set it has location and this symbol's new location
// equal the symbol's explicit location declarat
ed
in pre or next stage.
// equal the symbol's explicit location declarat
ion
in pre or next stage.
//
// vs: out vec4 a;
// fs: layout(..., location = 3,...) in vec4 a;
...
...
@@ -663,7 +663,7 @@ int TDefaultGlslIoResolver::resolveInOutLocation(EShLanguage stage, TVarEntryInf
int
TDefaultGlslIoResolver
::
resolveUniformLocation
(
EShLanguage
/*stage*/
,
TVarEntryInfo
&
ent
)
{
const
TType
&
type
=
ent
.
symbol
->
getType
();
TString
&
name
=
getAccessName
(
ent
.
symbol
);
const
TString
&
name
=
getAccessName
(
ent
.
symbol
);
// kick out of not doing this
if
(
!
doAutoLocationMapping
())
{
return
ent
.
newLocation
=
-
1
;
...
...
@@ -706,7 +706,7 @@ int TDefaultGlslIoResolver::resolveUniformLocation(EShLanguage /*stage*/, TVarEn
TVarSlotMap
::
iterator
iter
=
slotMap
.
find
(
name
);
if
(
iter
!=
slotMap
.
end
())
{
// If uniform resource be found, set it has location and this symbol's new location
// equal the uniform's explicit location declarat
ed
in other stage.
// equal the uniform's explicit location declarat
ion
in other stage.
//
// vs: uniform vec4 a;
// fs: layout(..., location = 3,...) uniform vec4 a;
...
...
@@ -714,7 +714,7 @@ int TDefaultGlslIoResolver::resolveUniformLocation(EShLanguage /*stage*/, TVarEn
location
=
iter
->
second
;
}
if
(
!
hasLocation
)
{
// No explicit location declarat
e
n in other stage.
// No explicit location declarat
io
n in other stage.
// So we should find a new slot for this uniform.
//
// vs: uniform vec4 a;
...
...
@@ -723,7 +723,7 @@ int TDefaultGlslIoResolver::resolveUniformLocation(EShLanguage /*stage*/, TVarEn
storageSlotMap
[
resourceKey
][
name
]
=
location
;
}
}
else
{
// the first uniform declarat
ed
in a program.
// the first uniform declarat
ion
in a program.
TVarSlotMap
varSlotMap
;
location
=
getFreeSlot
(
resourceKey
,
0
,
size
);
varSlotMap
[
name
]
=
location
;
...
...
@@ -734,8 +734,8 @@ int TDefaultGlslIoResolver::resolveUniformLocation(EShLanguage /*stage*/, TVarEn
int
TDefaultGlslIoResolver
::
resolveBinding
(
EShLanguage
/*stage*/
,
TVarEntryInfo
&
ent
)
{
const
TType
&
type
=
ent
.
symbol
->
getType
();
TString
&
name
=
getAccessName
(
ent
.
symbol
);
// On OpenGL arrays of opaque types take a sep
e
rate binding for each element
const
TString
&
name
=
getAccessName
(
ent
.
symbol
);
// On OpenGL arrays of opaque types take a sep
a
rate binding for each element
int
numBindings
=
intermediate
.
getSpv
().
openGl
!=
0
&&
type
.
isSizedArray
()
?
type
.
getCumulativeArraySize
()
:
1
;
TResourceType
resource
=
getResourceType
(
type
);
// don't need to handle uniform symbol, it will be handled in resolveUniformLocation
...
...
@@ -809,7 +809,7 @@ void TDefaultGlslIoResolver::endCollect(EShLanguage /*stage*/) {
void
TDefaultGlslIoResolver
::
reserverStorageSlot
(
TVarEntryInfo
&
ent
,
TInfoSink
&
infoSink
)
{
const
TType
&
type
=
ent
.
symbol
->
getType
();
TString
&
name
=
getAccessName
(
ent
.
symbol
);
const
TString
&
name
=
getAccessName
(
ent
.
symbol
);
TStorageQualifier
storage
=
type
.
getQualifier
().
storage
;
EShLanguage
stage
(
EShLangCount
);
switch
(
storage
)
{
...
...
@@ -869,7 +869,7 @@ void TDefaultGlslIoResolver::reserverStorageSlot(TVarEntryInfo& ent, TInfoSink&
void
TDefaultGlslIoResolver
::
reserverResourceSlot
(
TVarEntryInfo
&
ent
,
TInfoSink
&
infoSink
)
{
const
TType
&
type
=
ent
.
symbol
->
getType
();
TString
&
name
=
getAccessName
(
ent
.
symbol
);
const
TString
&
name
=
getAccessName
(
ent
.
symbol
);
int
resource
=
getResourceType
(
type
);
if
(
type
.
getQualifier
().
hasBinding
())
{
TVarSlotMap
&
varSlotMap
=
resourceSlotMap
[
resource
];
...
...
@@ -892,15 +892,11 @@ void TDefaultGlslIoResolver::reserverResourceSlot(TVarEntryInfo& ent, TInfoSink&
}
}
TString
&
TDefaultGlslIoResolver
::
getAccessName
(
const
TIntermSymbol
*
symbol
)
const
TString
&
TDefaultGlslIoResolver
::
getAccessName
(
const
TIntermSymbol
*
symbol
)
{
TString
name
;
if
(
symbol
->
getBasicType
()
==
EbtBlock
)
{
name
=
symbol
->
getType
().
getTypeName
();
}
else
{
name
=
symbol
->
getName
();
}
return
name
;
return
symbol
->
getBasicType
()
==
EbtBlock
?
symbol
->
getType
().
getTypeName
()
:
symbol
->
getName
();
}
//TDefaultGlslIoResolver end
...
...
glslang/MachineIndependent/iomapper.h
View file @
2e0f0a05
...
...
@@ -203,7 +203,7 @@ public:
void
endCollect
(
EShLanguage
)
override
;
void
reserverStorageSlot
(
TVarEntryInfo
&
ent
,
TInfoSink
&
infoSink
)
override
;
void
reserverResourceSlot
(
TVarEntryInfo
&
ent
,
TInfoSink
&
infoSink
)
override
;
TString
&
getAccessName
(
const
TIntermSymbol
*
);
const
TString
&
getAccessName
(
const
TIntermSymbol
*
);
// in/out symbol and uniform symbol are stored in the same resourceSlotMap, the storage key is used to identify each type of symbol.
// We use stage and storage qualifier to construct a storage key. it can help us identify the same storage resource used in different stage.
// if a resource is a program resource and we don't need know it usage stage, we can use same stage to build storage key.
...
...
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