[Mesa-dev] [PATCH 6/9] dispatch_sanity test: move validate_functions into class

Jordan Justen jordan.l.justen at intel.com
Wed Oct 24 14:20:08 PDT 2012


This will allow validate_functions to access ctx.Version.

Signed-off-by: Jordan Justen <jordan.l.justen at intel.com>
---
 src/mesa/main/tests/dispatch_sanity.cpp |   25 ++++++++++++++++++++-----
 1 file changed, 20 insertions(+), 5 deletions(-)

diff --git a/src/mesa/main/tests/dispatch_sanity.cpp b/src/mesa/main/tests/dispatch_sanity.cpp
index 7127754..d27dd39 100644
--- a/src/mesa/main/tests/dispatch_sanity.cpp
+++ b/src/mesa/main/tests/dispatch_sanity.cpp
@@ -84,10 +84,14 @@ class DispatchSanity_test : public ::testing::Test {
 public:
    virtual void SetUp();
 
+   void validate_functions();
+
    struct gl_config visual;
    struct dd_function_table driver_functions;
    struct gl_context share_list;
    struct gl_context ctx;
+
+   const struct function *function_table;
 };
 
 void
@@ -101,9 +105,11 @@ DispatchSanity_test::SetUp()
    _mesa_init_driver_functions(&driver_functions);
 }
 
-static void
-validate_functions(_glapi_proc *table, const struct function *function_table)
+void
+DispatchSanity_test::validate_functions()
 {
+   _glapi_proc *table = (_glapi_proc *) ctx.Exec;
+
    for (unsigned i = 0; function_table[i].name != NULL; i++) {
       const int offset = (function_table[i].offset != -1)
          ? function_table[i].offset
@@ -130,13 +136,22 @@ validate_functions(_glapi_proc *table, const struct function *function_table)
 #if FEATURE_ES1
 TEST_F(DispatchSanity_test, GLES11)
 {
-   _glapi_proc *exec = (_glapi_proc *) _mesa_create_exec_table_es1();
-   validate_functions(exec, gles11_functions_possible);
+   function_table = gles11_functions_possible;
+   ctx.Version = 11;
+   _mesa_initialize_context(&ctx,
+                            API_OPENGLES2, //api,
+                            &visual,
+                            NULL, //&share_list,
+                            &driver_functions);
+
+   ctx.Exec = _mesa_create_exec_table_es1();
+   validate_functions();
 }
 #endif /* FEATURE_ES1 */
 
 TEST_F(DispatchSanity_test, GLES2)
 {
+   function_table = gles2_functions_possible;
    ctx.Version = 20;
    _mesa_initialize_context(&ctx,
                             API_OPENGLES2, //api,
@@ -149,7 +164,7 @@ TEST_F(DispatchSanity_test, GLES2)
    _tnl_CreateContext(&ctx);
    _swsetup_CreateContext(&ctx);
 
-   validate_functions((_glapi_proc *) ctx.Exec, gles2_functions_possible);
+   validate_functions();
 }
 
 #if FEATURE_ES1
-- 
1.7.9.5



More information about the mesa-dev mailing list