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
acce8dce
Commit
acce8dce
authored
Apr 28, 2017
by
John Kessenich
Committed by
GitHub
Apr 28, 2017
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #868 from TiemoJung/two_pass_io_remap
Notification phase for io remapper
parents
bbae7de0
f1bfeec7
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
53 additions
and
0 deletions
+53
-0
iomapper.cpp
glslang/MachineIndependent/iomapper.cpp
+40
-0
ShaderLang.h
glslang/Public/ShaderLang.h
+13
-0
No files found.
glslang/MachineIndependent/iomapper.cpp
View file @
acce8dce
...
@@ -201,6 +201,36 @@ public:
...
@@ -201,6 +201,36 @@ public:
const
TVarLiveMap
&
uniformList
;
const
TVarLiveMap
&
uniformList
;
};
};
struct
TNotifyUniformAdaptor
{
EShLanguage
stage
;
TIoMapResolver
&
resolver
;
inline
TNotifyUniformAdaptor
(
EShLanguage
s
,
TIoMapResolver
&
r
)
:
stage
(
s
)
,
resolver
(
r
)
{
}
inline
void
operator
()(
TVarEntryInfo
&
ent
)
{
resolver
.
notifyBinding
(
stage
,
ent
.
symbol
->
getName
().
c_str
(),
ent
.
symbol
->
getType
(),
ent
.
live
);
}
};
struct
TNotifyInOutAdaptor
{
EShLanguage
stage
;
TIoMapResolver
&
resolver
;
inline
TNotifyInOutAdaptor
(
EShLanguage
s
,
TIoMapResolver
&
r
)
:
stage
(
s
)
,
resolver
(
r
)
{
}
inline
void
operator
()(
TVarEntryInfo
&
ent
)
{
resolver
.
notifyInOut
(
stage
,
ent
.
symbol
->
getName
().
c_str
(),
ent
.
symbol
->
getType
(),
ent
.
live
);
}
};
struct
TResolverUniformAdaptor
struct
TResolverUniformAdaptor
{
{
TResolverUniformAdaptor
(
EShLanguage
s
,
TIoMapResolver
&
r
,
TInfoSink
&
i
,
bool
&
e
,
TIntermediate
&
interm
)
TResolverUniformAdaptor
(
EShLanguage
s
,
TIoMapResolver
&
r
,
TInfoSink
&
i
,
bool
&
e
,
TIntermediate
&
interm
)
...
@@ -383,6 +413,10 @@ struct TDefaultIoResolverBase : public glslang::TIoMapResolver
...
@@ -383,6 +413,10 @@ struct TDefaultIoResolverBase : public glslang::TIoMapResolver
return
-
1
;
return
-
1
;
}
}
void
notifyBinding
(
EShLanguage
stage
,
const
char
*
name
,
const
TType
&
type
,
bool
is_live
)
override
{}
void
notifyInOut
(
EShLanguage
stage
,
const
char
*
name
,
const
TType
&
type
,
bool
is_live
)
override
{}
void
endNotifications
()
override
{}
protected
:
protected
:
static
int
getLayoutSet
(
const
glslang
::
TType
&
type
)
{
static
int
getLayoutSet
(
const
glslang
::
TType
&
type
)
{
if
(
type
.
getQualifier
().
hasSet
())
if
(
type
.
getQualifier
().
hasSet
())
...
@@ -674,8 +708,14 @@ bool TIoMapper::addStage(EShLanguage stage, TIntermediate &intermediate, TInfoSi
...
@@ -674,8 +708,14 @@ bool TIoMapper::addStage(EShLanguage stage, TIntermediate &intermediate, TInfoSi
std
::
sort
(
uniformVarMap
.
begin
(),
uniformVarMap
.
end
(),
TVarEntryInfo
::
TOrderByPriority
());
std
::
sort
(
uniformVarMap
.
begin
(),
uniformVarMap
.
end
(),
TVarEntryInfo
::
TOrderByPriority
());
bool
hadError
=
false
;
bool
hadError
=
false
;
TNotifyInOutAdaptor
inOutNotify
(
stage
,
*
resolver
);
TNotifyUniformAdaptor
uniformNotify
(
stage
,
*
resolver
);
TResolverUniformAdaptor
uniformResolve
(
stage
,
*
resolver
,
infoSink
,
hadError
,
intermediate
);
TResolverUniformAdaptor
uniformResolve
(
stage
,
*
resolver
,
infoSink
,
hadError
,
intermediate
);
TResolverInOutAdaptor
inOutResolve
(
stage
,
*
resolver
,
infoSink
,
hadError
,
intermediate
);
TResolverInOutAdaptor
inOutResolve
(
stage
,
*
resolver
,
infoSink
,
hadError
,
intermediate
);
std
::
for_each
(
inVarMap
.
begin
(),
inVarMap
.
end
(),
inOutNotify
);
std
::
for_each
(
outVarMap
.
begin
(),
outVarMap
.
end
(),
inOutNotify
);
std
::
for_each
(
uniformVarMap
.
begin
(),
uniformVarMap
.
end
(),
uniformNotify
);
resolver
->
endNotifications
();
std
::
for_each
(
inVarMap
.
begin
(),
inVarMap
.
end
(),
inOutResolve
);
std
::
for_each
(
inVarMap
.
begin
(),
inVarMap
.
end
(),
inOutResolve
);
std
::
for_each
(
outVarMap
.
begin
(),
outVarMap
.
end
(),
inOutResolve
);
std
::
for_each
(
outVarMap
.
begin
(),
outVarMap
.
end
(),
inOutResolve
);
std
::
for_each
(
uniformVarMap
.
begin
(),
uniformVarMap
.
end
(),
uniformResolve
);
std
::
for_each
(
uniformVarMap
.
begin
(),
uniformVarMap
.
end
(),
uniformResolve
);
...
...
glslang/Public/ShaderLang.h
View file @
acce8dce
...
@@ -463,6 +463,13 @@ class TIoMapper;
...
@@ -463,6 +463,13 @@ class TIoMapper;
// 5) all uniforms with set but no binding defined
// 5) all uniforms with set but no binding defined
// 6) all uniforms with no binding and no set defined
// 6) all uniforms with no binding and no set defined
//
//
// mapIO will use this resolver in two phases. The first
// phase is a notification phase, calling the corresponging
// notifiy callbacks, this phase ends with a call to endNotifications.
// Phase two starts directly after the call to endNotifications
// and calls all other callbacks to validate and to get the
// bindings, sets, locations, component and color indices.
//
// NOTE: that still limit checks are applied to bindings and sets
// NOTE: that still limit checks are applied to bindings and sets
// and may result in an error.
// and may result in an error.
class
TIoMapResolver
class
TIoMapResolver
...
@@ -491,6 +498,12 @@ public:
...
@@ -491,6 +498,12 @@ public:
// Should return a value >= 0 if the current color index should be overridden.
// Should return a value >= 0 if the current color index should be overridden.
// Return -1 if the current color index (including no index) should be kept.
// Return -1 if the current color index (including no index) should be kept.
virtual
int
resolveInOutIndex
(
EShLanguage
stage
,
const
char
*
name
,
const
TType
&
type
,
bool
is_live
)
=
0
;
virtual
int
resolveInOutIndex
(
EShLanguage
stage
,
const
char
*
name
,
const
TType
&
type
,
bool
is_live
)
=
0
;
// Notification of a uniform variable
virtual
void
notifyBinding
(
EShLanguage
stage
,
const
char
*
name
,
const
TType
&
type
,
bool
is_live
)
=
0
;
// Notification of a in or out variable
virtual
void
notifyInOut
(
EShLanguage
stage
,
const
char
*
name
,
const
TType
&
type
,
bool
is_live
)
=
0
;
// Called by mapIO when it has finished the notify pass
virtual
void
endNotifications
()
=
0
;
};
};
// Make one TProgram per set of shaders that will get linked together. Add all
// Make one TProgram per set of shaders that will get linked together. Add all
...
...
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