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
bd97b6f9
Commit
bd97b6f9
authored
Dec 20, 2019
by
John Kessenich
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Command-line: Give better error messages. From #1829.
parent
ebf634bc
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
11 deletions
+15
-11
StandAlone.cpp
StandAlone/StandAlone.cpp
+15
-11
No files found.
StandAlone/StandAlone.cpp
View file @
bd97b6f9
...
@@ -292,9 +292,12 @@ bool SetConfigFile(const std::string& name)
...
@@ -292,9 +292,12 @@ bool SetConfigFile(const std::string& name)
//
//
// Give error and exit with failure code.
// Give error and exit with failure code.
//
//
void
Error
(
const
char
*
message
)
void
Error
(
const
char
*
message
,
const
char
*
detail
=
nullptr
)
{
{
fprintf
(
stderr
,
"%s: Error %s (use -h for usage)
\n
"
,
ExecutableName
,
message
);
fprintf
(
stderr
,
"%s: Error: "
,
ExecutableName
);
if
(
detail
!=
nullptr
)
fprintf
(
stderr
,
"%s: "
,
detail
);
fprintf
(
stderr
,
"%s (use -h for usage)
\n
"
,
message
);
exit
(
EFailUsage
);
exit
(
EFailUsage
);
}
}
...
@@ -482,7 +485,7 @@ void ProcessArguments(std::vector<std::unique_ptr<glslang::TWorkItem>>& workItem
...
@@ -482,7 +485,7 @@ void ProcessArguments(std::vector<std::unique_ptr<glslang::TWorkItem>>& workItem
Options
|=
EOptionAutoMapLocations
;
Options
|=
EOptionAutoMapLocations
;
}
else
if
(
lowerword
==
"uniform-base"
)
{
}
else
if
(
lowerword
==
"uniform-base"
)
{
if
(
argc
<=
1
)
if
(
argc
<=
1
)
Error
(
"no <base> provided
for --uniform-base"
);
Error
(
"no <base> provided
"
,
lowerword
.
c_str
()
);
uniformBase
=
::
strtol
(
argv
[
1
],
NULL
,
10
);
uniformBase
=
::
strtol
(
argv
[
1
],
NULL
,
10
);
bumpArg
();
bumpArg
();
break
;
break
;
...
@@ -493,15 +496,16 @@ void ProcessArguments(std::vector<std::unique_ptr<glslang::TWorkItem>>& workItem
...
@@ -493,15 +496,16 @@ void ProcessArguments(std::vector<std::unique_ptr<glslang::TWorkItem>>& workItem
else
if
(
strcmp
(
argv
[
1
],
"opengl100"
)
==
0
)
else
if
(
strcmp
(
argv
[
1
],
"opengl100"
)
==
0
)
setOpenGlSpv
();
setOpenGlSpv
();
else
else
Error
(
"--client expects vulkan100 or opengl100"
);
Error
(
"expects vulkan100 or opengl100"
,
lowerword
.
c_str
());
}
}
else
Error
(
"expects vulkan100 or opengl100"
,
lowerword
.
c_str
());
bumpArg
();
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"
)
{
entryPointName
=
argv
[
1
];
entryPointName
=
argv
[
1
];
if
(
argc
<=
1
)
if
(
argc
<=
1
)
Error
(
"no <name> provided
for --entry-point"
);
Error
(
"no <name> provided
"
,
lowerword
.
c_str
()
);
bumpArg
();
bumpArg
();
}
else
if
(
lowerword
==
"flatten-uniform-arrays"
||
// synonyms
}
else
if
(
lowerword
==
"flatten-uniform-arrays"
||
// synonyms
lowerword
==
"flatten-uniform-array"
||
lowerword
==
"flatten-uniform-array"
||
...
@@ -576,7 +580,7 @@ void ProcessArguments(std::vector<std::unique_ptr<glslang::TWorkItem>>& workItem
...
@@ -576,7 +580,7 @@ void ProcessArguments(std::vector<std::unique_ptr<glslang::TWorkItem>>& workItem
}
else
if
(
lowerword
==
"source-entrypoint"
||
// synonyms
}
else
if
(
lowerword
==
"source-entrypoint"
||
// synonyms
lowerword
==
"sep"
)
{
lowerword
==
"sep"
)
{
if
(
argc
<=
1
)
if
(
argc
<=
1
)
Error
(
"no <entry-point> provided
for --source-entrypoint"
);
Error
(
"no <entry-point> provided
"
,
lowerword
.
c_str
()
);
sourceEntryPointName
=
argv
[
1
];
sourceEntryPointName
=
argv
[
1
];
bumpArg
();
bumpArg
();
break
;
break
;
...
@@ -627,14 +631,14 @@ void ProcessArguments(std::vector<std::unique_ptr<glslang::TWorkItem>>& workItem
...
@@ -627,14 +631,14 @@ void ProcessArguments(std::vector<std::unique_ptr<glslang::TWorkItem>>& workItem
lowerword
==
"vn"
)
{
lowerword
==
"vn"
)
{
Options
|=
EOptionOutputHexadecimal
;
Options
|=
EOptionOutputHexadecimal
;
if
(
argc
<=
1
)
if
(
argc
<=
1
)
Error
(
"no <C-variable-name> provided
for --variable-name"
);
Error
(
"no <C-variable-name> provided
"
,
lowerword
.
c_str
()
);
variableName
=
argv
[
1
];
variableName
=
argv
[
1
];
bumpArg
();
bumpArg
();
break
;
break
;
}
else
if
(
lowerword
==
"version"
)
{
}
else
if
(
lowerword
==
"version"
)
{
Options
|=
EOptionDumpVersions
;
Options
|=
EOptionDumpVersions
;
}
else
{
}
else
{
usage
(
);
Error
(
"unrecognized command-line option"
,
argv
[
0
]
);
}
}
}
}
break
;
break
;
...
@@ -760,7 +764,7 @@ void ProcessArguments(std::vector<std::unique_ptr<glslang::TWorkItem>>& workItem
...
@@ -760,7 +764,7 @@ void ProcessArguments(std::vector<std::unique_ptr<glslang::TWorkItem>>& workItem
Options
|=
EOptionOutputHexadecimal
;
Options
|=
EOptionOutputHexadecimal
;
break
;
break
;
default:
default:
usage
(
);
Error
(
"unrecognized command-line option"
,
argv
[
0
]
);
break
;
break
;
}
}
}
else
{
}
else
{
...
@@ -1263,7 +1267,7 @@ int singleMain()
...
@@ -1263,7 +1267,7 @@ int singleMain()
ProcessConfigFile
();
ProcessConfigFile
();
if
((
Options
&
EOptionReadHlsl
)
&&
!
((
Options
&
EOptionOutputPreprocessed
)
||
(
Options
&
EOptionSpv
)))
if
((
Options
&
EOptionReadHlsl
)
&&
!
((
Options
&
EOptionOutputPreprocessed
)
||
(
Options
&
EOptionSpv
)))
Error
(
"
ERROR:
HLSL requires SPIR-V code generation (or preprocessing only)"
);
Error
(
"HLSL requires SPIR-V code generation (or preprocessing only)"
);
//
//
// Two modes:
// Two modes:
...
...
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