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
facde2c8
Commit
facde2c8
authored
Jan 06, 2017
by
John Kessenich
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
PP #include: address PR feedback.
parent
63204c25
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
19 additions
and
11 deletions
+19
-11
StandAlone.cpp
StandAlone/StandAlone.cpp
+1
-1
ShaderLang.cpp
glslang/MachineIndependent/ShaderLang.cpp
+2
-2
Pp.cpp
glslang/MachineIndependent/preprocessor/Pp.cpp
+3
-3
ShaderLang.h
glslang/Public/ShaderLang.h
+12
-4
TestFixture.h
gtests/TestFixture.h
+1
-1
No files found.
StandAlone/StandAlone.cpp
View file @
facde2c8
...
@@ -582,7 +582,7 @@ void CompileAndLinkShaderUnits(std::vector<ShaderCompUnit> compUnits)
...
@@ -582,7 +582,7 @@ void CompileAndLinkShaderUnits(std::vector<ShaderCompUnit> compUnits)
if
(
Options
&
EOptionOutputPreprocessed
)
{
if
(
Options
&
EOptionOutputPreprocessed
)
{
std
::
string
str
;
std
::
string
str
;
glslang
::
TShader
::
Includer
includer
;
glslang
::
TShader
::
Forbid
Includer
includer
;
if
(
shader
->
preprocess
(
&
Resources
,
defaultVersion
,
ENoProfile
,
false
,
false
,
if
(
shader
->
preprocess
(
&
Resources
,
defaultVersion
,
ENoProfile
,
false
,
false
,
messages
,
&
str
,
includer
))
{
messages
,
&
str
,
includer
))
{
PutsIfNonEmpty
(
str
.
c_str
());
PutsIfNonEmpty
(
str
.
c_str
());
...
...
glslang/MachineIndependent/ShaderLang.cpp
View file @
facde2c8
...
@@ -221,7 +221,7 @@ bool InitializeSymbolTable(const TString& builtIns, int version, EProfile profil
...
@@ -221,7 +221,7 @@ bool InitializeSymbolTable(const TString& builtIns, int version, EProfile profil
language
,
infoSink
,
spvVersion
,
true
,
EShMsgDefault
,
language
,
infoSink
,
spvVersion
,
true
,
EShMsgDefault
,
true
));
true
));
TShader
::
Includer
includer
;
TShader
::
Forbid
Includer
includer
;
TPpContext
ppContext
(
*
parseContext
,
""
,
includer
);
TPpContext
ppContext
(
*
parseContext
,
""
,
includer
);
TScanContext
scanContext
(
*
parseContext
);
TScanContext
scanContext
(
*
parseContext
);
parseContext
->
setScanContext
(
&
scanContext
);
parseContext
->
setScanContext
(
&
scanContext
);
...
@@ -1217,7 +1217,7 @@ int ShCompile(
...
@@ -1217,7 +1217,7 @@ int ShCompile(
compiler
->
infoSink
.
debug
.
erase
();
compiler
->
infoSink
.
debug
.
erase
();
TIntermediate
intermediate
(
compiler
->
getLanguage
());
TIntermediate
intermediate
(
compiler
->
getLanguage
());
TShader
::
Includer
includer
;
TShader
::
Forbid
Includer
includer
;
bool
success
=
CompileDeferred
(
compiler
,
shaderStrings
,
numStrings
,
inputLengths
,
nullptr
,
bool
success
=
CompileDeferred
(
compiler
,
shaderStrings
,
numStrings
,
inputLengths
,
nullptr
,
""
,
optLevel
,
resources
,
defaultVersion
,
ENoProfile
,
false
,
""
,
optLevel
,
resources
,
defaultVersion
,
ENoProfile
,
false
,
forwardCompatible
,
messages
,
intermediate
,
includer
);
forwardCompatible
,
messages
,
intermediate
,
includer
);
...
...
glslang/MachineIndependent/preprocessor/Pp.cpp
View file @
facde2c8
...
@@ -576,12 +576,12 @@ int TPpContext::CPPifdef(int defined, TPpToken* ppToken)
...
@@ -576,12 +576,12 @@ int TPpContext::CPPifdef(int defined, TPpToken* ppToken)
int
TPpContext
::
CPPinclude
(
TPpToken
*
ppToken
)
int
TPpContext
::
CPPinclude
(
TPpToken
*
ppToken
)
{
{
const
TSourceLoc
directiveLoc
=
ppToken
->
loc
;
const
TSourceLoc
directiveLoc
=
ppToken
->
loc
;
bool
add
LocalSearch
=
true
;
// to additionally include the extra "" paths
bool
startWith
LocalSearch
=
true
;
// to additionally include the extra "" paths
int
token
=
scanToken
(
ppToken
);
int
token
=
scanToken
(
ppToken
);
// handle <header-name>-style #include
// handle <header-name>-style #include
if
(
token
==
'<'
)
{
if
(
token
==
'<'
)
{
add
LocalSearch
=
false
;
startWith
LocalSearch
=
false
;
token
=
scanHeaderName
(
ppToken
,
'>'
);
token
=
scanHeaderName
(
ppToken
,
'>'
);
}
}
// otherwise ppToken already has the header name and it was "header-name" style
// otherwise ppToken already has the header name and it was "header-name" style
...
@@ -609,7 +609,7 @@ int TPpContext::CPPinclude(TPpToken* ppToken)
...
@@ -609,7 +609,7 @@ int TPpContext::CPPinclude(TPpToken* ppToken)
// Find the inclusion, first look in "Local" ("") paths, if requested,
// Find the inclusion, first look in "Local" ("") paths, if requested,
// otherwise, only search the "System" (<>) paths.
// otherwise, only search the "System" (<>) paths.
TShader
::
Includer
::
IncludeResult
*
res
=
nullptr
;
TShader
::
Includer
::
IncludeResult
*
res
=
nullptr
;
if
(
add
LocalSearch
)
if
(
startWith
LocalSearch
)
res
=
includer
.
includeLocal
(
filename
.
c_str
(),
currentSourceFile
.
c_str
(),
includeStack
.
size
()
+
1
);
res
=
includer
.
includeLocal
(
filename
.
c_str
(),
currentSourceFile
.
c_str
(),
includeStack
.
size
()
+
1
);
if
(
!
res
||
res
->
headerName
.
empty
())
{
if
(
!
res
||
res
->
headerName
.
empty
())
{
includer
.
releaseInclude
(
res
);
includer
.
releaseInclude
(
res
);
...
...
glslang/Public/ShaderLang.h
View file @
facde2c8
...
@@ -360,9 +360,11 @@ public:
...
@@ -360,9 +360,11 @@ public:
// Resolves an inclusion request by name, current source name,
// Resolves an inclusion request by name, current source name,
// and include depth.
// and include depth.
// On success, returns an IncludeResult containing the resolved name
// On success, returns an IncludeResult containing the resolved name
// and content of the include. On failure, returns an IncludeResult
// and content of the include.
// On failure, returns a nullptr, or an IncludeResult
// with an empty string for the headerName and error details in the
// with an empty string for the headerName and error details in the
// header field. The Includer retains ownership of the contents
// header field.
// The Includer retains ownership of the contents
// of the returned IncludeResult value, and those contents must
// of the returned IncludeResult value, and those contents must
// remain valid until the releaseInclude method is called on that
// remain valid until the releaseInclude method is called on that
// IncludeResult object.
// IncludeResult object.
...
@@ -385,14 +387,20 @@ public:
...
@@ -385,14 +387,20 @@ public:
// Signals that the parser will no longer use the contents of the
// Signals that the parser will no longer use the contents of the
// specified IncludeResult.
// specified IncludeResult.
virtual
void
releaseInclude
(
IncludeResult
*
result
)
{
}
virtual
void
releaseInclude
(
IncludeResult
*
)
=
0
;
virtual
~
Includer
()
{}
virtual
~
Includer
()
{}
};
};
// Fail all Includer searches
class
ForbidIncluder
:
public
Includer
{
public
:
virtual
void
releaseInclude
(
IncludeResult
*
)
override
{
}
};
bool
parse
(
const
TBuiltInResource
*
res
,
int
defaultVersion
,
EProfile
defaultProfile
,
bool
forceDefaultVersionAndProfile
,
bool
parse
(
const
TBuiltInResource
*
res
,
int
defaultVersion
,
EProfile
defaultProfile
,
bool
forceDefaultVersionAndProfile
,
bool
forwardCompatible
,
EShMessages
messages
)
bool
forwardCompatible
,
EShMessages
messages
)
{
{
TShader
::
Includer
includer
;
TShader
::
Forbid
Includer
includer
;
return
parse
(
res
,
defaultVersion
,
defaultProfile
,
forceDefaultVersionAndProfile
,
forwardCompatible
,
messages
,
includer
);
return
parse
(
res
,
defaultVersion
,
defaultProfile
,
forceDefaultVersionAndProfile
,
forwardCompatible
,
messages
,
includer
);
}
}
...
...
gtests/TestFixture.h
View file @
facde2c8
...
@@ -521,7 +521,7 @@ public:
...
@@ -521,7 +521,7 @@ public:
glslang
::
TShader
shader
(
EShLangVertex
);
glslang
::
TShader
shader
(
EShLangVertex
);
shader
.
setStringsWithLengths
(
&
shaderStrings
,
&
shaderLengths
,
1
);
shader
.
setStringsWithLengths
(
&
shaderStrings
,
&
shaderLengths
,
1
);
std
::
string
ppShader
;
std
::
string
ppShader
;
glslang
::
TShader
::
Includer
includer
;
glslang
::
TShader
::
Forbid
Includer
includer
;
const
bool
success
=
shader
.
preprocess
(
const
bool
success
=
shader
.
preprocess
(
&
glslang
::
DefaultTBuiltInResource
,
defaultVersion
,
defaultProfile
,
&
glslang
::
DefaultTBuiltInResource
,
defaultVersion
,
defaultProfile
,
forceVersionProfile
,
isForwardCompatible
,
(
EShMessages
)(
EShMsgOnlyPreprocessor
|
EShMsgCascadingErrors
),
forceVersionProfile
,
isForwardCompatible
,
(
EShMessages
)(
EShMsgOnlyPreprocessor
|
EShMsgCascadingErrors
),
...
...
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