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
1061accf
Commit
1061accf
authored
Nov 01, 2016
by
John Kessenich
Committed by
GitHub
Nov 01, 2016
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #562 from TiemoJung/io_map_control_publish
HLSL -> Spir-V: Resource mapping handler
parents
909b8afa
c2016a52
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
36 additions
and
9 deletions
+36
-9
spv.register.autoassign.rangetest.frag.out
Test/baseResults/spv.register.autoassign.rangetest.frag.out
+0
-4
ShaderLang.cpp
glslang/MachineIndependent/ShaderLang.cpp
+2
-2
iomapper.cpp
glslang/MachineIndependent/iomapper.cpp
+0
-0
iomapper.h
glslang/MachineIndependent/iomapper.h
+1
-1
ShaderLang.h
glslang/Public/ShaderLang.h
+33
-2
No files found.
Test/baseResults/spv.register.autoassign.rangetest.frag.out
View file @
1061accf
...
@@ -2,10 +2,6 @@ spv.register.autoassign.rangetest.frag
...
@@ -2,10 +2,6 @@ spv.register.autoassign.rangetest.frag
Linked fragment stage:
Linked fragment stage:
INTERNAL ERROR: mapped binding out of range: g_tScene
INTERNAL ERROR: mapped binding out of range: g_tSamp
INTERNAL ERROR: mapped binding out of range: g_tScene
INTERNAL ERROR: mapped binding out of range: g_tSamp
INTERNAL ERROR: mapped binding out of range: g_tSamp
INTERNAL ERROR: mapped binding out of range: g_tSamp
INTERNAL ERROR: mapped binding out of range: g_tScene
INTERNAL ERROR: mapped binding out of range: g_tScene
...
...
glslang/MachineIndependent/ShaderLang.cpp
View file @
1061accf
...
@@ -1716,7 +1716,7 @@ void TProgram::dumpReflection() { reflection->dump(); }
...
@@ -1716,7 +1716,7 @@ void TProgram::dumpReflection() { reflection->dump(); }
//
//
// I/O mapping implementation.
// I/O mapping implementation.
//
//
bool
TProgram
::
mapIO
()
bool
TProgram
::
mapIO
(
TIoMapResolver
*
resolver
)
{
{
if
(
!
linked
||
ioMapper
)
if
(
!
linked
||
ioMapper
)
return
false
;
return
false
;
...
@@ -1725,7 +1725,7 @@ bool TProgram::mapIO()
...
@@ -1725,7 +1725,7 @@ bool TProgram::mapIO()
for
(
int
s
=
0
;
s
<
EShLangCount
;
++
s
)
{
for
(
int
s
=
0
;
s
<
EShLangCount
;
++
s
)
{
if
(
intermediate
[
s
])
{
if
(
intermediate
[
s
])
{
if
(
!
ioMapper
->
addStage
((
EShLanguage
)
s
,
*
intermediate
[
s
],
*
infoSink
))
if
(
!
ioMapper
->
addStage
((
EShLanguage
)
s
,
*
intermediate
[
s
],
*
infoSink
,
resolver
))
return
false
;
return
false
;
}
}
}
}
...
...
glslang/MachineIndependent/iomapper.cpp
View file @
1061accf
This diff is collapsed.
Click to expand it.
glslang/MachineIndependent/iomapper.h
View file @
1061accf
...
@@ -55,7 +55,7 @@ public:
...
@@ -55,7 +55,7 @@ public:
virtual
~
TIoMapper
()
{}
virtual
~
TIoMapper
()
{}
// grow the reflection stage by stage
// grow the reflection stage by stage
bool
addStage
(
EShLanguage
,
TIntermediate
&
,
TInfoSink
&
);
bool
addStage
(
EShLanguage
,
TIntermediate
&
,
TInfoSink
&
,
TIoMapResolver
*
);
};
};
}
// end namespace glslang
}
// end namespace glslang
...
...
glslang/Public/ShaderLang.h
View file @
1061accf
...
@@ -445,7 +445,36 @@ private:
...
@@ -445,7 +445,36 @@ private:
class
TReflection
;
class
TReflection
;
class
TIoMapper
;
class
TIoMapper
;
// Make one TProgram per set of shaders that will get linked together. Add all
// Allows to customize the binding layout after linking.
// All used uniform variables will invoke at least validateBinding.
// If validateBinding returned true then the other resolveBinding
// and resolveSet are invoked to resolve the binding and descriptor
// set index respectively.
// Invocations happen in a particular order:
// 1) var with binding and set already defined
// 2) var with binding but no set defined
// 3) var with set but no binding defined
// 4) var with no binding and no set defined
//
// NOTE: that still limit checks are applied to bindings and sets
// and may result in an error.
class
TIoMapResolver
{
public
:
virtual
~
TIoMapResolver
()
{}
// Should return true if the resulting/current binding would be ok.
// Basic idea is to do aliasing binding checks with this.
virtual
bool
validateBinding
(
EShLanguage
stage
,
const
char
*
name
,
const
TType
&
type
,
bool
is_live
)
=
0
;
// Should return a value >= 0 if the current binding should be overridden.
// Return -1 if the current binding (including no binding) should be kept.
virtual
int
resolveBinding
(
EShLanguage
stage
,
const
char
*
name
,
const
TType
&
type
,
bool
is_live
)
=
0
;
// Should return a value >= 0 if the current set should be overriden.
// Return -1 if the current set (including no set) should be kept.
virtual
int
resolveSet
(
EShLanguage
stage
,
const
char
*
name
,
const
TType
&
type
,
bool
is_live
)
=
0
;
};
// Make one TProgram per set of shaders that will get linked together. Add all
// the shaders that are to be linked together. After calling shader.parse()
// the shaders that are to be linked together. After calling shader.parse()
// for all shaders, call link().
// for all shaders, call link().
//
//
...
@@ -485,7 +514,9 @@ public:
...
@@ -485,7 +514,9 @@ public:
void
dumpReflection
();
void
dumpReflection
();
// I/O mapping: apply base offsets and map live unbound variables
// I/O mapping: apply base offsets and map live unbound variables
bool
mapIO
();
// If resolver is not provided it uses the previous approach
// and respects auto assignment and offsets.
bool
mapIO
(
TIoMapResolver
*
resolver
=
NULL
);
protected
:
protected
:
bool
linkStage
(
EShLanguage
,
EShMessages
);
bool
linkStage
(
EShLanguage
,
EShMessages
);
...
...
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