[Mesa-dev] [PATCH v2 10/13] dispatch_sanity test: pass ctx to validate_functions/nops
Jordan Justen
jordan.l.justen at intel.com
Tue Oct 30 11:25:31 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 | 32 +++++++++++++++++++++----------
1 file changed, 22 insertions(+), 10 deletions(-)
diff --git a/src/mesa/main/tests/dispatch_sanity.cpp b/src/mesa/main/tests/dispatch_sanity.cpp
index e88c1ac..a081247 100644
--- a/src/mesa/main/tests/dispatch_sanity.cpp
+++ b/src/mesa/main/tests/dispatch_sanity.cpp
@@ -89,6 +89,7 @@ public:
struct dd_function_table driver_functions;
struct gl_context share_list;
struct gl_context ctx;
+
};
void
@@ -113,8 +114,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
@@ -136,8 +139,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])
@@ -148,9 +153,16 @@ validate_nops(const _glapi_proc *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);
- validate_nops(exec);
+ ctx.Version = 11;
+ _mesa_initialize_context(&ctx,
+ API_OPENGLES, //api,
+ &visual,
+ NULL, //&share_list,
+ &driver_functions);
+
+ ctx.Exec = _mesa_create_exec_table_es1();
+ validate_functions(&ctx, gles11_functions_possible);
+ validate_nops(&ctx);
}
#endif /* FEATURE_ES1 */
@@ -168,8 +180,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)
@@ -186,9 +198,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
--
1.7.9.5
More information about the mesa-dev
mailing list