wined3d: Don't crash when opengl is not available.

Roderick Colenbrander thunderbird2k at gmail.com
Tue Mar 2 11:06:00 CST 2010


In what situation does it exactly crash for you? Is it crashing
because there is no libGL around? I'm not sure what the right thing to
do is. Due to it our wglGetProcAddress won't function because it
relies on glXGetProcAddress.

Our use of wglGetProcAddress isn't correct (but it works on WINE :))
in the sense that officially an OpenGL context must be around. Perhaps
I should fix this behavior in gdi32 and in wined3d. It would allow for
a nicer fix than adjusting the USE_GL_FUNC macro.

I'm not sure about the shader backend part of the patch (I don't know
that code well), so I'm leaving that to Henri and Stefan.

Roderick

On Tue, Mar 2, 2010 at 5:51 PM, Kusanagi Kouichi <slash at ac.auone-net.jp> wrote:
> Signed-off-by: Kusanagi Kouichi <slash at ac.auone-net.jp>
> ---
>  dlls/wined3d/directx.c |    5 ++++-
>  1 files changed, 4 insertions(+), 1 deletions(-)
>
> diff --git a/dlls/wined3d/directx.c b/dlls/wined3d/directx.c
> index 457cb85..cb64319 100644
> --- a/dlls/wined3d/directx.c
> +++ b/dlls/wined3d/directx.c
> @@ -4677,7 +4677,7 @@ BOOL InitAdapters(IWineD3DImpl *This)
>             goto nogl_adapter;
>         }
>  #else
> -#define USE_GL_FUNC(pfn) pfn = (void*)pwglGetProcAddress(#pfn);
> +#define USE_GL_FUNC(pfn) pfn = (void*)pwglGetProcAddress(#pfn); if (!pfn) goto nogl_adapter;
>         /* To bypass the opengl32 thunks load wglGetProcAddress from gdi32 (glXGetProcAddress wrapper) instead of opengl32's */
>         mod_gl = GetModuleHandleA("gdi32.dll");
>  #endif
> @@ -4950,6 +4950,9 @@ nogl_adapter:
>
>     initPixelFormatsNoGL(&This->adapters[0].gl_info);
>
> +    This->adapters[0].shader_backend = &none_shader_backend;
> +    This->adapters[0].fragment_pipe = &ffp_fragment_pipeline;
> +
>     This->adapter_count = 1;
>     return FALSE;
>  }
> --
> 1.7.0
>
>
>
>



More information about the wine-patches mailing list