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
eee9d536
Commit
eee9d536
authored
Sep 19, 2016
by
John Kessenich
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Track separate entry-point names and mangled names...
... and use each in the correct way at consumption sites. This completes issue #513.
parent
632f575e
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
29 additions
and
22 deletions
+29
-22
GlslangToSpv.cpp
SPIRV/GlslangToSpv.cpp
+3
-5
revision.h
glslang/Include/revision.h
+1
-1
ParseHelper.cpp
glslang/MachineIndependent/ParseHelper.cpp
+10
-5
ShaderLang.cpp
glslang/MachineIndependent/ShaderLang.cpp
+2
-2
linkValidate.cpp
glslang/MachineIndependent/linkValidate.cpp
+3
-3
localintermediate.h
glslang/MachineIndependent/localintermediate.h
+6
-3
reflection.cpp
glslang/MachineIndependent/reflection.cpp
+2
-2
hlslParseHelper.cpp
hlsl/hlslParseHelper.cpp
+2
-1
No files found.
SPIRV/GlslangToSpv.cpp
View file @
eee9d536
...
@@ -713,8 +713,8 @@ TGlslangToSpvTraverser::TGlslangToSpvTraverser(const glslang::TIntermediate* gls
...
@@ -713,8 +713,8 @@ TGlslangToSpvTraverser::TGlslangToSpvTraverser(const glslang::TIntermediate* gls
builder
.
setSource
(
TranslateSourceLanguage
(
glslangIntermediate
->
getSource
(),
glslangIntermediate
->
getProfile
()),
glslangIntermediate
->
getVersion
());
builder
.
setSource
(
TranslateSourceLanguage
(
glslangIntermediate
->
getSource
(),
glslangIntermediate
->
getProfile
()),
glslangIntermediate
->
getVersion
());
stdBuiltins
=
builder
.
import
(
"GLSL.std.450"
);
stdBuiltins
=
builder
.
import
(
"GLSL.std.450"
);
builder
.
setMemoryModel
(
spv
::
AddressingModelLogical
,
spv
::
MemoryModelGLSL450
);
builder
.
setMemoryModel
(
spv
::
AddressingModelLogical
,
spv
::
MemoryModelGLSL450
);
shaderEntry
=
builder
.
makeEntryPoint
(
glslangIntermediate
->
getEntryPoint
().
c_str
());
shaderEntry
=
builder
.
makeEntryPoint
(
glslangIntermediate
->
getEntryPoint
Name
().
c_str
());
entryPoint
=
builder
.
addEntryPoint
(
executionModel
,
shaderEntry
,
glslangIntermediate
->
getEntryPoint
().
c_str
());
entryPoint
=
builder
.
addEntryPoint
(
executionModel
,
shaderEntry
,
glslangIntermediate
->
getEntryPoint
Name
().
c_str
());
// Add the source extensions
// Add the source extensions
const
auto
&
sourceExtensions
=
glslangIntermediate
->
getRequestedExtensions
();
const
auto
&
sourceExtensions
=
glslangIntermediate
->
getRequestedExtensions
();
...
@@ -2453,9 +2453,7 @@ void TGlslangToSpvTraverser::declareUseOfStructMember(const glslang::TTypeList&
...
@@ -2453,9 +2453,7 @@ void TGlslangToSpvTraverser::declareUseOfStructMember(const glslang::TTypeList&
bool
TGlslangToSpvTraverser
::
isShaderEntryPoint
(
const
glslang
::
TIntermAggregate
*
node
)
bool
TGlslangToSpvTraverser
::
isShaderEntryPoint
(
const
glslang
::
TIntermAggregate
*
node
)
{
{
// have to ignore mangling and just look at the base name
return
node
->
getName
().
compare
(
glslangIntermediate
->
getEntryPointMangledName
().
c_str
())
==
0
;
size_t
firstOpen
=
node
->
getName
().
find
(
'('
);
return
node
->
getName
().
compare
(
0
,
firstOpen
,
glslangIntermediate
->
getEntryPoint
().
c_str
())
==
0
;
}
}
// Make all the functions, skeletally, without actually visiting their bodies.
// Make all the functions, skeletally, without actually visiting their bodies.
...
...
glslang/Include/revision.h
View file @
eee9d536
...
@@ -2,5 +2,5 @@
...
@@ -2,5 +2,5 @@
// For the version, it uses the latest git tag followed by the number of commits.
// For the version, it uses the latest git tag followed by the number of commits.
// For the date, it uses the current date (when then script is run).
// For the date, it uses the current date (when then script is run).
#define GLSLANG_REVISION "Overload400-PrecQual.149
6
"
#define GLSLANG_REVISION "Overload400-PrecQual.149
9
"
#define GLSLANG_DATE "19-Sep-2016"
#define GLSLANG_DATE "19-Sep-2016"
glslang/MachineIndependent/ParseHelper.cpp
View file @
eee9d536
...
@@ -1051,18 +1051,23 @@ TIntermAggregate* TParseContext::handleFunctionDefinition(const TSourceLoc& loc,
...
@@ -1051,18 +1051,23 @@ TIntermAggregate* TParseContext::handleFunctionDefinition(const TSourceLoc& loc,
currentFunctionType
=
new
TType
(
EbtVoid
);
currentFunctionType
=
new
TType
(
EbtVoid
);
functionReturnsValue
=
false
;
functionReturnsValue
=
false
;
// Check for entry point
if
(
function
.
getName
().
compare
(
intermediate
.
getEntryPointName
().
c_str
())
==
0
)
{
intermediate
.
setEntryPointMangledName
(
function
.
getMangledName
().
c_str
());
intermediate
.
incrementEntryPointCount
();
inMain
=
true
;
}
else
inMain
=
false
;
//
//
// Raise error message if main function takes any parameters or returns anything other than void
// Raise error message if main function takes any parameters or returns anything other than void
//
//
if
(
function
.
getName
()
==
intermediate
.
getEntryPoint
().
c_str
()
)
{
if
(
inMain
)
{
if
(
function
.
getParamCount
()
>
0
)
if
(
function
.
getParamCount
()
>
0
)
error
(
loc
,
"function cannot take any parameter(s)"
,
function
.
getName
().
c_str
(),
""
);
error
(
loc
,
"function cannot take any parameter(s)"
,
function
.
getName
().
c_str
(),
""
);
if
(
function
.
getType
().
getBasicType
()
!=
EbtVoid
)
if
(
function
.
getType
().
getBasicType
()
!=
EbtVoid
)
error
(
loc
,
""
,
function
.
getType
().
getBasicTypeString
().
c_str
(),
"entry point cannot return a value"
);
error
(
loc
,
""
,
function
.
getType
().
getBasicTypeString
().
c_str
(),
"entry point cannot return a value"
);
intermediate
.
incrementEntryPointCount
();
}
inMain
=
true
;
}
else
inMain
=
false
;
//
//
// New symbol table scope for body of function plus its arguments
// New symbol table scope for body of function plus its arguments
...
...
glslang/MachineIndependent/ShaderLang.cpp
View file @
eee9d536
...
@@ -697,7 +697,7 @@ bool ProcessDeferred(
...
@@ -697,7 +697,7 @@ bool ProcessDeferred(
parseContext
=
new
HlslParseContext
(
symbolTable
,
intermediate
,
false
,
version
,
profile
,
spvVersion
,
parseContext
=
new
HlslParseContext
(
symbolTable
,
intermediate
,
false
,
version
,
profile
,
spvVersion
,
compiler
->
getLanguage
(),
compiler
->
infoSink
,
forwardCompatible
,
messages
);
compiler
->
getLanguage
(),
compiler
->
infoSink
,
forwardCompatible
,
messages
);
}
else
{
}
else
{
intermediate
.
setEntryPoint
(
"main"
);
intermediate
.
setEntryPoint
Name
(
"main"
);
parseContext
=
new
TParseContext
(
symbolTable
,
intermediate
,
false
,
version
,
profile
,
spvVersion
,
parseContext
=
new
TParseContext
(
symbolTable
,
intermediate
,
false
,
version
,
profile
,
spvVersion
,
compiler
->
getLanguage
(),
compiler
->
infoSink
,
forwardCompatible
,
messages
);
compiler
->
getLanguage
(),
compiler
->
infoSink
,
forwardCompatible
,
messages
);
}
}
...
@@ -1485,7 +1485,7 @@ void TShader::setStringsWithLengthsAndNames(
...
@@ -1485,7 +1485,7 @@ void TShader::setStringsWithLengthsAndNames(
void
TShader
::
setEntryPoint
(
const
char
*
entryPoint
)
void
TShader
::
setEntryPoint
(
const
char
*
entryPoint
)
{
{
intermediate
->
setEntryPoint
(
entryPoint
);
intermediate
->
setEntryPoint
Name
(
entryPoint
);
}
}
//
//
...
...
glslang/MachineIndependent/linkValidate.cpp
View file @
eee9d536
...
@@ -75,11 +75,11 @@ void TIntermediate::merge(TInfoSink& infoSink, TIntermediate& unit)
...
@@ -75,11 +75,11 @@ void TIntermediate::merge(TInfoSink& infoSink, TIntermediate& unit)
if
(
source
!=
unit
.
source
)
if
(
source
!=
unit
.
source
)
error
(
infoSink
,
"can't link compilation units from different source languages"
);
error
(
infoSink
,
"can't link compilation units from different source languages"
);
if
(
source
==
EShSourceHlsl
&&
unit
.
entryPoint
.
size
()
>
0
)
{
if
(
source
==
EShSourceHlsl
&&
unit
.
entryPoint
Name
.
size
()
>
0
)
{
if
(
entryPoint
.
size
()
>
0
)
if
(
entryPoint
Name
.
size
()
>
0
)
error
(
infoSink
,
"can't handle multiple entry points per stage"
);
error
(
infoSink
,
"can't handle multiple entry points per stage"
);
else
else
entryPoint
=
unit
.
entryPoint
;
entryPoint
Name
=
unit
.
entryPointName
;
}
}
numEntryPoints
+=
unit
.
numEntryPoints
;
numEntryPoints
+=
unit
.
numEntryPoints
;
numErrors
+=
unit
.
numErrors
;
numErrors
+=
unit
.
numErrors
;
...
...
glslang/MachineIndependent/localintermediate.h
View file @
eee9d536
...
@@ -159,8 +159,10 @@ public:
...
@@ -159,8 +159,10 @@ public:
void
setSource
(
EShSource
s
)
{
source
=
s
;
}
void
setSource
(
EShSource
s
)
{
source
=
s
;
}
EShSource
getSource
()
const
{
return
source
;
}
EShSource
getSource
()
const
{
return
source
;
}
void
setEntryPoint
(
const
char
*
ep
)
{
entryPoint
=
ep
;
}
void
setEntryPointName
(
const
char
*
ep
)
{
entryPointName
=
ep
;
}
const
std
::
string
&
getEntryPoint
()
const
{
return
entryPoint
;
}
void
setEntryPointMangledName
(
const
char
*
ep
)
{
entryPointMangledName
=
ep
;
}
const
std
::
string
&
getEntryPointName
()
const
{
return
entryPointName
;
}
const
std
::
string
&
getEntryPointMangledName
()
const
{
return
entryPointMangledName
;
}
void
setVersion
(
int
v
)
{
version
=
v
;
}
void
setVersion
(
int
v
)
{
version
=
v
;
}
int
getVersion
()
const
{
return
version
;
}
int
getVersion
()
const
{
return
version
;
}
void
setProfile
(
EProfile
p
)
{
profile
=
p
;
}
void
setProfile
(
EProfile
p
)
{
profile
=
p
;
}
...
@@ -363,7 +365,8 @@ protected:
...
@@ -363,7 +365,8 @@ protected:
const
EShLanguage
language
;
// stage, known at construction time
const
EShLanguage
language
;
// stage, known at construction time
EShSource
source
;
// source language, known a bit later
EShSource
source
;
// source language, known a bit later
std
::
string
entryPoint
;
std
::
string
entryPointName
;
std
::
string
entryPointMangledName
;
EProfile
profile
;
EProfile
profile
;
int
version
;
int
version
;
SpvVersion
spvVersion
;
SpvVersion
spvVersion
;
...
...
glslang/MachineIndependent/reflection.cpp
View file @
eee9d536
...
@@ -670,8 +670,8 @@ bool TReflection::addStage(EShLanguage, const TIntermediate& intermediate)
...
@@ -670,8 +670,8 @@ bool TReflection::addStage(EShLanguage, const TIntermediate& intermediate)
TReflectionTraverser
it
(
intermediate
,
*
this
);
TReflectionTraverser
it
(
intermediate
,
*
this
);
// put the entry point on functions to process
// put the entry point on
the list of
functions to process
it
.
pushFunction
(
"main("
);
it
.
pushFunction
(
intermediate
.
getEntryPointMangledName
().
c_str
()
);
// process all the functions
// process all the functions
while
(
!
it
.
functions
.
empty
())
{
while
(
!
it
.
functions
.
empty
())
{
...
...
hlsl/hlslParseHelper.cpp
View file @
eee9d536
...
@@ -850,8 +850,9 @@ TIntermAggregate* HlslParseContext::handleFunctionDefinition(const TSourceLoc& l
...
@@ -850,8 +850,9 @@ TIntermAggregate* HlslParseContext::handleFunctionDefinition(const TSourceLoc& l
currentFunctionType
=
new
TType
(
EbtVoid
);
currentFunctionType
=
new
TType
(
EbtVoid
);
functionReturnsValue
=
false
;
functionReturnsValue
=
false
;
inEntryPoint
=
(
function
.
getName
()
==
intermediate
.
getEntryPoint
().
c_str
())
;
inEntryPoint
=
function
.
getName
().
compare
(
intermediate
.
getEntryPointName
().
c_str
())
==
0
;
if
(
inEntryPoint
)
{
if
(
inEntryPoint
)
{
intermediate
.
setEntryPointMangledName
(
function
.
getMangledName
().
c_str
());
remapEntryPointIO
(
function
);
remapEntryPointIO
(
function
);
if
(
entryPointOutput
)
{
if
(
entryPointOutput
)
{
if
(
shouldFlatten
(
entryPointOutput
->
getType
()))
if
(
shouldFlatten
(
entryPointOutput
->
getType
()))
...
...
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