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
6f98892d
Commit
6f98892d
authored
Jan 07, 2020
by
John Kessenich
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix #1829: Add "--" command-line options for macro def/undef.
This allows OpModuleProcessed logging to be consistent with everything taking "--" options.
parent
1642ca11
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 @
6f98892d
...
@@ -204,7 +204,7 @@ public:
...
@@ -204,7 +204,7 @@ public:
text
.
append
(
"#define "
);
text
.
append
(
"#define "
);
fixLine
(
def
);
fixLine
(
def
);
Processes
.
push_back
(
"
D
"
);
Processes
.
push_back
(
"
define-macro
"
);
Processes
.
back
().
append
(
def
);
Processes
.
back
().
append
(
def
);
// The first "=" needs to turn into a space
// The first "=" needs to turn into a space
...
@@ -222,7 +222,7 @@ public:
...
@@ -222,7 +222,7 @@ public:
text
.
append
(
"#undef "
);
text
.
append
(
"#undef "
);
fixLine
(
undef
);
fixLine
(
undef
);
Processes
.
push_back
(
"
U
"
);
Processes
.
push_back
(
"
undef-macro
"
);
Processes
.
back
().
append
(
undef
);
Processes
.
back
().
append
(
undef
);
text
.
append
(
undef
);
text
.
append
(
undef
);
...
@@ -500,6 +500,13 @@ void ProcessArguments(std::vector<std::unique_ptr<glslang::TWorkItem>>& workItem
...
@@ -500,6 +500,13 @@ void ProcessArguments(std::vector<std::unique_ptr<glslang::TWorkItem>>& workItem
}
else
}
else
Error
(
"expects vulkan100 or opengl100"
,
lowerword
.
c_str
());
Error
(
"expects vulkan100 or opengl100"
,
lowerword
.
c_str
());
bumpArg
();
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"
)
{
}
else
if
(
lowerword
==
"dump-builtin-symbols"
)
{
DumpBuiltinSymbols
=
true
;
DumpBuiltinSymbols
=
true
;
}
else
if
(
lowerword
==
"entry-point"
)
{
}
else
if
(
lowerword
==
"entry-point"
)
{
...
@@ -627,6 +634,13 @@ void ProcessArguments(std::vector<std::unique_ptr<glslang::TWorkItem>>& workItem
...
@@ -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"
);
"spirv1.0, spirv1.1, spirv1.2, spirv1.3, spirv1.4, or spirv1.5"
);
}
}
bumpArg
();
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
}
else
if
(
lowerword
==
"variable-name"
||
// synonyms
lowerword
==
"vn"
)
{
lowerword
==
"vn"
)
{
Options
|=
EOptionOutputHexadecimal
;
Options
|=
EOptionOutputHexadecimal
;
...
@@ -649,7 +663,7 @@ void ProcessArguments(std::vector<std::unique_ptr<glslang::TWorkItem>>& workItem
...
@@ -649,7 +663,7 @@ void ProcessArguments(std::vector<std::unique_ptr<glslang::TWorkItem>>& workItem
if
(
argv
[
0
][
2
]
==
0
)
if
(
argv
[
0
][
2
]
==
0
)
Options
|=
EOptionReadHlsl
;
Options
|=
EOptionReadHlsl
;
else
else
UserPreamble
.
addDef
(
getStringOperand
(
"-D<
macro> macro name
"
));
UserPreamble
.
addDef
(
getStringOperand
(
"-D<
name[=def]>
"
));
break
;
break
;
case
'u'
:
case
'u'
:
uniformLocationOverrides
.
push_back
(
getUniformOverride
());
uniformLocationOverrides
.
push_back
(
getUniformOverride
());
...
@@ -692,7 +706,7 @@ void ProcessArguments(std::vector<std::unique_ptr<glslang::TWorkItem>>& workItem
...
@@ -692,7 +706,7 @@ void ProcessArguments(std::vector<std::unique_ptr<glslang::TWorkItem>>& workItem
bumpArg
();
bumpArg
();
break
;
break
;
case
'U'
:
case
'U'
:
UserPreamble
.
addUndef
(
getStringOperand
(
"-U<
macro>: macro name
"
));
UserPreamble
.
addUndef
(
getStringOperand
(
"-U<
name>
"
));
break
;
break
;
case
'V'
:
case
'V'
:
setVulkanSpv
();
setVulkanSpv
();
...
@@ -1502,8 +1516,8 @@ void usage()
...
@@ -1502,8 +1516,8 @@ void usage()
"Options:
\n
"
"Options:
\n
"
" -C cascading errors; risk crash from accumulation of error recoveries
\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 input is HLSL (this is the default when any suffix is .hlsl)
\n
"
" -D<
macro=def
>
\n
"
" -D<
name[=def]> | --define-macro <name[=def]> | --D <name[=def]
>
\n
"
"
-D<macro>
define a pre-processor macro
\n
"
"
define a pre-processor macro
\n
"
" -E print pre-processed GLSL; cannot be used with -l;
\n
"
" -E print pre-processed GLSL; cannot be used with -l;
\n
"
" errors will appear on stderr
\n
"
" errors will appear on stderr
\n
"
" -G[ver] create SPIR-V binary, under OpenGL semantics; turns on -l;
\n
"
" -G[ver] create SPIR-V binary, under OpenGL semantics; turns on -l;
\n
"
...
@@ -1519,7 +1533,8 @@ void usage()
...
@@ -1519,7 +1533,8 @@ void usage()
" -Os optimizes SPIR-V to minimize size
\n
"
" -Os optimizes SPIR-V to minimize size
\n
"
" -S <stage> uses specified stage rather than parsing the file extension
\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
"
" 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
"
" -V[ver] create SPIR-V binary, under Vulkan semantics; turns on -l;
\n
"
" default file name is <stage>.spv (-o overrides this)
\n
"
" default file name is <stage>.spv (-o overrides this)
\n
"
" 'ver', when present, is the version of the input semantics,
\n
"
" 'ver', when present, is the version of the input semantics,
\n
"
...
...
Test/runtests
View file @
6f98892d
...
@@ -176,9 +176,9 @@ diff -b $BASEDIR/hlsl.pp.line3.frag.out $TARGETDIR/hlsl.pp.line3.frag.out || HAS
...
@@ -176,9 +176,9 @@ diff -b $BASEDIR/hlsl.pp.line3.frag.out $TARGETDIR/hlsl.pp.line3.frag.out || HAS
# Testing -D and -U
# Testing -D and -U
#
#
echo
"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
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
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