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
fccbb8b4
Commit
fccbb8b4
authored
Apr 17, 2018
by
John Kessenich
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'nicebyte-glsl-ext'
parents
3bb4c48c
62f84fd5
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
31 additions
and
23 deletions
+31
-23
StandAlone.cpp
StandAlone/StandAlone.cpp
+31
-23
No files found.
StandAlone/StandAlone.cpp
View file @
fccbb8b4
...
@@ -1196,38 +1196,46 @@ int C_DECL main(int argc, char* argv[])
...
@@ -1196,38 +1196,46 @@ int C_DECL main(int argc, char* argv[])
// .frag = fragment
// .frag = fragment
// .comp = compute
// .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
stageName
;
std
::
string
suffix
;
if
(
shaderStageName
)
if
(
shaderStageName
)
suffix
=
shaderStageName
;
stageName
=
shaderStageName
;
else
{
else
if
(
parseStageName
)
{
// Search for a suffix on a filename: e.g, "myfile.frag". If given
// Note: "first" extension means "first from the end", i.e.
// the suffix directly, we skip looking for the '.'
// if the file is named foo.vert.glsl, then "glsl" is first,
if
(
parseSuffix
)
{
// "vert" is second.
ext
=
name
.
rfind
(
'.'
);
size_t
firstExtStart
=
name
.
find_last_of
(
"."
);
if
(
ext
==
std
::
string
::
npos
)
{
bool
hasFirstExt
=
firstExtStart
!=
std
::
string
::
npos
;
usage
();
size_t
secondExtStart
=
hasFirstExt
?
name
.
find_last_of
(
"."
,
firstExtStart
-
1
)
:
std
::
string
::
npos
;
return
EShLangVertex
;
bool
hasSecondExt
=
secondExtStart
!=
std
::
string
::
npos
;
}
std
::
string
firstExt
=
name
.
substr
(
firstExtStart
+
1
,
std
::
string
::
npos
);
++
ext
;
bool
usesUnifiedExt
=
hasFirstExt
&&
(
firstExt
==
"glsl"
||
firstExt
==
"hlsl"
);
if
(
hasFirstExt
&&
!
usesUnifiedExt
)
{
stageName
=
firstExt
;
}
else
if
(
usesUnifiedExt
&&
hasSecondExt
)
{
stageName
=
name
.
substr
(
secondExtStart
+
1
,
firstExtStart
-
secondExtStart
-
1
);
}
else
{
usage
();
return
EShLangVertex
;
}
}
suffix
=
name
.
substr
(
ext
,
std
::
string
::
npos
);
}
else
}
stageName
=
name
;
if
(
s
uffix
==
"vert"
)
if
(
s
tageName
==
"vert"
)
return
EShLangVertex
;
return
EShLangVertex
;
else
if
(
s
uffix
==
"tesc"
)
else
if
(
s
tageName
==
"tesc"
)
return
EShLangTessControl
;
return
EShLangTessControl
;
else
if
(
s
uffix
==
"tese"
)
else
if
(
s
tageName
==
"tese"
)
return
EShLangTessEvaluation
;
return
EShLangTessEvaluation
;
else
if
(
s
uffix
==
"geom"
)
else
if
(
s
tageName
==
"geom"
)
return
EShLangGeometry
;
return
EShLangGeometry
;
else
if
(
s
uffix
==
"frag"
)
else
if
(
s
tageName
==
"frag"
)
return
EShLangFragment
;
return
EShLangFragment
;
else
if
(
s
uffix
==
"comp"
)
else
if
(
s
tageName
==
"comp"
)
return
EShLangCompute
;
return
EShLangCompute
;
usage
();
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