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

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 all the fine-grained validation from
waffle.

v2 (Suggestions from Chad):
 - Keep < 1.0 check to prevent WAFFLE_DONT_CARE as context version.
 - Update the unit tests alongside this intended functionality change.

Signed-off-by: Emil Velikov <emil.l.veli...@gmail.com>
---
 src/waffle/core/wcore_config_attrs.c          | 45 -------------------
 src/waffle/core/wcore_config_attrs_unittest.c | 64 ---------------------------
 2 files changed, 109 deletions(-)

diff --git a/src/waffle/core/wcore_config_attrs.c 
b/src/waffle/core/wcore_config_attrs.c
index 4a2cb5d..bb38fed 100644
--- a/src/waffle/core/wcore_config_attrs.c
+++ b/src/waffle/core/wcore_config_attrs.c
@@ -179,51 +179,6 @@ parse_context_version(struct wcore_config_attrs *attrs,
                      "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;
 }
 
diff --git a/src/waffle/core/wcore_config_attrs_unittest.c 
b/src/waffle/core/wcore_config_attrs_unittest.c
index 501e30f..cd745d1 100644
--- a/src/waffle/core/wcore_config_attrs_unittest.c
+++ b/src/waffle/core/wcore_config_attrs_unittest.c
@@ -445,21 +445,6 @@ test_wcore_config_attrs_gles11(void **state) {
 }
 
 static void
-test_wcore_config_attrs_gles12_is_bad(void **state) {
-    struct test_state_wcore_config_attrs *ts = *state;
-
-    const int32_t attrib_list[] = {
-        WAFFLE_CONTEXT_API,             WAFFLE_CONTEXT_OPENGL_ES1,
-        WAFFLE_CONTEXT_MAJOR_VERSION,   1,
-        WAFFLE_CONTEXT_MINOR_VERSION,   2,
-        0,
-    };
-
-    assert_false(wcore_config_attrs_parse(attrib_list, &ts->actual_attrs));
-    assert_int_equal(wcore_error_get_code(), WAFFLE_ERROR_BAD_ATTRIBUTE);
-}
-
-static void
 test_wcore_config_attrs_gles20(void **state) {
     struct test_state_wcore_config_attrs *ts = *state;
 
@@ -492,21 +477,6 @@ test_wcore_config_attrs_gles21(void **state) {
 }
 
 static void
-test_wcore_config_attrs_gles2_with_version_30(void **state) {
-    struct test_state_wcore_config_attrs *ts = *state;
-
-    const int32_t attrib_list[] = {
-        WAFFLE_CONTEXT_API,             WAFFLE_CONTEXT_OPENGL_ES2,
-        WAFFLE_CONTEXT_MAJOR_VERSION,   3,
-        WAFFLE_CONTEXT_MINOR_VERSION,   0,
-        0,
-    };
-
-    assert_false(wcore_config_attrs_parse(attrib_list, &ts->actual_attrs));
-    assert_int_equal(wcore_error_get_code(), WAFFLE_ERROR_BAD_ATTRIBUTE);
-}
-
-static void
 test_wcore_config_attrs_gles30(void **state) {
     struct test_state_wcore_config_attrs *ts = *state;
 
@@ -539,36 +509,6 @@ test_wcore_config_attrs_gles31(void **state) {
 }
 
 static void
-test_wcore_config_attrs_gles3_with_version_20(void **state) {
-    struct test_state_wcore_config_attrs *ts = *state;
-
-    const int32_t attrib_list[] = {
-        WAFFLE_CONTEXT_API,             WAFFLE_CONTEXT_OPENGL_ES3,
-        WAFFLE_CONTEXT_MAJOR_VERSION,   2,
-        WAFFLE_CONTEXT_MINOR_VERSION,   0,
-        0,
-    };
-
-    assert_false(wcore_config_attrs_parse(attrib_list, &ts->actual_attrs));
-    assert_int_equal(wcore_error_get_code(), WAFFLE_ERROR_BAD_ATTRIBUTE);
-}
-
-static void
-test_wcore_config_attrs_gles3_with_version_40(void **state) {
-    struct test_state_wcore_config_attrs *ts = *state;
-
-    const int32_t attrib_list[] = {
-        WAFFLE_CONTEXT_API,             WAFFLE_CONTEXT_OPENGL_ES3,
-        WAFFLE_CONTEXT_MAJOR_VERSION,   4,
-        WAFFLE_CONTEXT_MINOR_VERSION,   0,
-        0,
-    };
-
-    assert_false(wcore_config_attrs_parse(attrib_list, &ts->actual_attrs));
-    assert_int_equal(wcore_error_get_code(), WAFFLE_ERROR_BAD_ATTRIBUTE);
-}
-
-static void
 test_wcore_config_attrs_color_buffer_size(void **state) {
     struct test_state_wcore_config_attrs *ts = *state;
 
@@ -1169,14 +1109,10 @@ main(void) {
         unit_test_make(test_wcore_config_attrs_negative_minor_version),
         unit_test_make(test_wcore_config_attrs_gles10),
         unit_test_make(test_wcore_config_attrs_gles11),
-        unit_test_make(test_wcore_config_attrs_gles12_is_bad),
         unit_test_make(test_wcore_config_attrs_gles20),
         unit_test_make(test_wcore_config_attrs_gles21),
-        unit_test_make(test_wcore_config_attrs_gles2_with_version_30),
         unit_test_make(test_wcore_config_attrs_gles30),
         unit_test_make(test_wcore_config_attrs_gles31),
-        unit_test_make(test_wcore_config_attrs_gles3_with_version_20),
-        unit_test_make(test_wcore_config_attrs_gles3_with_version_40),
         unit_test_make(test_wcore_config_attrs_color_buffer_size),
         unit_test_make(test_wcore_config_attrs_double_buffered_is_true),
         unit_test_make(test_wcore_config_attrs_double_buffered_is_false),
-- 
2.8.0

_______________________________________________
waffle mailing list
waffle@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/waffle

Reply via email to