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
7bc04732
Unverified
Commit
7bc04732
authored
Sep 25, 2019
by
John Kessenich
Committed by
GitHub
Sep 25, 2019
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #1906 from ShchchowAMD/master
Reflection will crash when the VS input symbol defines the same name with FS output symbol
parents
973d0e53
f4b2ba2c
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
32 additions
and
4 deletions
+32
-4
ShaderLang.cpp
glslang/MachineIndependent/ShaderLang.cpp
+3
-0
reflection.cpp
glslang/MachineIndependent/reflection.cpp
+9
-4
reflection.h
glslang/MachineIndependent/reflection.h
+16
-0
ShaderLang.h
glslang/Public/ShaderLang.h
+4
-0
No files found.
glslang/MachineIndependent/ShaderLang.cpp
View file @
7bc04732
...
@@ -2048,6 +2048,9 @@ bool TProgram::buildReflection(int opts)
...
@@ -2048,6 +2048,9 @@ bool TProgram::buildReflection(int opts)
unsigned
TProgram
::
getLocalSize
(
int
dim
)
const
{
return
reflection
->
getLocalSize
(
dim
);
}
unsigned
TProgram
::
getLocalSize
(
int
dim
)
const
{
return
reflection
->
getLocalSize
(
dim
);
}
int
TProgram
::
getReflectionIndex
(
const
char
*
name
)
const
{
return
reflection
->
getIndex
(
name
);
}
int
TProgram
::
getReflectionIndex
(
const
char
*
name
)
const
{
return
reflection
->
getIndex
(
name
);
}
int
TProgram
::
getReflectionPipeIOIndex
(
const
char
*
name
,
const
bool
inOrOut
)
const
{
return
reflection
->
getPipeIOIndex
(
name
,
inOrOut
);
}
int
TProgram
::
getNumUniformVariables
()
const
{
return
reflection
->
getNumUniforms
();
}
int
TProgram
::
getNumUniformVariables
()
const
{
return
reflection
->
getNumUniforms
();
}
const
TObjectReflection
&
TProgram
::
getUniform
(
int
index
)
const
{
return
reflection
->
getUniform
(
index
);
}
const
TObjectReflection
&
TProgram
::
getUniform
(
int
index
)
const
{
return
reflection
->
getUniform
(
index
);
}
int
TProgram
::
getNumUniformBlocks
()
const
{
return
reflection
->
getNumUniformBlocks
();
}
int
TProgram
::
getNumUniformBlocks
()
const
{
return
reflection
->
getNumUniformBlocks
();
}
...
...
glslang/MachineIndependent/reflection.cpp
View file @
7bc04732
...
@@ -112,6 +112,10 @@ public:
...
@@ -112,6 +112,10 @@ public:
TReflection
::
TMapIndexToReflection
&
ioItems
=
TReflection
::
TMapIndexToReflection
&
ioItems
=
input
?
reflection
.
indexToPipeInput
:
reflection
.
indexToPipeOutput
;
input
?
reflection
.
indexToPipeInput
:
reflection
.
indexToPipeOutput
;
TReflection
::
TNameToIndex
&
ioMapper
=
input
?
reflection
.
pipeInNameToIndex
:
reflection
.
pipeOutNameToIndex
;
if
(
reflection
.
options
&
EShReflectionUnwrapIOBlocks
)
{
if
(
reflection
.
options
&
EShReflectionUnwrapIOBlocks
)
{
bool
anonymous
=
IsAnonymous
(
name
);
bool
anonymous
=
IsAnonymous
(
name
);
...
@@ -129,12 +133,13 @@ public:
...
@@ -129,12 +133,13 @@ public:
blowUpIOAggregate
(
input
,
baseName
,
type
);
blowUpIOAggregate
(
input
,
baseName
,
type
);
}
}
}
else
{
}
else
{
TReflection
::
TNameToIndex
::
const_iterator
it
=
reflection
.
nameToIndex
.
find
(
name
.
c_str
());
TReflection
::
TNameToIndex
::
const_iterator
it
=
ioMapper
.
find
(
name
.
c_str
());
if
(
it
==
reflection
.
nameToIndex
.
end
())
{
if
(
it
==
ioMapper
.
end
())
{
reflection
.
nameToIndex
[
name
.
c_str
()]
=
(
int
)
ioItems
.
size
();
// seperate pipe i/o params from uniforms and blocks
// in is only for input in first stage as out is only for last stage. check traverse in call stack.
ioMapper
[
name
.
c_str
()]
=
ioItems
.
size
();
ioItems
.
push_back
(
ioItems
.
push_back
(
TObjectReflection
(
name
.
c_str
(),
type
,
0
,
mapToGlType
(
type
),
mapToGlArraySize
(
type
),
0
));
TObjectReflection
(
name
.
c_str
(),
type
,
0
,
mapToGlType
(
type
),
mapToGlArraySize
(
type
),
0
));
EShLanguageMask
&
stages
=
ioItems
.
back
().
stages
;
EShLanguageMask
&
stages
=
ioItems
.
back
().
stages
;
stages
=
static_cast
<
EShLanguageMask
>
(
stages
|
1
<<
intermediate
.
getStage
());
stages
=
static_cast
<
EShLanguageMask
>
(
stages
|
1
<<
intermediate
.
getStage
());
}
else
{
}
else
{
...
...
glslang/MachineIndependent/reflection.h
View file @
7bc04732
...
@@ -152,6 +152,20 @@ public:
...
@@ -152,6 +152,20 @@ public:
// see getIndex(const char*)
// see getIndex(const char*)
int
getIndex
(
const
TString
&
name
)
const
{
return
getIndex
(
name
.
c_str
());
}
int
getIndex
(
const
TString
&
name
)
const
{
return
getIndex
(
name
.
c_str
());
}
// for mapping any name to its index (only pipe input/output names)
int
getPipeIOIndex
(
const
char
*
name
,
const
bool
inOrOut
)
const
{
TNameToIndex
::
const_iterator
it
=
inOrOut
?
pipeInNameToIndex
.
find
(
name
)
:
pipeOutNameToIndex
.
find
(
name
);
if
(
it
==
(
inOrOut
?
pipeInNameToIndex
.
end
()
:
pipeOutNameToIndex
.
end
()))
return
-
1
;
else
return
it
->
second
;
}
// see gePipeIOIndex(const char*, const bool)
int
getPipeIOIndex
(
const
TString
&
name
,
const
bool
inOrOut
)
const
{
return
getPipeIOIndex
(
name
.
c_str
(),
inOrOut
);
}
// Thread local size
// Thread local size
unsigned
getLocalSize
(
int
dim
)
const
{
return
dim
<=
2
?
localSize
[
dim
]
:
0
;
}
unsigned
getLocalSize
(
int
dim
)
const
{
return
dim
<=
2
?
localSize
[
dim
]
:
0
;
}
...
@@ -189,6 +203,8 @@ protected:
...
@@ -189,6 +203,8 @@ protected:
TObjectReflection
badReflection
;
// return for queries of -1 or generally out of range; has expected descriptions with in it for this
TObjectReflection
badReflection
;
// return for queries of -1 or generally out of range; has expected descriptions with in it for this
TNameToIndex
nameToIndex
;
// maps names to indexes; can hold all types of data: uniform/buffer and which function names have been processed
TNameToIndex
nameToIndex
;
// maps names to indexes; can hold all types of data: uniform/buffer and which function names have been processed
TNameToIndex
pipeInNameToIndex
;
// maps pipe in names to indexes, this is a fix to seperate pipe I/O from uniforms and buffers.
TNameToIndex
pipeOutNameToIndex
;
// maps pipe out names to indexes, this is a fix to seperate pipe I/O from uniforms and buffers.
TMapIndexToReflection
indexToUniform
;
TMapIndexToReflection
indexToUniform
;
TMapIndexToReflection
indexToUniformBlock
;
TMapIndexToReflection
indexToUniformBlock
;
TMapIndexToReflection
indexToBufferVariable
;
TMapIndexToReflection
indexToBufferVariable
;
...
...
glslang/Public/ShaderLang.h
View file @
7bc04732
...
@@ -789,6 +789,7 @@ public:
...
@@ -789,6 +789,7 @@ public:
bool
buildReflection
(
int
opts
=
EShReflectionDefault
);
bool
buildReflection
(
int
opts
=
EShReflectionDefault
);
unsigned
getLocalSize
(
int
dim
)
const
;
// return dim'th local size
unsigned
getLocalSize
(
int
dim
)
const
;
// return dim'th local size
int
getReflectionIndex
(
const
char
*
name
)
const
;
int
getReflectionIndex
(
const
char
*
name
)
const
;
int
getReflectionPipeIOIndex
(
const
char
*
name
,
const
bool
inOrOut
)
const
;
int
getNumUniformVariables
()
const
;
int
getNumUniformVariables
()
const
;
const
TObjectReflection
&
getUniform
(
int
index
)
const
;
const
TObjectReflection
&
getUniform
(
int
index
)
const
;
int
getNumUniformBlocks
()
const
;
int
getNumUniformBlocks
()
const
;
...
@@ -818,6 +819,9 @@ public:
...
@@ -818,6 +819,9 @@ public:
// can be used for glGetUniformIndices()
// can be used for glGetUniformIndices()
int
getUniformIndex
(
const
char
*
name
)
const
{
return
getReflectionIndex
(
name
);
}
int
getUniformIndex
(
const
char
*
name
)
const
{
return
getReflectionIndex
(
name
);
}
int
getPipeIOIndex
(
const
char
*
name
,
const
bool
inOrOut
)
const
{
return
getReflectionPipeIOIndex
(
name
,
inOrOut
);
}
// can be used for "name" part of glGetActiveUniform()
// can be used for "name" part of glGetActiveUniform()
const
char
*
getUniformName
(
int
index
)
const
{
return
getUniform
(
index
).
name
.
c_str
();
}
const
char
*
getUniformName
(
int
index
)
const
{
return
getUniform
(
index
).
name
.
c_str
();
}
...
...
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