GLSL: Initiate version GLSL 460, including accept extraneous semicolons.

This commit is contained in:
John Kessenich 2017-07-23 14:44:59 -06:00
parent fda6edcbad
commit de16e52b25
10 changed files with 1627 additions and 1517 deletions

View File

@ -26,3 +26,4 @@ void foo()
{ {
SS::f; SS::f;
} }
; // ERROR: no extraneous semicolons

13
Test/460.frag Normal file
View File

@ -0,0 +1,13 @@
#version 460 core
struct S {
float f;
vec4 v;
};
in S s;
void main()
{
interpolateAtCentroid(s.v);
}

11
Test/460.vert Normal file
View File

@ -0,0 +1,11 @@
#version 460 core
int i;
; // extraneous semicolon okay
float f;;;
void main()
{
}
;
;

View File

@ -2,7 +2,8 @@
ERROR: 0:12: 'out' : cannot be bool ERROR: 0:12: 'out' : cannot be bool
ERROR: 0:13: 'sampler2D' : sampler/image types can only be used in uniform variables or function parameters: outo ERROR: 0:13: 'sampler2D' : sampler/image types can only be used in uniform variables or function parameters: outo
ERROR: 0:27: '::' : not supported ERROR: 0:27: '::' : not supported
ERROR: 3 compilation errors. No code generated. ERROR: 0:29: 'extraneous semicolon' : not supported for this version or the enabled extensions
ERROR: 4 compilation errors. No code generated.
Shader version: 450 Shader version: 450

31
Test/baseResults/460.frag.out Executable file
View File

@ -0,0 +1,31 @@
460.frag
Shader version: 460
0:? Sequence
0:10 Function Definition: main( ( global void)
0:10 Function Parameters:
0:12 Sequence
0:12 interpolateAtCentroid ( global 4-component vector of float)
0:12 v: direct index for structure ( global 4-component vector of float)
0:12 's' ( smooth in structure{ global float f, global 4-component vector of float v})
0:12 Constant:
0:12 1 (const int)
0:? Linker Objects
0:? 's' ( smooth in structure{ global float f, global 4-component vector of float v})
Linked fragment stage:
Shader version: 460
0:? Sequence
0:10 Function Definition: main( ( global void)
0:10 Function Parameters:
0:12 Sequence
0:12 interpolateAtCentroid ( global 4-component vector of float)
0:12 v: direct index for structure ( global 4-component vector of float)
0:12 's' ( smooth in structure{ global float f, global 4-component vector of float v})
0:12 Constant:
0:12 1 (const int)
0:? Linker Objects
0:? 's' ( smooth in structure{ global float f, global 4-component vector of float v})

25
Test/baseResults/460.vert.out Executable file
View File

@ -0,0 +1,25 @@
460.vert
Shader version: 460
0:? Sequence
0:7 Function Definition: main( ( global void)
0:7 Function Parameters:
0:? Linker Objects
0:? 'i' ( global int)
0:? 'f' ( global float)
0:? 'gl_VertexID' ( gl_VertexId int VertexId)
0:? 'gl_InstanceID' ( gl_InstanceId int InstanceId)
Linked vertex stage:
Shader version: 460
0:? Sequence
0:7 Function Definition: main( ( global void)
0:7 Function Parameters:
0:? Linker Objects
0:? 'i' ( global int)
0:? 'f' ( global float)
0:? 'gl_VertexID' ( gl_VertexId int VertexId)
0:? 'gl_InstanceID' ( gl_InstanceId int InstanceId)

View File

@ -116,7 +116,7 @@ TParseContextBase* CreateParseContext(TSymbolTable& symbolTable, TIntermediate&
// Local mapping functions for making arrays of symbol tables.... // Local mapping functions for making arrays of symbol tables....
const int VersionCount = 16; // index range in MapVersionToIndex const int VersionCount = 17; // index range in MapVersionToIndex
int MapVersionToIndex(int version) int MapVersionToIndex(int version)
{ {
@ -140,6 +140,7 @@ int MapVersionToIndex(int version)
case 450: index = 14; break; case 450: index = 14; break;
case 500: index = 0; break; // HLSL case 500: index = 0; break; // HLSL
case 320: index = 15; break; case 320: index = 15; break;
case 460: index = 16; break;
default: assert(0); break; default: assert(0); break;
} }
@ -516,6 +517,7 @@ bool DeduceVersionProfile(TInfoSink& infoSink, EShLanguage stage, bool versionNo
case 430: break; case 430: break;
case 440: break; case 440: break;
case 450: break; case 450: break;
case 460: break;
// unknown version // unknown version
default: default:

View File

@ -2872,8 +2872,10 @@ translation_unit
parseContext.intermediate.setTreeRoot($$); parseContext.intermediate.setTreeRoot($$);
} }
| translation_unit external_declaration { | translation_unit external_declaration {
$$ = parseContext.intermediate.growAggregate($1, $2); if ($2 != nullptr) {
parseContext.intermediate.setTreeRoot($$); $$ = parseContext.intermediate.growAggregate($1, $2);
parseContext.intermediate.setTreeRoot($$);
}
} }
; ;
@ -2884,6 +2886,11 @@ external_declaration
| declaration { | declaration {
$$ = $1; $$ = $1;
} }
| SEMICOLON {
parseContext.requireProfile($1.loc, ~EEsProfile, "extraneous semicolon");
parseContext.profileRequires($1.loc, ~EEsProfile, 460, nullptr, "extraneous semicolon");
$$ = nullptr;
}
; ;
function_definition function_definition

File diff suppressed because it is too large Load Diff

View File

@ -151,6 +151,8 @@ INSTANTIATE_TEST_CASE_P(
"450.tese", "450.tese",
"450.frag", "450.frag",
"450.comp", "450.comp",
"460.frag",
"460.vert",
"dce.frag", "dce.frag",
"atomic_uint.frag", "atomic_uint.frag",
"aggOps.frag", "aggOps.frag",