Implement extensions GL_OVR_multiview and GL_OVR_multiview2

They are almost identical to the already supported GL_EXT_multiview
This commit is contained in:
David Srbecký
2017-06-30 18:33:51 +01:00
parent 2ae23ca1ca
commit 0fbe02c6a0
9 changed files with 135 additions and 6 deletions

View File

@@ -3457,6 +3457,12 @@ void TBuiltIns::initialize(int version, EProfile profile, const SpvVersion& spvV
"\n");
}
if (version >= 300 /* both ES and non-ES */) {
stageBuiltins[EShLangVertex].append(
"in highp uint gl_ViewID_OVR;" // GL_OVR_multiview, GL_OVR_multiview2
"\n");
}
//============================================================================
//
@@ -3905,6 +3911,12 @@ void TBuiltIns::initialize(int version, EProfile profile, const SpvVersion& spvV
"\n");
}
if (version >= 300 /* both ES and non-ES */) {
stageBuiltins[EShLangFragment].append(
"flat in highp uint gl_ViewID_OVR;" // GL_OVR_multiview, GL_OVR_multiview2
"\n");
}
// printf("%s\n", commonBuiltins.c_str());
// printf("%s\n", stageBuiltins[EShLangFragment].c_str());
}
@@ -5331,6 +5343,11 @@ void TBuiltIns::identifyBuiltIns(int version, EProfile profile, const SpvVersion
BuiltInVariable("gl_InstanceIndex", EbvInstanceIndex, symbolTable);
}
if (version >= 300 /* both ES and non-ES */) {
symbolTable.setVariableExtensions("gl_ViewID_OVR", Num_OVR_multiview_EXTs, OVR_multiview_EXTs);
BuiltInVariable("gl_ViewID_OVR", EbvViewIndex, symbolTable);
}
if (profile == EEsProfile) {
symbolTable.setFunctionExtensions("shadow2DEXT", 1, &E_GL_EXT_shadow_samplers);
symbolTable.setFunctionExtensions("shadow2DProjEXT", 1, &E_GL_EXT_shadow_samplers);
@@ -5678,6 +5695,10 @@ void TBuiltIns::identifyBuiltIns(int version, EProfile profile, const SpvVersion
BuiltInVariable("gl_DeviceIndex", EbvDeviceIndex, symbolTable);
symbolTable.setVariableExtensions("gl_ViewIndex", 1, &E_GL_EXT_multiview);
BuiltInVariable("gl_ViewIndex", EbvViewIndex, symbolTable);
if (version >= 300 /* both ES and non-ES */) {
symbolTable.setVariableExtensions("gl_ViewID_OVR", Num_OVR_multiview_EXTs, OVR_multiview_EXTs);
BuiltInVariable("gl_ViewID_OVR", EbvViewIndex, symbolTable);
}
if (profile == EEsProfile) {
symbolTable.setFunctionExtensions("shadow2DEXT", 1, &E_GL_EXT_shadow_samplers);

View File

@@ -239,6 +239,10 @@ void TParseVersions::initializeExtensionBehavior()
// EXT extensions
extensionBehavior[E_GL_EXT_device_group] = EBhDisable;
extensionBehavior[E_GL_EXT_multiview] = EBhDisable;
// OVR extensions
extensionBehavior[E_GL_OVR_multiview] = EBhDisable;
extensionBehavior[E_GL_OVR_multiview2] = EBhDisable;
}
// Get code that is not part of a shared symbol table, is specific to this shader,
@@ -343,12 +347,19 @@ void TParseVersions::getPreamble(std::string& preamble)
if ((profile != EEsProfile && version >= 140) ||
(profile == EEsProfile && version >= 310)) {
preamble +=
preamble +=
"#define GL_EXT_device_group 1\n"
"#define GL_EXT_multiview 1\n"
;
}
if (version >= 300 /* both ES and non-ES */) {
preamble +=
"#define GL_OVR_multiview 1\n"
"#define GL_OVR_multiview2 1\n"
;
}
// #line and #include
preamble +=
"#define GL_GOOGLE_cpp_style_line_directive 1\n"

View File

@@ -143,6 +143,13 @@ const char* const E_GL_EXT_shader_image_load_formatted = "GL_EXT_shader_image_lo
const char* const E_GL_EXT_device_group = "GL_EXT_device_group";
const char* const E_GL_EXT_multiview = "GL_EXT_multiview";
// OVR extensions
const char* const E_GL_OVR_multiview = "GL_OVR_multiview";
const char* const E_GL_OVR_multiview2 = "GL_OVR_multiview2";
const char* const OVR_multiview_EXTs[] = { E_GL_OVR_multiview, E_GL_OVR_multiview2 };
const int Num_OVR_multiview_EXTs = sizeof(OVR_multiview_EXTs) / sizeof(OVR_multiview_EXTs[0]);
// #line and #include
const char* const E_GL_GOOGLE_cpp_style_line_directive = "GL_GOOGLE_cpp_style_line_directive";
const char* const E_GL_GOOGLE_include_directive = "GL_GOOGLE_include_directive";