OSDN Git Service

[GLESv3] Add KHR_create_context semantics
authorLingfeng Yang <lfy@google.com>
Wed, 25 Jan 2017 16:05:53 +0000 (08:05 -0800)
committerLingfeng Yang <lfy@google.com>
Wed, 25 Jan 2017 16:24:36 +0000 (08:24 -0800)
If the ES 3.x feature is enabled:

1. If not on GLES1, select the highest available 3.x context if
   major version was not specified.
2. If on GLES2, upgrade to highest available 3.x context.

- In this case, need to allow GL_HALF_FLOAT_OES through to
keep from regressing CTS dEQP-GLES2.functional.fbo.completeness
if the feature is enabled.

Change-Id: I92194387f09f3a531c6d39b5e2659ff62c4c77cd

system/GLESv2_enc/GLESv2Validation.cpp
system/egl/egl.cpp

index 5426f1d..0bf49e3 100644 (file)
@@ -628,6 +628,7 @@ bool isCubeMapTarget(GLenum target) {
     f(GL_FLOAT) \
     f(GL_FLOAT_32_UNSIGNED_INT_24_8_REV) \
     f(GL_HALF_FLOAT) \
+    f(GL_HALF_FLOAT_OES) \
     f(GL_INT) \
     f(GL_SHORT) \
     f(GL_UNSIGNED_BYTE) \
index b9aaf07..7dcd836 100644 (file)
@@ -1303,12 +1303,42 @@ EGLContext eglCreateContext(EGLDisplay dpy, EGLConfig config, EGLContext share_c
         attrib_list+=2;
     }
 
-    if (!wantedMajorVersion) {
-        majorVersion = 1;
-    }
-
     // Support up to GLES 3.2 depending on advertised version from the host system.
     DEFINE_AND_VALIDATE_HOST_CONNECTION(EGL_NO_CONTEXT);
+    if (rcEnc->getGLESMaxVersion() >= GLES_MAX_VERSION_3_0) {
+        if (!wantedMajorVersion) {
+            majorVersion = 1;
+            wantedMinorVersion = false;
+        }
+
+        if (wantedMajorVersion &&
+            majorVersion == 2) {
+            majorVersion = 3;
+            wantedMinorVersion = false;
+        }
+
+        if (majorVersion == 3 && !wantedMinorVersion) {
+            switch (rcEnc->getGLESMaxVersion()) {
+                case GLES_MAX_VERSION_3_0:
+                    minorVersion = 0;
+                    break;
+                case GLES_MAX_VERSION_3_1:
+                    minorVersion = 1;
+                    break;
+                case GLES_MAX_VERSION_3_2:
+                    minorVersion = 2;
+                    break;
+                default:
+                    minorVersion = 0;
+                    break;
+            }
+        }
+    } else {
+        if (!wantedMajorVersion) {
+            majorVersion = 1;
+        }
+    }
+
     switch (majorVersion) {
     case 1:
     case 2: