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
805b09f9
Unverified
Commit
805b09f9
authored
Apr 17, 2019
by
John Kessenich
Committed by
GitHub
Apr 17, 2019
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #1753 from pixeljetstream/ckubischnv_dumpbuiltins
introduce ability to dump builtin symbol table
parents
0527c9db
83318018
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
82 additions
and
19 deletions
+82
-19
StandAlone.cpp
StandAlone/StandAlone.cpp
+6
-0
Types.h
glslang/Include/Types.h
+1
-1
ShaderLang.cpp
glslang/MachineIndependent/ShaderLang.cpp
+15
-0
SymbolTable.cpp
glslang/MachineIndependent/SymbolTable.cpp
+52
-12
SymbolTable.h
glslang/MachineIndependent/SymbolTable.h
+7
-6
ShaderLang.h
glslang/Public/ShaderLang.h
+1
-0
No files found.
StandAlone/StandAlone.cpp
View file @
805b09f9
...
@@ -162,6 +162,7 @@ const char* shaderStageName = nullptr;
...
@@ -162,6 +162,7 @@ const char* shaderStageName = nullptr;
const
char
*
variableName
=
nullptr
;
const
char
*
variableName
=
nullptr
;
bool
HlslEnable16BitTypes
=
false
;
bool
HlslEnable16BitTypes
=
false
;
bool
HlslDX9compatible
=
false
;
bool
HlslDX9compatible
=
false
;
bool
DumpBuiltinSymbols
=
false
;
std
::
vector
<
std
::
string
>
IncludeDirectoryList
;
std
::
vector
<
std
::
string
>
IncludeDirectoryList
;
// Source environment
// Source environment
...
@@ -494,6 +495,8 @@ void ProcessArguments(std::vector<std::unique_ptr<glslang::TWorkItem>>& workItem
...
@@ -494,6 +495,8 @@ void ProcessArguments(std::vector<std::unique_ptr<glslang::TWorkItem>>& workItem
Error
(
"--client expects vulkan100 or opengl100"
);
Error
(
"--client expects vulkan100 or opengl100"
);
}
}
bumpArg
();
bumpArg
();
}
else
if
(
lowerword
==
"dump-builtin-symbols"
)
{
DumpBuiltinSymbols
=
true
;
}
else
if
(
lowerword
==
"entry-point"
)
{
}
else
if
(
lowerword
==
"entry-point"
)
{
entryPointName
=
argv
[
1
];
entryPointName
=
argv
[
1
];
if
(
argc
<=
1
)
if
(
argc
<=
1
)
...
@@ -833,6 +836,8 @@ void SetMessageOptions(EShMessages& messages)
...
@@ -833,6 +836,8 @@ void SetMessageOptions(EShMessages& messages)
messages
=
(
EShMessages
)(
messages
|
EShMsgHlslLegalization
);
messages
=
(
EShMessages
)(
messages
|
EShMsgHlslLegalization
);
if
(
HlslDX9compatible
)
if
(
HlslDX9compatible
)
messages
=
(
EShMessages
)(
messages
|
EShMsgHlslDX9Compatible
);
messages
=
(
EShMessages
)(
messages
|
EShMsgHlslDX9Compatible
);
if
(
DumpBuiltinSymbols
)
messages
=
(
EShMessages
)(
messages
|
EShMsgBuiltinSymbolTable
);
}
}
//
//
...
@@ -1520,6 +1525,7 @@ void usage()
...
@@ -1520,6 +1525,7 @@ void usage()
" --auto-map-locations | --aml automatically locate input/output lacking
\n
"
" --auto-map-locations | --aml automatically locate input/output lacking
\n
"
" 'location' (fragile, not cross stage)
\n
"
" 'location' (fragile, not cross stage)
\n
"
" --client {vulkan<ver>|opengl<ver>} see -V and -G
\n
"
" --client {vulkan<ver>|opengl<ver>} see -V and -G
\n
"
" --dump-builtin-symbols prints builtin symbol table prior each compile
\n
"
" -dumpfullversion | -dumpversion print bare major.minor.patchlevel
\n
"
" -dumpfullversion | -dumpversion print bare major.minor.patchlevel
\n
"
" --flatten-uniform-arrays | --fua flatten uniform texture/sampler arrays to
\n
"
" --flatten-uniform-arrays | --fua flatten uniform texture/sampler arrays to
\n
"
" scalars
\n
"
" scalars
\n
"
...
...
glslang/Include/Types.h
View file @
805b09f9
...
@@ -2018,7 +2018,7 @@ public:
...
@@ -2018,7 +2018,7 @@ public:
}
}
// Add struct/block members
// Add struct/block members
if
(
isStruct
())
{
if
(
isStruct
()
&&
structure
)
{
appendStr
(
"{"
);
appendStr
(
"{"
);
for
(
size_t
i
=
0
;
i
<
structure
->
size
();
++
i
)
{
for
(
size_t
i
=
0
;
i
<
structure
->
size
();
++
i
)
{
if
(
!
(
*
structure
)[
i
].
type
->
hiddenMember
())
{
if
(
!
(
*
structure
)[
i
].
type
->
hiddenMember
())
{
...
...
glslang/MachineIndependent/ShaderLang.cpp
View file @
805b09f9
...
@@ -377,6 +377,8 @@ bool InitializeSymbolTables(TInfoSink& infoSink, TSymbolTable** commonTable, TS
...
@@ -377,6 +377,8 @@ bool InitializeSymbolTables(TInfoSink& infoSink, TSymbolTable** commonTable, TS
infoSink
,
commonTable
,
symbolTables
);
infoSink
,
commonTable
,
symbolTables
);
#endif
#endif
return
true
;
return
true
;
}
}
...
@@ -474,6 +476,16 @@ void SetupBuiltinSymbolTable(int version, EProfile profile, const SpvVersion& sp
...
@@ -474,6 +476,16 @@ void SetupBuiltinSymbolTable(int version, EProfile profile, const SpvVersion& sp
glslang
::
ReleaseGlobalLock
();
glslang
::
ReleaseGlobalLock
();
}
}
// Function to Print all builtins
void
DumpBuiltinSymbolTable
(
TInfoSink
&
infoSink
,
const
TSymbolTable
&
symbolTable
)
{
infoSink
.
debug
<<
"BuiltinSymbolTable {
\n
"
;
symbolTable
.
dump
(
infoSink
,
true
);
infoSink
.
debug
<<
"}
\n
"
;
}
// Return true if the shader was correctly specified for version/profile/stage.
// Return true if the shader was correctly specified for version/profile/stage.
bool
DeduceVersionProfile
(
TInfoSink
&
infoSink
,
EShLanguage
stage
,
bool
versionNotFirst
,
int
defaultVersion
,
bool
DeduceVersionProfile
(
TInfoSink
&
infoSink
,
EShLanguage
stage
,
bool
versionNotFirst
,
int
defaultVersion
,
EShSource
source
,
int
&
version
,
EProfile
&
profile
,
const
SpvVersion
&
spvVersion
)
EShSource
source
,
int
&
version
,
EProfile
&
profile
,
const
SpvVersion
&
spvVersion
)
...
@@ -905,6 +917,9 @@ bool ProcessDeferred(
...
@@ -905,6 +917,9 @@ bool ProcessDeferred(
return
false
;
return
false
;
}
}
if
(
messages
&
EShMsgBuiltinSymbolTable
)
DumpBuiltinSymbolTable
(
compiler
->
infoSink
,
*
symbolTable
);
//
//
// Now we can process the full shader under proper symbols and rules.
// Now we can process the full shader under proper symbols and rules.
//
//
...
...
glslang/MachineIndependent/SymbolTable.cpp
View file @
805b09f9
...
@@ -176,37 +176,77 @@ void TType::buildMangledName(TString& mangledName) const
...
@@ -176,37 +176,77 @@ void TType::buildMangledName(TString& mangledName) const
// Dump functions.
// Dump functions.
//
//
void
T
Variable
::
dump
(
TInfoSink
&
infoSink
)
const
void
T
Symbol
::
dumpExtensions
(
TInfoSink
&
infoSink
)
const
{
{
infoSink
.
debug
<<
getName
().
c_str
()
<<
": "
<<
type
.
getStorageQualifierString
()
<<
" "
<<
type
.
getBasicTypeString
();
int
numExtensions
=
getNumExtensions
();
if
(
type
.
isArray
())
{
if
(
numExtensions
)
{
infoSink
.
debug
<<
"[0]"
;
infoSink
.
debug
<<
" <"
;
for
(
int
i
=
0
;
i
<
numExtensions
;
i
++
)
infoSink
.
debug
<<
getExtensions
()[
i
]
<<
","
;
infoSink
.
debug
<<
">"
;
}
}
}
void
TVariable
::
dump
(
TInfoSink
&
infoSink
,
bool
complete
)
const
{
if
(
complete
)
{
infoSink
.
debug
<<
getName
().
c_str
()
<<
": "
<<
type
.
getCompleteString
();
dumpExtensions
(
infoSink
);
}
else
{
infoSink
.
debug
<<
getName
().
c_str
()
<<
": "
<<
type
.
getStorageQualifierString
()
<<
" "
<<
type
.
getBasicTypeString
();
if
(
type
.
isArray
())
infoSink
.
debug
<<
"[0]"
;
}
infoSink
.
debug
<<
"
\n
"
;
infoSink
.
debug
<<
"
\n
"
;
}
}
void
TFunction
::
dump
(
TInfoSink
&
infoSink
)
const
void
TFunction
::
dump
(
TInfoSink
&
infoSink
,
bool
complete
)
const
{
{
infoSink
.
debug
<<
getName
().
c_str
()
<<
": "
<<
returnType
.
getBasicTypeString
()
<<
" "
<<
getMangledName
().
c_str
()
<<
"
\n
"
;
if
(
complete
)
{
infoSink
.
debug
<<
getName
().
c_str
()
<<
": "
<<
returnType
.
getCompleteString
()
<<
" "
<<
getName
().
c_str
()
<<
"("
;
int
numParams
=
getParamCount
();
for
(
int
i
=
0
;
i
<
numParams
;
i
++
)
{
const
TParameter
&
param
=
parameters
[
i
];
infoSink
.
debug
<<
param
.
type
->
getCompleteString
()
<<
" "
<<
(
param
.
type
->
isStruct
()
?
"of "
+
param
.
type
->
getTypeName
()
+
" "
:
""
)
<<
(
param
.
name
?
*
param
.
name
:
""
)
<<
(
i
<
numParams
-
1
?
","
:
""
);
}
infoSink
.
debug
<<
")"
;
dumpExtensions
(
infoSink
);
}
else
{
infoSink
.
debug
<<
getName
().
c_str
()
<<
": "
<<
returnType
.
getBasicTypeString
()
<<
" "
<<
getMangledName
().
c_str
()
<<
"n"
;
}
infoSink
.
debug
<<
"
\n
"
;
}
}
void
TAnonMember
::
dump
(
TInfoSink
&
TInfoSink
)
const
void
TAnonMember
::
dump
(
TInfoSink
&
TInfoSink
,
bool
complete
)
const
{
{
TInfoSink
.
debug
<<
"anonymous member "
<<
getMemberNumber
()
<<
" of "
<<
getAnonContainer
().
getName
().
c_str
()
<<
"
\n
"
;
TInfoSink
.
debug
<<
"anonymous member "
<<
getMemberNumber
()
<<
" of "
<<
getAnonContainer
().
getName
().
c_str
()
<<
"
\n
"
;
}
}
void
TSymbolTableLevel
::
dump
(
TInfoSink
&
infoSink
)
const
void
TSymbolTableLevel
::
dump
(
TInfoSink
&
infoSink
,
bool
complete
)
const
{
{
tLevel
::
const_iterator
it
;
tLevel
::
const_iterator
it
;
for
(
it
=
level
.
begin
();
it
!=
level
.
end
();
++
it
)
for
(
it
=
level
.
begin
();
it
!=
level
.
end
();
++
it
)
(
*
it
).
second
->
dump
(
infoSink
);
(
*
it
).
second
->
dump
(
infoSink
,
complete
);
}
}
void
TSymbolTable
::
dump
(
TInfoSink
&
infoSink
)
const
void
TSymbolTable
::
dump
(
TInfoSink
&
infoSink
,
bool
complete
)
const
{
{
for
(
int
level
=
currentLevel
();
level
>=
0
;
--
level
)
{
for
(
int
level
=
currentLevel
();
level
>=
0
;
--
level
)
{
infoSink
.
debug
<<
"LEVEL "
<<
level
<<
"
\n
"
;
infoSink
.
debug
<<
"LEVEL "
<<
level
<<
"
\n
"
;
table
[
level
]
->
dump
(
infoSink
);
table
[
level
]
->
dump
(
infoSink
,
complete
);
}
}
}
}
...
...
glslang/MachineIndependent/SymbolTable.h
View file @
805b09f9
...
@@ -116,7 +116,8 @@ public:
...
@@ -116,7 +116,8 @@ public:
}
}
virtual
int
getNumExtensions
()
const
{
return
extensions
==
nullptr
?
0
:
(
int
)
extensions
->
size
();
}
virtual
int
getNumExtensions
()
const
{
return
extensions
==
nullptr
?
0
:
(
int
)
extensions
->
size
();
}
virtual
const
char
**
getExtensions
()
const
{
return
extensions
->
data
();
}
virtual
const
char
**
getExtensions
()
const
{
return
extensions
->
data
();
}
virtual
void
dump
(
TInfoSink
&
infoSink
)
const
=
0
;
virtual
void
dump
(
TInfoSink
&
infoSink
,
bool
complete
=
false
)
const
=
0
;
void
dumpExtensions
(
TInfoSink
&
infoSink
)
const
;
virtual
bool
isReadOnly
()
const
{
return
!
writable
;
}
virtual
bool
isReadOnly
()
const
{
return
!
writable
;
}
virtual
void
makeReadOnly
()
{
writable
=
false
;
}
virtual
void
makeReadOnly
()
{
writable
=
false
;
}
...
@@ -192,7 +193,7 @@ public:
...
@@ -192,7 +193,7 @@ public:
}
}
virtual
const
char
**
getMemberExtensions
(
int
member
)
const
{
return
(
*
memberExtensions
)[
member
].
data
();
}
virtual
const
char
**
getMemberExtensions
(
int
member
)
const
{
return
(
*
memberExtensions
)[
member
].
data
();
}
virtual
void
dump
(
TInfoSink
&
infoSink
)
const
;
virtual
void
dump
(
TInfoSink
&
infoSink
,
bool
complete
=
false
)
const
;
protected
:
protected
:
explicit
TVariable
(
const
TVariable
&
);
explicit
TVariable
(
const
TVariable
&
);
...
@@ -313,7 +314,7 @@ public:
...
@@ -313,7 +314,7 @@ public:
virtual
TParameter
&
operator
[](
int
i
)
{
assert
(
writable
);
return
parameters
[
i
];
}
virtual
TParameter
&
operator
[](
int
i
)
{
assert
(
writable
);
return
parameters
[
i
];
}
virtual
const
TParameter
&
operator
[](
int
i
)
const
{
return
parameters
[
i
];
}
virtual
const
TParameter
&
operator
[](
int
i
)
const
{
return
parameters
[
i
];
}
virtual
void
dump
(
TInfoSink
&
infoSink
)
const
override
;
virtual
void
dump
(
TInfoSink
&
infoSink
,
bool
complete
=
false
)
const
override
;
protected
:
protected
:
explicit
TFunction
(
const
TFunction
&
);
explicit
TFunction
(
const
TFunction
&
);
...
@@ -373,7 +374,7 @@ public:
...
@@ -373,7 +374,7 @@ public:
virtual
const
char
**
getExtensions
()
const
override
{
return
anonContainer
.
getMemberExtensions
(
memberNumber
);
}
virtual
const
char
**
getExtensions
()
const
override
{
return
anonContainer
.
getMemberExtensions
(
memberNumber
);
}
virtual
int
getAnonId
()
const
{
return
anonId
;
}
virtual
int
getAnonId
()
const
{
return
anonId
;
}
virtual
void
dump
(
TInfoSink
&
infoSink
)
const
override
;
virtual
void
dump
(
TInfoSink
&
infoSink
,
bool
complete
=
false
)
const
override
;
protected
:
protected
:
explicit
TAnonMember
(
const
TAnonMember
&
);
explicit
TAnonMember
(
const
TAnonMember
&
);
...
@@ -541,7 +542,7 @@ public:
...
@@ -541,7 +542,7 @@ public:
void
relateToOperator
(
const
char
*
name
,
TOperator
op
);
void
relateToOperator
(
const
char
*
name
,
TOperator
op
);
void
setFunctionExtensions
(
const
char
*
name
,
int
num
,
const
char
*
const
extensions
[]);
void
setFunctionExtensions
(
const
char
*
name
,
int
num
,
const
char
*
const
extensions
[]);
void
dump
(
TInfoSink
&
infoSink
)
const
;
void
dump
(
TInfoSink
&
infoSink
,
bool
complete
=
false
)
const
;
TSymbolTableLevel
*
clone
()
const
;
TSymbolTableLevel
*
clone
()
const
;
void
readOnly
();
void
readOnly
();
...
@@ -842,7 +843,7 @@ public:
...
@@ -842,7 +843,7 @@ public:
}
}
int
getMaxSymbolId
()
{
return
uniqueId
;
}
int
getMaxSymbolId
()
{
return
uniqueId
;
}
void
dump
(
TInfoSink
&
infoSink
)
const
;
void
dump
(
TInfoSink
&
infoSink
,
bool
complete
=
false
)
const
;
void
copyTable
(
const
TSymbolTable
&
copyOf
);
void
copyTable
(
const
TSymbolTable
&
copyOf
);
void
setPreviousDefaultPrecisions
(
TPrecisionQualifier
*
p
)
{
table
[
currentLevel
()]
->
setPreviousDefaultPrecisions
(
p
);
}
void
setPreviousDefaultPrecisions
(
TPrecisionQualifier
*
p
)
{
table
[
currentLevel
()]
->
setPreviousDefaultPrecisions
(
p
);
}
...
...
glslang/Public/ShaderLang.h
View file @
805b09f9
...
@@ -234,6 +234,7 @@ enum EShMessages {
...
@@ -234,6 +234,7 @@ enum EShMessages {
EShMsgHlslEnable16BitTypes
=
(
1
<<
11
),
// enable use of 16-bit types in SPIR-V for HLSL
EShMsgHlslEnable16BitTypes
=
(
1
<<
11
),
// enable use of 16-bit types in SPIR-V for HLSL
EShMsgHlslLegalization
=
(
1
<<
12
),
// enable HLSL Legalization messages
EShMsgHlslLegalization
=
(
1
<<
12
),
// enable HLSL Legalization messages
EShMsgHlslDX9Compatible
=
(
1
<<
13
),
// enable HLSL DX9 compatible mode (right now only for samplers)
EShMsgHlslDX9Compatible
=
(
1
<<
13
),
// enable HLSL DX9 compatible mode (right now only for samplers)
EShMsgBuiltinSymbolTable
=
(
1
<<
14
),
// print the builtin symbol table
};
};
//
//
...
...
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