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
619dc896
Unverified
Commit
619dc896
authored
Apr 09, 2018
by
John Kessenich
Committed by
GitHub
Apr 09, 2018
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #1338 from cgmb/minor-shaderlang-fixups
Minor cleanup in ShaderLang.cpp
parents
1dcd1623
39bbad5a
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
27 deletions
+12
-27
ShaderLang.cpp
glslang/MachineIndependent/ShaderLang.cpp
+12
-27
No files found.
glslang/MachineIndependent/ShaderLang.cpp
View file @
619dc896
...
...
@@ -744,9 +744,9 @@ bool ProcessDeferred(
const
int
numPre
=
2
;
const
int
numPost
=
requireNonempty
?
1
:
0
;
const
int
numTotal
=
numPre
+
numStrings
+
numPost
;
s
ize_t
*
lengths
=
new
size_t
[
numTotal
]
;
const
char
**
strings
=
new
const
char
*
[
numTotal
]
;
const
char
**
names
=
new
const
char
*
[
numTotal
]
;
s
td
::
unique_ptr
<
size_t
[]
>
lengths
(
new
size_t
[
numTotal
])
;
std
::
unique_ptr
<
const
char
*
[]
>
strings
(
new
const
char
*
[
numTotal
])
;
std
::
unique_ptr
<
const
char
*
[]
>
names
(
new
const
char
*
[
numTotal
])
;
for
(
int
s
=
0
;
s
<
numStrings
;
++
s
)
{
strings
[
s
+
numPre
]
=
shaderStrings
[
s
];
if
(
inputLengths
==
nullptr
||
inputLengths
[
s
]
<
0
)
...
...
@@ -834,19 +834,14 @@ bool ProcessDeferred(
[
stage
];
// Dynamically allocate the symbol table so we can control when it is deallocated WRT the pool.
TSymbolTable
*
symbolTableMemory
=
new
TSymbolTable
;
TSymbolTable
&
symbolTable
=
*
symbolTableMemory
;
std
::
unique_ptr
<
TSymbolTable
>
symbolTable
(
new
TSymbolTable
);
if
(
cachedTable
)
symbolTable
.
adoptLevels
(
*
cachedTable
);
symbolTable
->
adoptLevels
(
*
cachedTable
);
// Add built-in symbols that are potentially context dependent;
// they get popped again further down.
if
(
!
AddContextSpecificSymbols
(
resources
,
compiler
->
infoSink
,
symbolTable
,
version
,
profile
,
spvVersion
,
if
(
!
AddContextSpecificSymbols
(
resources
,
compiler
->
infoSink
,
*
symbolTable
,
version
,
profile
,
spvVersion
,
stage
,
source
))
{
delete
symbolTableMemory
;
delete
[]
lengths
;
delete
[]
strings
;
delete
[]
names
;
return
false
;
}
...
...
@@ -854,10 +849,9 @@ bool ProcessDeferred(
// Now we can process the full shader under proper symbols and rules.
//
TParseContextBase
*
parseContext
=
CreateParseContext
(
symbolTable
,
intermediate
,
version
,
profile
,
source
,
stage
,
compiler
->
infoSink
,
spvVersion
,
forwardCompatible
,
messages
,
false
,
sourceEntryPointName
);
std
::
unique_ptr
<
TParseContextBase
>
parseContext
(
CreateParseContext
(
*
symbolTable
,
intermediate
,
version
,
profile
,
source
,
stage
,
compiler
->
infoSink
,
spvVersion
,
forwardCompatible
,
messages
,
false
,
sourceEntryPointName
));
TPpContext
ppContext
(
*
parseContext
,
names
[
numPre
]
?
names
[
numPre
]
:
""
,
includer
);
// only GLSL (bison triggered, really) needs an externally set scan context
...
...
@@ -893,23 +887,14 @@ bool ProcessDeferred(
lengths
[
postIndex
]
=
strlen
(
strings
[
numStrings
+
numPre
]);
names
[
postIndex
]
=
nullptr
;
}
TInputScanner
fullInput
(
numStrings
+
numPre
+
numPost
,
strings
,
lengths
,
names
,
numPre
,
numPost
);
TInputScanner
fullInput
(
numStrings
+
numPre
+
numPost
,
strings
.
get
(),
lengths
.
get
(),
names
.
get
()
,
numPre
,
numPost
);
// Push a new symbol allocation scope that will get used for the shader's globals.
symbolTable
.
push
();
symbolTable
->
push
();
bool
success
=
processingContext
(
*
parseContext
,
ppContext
,
fullInput
,
versionWillBeError
,
symbolTable
,
versionWillBeError
,
*
symbolTable
,
intermediate
,
optLevel
,
messages
);
// Clean up the symbol table. The AST is self-sufficient now.
delete
symbolTableMemory
;
delete
parseContext
;
delete
[]
lengths
;
delete
[]
strings
;
delete
[]
names
;
return
success
;
}
...
...
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