[waffle] [PATCH 2/4] wcore: don't parse/validate the exact major/minor version

Emil Velikov emil.l.velikov at gmail.com
Tue Sep 1 05:35:50 PDT 2015


Keeping track what is and isn't the correct version at any given time
sounds unfeasable.

On one hand currently we allow any random value as minor for ES2 and
ES3, whist for GL we allow any values as long as they are >= 1.0

If we are to keep track what versions are valid, this is going to cause
problems as new versions of the specs get released.

Let's do the sane thing and remove the bookkeeping from waffle.

Note: this will break the tests. Should we update them prior, alongside
or after this commit ?

Signed-off-by: Emil Velikov <emil.l.velikov at gmail.com>
---
 src/waffle/core/wcore_config_attrs.c | 71 ------------------------------------
 1 file changed, 71 deletions(-)

diff --git a/src/waffle/core/wcore_config_attrs.c b/src/waffle/core/wcore_config_attrs.c
index 4a2cb5d..3c6753a 100644
--- a/src/waffle/core/wcore_config_attrs.c
+++ b/src/waffle/core/wcore_config_attrs.c
@@ -160,74 +160,6 @@ set_context_version_default(struct wcore_config_attrs *attrs)
 }
 
 static bool
-parse_context_version(struct wcore_config_attrs *attrs,
-                      const int32_t attrib_list[])
-{
-    wcore_attrib_list32_get(attrib_list, WAFFLE_CONTEXT_MAJOR_VERSION,
-                            &attrs->context_major_version);
-    wcore_attrib_list32_get(attrib_list, WAFFLE_CONTEXT_MINOR_VERSION,
-                            &attrs->context_minor_version);
-
-    if (attrs->context_major_version < 1) {
-        wcore_errorf(WAFFLE_ERROR_BAD_ATTRIBUTE,
-                     "WAFFLE_CONTEXT_MAJOR_VERSION must be >= 1");
-        return false;
-    }
-
-    if (attrs->context_minor_version < 0) {
-        wcore_errorf(WAFFLE_ERROR_BAD_ATTRIBUTE,
-                     "WAFFLE_CONTEXT_MINOR_VERSION must be >= 0");
-        return false;
-    }
-
-    switch (attrs->context_api) {
-        case WAFFLE_CONTEXT_OPENGL:
-            if (wcore_config_attrs_version_lt(attrs, 10)) {
-                wcore_errorf(WAFFLE_ERROR_BAD_ATTRIBUTE,
-                             "for OpenGL, the requested context version "
-                             "must be >= 1.0");
-                return false;
-            }
-            break;
-
-        case WAFFLE_CONTEXT_OPENGL_ES1:
-            if (!wcore_config_attrs_version_eq(attrs, 10) &&
-                !wcore_config_attrs_version_eq(attrs, 11)) {
-                wcore_errorf(WAFFLE_ERROR_BAD_ATTRIBUTE,
-                             "for OpenGL ES1, the requested context version "
-                             "must be 1.0 or 1.1");
-                return false;
-            }
-            break;
-
-        case WAFFLE_CONTEXT_OPENGL_ES2:
-            if (attrs->context_major_version != 2) {
-                wcore_errorf(WAFFLE_ERROR_BAD_ATTRIBUTE,
-                             "for OpenGL ES2, the requested major context "
-                             "version must be 2");
-                return false;
-            }
-            break;
-
-        case WAFFLE_CONTEXT_OPENGL_ES3:
-            if (attrs->context_major_version != 3) {
-                wcore_errorf(WAFFLE_ERROR_BAD_ATTRIBUTE,
-                             "for OpenGL ES3, the requested major context "
-                             "version must be 3");
-                return false;
-            }
-            break;
-
-        default:
-            wcore_error_internal("attrs->context_api has bad value 0x%x",
-                                 attrs->context_api);
-            return false;
-    }
-
-    return true;
-}
-
-static bool
 set_context_profile_default(struct wcore_config_attrs *attrs)
 {
     switch (attrs->context_api) {
@@ -478,9 +410,6 @@ wcore_config_attrs_parse(
     if (!set_context_version_default(attrs))
         return false;
 
-    if (!parse_context_version(attrs, waffle_attrib_list))
-        return false;
-
     if (!set_context_profile_default(attrs))
         return false;
 
-- 
2.5.0



More information about the waffle mailing list