[3/6] wined3d: The adapters array should be owned by IWineD3DImpl.

Henri Verbeet hverbeet at gmail.com
Wed Mar 11 09:10:54 CDT 2009


2009/3/11 Allan Tong <actong88 at gmail.com>:
> On Wed, Mar 11, 2009 at 5:18 AM, Henri Verbeet <hverbeet at codeweavers.com> wrote:
>
>> @@ -4051,10 +4097,11 @@ static void WINE_GLAPI diffuse_d3dcolor(const void *data)
>>  static void WINE_GLAPI specular_d3dcolor(const void *data)
>>  {
>>     DWORD specularColor = *((const DWORD *)data);
>> +    GLbyte d[] = {D3DCOLOR_B_R(specularColor),
>> +            D3DCOLOR_B_G(specularColor),
>> +            D3DCOLOR_B_B(specularColor)};
>>
>> -    GL_EXTCALL(glSecondaryColor3ubEXT)(D3DCOLOR_B_R(specularColor),
>> -                                       D3DCOLOR_B_G(specularColor),
>> -                                       D3DCOLOR_B_B(specularColor));
>> +    specular_func_3ubv(d);
>>  }
>>
>>  static void WINE_GLAPI warn_no_specular_func(const void *data)
>> @@ -4110,6 +4157,7 @@ static void fillGLAttribFuncs(const WineD3D_GL_Info *gl_info)
>>     }
>>     specular_funcs[WINED3DDECLTYPE_FLOAT4]      = invalid_func;
>>     if(GL_SUPPORT(EXT_SECONDARY_COLOR)) {
>> +        specular_func_3ubv = (glAttribFunc)GL_EXTCALL(glSecondaryColor3ubvEXT);
>>         specular_funcs[WINED3DDECLTYPE_D3DCOLOR]    = specular_d3dcolor;
>>     } else {
>>         specular_funcs[WINED3DDECLTYPE_D3DCOLOR]      = warn_no_specular_func;
>
> This looks like an unrelated change.
>
Yes, but unfortunately it isn't. GL_EXTCALL() depends on
GLINFO_LOCATION, which was defined as "(Adapters[0].gl_info)". That
obviously doesn't work anymore now that Adapters isn't global anymore.
Having specular_func_3ubv as global isn't particularly pretty or safe
of course, but it's not much worse than eg. the specular_funcs array
in that regard.

>> @@ -4182,7 +4231,7 @@ BOOL InitAdapters(void) {
>>     /* No need to hold any lock. The calling library makes sure only one thread calls
>>      * wined3d simultaneously
>>      */
>> -    if(numAdapters > 0) return Adapters[0].opengl;
>> +    if (This->adapter_count) return This->adapters[0].opengl;
>>
>>     TRACE("Initializing adapters\n");
>
> Is this check still necessary?  InitAdapters should only be called
> once per IWineD3DImpl object.
>
Yeah, this is redundant now. I'll send a patch to remove it.



More information about the wine-devel mailing list