Disable OpenGL ES 3.0 in Chromium builds.
Change-Id: I6077e9f439dc20217e9e7fb6c6f98f969e7d0b51
Reviewed-on: https://swiftshader-review.googlesource.com/8790
Reviewed-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Nicolas Capens <capn@google.com>
Tested-by: Nicolas Capens <capn@google.com>
diff --git a/BUILD.gn b/BUILD.gn
index d646afe..57cbf33 100644
--- a/BUILD.gn
+++ b/BUILD.gn
@@ -23,6 +23,7 @@
"/EHsc",
"/nologo",
"/Gd", # Default calling convention
+ "/DSTRICT_CONFORMANCE", # Disables OpenGL ES 3.0
]
if (is_debug) {
@@ -38,6 +39,7 @@
"-fno-operator-names",
"-D__STDC_CONSTANT_MACROS",
"-D__STDC_LIMIT_MACROS",
+ "-DSTRICT_CONFORMANCE", # Disables OpenGL ES 3.0
]
if (is_debug) {
diff --git a/src/OpenGL/libEGL/Config.cpp b/src/OpenGL/libEGL/Config.cpp
index 80c36c8..43ca44d 100644
--- a/src/OpenGL/libEGL/Config.cpp
+++ b/src/OpenGL/libEGL/Config.cpp
@@ -34,10 +34,13 @@
namespace egl
{
-#ifdef __ANDROID__
-const bool android = true;
+// OpenGL ES 3.0 support is not conformant yet, but can be used for testing purposes. Expose it as conformant configs
+// if strict conformance advertisement isn't required. If strict conformance advertisement is required, expose them
+// as non-conformant configs, but only when EGL_CONFIG_CAVEAT is EGL_NON_CONFORMANT_CONFIG or EGL_DONT_CARE.
+#if defined(__ANDROID__) || defined(STRICT_CONFORMANCE)
+const bool strictConformance = true;
#else
-const bool android = false;
+const bool strictConformance = false;
#endif
Config::Config(sw::Format displayFormat, EGLint minInterval, EGLint maxInterval, sw::Format renderTargetFormat, sw::Format depthStencilFormat, EGLint multiSample, bool conformant)
@@ -124,9 +127,9 @@
mBufferSize = mRedSize + mGreenSize + mBlueSize + mLuminanceSize + mAlphaSize;
mAlphaMaskSize = 0;
mColorBufferType = EGL_RGB_BUFFER;
- mConfigCaveat = (conformant || !android) ? EGL_NONE : EGL_NON_CONFORMANT_CONFIG;
+ mConfigCaveat = (conformant || !strictConformance) ? EGL_NONE : EGL_NON_CONFORMANT_CONFIG;
mConfigID = 0;
- mConformant = EGL_OPENGL_ES_BIT | EGL_OPENGL_ES2_BIT | (android ? 0 : EGL_OPENGL_ES3_BIT); // Do not advertize OpenGL ES 3.0 conformance on Android
+ mConformant = EGL_OPENGL_ES_BIT | EGL_OPENGL_ES2_BIT | (strictConformance ? 0 : EGL_OPENGL_ES3_BIT);
switch(depthStencilFormat)
{
@@ -183,7 +186,7 @@
mMinSwapInterval = minInterval;
mNativeRenderable = EGL_FALSE;
mNativeVisualType = 0;
- mRenderableType = EGL_OPENGL_ES_BIT | EGL_OPENGL_ES2_BIT | ((conformant && android) ? 0 : EGL_OPENGL_ES3_BIT); // Only advertise non-conformant configs as OpenGL ES 3.0 renderable on Android
+ mRenderableType = EGL_OPENGL_ES_BIT | EGL_OPENGL_ES2_BIT | ((conformant && strictConformance) ? 0 : EGL_OPENGL_ES3_BIT);
mSampleBuffers = (multiSample > 0) ? 1 : 0;
mSamples = multiSample;
mSurfaceType = EGL_PBUFFER_BIT | EGL_WINDOW_BIT | EGL_SWAP_BEHAVIOR_PRESERVED_BIT;
@@ -336,10 +339,11 @@
Config conformantConfig(displayFormat, minSwapInterval, maxSwapInterval, renderTargetFormat, depthStencilFormat, multiSample, true);
mSet.insert(conformantConfig);
- #ifdef __ANDROID__
+ if(strictConformance) // When strict conformance is required, add non-conformant configs explicitly as such.
+ {
Config nonConformantConfig(displayFormat, minSwapInterval, maxSwapInterval, renderTargetFormat, depthStencilFormat, multiSample, false);
mSet.insert(nonConformantConfig);
- #endif
+ }
}
size_t ConfigSet::size() const