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

@@ -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);
BuiltInVariable("gl_DeviceIndex", EbvDeviceIndex, symbolTable);
symbolTable.setFunctionExtensions("gl_ViewIndex", 1, &E_GL_EXT_multiview);
BuiltInVariable("gl_ViewIndex", EbvViewIndex, symbolTable);
}
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 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"