Merge pull request #1006 from KhronosGroup/4.60

GLSL: Add GLSL 4.60 features
This commit is contained in:
John Kessenich 2017-08-02 02:11:52 +09:00 committed by GitHub
commit 4cf5266042
22 changed files with 2045 additions and 1541 deletions

View File

@ -1745,6 +1745,20 @@ bool TGlslangToSpvTraverser::visitAggregate(glslang::TVisit visit, glslang::TInt
atomic = true;
break;
case glslang::EOpAtomicCounterAdd:
case glslang::EOpAtomicCounterSubtract:
case glslang::EOpAtomicCounterMin:
case glslang::EOpAtomicCounterMax:
case glslang::EOpAtomicCounterAnd:
case glslang::EOpAtomicCounterOr:
case glslang::EOpAtomicCounterXor:
case glslang::EOpAtomicCounterExchange:
case glslang::EOpAtomicCounterCompSwap:
builder.addExtension("SPV_KHR_shader_atomic_counter_ops");
builder.addCapability(spv::CapabilityAtomicStorageOps);
atomic = true;
break;
default:
break;
}
@ -1815,6 +1829,15 @@ bool TGlslangToSpvTraverser::visitAggregate(glslang::TVisit visit, glslang::TInt
case glslang::EOpAtomicXor:
case glslang::EOpAtomicExchange:
case glslang::EOpAtomicCompSwap:
case glslang::EOpAtomicCounterAdd:
case glslang::EOpAtomicCounterSubtract:
case glslang::EOpAtomicCounterMin:
case glslang::EOpAtomicCounterMax:
case glslang::EOpAtomicCounterAnd:
case glslang::EOpAtomicCounterOr:
case glslang::EOpAtomicCounterXor:
case glslang::EOpAtomicCounterExchange:
case glslang::EOpAtomicCounterCompSwap:
if (arg == 0)
lvalue = true;
break;
@ -4619,34 +4642,45 @@ spv::Id TGlslangToSpvTraverser::createAtomicOperation(glslang::TOperator op, spv
switch (op) {
case glslang::EOpAtomicAdd:
case glslang::EOpImageAtomicAdd:
case glslang::EOpAtomicCounterAdd:
opCode = spv::OpAtomicIAdd;
break;
case glslang::EOpAtomicCounterSubtract:
opCode = spv::OpAtomicISub;
break;
case glslang::EOpAtomicMin:
case glslang::EOpImageAtomicMin:
case glslang::EOpAtomicCounterMin:
opCode = typeProxy == glslang::EbtUint ? spv::OpAtomicUMin : spv::OpAtomicSMin;
break;
case glslang::EOpAtomicMax:
case glslang::EOpImageAtomicMax:
case glslang::EOpAtomicCounterMax:
opCode = typeProxy == glslang::EbtUint ? spv::OpAtomicUMax : spv::OpAtomicSMax;
break;
case glslang::EOpAtomicAnd:
case glslang::EOpImageAtomicAnd:
case glslang::EOpAtomicCounterAnd:
opCode = spv::OpAtomicAnd;
break;
case glslang::EOpAtomicOr:
case glslang::EOpImageAtomicOr:
case glslang::EOpAtomicCounterOr:
opCode = spv::OpAtomicOr;
break;
case glslang::EOpAtomicXor:
case glslang::EOpImageAtomicXor:
case glslang::EOpAtomicCounterXor:
opCode = spv::OpAtomicXor;
break;
case glslang::EOpAtomicExchange:
case glslang::EOpImageAtomicExchange:
case glslang::EOpAtomicCounterExchange:
opCode = spv::OpAtomicExchange;
break;
case glslang::EOpAtomicCompSwap:
case glslang::EOpImageAtomicCompSwap:
case glslang::EOpAtomicCounterCompSwap:
opCode = spv::OpAtomicCompareExchange;
break;
case glslang::EOpAtomicCounterIncrement:

View File

@ -846,6 +846,8 @@ const char* CapabilityString(int info)
case 5009: return "ImageGatherBiasLodAMD";
#endif
case 4445: return "AtomicStorageOps";
case 4447: return "SampleMaskPostDepthCoverage";
#ifdef NV_EXTENSIONS
case 5251: return "GeometryShaderPassthroughNV";

View File

@ -22,7 +22,27 @@ out SA outSA;
struct SS { float f; S s; };
out SS outSS;
layout(binding = 0) uniform atomic_uint aui;
uint ui;
void foo()
{
SS::f;
atomicCounterAdd(aui, ui); // ERROR, need 4.6
atomicCounterSubtract(aui, ui); // ERROR, need 4.6
atomicCounterMin(aui, ui); // ERROR, need 4.6
atomicCounterMax(aui, ui); // ERROR, need 4.6
atomicCounterAnd(aui, ui); // ERROR, need 4.6
atomicCounterOr(aui, ui); // ERROR, need 4.6
atomicCounterXor(aui, ui); // ERROR, need 4.6
atomicCounterExchange(aui, ui); // ERROR, need 4.6
atomicCounterCompSwap(aui, ui, ui); // ERROR, need 4.6
int a = gl_BaseVertex + gl_BaseInstance + gl_DrawID; // ERROR, need 4.6
bool b1;
anyInvocation(b1); // ERROR, need 4.6
allInvocations(b1); // ERROR, need 4.6
allInvocationsEqual(b1); // ERROR, need 4.6
}
; // ERROR: no extraneous semicolons

17
Test/460.frag Normal file
View File

@ -0,0 +1,17 @@
#version 460 core
struct S {
float f;
vec4 v;
};
in S s;
void main()
{
interpolateAtCentroid(s.v);
bool b1;
b1 = anyInvocation(b1);
b1 = allInvocations(b1);
b1 = allInvocationsEqual(b1);
}

15
Test/460.vert Normal file
View File

@ -0,0 +1,15 @@
#version 460 core
int i;
; // extraneous semicolon okay
float f;;;
void main()
{
bool b1;
b1 = anyInvocation(b1);
b1 = allInvocations(b1);
b1 = allInvocationsEqual(b1);
}
;
;

View File

@ -1,8 +1,25 @@
450.vert
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:27: '::' : not supported
ERROR: 3 compilation errors. No code generated.
ERROR: 0:30: '::' : not supported
ERROR: 0:31: 'atomicCounterAdd' : no matching overloaded function found
ERROR: 0:32: 'atomicCounterSubtract' : no matching overloaded function found
ERROR: 0:33: 'atomicCounterMin' : no matching overloaded function found
ERROR: 0:34: 'atomicCounterMax' : no matching overloaded function found
ERROR: 0:35: 'atomicCounterAnd' : no matching overloaded function found
ERROR: 0:36: 'atomicCounterOr' : no matching overloaded function found
ERROR: 0:37: 'atomicCounterXor' : no matching overloaded function found
ERROR: 0:38: 'atomicCounterExchange' : no matching overloaded function found
ERROR: 0:39: 'atomicCounterCompSwap' : no matching overloaded function found
ERROR: 0:41: 'gl_BaseVertex' : undeclared identifier
ERROR: 0:41: 'gl_BaseInstance' : undeclared identifier
ERROR: 0:41: 'gl_DrawID' : undeclared identifier
ERROR: 0:41: '=' : cannot convert from ' temp float' to ' temp int'
ERROR: 0:44: 'anyInvocation' : no matching overloaded function found
ERROR: 0:45: 'allInvocations' : no matching overloaded function found
ERROR: 0:46: 'allInvocationsEqual' : no matching overloaded function found
ERROR: 0:48: 'extraneous semicolon' : not supported for this version or the enabled extensions
ERROR: 20 compilation errors. No code generated.
Shader version: 450
@ -20,8 +37,33 @@ ERROR: node is still EOpNull!
0:9 2 (const int)
0:9 Constant:
0:9 4.500000
0:25 Function Definition: foo( ( global void)
0:25 Function Parameters:
0:28 Function Definition: foo( ( global void)
0:28 Function Parameters:
0:? Sequence
0:31 Constant:
0:31 0.000000
0:32 Constant:
0:32 0.000000
0:33 Constant:
0:33 0.000000
0:34 Constant:
0:34 0.000000
0:35 Constant:
0:35 0.000000
0:36 Constant:
0:36 0.000000
0:37 Constant:
0:37 0.000000
0:38 Constant:
0:38 0.000000
0:39 Constant:
0:39 0.000000
0:44 Constant:
0:44 0.000000
0:45 Constant:
0:45 0.000000
0:46 Constant:
0:46 0.000000
0:? Linker Objects
0:? 'anon@0' ( out block{ out 3-element array of float CullDistance gl_CullDistance})
0:? 'outb' ( smooth out bool)
@ -33,6 +75,8 @@ ERROR: node is still EOpNull!
0:? 'outsa' ( smooth out 4-element array of structure{ global float f})
0:? 'outSA' ( smooth out structure{ global 4-element array of float f})
0:? 'outSS' ( smooth out structure{ global float f, global structure{ global float f} s})
0:? 'aui' (layout( binding=0 offset=0) uniform atomic_uint)
0:? 'ui' ( global uint)
0:? 'gl_VertexID' ( gl_VertexId int VertexId)
0:? 'gl_InstanceID' ( gl_InstanceId int InstanceId)
@ -66,6 +110,8 @@ ERROR: node is still EOpNull!
0:? 'outsa' ( smooth out 4-element array of structure{ global float f})
0:? 'outSA' ( smooth out structure{ global 4-element array of float f})
0:? 'outSS' ( smooth out structure{ global float f, global structure{ global float f} s})
0:? 'aui' (layout( binding=0 offset=0) uniform atomic_uint)
0:? 'ui' ( global uint)
0:? 'gl_VertexID' ( gl_VertexId int VertexId)
0:? 'gl_InstanceID' ( gl_InstanceId int InstanceId)

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

@ -0,0 +1,55 @@
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:14 move second child to first child ( temp bool)
0:14 'b1' ( temp bool)
0:14 anyInvocation ( global bool)
0:14 'b1' ( temp bool)
0:15 move second child to first child ( temp bool)
0:15 'b1' ( temp bool)
0:15 allInvocations ( global bool)
0:15 'b1' ( temp bool)
0:16 move second child to first child ( temp bool)
0:16 'b1' ( temp bool)
0:16 allInvocationsEqual ( global bool)
0:16 'b1' ( temp bool)
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:14 move second child to first child ( temp bool)
0:14 'b1' ( temp bool)
0:14 anyInvocation ( global bool)
0:14 'b1' ( temp bool)
0:15 move second child to first child ( temp bool)
0:15 'b1' ( temp bool)
0:15 allInvocations ( global bool)
0:15 'b1' ( temp bool)
0:16 move second child to first child ( temp bool)
0:16 'b1' ( temp bool)
0:16 allInvocationsEqual ( global bool)
0:16 'b1' ( temp bool)
0:? Linker Objects
0:? 's' ( smooth in structure{ global float f, global 4-component vector of float v})

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

@ -0,0 +1,51 @@
460.vert
Shader version: 460
0:? Sequence
0:7 Function Definition: main( ( global void)
0:7 Function Parameters:
0:? Sequence
0:10 move second child to first child ( temp bool)
0:10 'b1' ( temp bool)
0:10 anyInvocation ( global bool)
0:10 'b1' ( temp bool)
0:11 move second child to first child ( temp bool)
0:11 'b1' ( temp bool)
0:11 allInvocations ( global bool)
0:11 'b1' ( temp bool)
0:12 move second child to first child ( temp bool)
0:12 'b1' ( temp bool)
0:12 allInvocationsEqual ( global bool)
0:12 'b1' ( temp bool)
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:? Sequence
0:10 move second child to first child ( temp bool)
0:10 'b1' ( temp bool)
0:10 anyInvocation ( global bool)
0:10 'b1' ( temp bool)
0:11 move second child to first child ( temp bool)
0:11 'b1' ( temp bool)
0:11 allInvocations ( global bool)
0:11 'b1' ( temp bool)
0:12 move second child to first child ( temp bool)
0:12 'b1' ( temp bool)
0:12 allInvocationsEqual ( global bool)
0:12 'b1' ( temp bool)
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

@ -0,0 +1,33 @@
spv.460.comp
// Module Version 10000
// Generated by (magic number): 80001
// Id's are bound by 15
Capability Shader
Capability SubgroupVoteKHR
Extension "SPV_KHR_subgroup_vote"
1: ExtInstImport "GLSL.std.450"
MemoryModel Logical GLSL450
EntryPoint GLCompute 4 "main"
ExecutionMode 4 LocalSize 1 1 1
Source GLSL 460
Name 4 "main"
Name 8 "b1"
2: TypeVoid
3: TypeFunction 2
6: TypeBool
7: TypePointer Function 6(bool)
4(main): 2 Function None 3
5: Label
8(b1): 7(ptr) Variable Function
9: 6(bool) Load 8(b1)
10: 6(bool) SubgroupAnyKHR 9
Store 8(b1) 10
11: 6(bool) Load 8(b1)
12: 6(bool) SubgroupAllKHR 11
Store 8(b1) 12
13: 6(bool) Load 8(b1)
14: 6(bool) SubgroupAllEqualKHR 13
Store 8(b1) 14
Return
FunctionEnd

View File

@ -0,0 +1,51 @@
spv.460.frag
// Module Version 10000
// Generated by (magic number): 80001
// Id's are bound by 32
Capability Shader
Capability AtomicStorage
Capability AtomicStorageOps
Extension "SPV_KHR_shader_atomic_counter_ops"
1: ExtInstImport "GLSL.std.450"
MemoryModel Logical GLSL450
EntryPoint Fragment 4 "main"
ExecutionMode 4 OriginLowerLeft
Source GLSL 460
Name 4 "main"
Name 8 "aui"
Name 10 "ui"
Decorate 8(aui) Offset 0
Decorate 8(aui) Binding 0
2: TypeVoid
3: TypeFunction 2
6: TypeInt 32 0
7: TypePointer AtomicCounter 6(int)
8(aui): 7(ptr) Variable AtomicCounter
9: TypePointer Private 6(int)
10(ui): 9(ptr) Variable Private
12: 6(int) Constant 1
13: 6(int) Constant 0
4(main): 2 Function None 3
5: Label
11: 6(int) Load 10(ui)
14: 6(int) AtomicIAdd 8(aui) 12 13 11
15: 6(int) Load 10(ui)
16: 6(int) AtomicISub 8(aui) 12 13 15
17: 6(int) Load 10(ui)
18: 6(int) AtomicUMin 8(aui) 12 13 17
19: 6(int) Load 10(ui)
20: 6(int) AtomicUMax 8(aui) 12 13 19
21: 6(int) Load 10(ui)
22: 6(int) AtomicAnd 8(aui) 12 13 21
23: 6(int) Load 10(ui)
24: 6(int) AtomicOr 8(aui) 12 13 23
25: 6(int) Load 10(ui)
26: 6(int) AtomicXor 8(aui) 12 13 25
27: 6(int) Load 10(ui)
28: 6(int) AtomicExchange 8(aui) 12 13 27
29: 6(int) Load 10(ui)
30: 6(int) Load 10(ui)
31: 6(int) AtomicCompareExchange 8(aui) 12 13 13 30 29
Return
FunctionEnd

View File

@ -0,0 +1,45 @@
spv.460.vert
// Module Version 10000
// Generated by (magic number): 80001
// Id's are bound by 20
Capability Shader
Capability DrawParameters
Extension "SPV_KHR_shader_draw_parameters"
1: ExtInstImport "GLSL.std.450"
MemoryModel Logical GLSL450
EntryPoint Vertex 4 "main" 10 12 15 18 19
Source GLSL 460
Name 4 "main"
Name 8 "a"
Name 10 "gl_BaseVertex"
Name 12 "gl_BaseInstance"
Name 15 "gl_DrawID"
Name 18 "gl_VertexID"
Name 19 "gl_InstanceID"
Decorate 10(gl_BaseVertex) BuiltIn BaseVertex
Decorate 12(gl_BaseInstance) BuiltIn BaseInstance
Decorate 15(gl_DrawID) BuiltIn DrawIndex
Decorate 18(gl_VertexID) BuiltIn VertexId
Decorate 19(gl_InstanceID) BuiltIn InstanceId
2: TypeVoid
3: TypeFunction 2
6: TypeInt 32 1
7: TypePointer Function 6(int)
9: TypePointer Input 6(int)
10(gl_BaseVertex): 9(ptr) Variable Input
12(gl_BaseInstance): 9(ptr) Variable Input
15(gl_DrawID): 9(ptr) Variable Input
18(gl_VertexID): 9(ptr) Variable Input
19(gl_InstanceID): 9(ptr) Variable Input
4(main): 2 Function None 3
5: Label
8(a): 7(ptr) Variable Function
11: 6(int) Load 10(gl_BaseVertex)
13: 6(int) Load 12(gl_BaseInstance)
14: 6(int) IAdd 11 13
16: 6(int) Load 15(gl_DrawID)
17: 6(int) IAdd 14 16
Store 8(a) 17
Return
FunctionEnd

9
Test/spv.460.comp Normal file
View File

@ -0,0 +1,9 @@
#version 460
void main()
{
bool b1;
b1 = anyInvocation(b1);
b1 = allInvocations(b1);
b1 = allInvocationsEqual(b1);
}

17
Test/spv.460.frag Normal file
View File

@ -0,0 +1,17 @@
#version 460 core
layout(binding = 0) uniform atomic_uint aui;
uint ui;
void main()
{
atomicCounterAdd(aui, ui);
atomicCounterSubtract(aui, ui);
atomicCounterMin(aui, ui);
atomicCounterMax(aui, ui);
atomicCounterAnd(aui, ui);
atomicCounterOr(aui, ui);
atomicCounterXor(aui, ui);
atomicCounterExchange(aui, ui);
atomicCounterCompSwap(aui, ui, ui);
}

6
Test/spv.460.vert Normal file
View File

@ -0,0 +1,6 @@
#version 460
void main()
{
int a = gl_BaseVertex + gl_BaseInstance + gl_DrawID;
}

View File

@ -420,6 +420,15 @@ enum TOperator {
EOpAtomicCounterIncrement,
EOpAtomicCounterDecrement,
EOpAtomicCounter,
EOpAtomicCounterAdd,
EOpAtomicCounterSubtract,
EOpAtomicCounterMin,
EOpAtomicCounterMax,
EOpAtomicCounterAnd,
EOpAtomicCounterOr,
EOpAtomicCounterXor,
EOpAtomicCounterExchange,
EOpAtomicCounterCompSwap,
EOpAny,
EOpAll,

View File

@ -1375,9 +1375,23 @@ void TBuiltIns::initialize(int version, EProfile profile, const SpvVersion& spvV
if ((profile != EEsProfile && version >= 300) ||
(profile == EEsProfile && version >= 310)) {
commonBuiltins.append(
"uint atomicCounterIncrement(atomic_uint x);"
"uint atomicCounterDecrement(atomic_uint x);"
"uint atomicCounter(atomic_uint x);"
"uint atomicCounterIncrement(atomic_uint);"
"uint atomicCounterDecrement(atomic_uint);"
"uint atomicCounter(atomic_uint);"
"\n");
}
if (profile != EEsProfile && version >= 460) {
commonBuiltins.append(
"uint atomicCounterAdd(atomic_uint, uint);"
"uint atomicCounterSubtract(atomic_uint, uint);"
"uint atomicCounterMin(atomic_uint, uint);"
"uint atomicCounterMax(atomic_uint, uint);"
"uint atomicCounterAnd(atomic_uint, uint);"
"uint atomicCounterOr(atomic_uint, uint);"
"uint atomicCounterXor(atomic_uint, uint);"
"uint atomicCounterExchange(atomic_uint, uint);"
"uint atomicCounterCompSwap(atomic_uint, uint, uint);"
"\n");
}
@ -1572,6 +1586,15 @@ void TBuiltIns::initialize(int version, EProfile profile, const SpvVersion& spvV
"\n");
}
if (profile != EEsProfile && version >= 460) {
commonBuiltins.append(
"bool anyInvocation(bool);"
"bool allInvocations(bool);"
"bool allInvocationsEqual(bool);"
"\n");
}
#ifdef AMD_EXTENSIONS
// GL_AMD_shader_ballot
if (profile != EEsProfile && version >= 450) {
@ -3402,6 +3425,13 @@ void TBuiltIns::initialize(int version, EProfile profile, const SpvVersion& spvV
"in int gl_DrawIDARB;"
);
}
if (version >= 460) {
stageBuiltins[EShLangVertex].append(
"in int gl_BaseVertex;"
"in int gl_BaseInstance;"
"in int gl_DrawID;"
);
}
#ifdef NV_EXTENSIONS
if (version >= 450)
@ -5216,16 +5246,19 @@ void TBuiltIns::identifyBuiltIns(int version, EProfile profile, const SpvVersion
switch(language) {
case EShLangVertex:
if (profile != EEsProfile) {
if (version >= 440) {
symbolTable.setVariableExtensions("gl_BaseVertexARB", 1, &E_GL_ARB_shader_draw_parameters);
symbolTable.setVariableExtensions("gl_BaseInstanceARB", 1, &E_GL_ARB_shader_draw_parameters);
symbolTable.setVariableExtensions("gl_DrawIDARB", 1, &E_GL_ARB_shader_draw_parameters);
BuiltInVariable("gl_BaseVertexARB", EbvBaseVertex, symbolTable);
BuiltInVariable("gl_BaseInstanceARB", EbvBaseInstance, symbolTable);
BuiltInVariable("gl_DrawIDARB", EbvDrawId, symbolTable);
}
if (profile != EEsProfile) {
if (version >= 460) {
BuiltInVariable("gl_BaseVertex", EbvBaseVertex, symbolTable);
BuiltInVariable("gl_BaseInstance", EbvBaseInstance, symbolTable);
BuiltInVariable("gl_DrawID", EbvDrawId, symbolTable);
}
symbolTable.setVariableExtensions("gl_SubGroupSizeARB", 1, &E_GL_ARB_shader_ballot);
symbolTable.setVariableExtensions("gl_SubGroupInvocationARB", 1, &E_GL_ARB_shader_ballot);
symbolTable.setVariableExtensions("gl_SubGroupEqMaskARB", 1, &E_GL_ARB_shader_ballot);
@ -5249,10 +5282,12 @@ void TBuiltIns::identifyBuiltIns(int version, EProfile profile, const SpvVersion
// Treat "gl_SubGroupSizeARB" as shader input instead of uniform for Vulkan
SpecialQualifier("gl_SubGroupSizeARB", EvqVaryingIn, EbvSubGroupSize, symbolTable);
if (version >= 430) {
symbolTable.setFunctionExtensions("anyInvocationARB", 1, &E_GL_ARB_shader_group_vote);
symbolTable.setFunctionExtensions("allInvocationsARB", 1, &E_GL_ARB_shader_group_vote);
symbolTable.setFunctionExtensions("allInvocationsEqualARB", 1, &E_GL_ARB_shader_group_vote);
}
}
#ifdef AMD_EXTENSIONS
if (profile != EEsProfile) {
@ -5909,6 +5944,18 @@ void TBuiltIns::identifyBuiltIns(int version, EProfile profile, const SpvVersion
symbolTable.relateToOperator("atomicCounterDecrement", EOpAtomicCounterDecrement);
symbolTable.relateToOperator("atomicCounter", EOpAtomicCounter);
if (profile != EEsProfile && version >= 460) {
symbolTable.relateToOperator("atomicCounterAdd", EOpAtomicCounterAdd);
symbolTable.relateToOperator("atomicCounterSubtract", EOpAtomicCounterSubtract);
symbolTable.relateToOperator("atomicCounterMin", EOpAtomicCounterMin);
symbolTable.relateToOperator("atomicCounterMax", EOpAtomicCounterMax);
symbolTable.relateToOperator("atomicCounterAnd", EOpAtomicCounterAnd);
symbolTable.relateToOperator("atomicCounterOr", EOpAtomicCounterOr);
symbolTable.relateToOperator("atomicCounterXor", EOpAtomicCounterXor);
symbolTable.relateToOperator("atomicCounterExchange", EOpAtomicCounterExchange);
symbolTable.relateToOperator("atomicCounterCompSwap", EOpAtomicCounterCompSwap);
}
symbolTable.relateToOperator("fma", EOpFma);
symbolTable.relateToOperator("frexp", EOpFrexp);
symbolTable.relateToOperator("ldexp", EOpLdexp);
@ -6051,10 +6098,16 @@ void TBuiltIns::identifyBuiltIns(int version, EProfile profile, const SpvVersion
symbolTable.relateToOperator("readInvocationARB", EOpReadInvocation);
symbolTable.relateToOperator("readFirstInvocationARB", EOpReadFirstInvocation);
if (version >= 430) {
symbolTable.relateToOperator("anyInvocationARB", EOpAnyInvocation);
symbolTable.relateToOperator("allInvocationsARB", EOpAllInvocations);
symbolTable.relateToOperator("allInvocationsEqualARB", EOpAllInvocationsEqual);
}
if (version >= 460) {
symbolTable.relateToOperator("anyInvocation", EOpAnyInvocation);
symbolTable.relateToOperator("allInvocations", EOpAllInvocations);
symbolTable.relateToOperator("allInvocationsEqual", EOpAllInvocationsEqual);
}
#ifdef AMD_EXTENSIONS
symbolTable.relateToOperator("minInvocationsAMD", EOpMinInvocations);
symbolTable.relateToOperator("maxInvocationsAMD", EOpMaxInvocations);

View File

@ -116,7 +116,7 @@ TParseContextBase* CreateParseContext(TSymbolTable& symbolTable, TIntermediate&
// 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)
{
@ -140,6 +140,7 @@ int MapVersionToIndex(int version)
case 450: index = 14; break;
case 500: index = 0; break; // HLSL
case 320: index = 15; break;
case 460: index = 16; break;
default: assert(0); break;
}
@ -516,6 +517,7 @@ bool DeduceVersionProfile(TInfoSink& infoSink, EShLanguage stage, bool versionNo
case 430: break;
case 440: break;
case 450: break;
case 460: break;
// unknown version
default:

View File

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

File diff suppressed because it is too large Load Diff

View File

@ -682,6 +682,16 @@ bool TOutputTraverser::visitAggregate(TVisit /* visit */, TIntermAggregate* node
case EOpAtomicExchange: out.debug << "AtomicExchange"; break;
case EOpAtomicCompSwap: out.debug << "AtomicCompSwap"; break;
case EOpAtomicCounterAdd: out.debug << "AtomicCounterAdd"; break;
case EOpAtomicCounterSubtract: out.debug << "AtomicCounterSubtract"; break;
case EOpAtomicCounterMin: out.debug << "AtomicCounterMin"; break;
case EOpAtomicCounterMax: out.debug << "AtomicCounterMax"; break;
case EOpAtomicCounterAnd: out.debug << "AtomicCounterAnd"; break;
case EOpAtomicCounterOr: out.debug << "AtomicCounterOr"; break;
case EOpAtomicCounterXor: out.debug << "AtomicCounterXor"; break;
case EOpAtomicCounterExchange: out.debug << "AtomicCounterExchange"; break;
case EOpAtomicCounterCompSwap: out.debug << "AtomicCounterCompSwap"; break;
case EOpImageQuerySize: out.debug << "imageQuerySize"; break;
case EOpImageQuerySamples: out.debug << "imageQuerySamples"; break;
case EOpImageLoad: out.debug << "imageLoad"; break;

View File

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

View File

@ -360,6 +360,9 @@ INSTANTIATE_TEST_CASE_P(
INSTANTIATE_TEST_CASE_P(
Glsl, CompileOpenGLToSpirvTest,
::testing::ValuesIn(std::vector<std::string>({
"spv.460.frag",
"spv.460.vert",
"spv.460.comp",
"spv.atomic.comp",
"spv.glFragColor.frag",
"spv.specConst.vert",