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

Jordan Justen jljusten at gmail.com
Thu Oct 25 13:28:51 PDT 2012


On Thu, Oct 25, 2012 at 11:11 AM, Ian Romanick <idr at freedesktop.org> wrote:
> On 10/24/2012 02:20 PM, Jordan Justen wrote:
>>
>> This will allow validate_functions to access ctx.Version.
>
> Why is this better than just passing ctx.Version as an extra parameter to
> validate_functions?  I'm not a fan of passing hidden function parameters
> using the class.

I just thought that it seemed more natural for the context version to
be set & referenced inside the context structure...

What about passing a ptr to ctx to validate_functions instead?

>>
>> 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,
>
> So... you want it to make version 1.1 of the OpenGL ES 2 API? :p

Yikes!

-Jordan

>> +                            &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
>>
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/mesa-dev


More information about the mesa-dev mailing list