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
e5dbc311
Unverified
Commit
e5dbc311
authored
Jan 08, 2020
by
John Kessenich
Committed by
GitHub
Jan 08, 2020
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #2052 from KhronosGroup/fix-processed-def-undef-1829
Fix #1829: Allow "--" options for def/undef, for OpModuleProcessed.
parents
1642ca11
6f98892d
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
24 additions
and
9 deletions
+24
-9
StandAlone.cpp
StandAlone/StandAlone.cpp
+22
-7
runtests
Test/runtests
+2
-2
No files found.
StandAlone/StandAlone.cpp
View file @
e5dbc311
...
...
@@ -204,7 +204,7 @@ public:
text
.
append
(
"#define "
);
fixLine
(
def
);
Processes
.
push_back
(
"
D
"
);
Processes
.
push_back
(
"
define-macro
"
);
Processes
.
back
().
append
(
def
);
// The first "=" needs to turn into a space
...
...
@@ -222,7 +222,7 @@ public:
text
.
append
(
"#undef "
);
fixLine
(
undef
);
Processes
.
push_back
(
"
U
"
);
Processes
.
push_back
(
"
undef-macro
"
);
Processes
.
back
().
append
(
undef
);
text
.
append
(
undef
);
...
...
@@ -500,6 +500,13 @@ void ProcessArguments(std::vector<std::unique_ptr<glslang::TWorkItem>>& workItem
}
else
Error
(
"expects vulkan100 or opengl100"
,
lowerword
.
c_str
());
bumpArg
();
}
else
if
(
lowerword
==
"define-macro"
||
lowerword
==
"d"
)
{
if
(
argc
>
1
)
UserPreamble
.
addDef
(
argv
[
1
]);
else
Error
(
"expects <name[=def]>"
,
argv
[
0
]);
bumpArg
();
}
else
if
(
lowerword
==
"dump-builtin-symbols"
)
{
DumpBuiltinSymbols
=
true
;
}
else
if
(
lowerword
==
"entry-point"
)
{
...
...
@@ -627,6 +634,13 @@ void ProcessArguments(std::vector<std::unique_ptr<glslang::TWorkItem>>& workItem
"spirv1.0, spirv1.1, spirv1.2, spirv1.3, spirv1.4, or spirv1.5"
);
}
bumpArg
();
}
else
if
(
lowerword
==
"undef-macro"
||
lowerword
==
"u"
)
{
if
(
argc
>
1
)
UserPreamble
.
addUndef
(
argv
[
1
]);
else
Error
(
"expects <name>"
,
argv
[
0
]);
bumpArg
();
}
else
if
(
lowerword
==
"variable-name"
||
// synonyms
lowerword
==
"vn"
)
{
Options
|=
EOptionOutputHexadecimal
;
...
...
@@ -649,7 +663,7 @@ void ProcessArguments(std::vector<std::unique_ptr<glslang::TWorkItem>>& workItem
if
(
argv
[
0
][
2
]
==
0
)
Options
|=
EOptionReadHlsl
;
else
UserPreamble
.
addDef
(
getStringOperand
(
"-D<
macro> macro name
"
));
UserPreamble
.
addDef
(
getStringOperand
(
"-D<
name[=def]>
"
));
break
;
case
'u'
:
uniformLocationOverrides
.
push_back
(
getUniformOverride
());
...
...
@@ -692,7 +706,7 @@ void ProcessArguments(std::vector<std::unique_ptr<glslang::TWorkItem>>& workItem
bumpArg
();
break
;
case
'U'
:
UserPreamble
.
addUndef
(
getStringOperand
(
"-U<
macro>: macro name
"
));
UserPreamble
.
addUndef
(
getStringOperand
(
"-U<
name>
"
));
break
;
case
'V'
:
setVulkanSpv
();
...
...
@@ -1502,8 +1516,8 @@ void usage()
"Options:
\n
"
" -C cascading errors; risk crash from accumulation of error recoveries
\n
"
" -D input is HLSL (this is the default when any suffix is .hlsl)
\n
"
" -D<
macro=def
>
\n
"
"
-D<macro>
define a pre-processor macro
\n
"
" -D<
name[=def]> | --define-macro <name[=def]> | --D <name[=def]
>
\n
"
"
define a pre-processor macro
\n
"
" -E print pre-processed GLSL; cannot be used with -l;
\n
"
" errors will appear on stderr
\n
"
" -G[ver] create SPIR-V binary, under OpenGL semantics; turns on -l;
\n
"
...
...
@@ -1519,7 +1533,8 @@ void usage()
" -Os optimizes SPIR-V to minimize size
\n
"
" -S <stage> uses specified stage rather than parsing the file extension
\n
"
" choices for <stage> are vert, tesc, tese, geom, frag, or comp
\n
"
" -U<macro> undefine a pre-processor macro
\n
"
" -U<name> | --undef-macro <name> | --U <name>
\n
"
" undefine a pre-processor macro
\n
"
" -V[ver] create SPIR-V binary, under Vulkan semantics; turns on -l;
\n
"
" default file name is <stage>.spv (-o overrides this)
\n
"
" 'ver', when present, is the version of the input semantics,
\n
"
...
...
Test/runtests
View file @
e5dbc311
...
...
@@ -176,9 +176,9 @@ diff -b $BASEDIR/hlsl.pp.line3.frag.out $TARGETDIR/hlsl.pp.line3.frag.out || HAS
# Testing -D and -U
#
echo
"Testing -D and -U"
$EXE
-DUNDEFED
-UIN_SHADER
-DFOO
=
200
-i
-l
-
UUNDEFED
-D
MUL
=
FOO
*
2 glsl.-D-U.frag
>
$TARGETDIR
/glsl.-D-U.frag.out
$EXE
-DUNDEFED
-UIN_SHADER
-DFOO
=
200
-i
-l
-
-U
UNDEFED
--define-macro
MUL
=
FOO
*
2 glsl.-D-U.frag
>
$TARGETDIR
/glsl.-D-U.frag.out
diff
-b
$BASEDIR
/glsl.-D-U.frag.out
$TARGETDIR
/glsl.-D-U.frag.out
||
HASERROR
=
1
$EXE
-D
-Od
-e
main
-V
-i
-DUNDEFED
-UIN_SHADER
-
DFOO
=
200
-U
UNDEFED
-Od
hlsl.-D-U.frag
>
$TARGETDIR
/hlsl.-D-U.frag.out
$EXE
-D
-Od
-e
main
-V
-i
-DUNDEFED
-UIN_SHADER
-
-D
FOO
=
200
--undef-macro
UNDEFED
-Od
hlsl.-D-U.frag
>
$TARGETDIR
/hlsl.-D-U.frag.out
diff
-b
$BASEDIR
/hlsl.-D-U.frag.out
$TARGETDIR
/hlsl.-D-U.frag.out
||
HASERROR
=
1
#
...
...
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