Mesa (master): dispatch_sanity test: pass ctx to validate_functions/nops

Jordan Justen jljusten at kemper.freedesktop.org
Sat Nov 3 18:17:41 UTC 2012


Module: Mesa
Branch: master
Commit: 7e64fe583f625c01d6a6eed664f5a4f808607830
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=7e64fe583f625c01d6a6eed664f5a4f808607830

Author: Jordan Justen <jordan.l.justen at intel.com>
Date:   Tue Oct 16 20:50:03 2012 -0700

dispatch_sanity test: pass ctx to validate_functions/nops

This will allow validate_functions to access ctx->Version.

Signed-off-by: Jordan Justen <jordan.l.justen at intel.com>
Reviewed-by: Paul Berry <stereotype441 at gmail.com>

---

 src/mesa/main/tests/dispatch_sanity.cpp |   22 +++++++++++++---------
 1 files changed, 13 insertions(+), 9 deletions(-)

diff --git a/src/mesa/main/tests/dispatch_sanity.cpp b/src/mesa/main/tests/dispatch_sanity.cpp
index 1233b04..474413c 100644
--- a/src/mesa/main/tests/dispatch_sanity.cpp
+++ b/src/mesa/main/tests/dispatch_sanity.cpp
@@ -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




More information about the mesa-commit mailing list