dispatch_sanity test: pass ctx to validate_functions/nops
authorJordan Justen <jordan.l.justen@intel.com>
Wed, 17 Oct 2012 03:50:03 +0000 (20:50 -0700)
committerJordan Justen <jordan.l.justen@intel.com>
Sat, 3 Nov 2012 17:54:41 +0000 (10:54 -0700)
This will allow validate_functions to access ctx->Version.

Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Paul Berry <stereotype441@gmail.com>
src/mesa/main/tests/dispatch_sanity.cpp

index 1233b04ae8857c3977fea9f3586528a0148f3718..474413cbf5726d4332d94e105282283745355e76 100644 (file)
@@ -112,8 +112,10 @@ offset_to_proc_name_safe(unsigned offset)
  * _glapi_proc *table exist. When found, set their pointers in the table
  * to _mesa_generic_nop.  */
 static void
-validate_functions(_glapi_proc *table, const struct function *function_table)
+validate_functions(struct gl_context *ctx, const struct function *function_table)
 {
+   _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
@@ -135,8 +137,10 @@ validate_functions(_glapi_proc *table, const struct function *function_table)
 /* Scan through the table and ensure that there is nothing except
  * _mesa_generic_nop (as set by validate_functions().  */
 static void
-validate_nops(const _glapi_proc *table)
+validate_nops(struct gl_context *ctx)
 {
+   _glapi_proc *table = (_glapi_proc *) ctx->Exec;
+
    const unsigned size = _glapi_get_dispatch_table_size();
    for (unsigned i = 0; i < size; i++) {
       EXPECT_EQ((_glapi_proc) _mesa_generic_nop, table[i])
@@ -159,8 +163,8 @@ TEST_F(DispatchSanity_test, GLES11)
    _tnl_CreateContext(&ctx);
    _swsetup_CreateContext(&ctx);
 
-   validate_functions((_glapi_proc *) ctx.Exec, gles11_functions_possible);
-   validate_nops((_glapi_proc *) ctx.Exec);
+   validate_functions(&ctx, gles11_functions_possible);
+   validate_nops(&ctx);
 }
 #endif /* FEATURE_ES1 */
 
@@ -178,8 +182,8 @@ TEST_F(DispatchSanity_test, GLES2)
    _tnl_CreateContext(&ctx);
    _swsetup_CreateContext(&ctx);
 
-   validate_functions((_glapi_proc *) ctx.Exec, gles2_functions_possible);
-   validate_nops((_glapi_proc *) ctx.Exec);
+   validate_functions(&ctx, gles2_functions_possible);
+   validate_nops(&ctx);
 }
 
 TEST_F(DispatchSanity_test, GLES3)
@@ -196,9 +200,9 @@ TEST_F(DispatchSanity_test, GLES3)
    _tnl_CreateContext(&ctx);
    _swsetup_CreateContext(&ctx);
 
-   validate_functions((_glapi_proc *) ctx.Exec, gles2_functions_possible);
-   validate_functions((_glapi_proc *) ctx.Exec, gles3_functions_possible);
-   validate_nops((_glapi_proc *) ctx.Exec);
+   validate_functions(&ctx, gles2_functions_possible);
+   validate_functions(&ctx, gles3_functions_possible);
+   validate_nops(&ctx);
 }
 
 #if FEATURE_ES1