Full stack: properly implement GL_EXT_device_group and GL_EXT_multiview.

This commit is contained in:
John Kessenich 2017-03-14 16:45:30 -06:00
parent 78cfba97e1
commit c08fb8ab9c
19 changed files with 319 additions and 30 deletions

View File

@ -57,3 +57,23 @@ void foo()
v += textureProjGradOffset(s2dr, tloc4, ivec2(0.0), ivec2(0.0), ivec2(1,2));
v += textureProjGradOffset(s2drs, tloc4, ivec2(0.0), ivec2(0.0), ivec2(1,2));
}
void devi()
{
gl_DeviceIndex; // ERROR, no extension
gl_ViewIndex; // ERROR, no extension
}
#ifdef GL_EXT_device_group
#extension GL_EXT_device_group : enable
#endif
#ifdef GL_EXT_device_group
#extension GL_EXT_multiview : enable
#endif
void devie()
{
gl_DeviceIndex;
gl_ViewIndex;
}

View File

@ -238,3 +238,19 @@ float t__; // ERROR, no __ until revision 310
#define __D
shared vec4 arr[2][3][4];
void devi()
{
gl_DeviceIndex; // ERROR, no extension
gl_ViewIndex; // ERROR, never this stage
}
#ifdef GL_EXT_device_group
#extension GL_EXT_device_group : enable
#endif
void devie()
{
gl_DeviceIndex;
gl_ViewIndex; // ERROR, never this stage
}

View File

@ -429,3 +429,23 @@ void blendFoo(layout(blend_support_hsl_luminosity) vec3 v) { } // ERROR, only on
layout(blend_support_flizbit) out; // ERROR, no flizbit
out vec4 outAA[2][2]; // ERROR
void devi()
{
gl_DeviceIndex; // ERROR, no extension
gl_ViewIndex; // ERROR, no extension
}
#ifdef GL_EXT_device_group
#extension GL_EXT_device_group : enable
#endif
#ifdef GL_EXT_device_group
#extension GL_EXT_multiview : enable
#endif
void devie()
{
gl_DeviceIndex;
gl_ViewIndex;
}

View File

