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
9353f1af
Commit
9353f1af
authored
Jul 23, 2017
by
John Kessenich
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
GLSL: Add version-number checking.
parent
67eb4970
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
67 additions
and
3 deletions
+67
-3
435.vert
Test/435.vert
+3
-0
435.vert.out
Test/baseResults/435.vert.out
+25
-0
ShaderLang.cpp
glslang/MachineIndependent/ShaderLang.cpp
+38
-3
AST.FromFile.cpp
gtests/AST.FromFile.cpp
+1
-0
No files found.
Test/435.vert
0 → 100644
View file @
9353f1af
#version 435
void
main
()
{}
\ No newline at end of file
Test/baseResults/435.vert.out
0 → 100755
View file @
9353f1af
435.vert
ERROR: version not supported
ERROR: 1 compilation errors. No code generated.
Shader version: 450
ERROR: node is still EOpNull!
0:2 Function Definition: main( ( global void)
0:2 Function Parameters:
0:? Linker Objects
0:? 'gl_VertexID' ( gl_VertexId int VertexId)
0:? 'gl_InstanceID' ( gl_InstanceId int InstanceId)
Linked vertex stage:
Shader version: 450
ERROR: node is still EOpNull!
0:2 Function Definition: main( ( global void)
0:2 Function Parameters:
0:? Linker Objects
0:? 'gl_VertexID' ( gl_VertexId int VertexId)
0:? 'gl_InstanceID' ( gl_InstanceId int InstanceId)
glslang/MachineIndependent/ShaderLang.cpp
View file @
9353f1af
//
//
// Copyright (C) 2002-2005 3Dlabs Inc. Ltd.
// Copyright (C) 2002-2005 3Dlabs Inc. Ltd.
// Copyright (C) 2013-2016 LunarG, Inc.
// Copyright (C) 2013-2016 LunarG, Inc.
// Copyright (C) 2015-201
6
Google, Inc.
// Copyright (C) 2015-201
7
Google, Inc.
//
//
// All rights reserved.
// All rights reserved.
//
//
...
@@ -138,7 +138,8 @@ int MapVersionToIndex(int version)
...
@@ -138,7 +138,8 @@ int MapVersionToIndex(int version)
case
440
:
index
=
12
;
break
;
case
440
:
index
=
12
;
break
;
case
310
:
index
=
13
;
break
;
case
310
:
index
=
13
;
break
;
case
450
:
index
=
14
;
break
;
case
450
:
index
=
14
;
break
;
default:
break
;
case
500
:
index
=
0
;
break
;
// HLSL
default:
assert
(
0
);
break
;
}
}
assert
(
index
<
VersionCount
);
assert
(
index
<
VersionCount
);
...
@@ -447,7 +448,7 @@ bool DeduceVersionProfile(TInfoSink& infoSink, EShLanguage stage, bool versionNo
...
@@ -447,7 +448,7 @@ bool DeduceVersionProfile(TInfoSink& infoSink, EShLanguage stage, bool versionNo
return
correct
;
return
correct
;
}
}
// Get a
good
version...
// Get a version...
if
(
version
==
0
)
{
if
(
version
==
0
)
{
version
=
defaultVersion
;
version
=
defaultVersion
;
// infoSink.info.message(EPrefixWarning, "#version: statement missing; use #version on first line of shader");
// infoSink.info.message(EPrefixWarning, "#version: statement missing; use #version on first line of shader");
...
@@ -493,6 +494,40 @@ bool DeduceVersionProfile(TInfoSink& infoSink, EShLanguage stage, bool versionNo
...
@@ -493,6 +494,40 @@ bool DeduceVersionProfile(TInfoSink& infoSink, EShLanguage stage, bool versionNo
}
}
}
}
// Fix version...
switch
(
version
)
{
// ES versions
case
100
:
break
;
case
300
:
break
;
case
310
:
break
;
// desktop versions
case
110
:
break
;
case
120
:
break
;
case
130
:
break
;
case
140
:
break
;
case
150
:
break
;
case
330
:
break
;
case
400
:
break
;
case
410
:
break
;
case
420
:
break
;
case
430
:
break
;
case
440
:
break
;
case
450
:
break
;
// unknown version
default:
correct
=
false
;
infoSink
.
info
.
message
(
EPrefixError
,
"version not supported"
);
if
(
profile
==
EEsProfile
)
version
=
310
;
else
{
version
=
450
;
profile
=
ECoreProfile
;
}
break
;
}
// Correct for stage type...
// Correct for stage type...
switch
(
stage
)
{
switch
(
stage
)
{
case
EShLangGeometry
:
case
EShLangGeometry
:
...
...
gtests/AST.FromFile.cpp
View file @
9353f1af
...
@@ -136,6 +136,7 @@ INSTANTIATE_TEST_CASE_P(
...
@@ -136,6 +136,7 @@ INSTANTIATE_TEST_CASE_P(
"430.vert"
,
"430.vert"
,
"430.comp"
,
"430.comp"
,
"430AofA.frag"
,
"430AofA.frag"
,
"435.vert"
,
"440.vert"
,
"440.vert"
,
"440.frag"
,
"440.frag"
,
"450.vert"
,
"450.vert"
,
...
...
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