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
62f84fd5
Commit
62f84fd5
authored
Apr 17, 2018
by
John Kessenich
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'glsl-ext' of
https://github.com/nicebyte/glslang
into nicebyte-glsl-ext
parents
3bb4c48c
33ddaaaf
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
34 additions
and
24 deletions
+34
-24
StandAlone.cpp
StandAlone/StandAlone.cpp
+34
-24
No files found.
StandAlone/StandAlone.cpp
View file @
62f84fd5
...
...
@@ -1196,38 +1196,48 @@ int C_DECL main(int argc, char* argv[])
// .frag = fragment
// .comp = compute
//
EShLanguage
FindLanguage
(
const
std
::
string
&
name
,
bool
parseSuffix
)
// Additionally, the file names may end in .<stage>.glsl and .<stage>.hlsl
// where <stage> is one of the stages listed above.
//
EShLanguage
FindLanguage
(
const
std
::
string
&
name
,
bool
parseStageName
)
{
size_t
ext
=
0
;
std
::
string
suffix
;
if
(
shaderStageName
)
suffix
=
shaderStageName
;
else
{
// Search for a suffix on a filename: e.g, "myfile.frag". If given
// the suffix directly, we skip looking for the '.'
if
(
parseSuffix
)
{
ext
=
name
.
rfind
(
'.'
);
if
(
ext
==
std
::
string
::
npos
)
{
usage
();
return
EShLangVertex
;
}
++
ext
;
std
::
string
stage_name
;
if
(
shaderStageName
)
{
stage_name
=
shaderStageName
;
}
else
if
(
parseStageName
)
{
// Note: "first" extension means "first from the end", i.e.
// if the file is named foo.vert.glsl, then "glsl" is first,
// "vert" is second.
size_t
first_ext_start
=
name
.
find_last_of
(
"."
);
bool
has_first_ext
=
first_ext_start
!=
std
::
string
::
npos
;
size_t
second_ext_start
=
has_first_ext
?
name
.
find_last_of
(
"."
,
first_ext_start
-
1
)
:
std
::
string
::
npos
;
bool
has_second_ext
=
second_ext_start
!=
std
::
string
::
npos
;
std
::
string
first_ext
=
name
.
substr
(
first_ext_start
+
1
,
std
::
string
::
npos
);
bool
uses_unified_ext
=
has_first_ext
&&
(
first_ext
==
"glsl"
||
first_ext
==
"hlsl"
);
if
(
has_first_ext
&&
!
uses_unified_ext
)
{
stage_name
=
first_ext
;
}
else
if
(
uses_unified_ext
&&
has_second_ext
)
{
stage_name
=
name
.
substr
(
second_ext_start
+
1
,
first_ext_start
-
second_ext_start
-
1
);
}
else
{
usage
();
return
EShLangVertex
;
}
suffix
=
name
.
substr
(
ext
,
std
::
string
::
npos
);
}
else
{
stage_name
=
name
;
}
if
(
suffix
==
"vert"
)
if
(
stage_name
==
"vert"
)
return
EShLangVertex
;
else
if
(
s
uffix
==
"tesc"
)
else
if
(
s
tage_name
==
"tesc"
)
return
EShLangTessControl
;
else
if
(
s
uffix
==
"tese"
)
else
if
(
s
tage_name
==
"tese"
)
return
EShLangTessEvaluation
;
else
if
(
s
uffix
==
"geom"
)
else
if
(
s
tage_name
==
"geom"
)
return
EShLangGeometry
;
else
if
(
s
uffix
==
"frag"
)
else
if
(
s
tage_name
==
"frag"
)
return
EShLangFragment
;
else
if
(
s
uffix
==
"comp"
)
else
if
(
s
tage_name
==
"comp"
)
return
EShLangCompute
;
usage
();
...
...
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