@ -103,3 +103,23 @@ patch out pinbn {
invariant precise out vec4 badOrder[]; // ERROR, precise must appear first
void badp(out precise float f); // ERROR, precise must appear first
void devi()
{
gl_DeviceIndex; // ERROR, no extension
gl_ViewIndex; // ERROR, no extension
}
#ifdef GL_EXT_device_group
#extension GL_EXT_device_group : enable
#endif
#ifdef GL_EXT_device_group
#extension GL_EXT_multiview : enable
#endif
void devie()
{
gl_DeviceIndex;
gl_ViewIndex;
}

View File

@ -103,3 +103,23 @@ in float gl_TessLevelOuter[4]; // ERROR, can't redeclare
patch in pinbn {
int a;
} pinbi;
void devi()
{
gl_DeviceIndex; // ERROR, no extension
gl_ViewIndex; // ERROR, no extension
}
#ifdef GL_EXT_device_group
#extension GL_EXT_device_group : enable
#endif
#ifdef GL_EXT_device_group
#extension GL_EXT_multiview : enable
#endif
void devie()
{
gl_DeviceIndex;
gl_ViewIndex;
}

View File

@ -9,12 +9,16 @@ ERROR: 0:38: 'gl_ClipVertex' : cannot redeclare after use
ERROR: 0:39: 'gl_FogFragCoord' : cannot redeclare after use
ERROR: 0:51: 'texelFetch' : no matching overloaded function found
ERROR: 0:53: 'texture' : no matching overloaded function found
ERROR: 10 compilation errors. No code generated.
ERROR: 0:63: 'gl_DeviceIndex' : required extension not requested: GL_EXT_device_group
ERROR: 0:64: 'gl_ViewIndex' : required extension not requested: GL_EXT_multiview
ERROR: 12 compilation errors. No code generated.
Shader version: 140
Requested GL_ARB_explicit_attrib_location
Requested GL_ARB_separate_shader_objects
Requested GL_EXT_device_group
Requested GL_EXT_multiview
ERROR: node is still EOpNull!
0:9 Function Definition: main( (global void)
0:9 Function Parameters:
@ -116,6 +120,16 @@ ERROR: node is still EOpNull!
0:58 Constant:
0:58 1 (const int)
0:58 2 (const int)
0:61 Function Definition: devi( (global void)
0:61 Function Parameters:
0:63 Sequence
0:63 'gl_DeviceIndex' (in int DeviceIndex)
0:64 'gl_ViewIndex' (in int ViewIndex)
0:75 Function Definition: devie( (global void)
0:75 Function Parameters:
0:77 Sequence
0:77 'gl_DeviceIndex' (in int DeviceIndex)
0:78 'gl_ViewIndex' (in int ViewIndex)
0:? Linker Objects
0:? 'sbuf' (uniform isamplerBuffer)
0:? 'anon@0' (layout(column_major std140 ) uniform block{layout(column_major std140 offset=0 ) uniform int anonMem})
@ -142,6 +156,8 @@ Linked vertex stage:
Shader version: 140
Requested GL_ARB_explicit_attrib_location
Requested GL_ARB_separate_shader_objects
Requested GL_EXT_device_group
Requested GL_EXT_multiview
ERROR: node is still EOpNull!
0:9 Function Definition: main( (global void)
0:9 Function Parameters:

View File

@ -232,11 +232,15 @@ ERROR: 0:87: 'location' : overlapping use of location 4
ERROR: 0:104: '' : precise qualifier must appear first
ERROR: 0:105: '' : precise qualifier must appear first
ERROR: 0:105: '' : precise qualifier must appear first
ERROR: 21 compilation errors. No code generated.
ERROR: 0:109: 'gl_DeviceIndex' : required extension not requested: GL_EXT_device_group
ERROR: 0:110: 'gl_ViewIndex' : required extension not requested: GL_EXT_multiview
ERROR: 23 compilation errors. No code generated.
Shader version: 400
Requested GL_ARB_separate_shader_objects
Requested GL_EXT_device_group
Requested GL_EXT_multiview
vertices = 4
ERROR: node is still EOpNull!
0:13 Function Definition: main( (global void)
@ -408,6 +412,16 @@ ERROR: node is still EOpNull!
0:97 'd' (noContraction temp double)
0:97 'd' (noContraction temp double)
0:97 'd' (noContraction temp double)
0:107 Function Definition: devi( (global void)
0:107 Function Parameters:
0:109 Sequence
0:109 'gl_DeviceIndex' (in int DeviceIndex)
0:110 'gl_ViewIndex' (in int ViewIndex)
0:121 Function Definition: devie( (global void)
0:121 Function Parameters:
0:123 Sequence
0:123 'gl_DeviceIndex' (in int DeviceIndex)
0:124 'gl_ViewIndex' (in int ViewIndex)
0:? Linker Objects
0:? 'gl_out' (out 4-element array of block{out 4-component vector of float Position gl_Position, out float PointSize gl_PointSize, out implicitly-sized array of float ClipDistance gl_ClipDistance})
0:? 'outa' (global 4-element array of int)
@ -459,11 +473,15 @@ ERROR: 0:86: '[]' : tessellation input array size must be gl_MaxPatchVertices or
ERROR: 0:96: 'location' : overlapping use of location 24
ERROR: 0:99: 'location' : overlapping use of location 24
ERROR: 0:101: 'gl_TessLevelOuter' : identifiers starting with "gl_" are reserved
ERROR: 30 compilation errors. No code generated.
ERROR: 0:109: 'gl_DeviceIndex' : required extension not requested: GL_EXT_device_group
ERROR: 0:110: 'gl_ViewIndex' : required extension not requested: GL_EXT_multiview
ERROR: 32 compilation errors. No code generated.
Shader version: 400
Requested GL_ARB_separate_shader_objects
Requested GL_EXT_device_group
Requested GL_EXT_multiview
input primitive = quads
vertex spacing = fractional_odd_spacing
triangle order = cw
@ -559,6 +577,16 @@ ERROR: node is still EOpNull!
0:44 Constant:
0:44 2 (const int)
0:44 'cd' (temp float)
0:107 Function Definition: devi( (global void)
0:107 Function Parameters:
0:109 Sequence
0:109 'gl_DeviceIndex' (in int DeviceIndex)
0:110 'gl_ViewIndex' (in int ViewIndex)
0:121 Function Definition: devie( (global void)
0:121 Function Parameters:
0:123 Sequence
0:123 'gl_DeviceIndex' (in int DeviceIndex)
0:124 'gl_ViewIndex' (in int ViewIndex)
0:? Linker Objects
0:? 'patchIn' (patch in 4-component vector of float)
0:? 'patchOut' (patch out 4-component vector of float)
@ -952,6 +980,8 @@ ERROR: Linking tessellation evaluation stage: Multiple function bodies in multip
Shader version: 420
Requested GL_ARB_separate_shader_objects
Requested GL_ARB_tessellation_shader
Requested GL_EXT_device_group
Requested GL_EXT_multiview
vertices = 4
0:? Sequence
0:10 Function Definition: main( (global void)
@ -1277,6 +1307,8 @@ vertices = 4
Shader version: 420
Requested GL_ARB_separate_shader_objects
Requested GL_ARB_tessellation_shader
Requested GL_EXT_device_group
Requested GL_EXT_multiview
input primitive = quads
vertex spacing = fractional_odd_spacing
triangle order = cw

View File

@ -81,10 +81,14 @@ ERROR: 0:227: 'input block' : not supported in this stage: compute
ERROR: 0:231: 'output block' : not supported in this stage: compute
WARNING: 0:235: 't__' : identifiers containing consecutive underscores ("__") are reserved
WARNING: 0:238: '#define' : names containing consecutive underscores are reserved: __D
ERROR: 79 compilation errors. No code generated.
ERROR: 0:244: 'gl_DeviceIndex' : required extension not requested: GL_EXT_device_group
ERROR: 0:245: 'gl_ViewIndex' : undeclared identifier
ERROR: 0:255: 'gl_ViewIndex' : undeclared identifier
ERROR: 82 compilation errors. No code generated.
Shader version: 310
Requested GL_EXT_device_group
local_size = (2, 1, 4096)
ERROR: node is still EOpNull!
0:27 Function Definition: main( (global void)
@ -443,6 +447,16 @@ ERROR: node is still EOpNull!
0:224 0 (const int)
0:224 Constant:
0:224 2 (const int)
0:242 Function Definition: devi( (global void)
0:242 Function Parameters:
0:244 Sequence
0:244 'gl_DeviceIndex' (in highp int DeviceIndex)
0:245 'gl_ViewIndex' (temp float)
0:252 Function Definition: devie( (global void)
0:252 Function Parameters:
0:254 Sequence
0:254 'gl_DeviceIndex' (in highp int DeviceIndex)
0:255 'gl_ViewIndex' (temp float)
0:? Linker Objects
0:? 'gl_WorkGroupSize' (const highp 3-component vector of uint WorkGroupSize)
0:? 2 (const uint)
@ -512,6 +526,7 @@ Linked compute stage:
Shader version: 310
Requested GL_EXT_device_group
local_size = (2, 1, 4096)
ERROR: node is still EOpNull!
0:27 Function Definition: main( (global void)

View File

@ -133,10 +133,14 @@ ERROR: 0:427: 'blend equation' : can only apply to a standalone qualifier
ERROR: 0:428: 'blend equation' : can only apply to a standalone qualifier
ERROR: 0:429: 'blend_support' : unknown blend equation
ERROR: 0:431: 'fragment-shader array-of-array output' : not supported with this profile: es
ERROR: 125 compilation errors. No code generated.
ERROR: 0:435: 'gl_DeviceIndex' : required extension not requested: GL_EXT_device_group
ERROR: 0:436: 'gl_ViewIndex' : required extension not requested: GL_EXT_multiview
ERROR: 127 compilation errors. No code generated.
Shader version: 310
Requested GL_EXT_device_group
Requested GL_EXT_multiview
Requested GL_EXT_shader_io_blocks
Requested GL_EXT_texture_cube_map_array
Requested GL_KHR_blend_equation_advanced
@ -916,6 +920,16 @@ ERROR: node is still EOpNull!
0:428 Function Definition: blendFoo(vf3; (global void)
0:428 Function Parameters:
0:428 'v' (in mediump 3-component vector of float)
0:433 Function Definition: devi( (global void)
0:433 Function Parameters:
0:435 Sequence
0:435 'gl_DeviceIndex' (flat in highp int DeviceIndex)
0:436 'gl_ViewIndex' (flat in highp int ViewIndex)
0:447 Function Definition: devie( (global void)
0:447 Function Parameters:
0:449 Sequence
0:449 'gl_DeviceIndex' (flat in highp int DeviceIndex)
0:450 'gl_ViewIndex' (flat in highp int ViewIndex)
0:? Linker Objects
0:? 'gl_FragCoord' (smooth in mediump 4-component vector of float)
0:? 'v3' (layout(location=2 ) smooth in mediump 3-component vector of float)
@ -1017,6 +1031,8 @@ Linked fragment stage:
ERROR: Linking fragment stage: when more than one fragment shader output, all must have location qualifiers
Shader version: 310
Requested GL_EXT_device_group
Requested GL_EXT_multiview
Requested GL_EXT_shader_io_blocks
Requested GL_EXT_texture_cube_map_array
Requested GL_KHR_blend_equation_advanced

View File

@ -21,11 +21,15 @@ ERROR: 0:87: 'location' : overlapping use of location 4
ERROR: 0:104: '' : precise qualifier must appear first
ERROR: 0:105: '' : precise qualifier must appear first
ERROR: 0:105: '' : precise qualifier must appear first
ERROR: 21 compilation errors. No code generated.
ERROR: 0:109: 'gl_DeviceIndex' : required extension not requested: GL_EXT_device_group
ERROR: 0:110: 'gl_ViewIndex' : required extension not requested: GL_EXT_multiview
ERROR: 23 compilation errors. No code generated.
Shader version: 400
Requested GL_ARB_separate_shader_objects
Requested GL_EXT_device_group
Requested GL_EXT_multiview
vertices = 4
ERROR: node is still EOpNull!
0:13 Function Definition: main( (global void)
@ -197,6 +201,16 @@ ERROR: node is still EOpNull!
0:97 'd' (noContraction temp double)
0:97 'd' (noContraction temp double)
0:97 'd' (noContraction temp double)
0:107 Function Definition: devi( (global void)
0:107 Function Parameters:
0:109 Sequence
0:109 'gl_DeviceIndex' (in int DeviceIndex)
0:110 'gl_ViewIndex' (in int ViewIndex)
0:121 Function Definition: devie( (global void)
0:121 Function Parameters:
0:123 Sequence
0:123 'gl_DeviceIndex' (in int DeviceIndex)
0:124 'gl_ViewIndex' (in int ViewIndex)
0:? Linker Objects
0:? 'gl_out' (out 4-element array of block{out 4-component vector of float Position gl_Position, out float PointSize gl_PointSize, out implicitly-sized array of float ClipDistance gl_ClipDistance})
0:? 'outa' (global 4-element array of int)
@ -222,6 +236,8 @@ Linked tessellation control stage:
Shader version: 400
Requested GL_ARB_separate_shader_objects
Requested GL_EXT_device_group
Requested GL_EXT_multiview
vertices = 4
ERROR: node is still EOpNull!
0:13 Function Definition: main( (global void)

View File

@ -30,11 +30,15 @@ ERROR: 0:86: '[]' : tessellation input array size must be gl_MaxPatchVertices or
ERROR: 0:96: 'location' : overlapping use of location 24
ERROR: 0:99: 'location' : overlapping use of location 24
ERROR: 0:101: 'gl_TessLevelOuter' : identifiers starting with "gl_" are reserved
ERROR: 30 compilation errors. No code generated.
ERROR: 0:109: 'gl_DeviceIndex' : required extension not requested: GL_EXT_device_group
ERROR: 0:110: 'gl_ViewIndex' : required extension not requested: GL_EXT_multiview
ERROR: 32 compilation errors. No code generated.
Shader version: 400
Requested GL_ARB_separate_shader_objects
Requested GL_EXT_device_group
Requested GL_EXT_multiview
input primitive = quads
vertex spacing = fractional_odd_spacing
triangle order = cw
@ -130,6 +134,16 @@ ERROR: node is still EOpNull!
0:44 Constant:
0:44 2 (const int)
0:44 'cd' (temp float)
0:107 Function Definition: devi( (global void)
0:107 Function Parameters:
0:109 Sequence
0:109 'gl_DeviceIndex' (in int DeviceIndex)
0:110 'gl_ViewIndex' (in int ViewIndex)
0:121 Function Definition: devie( (global void)
0:121 Function Parameters:
0:123 Sequence
0:123 'gl_DeviceIndex' (in int DeviceIndex)
0:124 'gl_ViewIndex' (in int ViewIndex)
0:? Linker Objects
0:? 'patchIn' (patch in 4-component vector of float)
0:? 'patchOut' (patch out 4-component vector of float)
@ -160,6 +174,8 @@ Linked tessellation evaluation stage:
Shader version: 400
Requested GL_ARB_separate_shader_objects
Requested GL_EXT_device_group
Requested GL_EXT_multiview
input primitive = quads
vertex spacing = fractional_odd_spacing
triangle order = cw

View File

@ -3,14 +3,17 @@ Warning, version 310 is not yet complete; most version-specific features are pre
// Module Version 10000
// Generated by (magic number): 80001
// Id's are bound by 67
// Id's are bound by 69
Capability Shader
Capability DeviceGroup
Extension "SPV_KHR_device_group"
1: ExtInstImport "GLSL.std.450"
MemoryModel Logical GLSL450
EntryPoint GLCompute 4 "main" 53
EntryPoint GLCompute 4 "main" 53 64
ExecutionMode 4 LocalSize 16 32 4
Source ESSL 310
SourceExtension "GL_EXT_device_group"
Name 4 "main"
Name 13 "outb"
MemberName 13(outb) 0 "f"
@ -29,6 +32,7 @@ Warning, version 310 is not yet complete; most version-specific features are pre
MemberName 48(outs) 1 "va"
Name 50 "outnames"
Name 53 "gl_LocalInvocationID"
Name 64 "gl_DeviceIndex"
Decorate 12 ArrayStride 16
MemberDecorate 13(outb) 0 Offset 0
MemberDecorate 13(outb) 1 Offset 4
@ -46,7 +50,8 @@ Warning, version 310 is not yet complete; most version-specific features are pre
Decorate 48(outs) BufferBlock
Decorate 50(outnames) DescriptorSet 0
Decorate 53(gl_LocalInvocationID) BuiltIn LocalInvocationId
Decorate 66 BuiltIn WorkgroupSize
Decorate 64(gl_DeviceIndex) BuiltIn DeviceIndex
Decorate 68 BuiltIn WorkgroupSize
2: TypeVoid
3: TypeFunction 2
6: TypeInt 32 0
@ -87,10 +92,12 @@ Warning, version 310 is not yet complete; most version-specific features are pre
53(gl_LocalInvocationID): 52(ptr) Variable Input
54: TypePointer Input 6(int)
61: TypePointer Uniform 16(int)
63: 6(int) Constant 16
64: 6(int) Constant 32
65: 6(int) Constant 4
66: 51(ivec3) ConstantComposite 63 64 65
63: TypePointer Input 16(int)
64(gl_DeviceIndex): 63(ptr) Variable Input
65: 6(int) Constant 16
66: 6(int) Constant 32
67: 6(int) Constant 4
68: 51(ivec3) ConstantComposite 65 66 67
4(main): 2 Function None 3
5: Label
ControlBarrier 7 8 9

View File

@ -10,13 +10,14 @@ Warning, version 450 is not yet complete; most version-specific features are pre
Extension "SPV_KHR_device_group"
1: ExtInstImport "GLSL.std.450"
MemoryModel Logical GLSL450
EntryPoint Fragment 4 "main" 9
EntryPoint Fragment 4 "main" 9 12
ExecutionMode 4 OriginUpperLeft
Source GLSL 450
SourceExtension "GL_EXT_device_group"
Name 4 "main"
Name 9 "color"
Name 12 "gl_DeviceIndex"
Decorate 12(gl_DeviceIndex) Flat
Decorate 12(gl_DeviceIndex) BuiltIn DeviceIndex
2: TypeVoid
3: TypeFunction 2
@ -25,8 +26,8 @@ Warning, version 450 is not yet complete; most version-specific features are pre
8: TypePointer Output 7(fvec4)
9(color): 8(ptr) Variable Output
10: TypeInt 32 1
11: TypePointer UniformConstant 10(int)
12(gl_DeviceIndex): 11(ptr) Variable UniformConstant
11: TypePointer Input 10(int)
12(gl_DeviceIndex): 11(ptr) Variable Input
15: 6(float) Constant 0
4(main): 2 Function None 3
5: Label

View File

@ -10,13 +10,14 @@ Warning, version 450 is not yet complete; most version-specific features are pre
Extension "SPV_KHR_multiview"
1: ExtInstImport "GLSL.std.450"
MemoryModel Logical GLSL450
EntryPoint Fragment 4 "main" 9
EntryPoint Fragment 4 "main" 9 12
ExecutionMode 4 OriginUpperLeft
Source GLSL 450
SourceExtension "GL_EXT_multiview"
Name 4 "main"
Name 9 "color"
Name 12 "gl_ViewIndex"
Decorate 12(gl_ViewIndex) Flat
Decorate 12(gl_ViewIndex) BuiltIn ViewIndex
2: TypeVoid
3: TypeFunction 2
@ -25,8 +26,8 @@ Warning, version 450 is not yet complete; most version-specific features are pre
8: TypePointer Output 7(fvec4)
9(color): 8(ptr) Variable Output
10: TypeInt 32 1
11: TypePointer UniformConstant 10(int)
12(gl_ViewIndex): 11(ptr) Variable UniformConstant
11: TypePointer Input 10(int)
12(gl_ViewIndex): 11(ptr) Variable Input
15: 6(float) Constant 0
4(main): 2 Function None 3
5: Label

View File

@ -24,6 +24,8 @@ buffer outs {
vec4 va[];
} outnames;
#extension GL_EXT_device_group : enable
void main()
{
barrier();
@ -34,4 +36,5 @@ void main()
outbname.uns[i] = vec3(s);
outnames.va[gl_LocalInvocationID.x] = vec4(s);
outnames.s = outbname.uns.length();
gl_DeviceIndex;
}

View File

@ -328,6 +328,10 @@ __inline const char* GetBuiltInVariableString(TBuiltInVariable v)
case EbvBaryCoordSmoothSample: return "BaryCoordSmoothSample";
case EbvBaryCoordPullModel: return "BaryCoordPullModel";
#endif
case EbvViewIndex: return "ViewIndex";
case EbvDeviceIndex: return "DeviceIndex";
#ifdef NV_EXTENSIONS
case EbvViewportMaskNV: return "ViewportMaskNV";
case EbvSecondaryPositionNV: return "SecondaryPositionNV";

View File

@ -2,5 +2,5 @@
// For the version, it uses the latest git tag followed by the number of commits.
// For the date, it uses the current date (when then script is run).
#define GLSLANG_REVISION "Overload400-PrecQual.1908"
#define GLSLANG_REVISION "Overload400-PrecQual.1909"
#define GLSLANG_DATE "14-Mar-2017"

View File

@ -3125,6 +3125,13 @@ void TBuiltIns::initialize(int version, EProfile profile, const SpvVersion& spvV
"\n");
}
if ((profile != EEsProfile && version >= 140) ||
(profile == EEsProfile && version >= 310)) {
stageBuiltins[EShLangCompute].append(
"in highp int gl_DeviceIndex;" // GL_EXT_device_group
"\n");
}
//============================================================================
//
// Define the interface to the vertex shader.
@ -3290,6 +3297,15 @@ void TBuiltIns::initialize(int version, EProfile profile, const SpvVersion& spvV
}
}
if ((profile != EEsProfile && version >= 140) ||
(profile == EEsProfile && version >= 310)) {
stageBuiltins[EShLangVertex].append(
"in highp int gl_DeviceIndex;" // GL_EXT_device_group
"in highp int gl_ViewIndex;" // GL_EXT_multiview
"\n");
}
//============================================================================
//
// Define the interface to the geometry shader.
@ -3398,6 +3414,14 @@ void TBuiltIns::initialize(int version, EProfile profile, const SpvVersion& spvV
);
}
if ((profile != EEsProfile && version >= 140) ||
(profile == EEsProfile && version >= 310)) {
stageBuiltins[EShLangGeometry].append(
"in highp int gl_DeviceIndex;" // GL_EXT_device_group
"in highp int gl_ViewIndex;" // GL_EXT_multiview
"\n");
}
//============================================================================
//
// Define the interface to the tessellation control shader.
@ -3469,6 +3493,14 @@ void TBuiltIns::initialize(int version, EProfile profile, const SpvVersion& spvV
"\n");
}
if ((profile != EEsProfile && version >= 140) ||
(profile == EEsProfile && version >= 310)) {
stageBuiltins[EShLangTessControl].append(
"in highp int gl_DeviceIndex;" // GL_EXT_device_group
"in highp int gl_ViewIndex;" // GL_EXT_multiview
"\n");
}
//============================================================================
//
// Define the interface to the tessellation evaluation shader.
@ -3544,6 +3576,14 @@ void TBuiltIns::initialize(int version, EProfile profile, const SpvVersion& spvV
"\n");
}
if ((profile != EEsProfile && version >= 140) ||
(profile == EEsProfile && version >= 310)) {
stageBuiltins[EShLangTessEvaluation].append(
"in highp int gl_DeviceIndex;" // GL_EXT_device_group
"in highp int gl_ViewIndex;" // GL_EXT_multiview
"\n");
}
//============================================================================
//
// Define the interface to the fragment shader.
@ -3701,9 +3741,12 @@ void TBuiltIns::initialize(int version, EProfile profile, const SpvVersion& spvV
"\n");
}
if (profile != EEsProfile) {
commonBuiltins.append("uniform int gl_ViewIndex;");
commonBuiltins.append("uniform int gl_DeviceIndex;"); // GL_EXT_device_group
if ((profile != EEsProfile && version >= 140) ||
(profile == EEsProfile && version >= 310)) {
stageBuiltins[EShLangFragment].append(
"flat in highp int gl_DeviceIndex;" // GL_EXT_device_group
"flat in highp int gl_ViewIndex;" // GL_EXT_multiview
"\n");
}
// printf("%s\n", commonBuiltins.c_str());
@ -5120,6 +5163,14 @@ void TBuiltIns::identifyBuiltIns(int version, EProfile profile, const SpvVersion
// symbolTable.setVariableExtensions("gl_PointSize", Num_AEP_tessellation_point_size, AEP_tessellation_point_size);
//}
if ((profile != EEsProfile && version >= 140) ||
(profile == EEsProfile && version >= 310)) {
symbolTable.setVariableExtensions("gl_DeviceIndex", 1, &E_GL_EXT_device_group);
BuiltInVariable("gl_DeviceIndex", EbvDeviceIndex, symbolTable);
symbolTable.setVariableExtensions("gl_ViewIndex", 1, &E_GL_EXT_multiview);
BuiltInVariable("gl_ViewIndex", EbvViewIndex, symbolTable);
}
break;
case EShLangFragment:
@ -5317,12 +5368,10 @@ void TBuiltIns::identifyBuiltIns(int version, EProfile profile, const SpvVersion
symbolTable.setFunctionExtensions("imageAtomicCompSwap", 1, &E_GL_OES_shader_image_atomic);
}
if (profile != EEsProfile) {
symbolTable.setFunctionExtensions("gl_DeviceIndex", 1, &E_GL_EXT_device_group);
symbolTable.setVariableExtensions("gl_DeviceIndex", 1, &E_GL_EXT_device_group);
BuiltInVariable("gl_DeviceIndex", EbvDeviceIndex, symbolTable);
symbolTable.setFunctionExtensions("gl_ViewIndex", 1, &E_GL_EXT_multiview);
symbolTable.setVariableExtensions("gl_ViewIndex", 1, &E_GL_EXT_multiview);
BuiltInVariable("gl_ViewIndex", EbvViewIndex, symbolTable);
}
break;
case EShLangCompute:
@ -5356,6 +5405,15 @@ void TBuiltIns::identifyBuiltIns(int version, EProfile profile, const SpvVersion
symbolTable.setFunctionExtensions("memoryBarrierShared", 1, &E_GL_ARB_compute_shader);
symbolTable.setFunctionExtensions("groupMemoryBarrier", 1, &E_GL_ARB_compute_shader);
}
if ((profile != EEsProfile && version >= 140) ||
(profile == EEsProfile && version >= 310)) {
symbolTable.setVariableExtensions("gl_DeviceIndex", 1, &E_GL_EXT_device_group);
BuiltInVariable("gl_DeviceIndex", EbvDeviceIndex, symbolTable);
symbolTable.setVariableExtensions("gl_ViewIndex", 1, &E_GL_EXT_multiview);
BuiltInVariable("gl_ViewIndex", EbvViewIndex, symbolTable);
}
break;
default:

View File

@ -334,6 +334,14 @@ void TParseVersions::getPreamble(std::string& preamble)
}
}
if ((profile != EEsProfile && version >= 140) ||
(profile == EEsProfile && version >= 310)) {
preamble +=
"#define GL_EXT_device_group 1\n"
"#define GL_EXT_multiview 1\n"
;
}
// #line and #include
preamble +=
"#define GL_GOOGLE_cpp_style_line_directive 1\n"