Stefan Dösinger : wined3d: Return a fake pixel format if gl is not loaded.

Alexandre Julliard julliard at winehq.org
Tue Apr 1 16:44:12 CDT 2008


Module: wine
Branch: master
Commit: 8673be0bd7579eb6440fc2d0b1c60c93f3067c64
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=8673be0bd7579eb6440fc2d0b1c60c93f3067c64

Author: Stefan Dösinger <stefan at codeweavers.com>
Date:   Fri Mar 28 23:04:34 2008 +0100

wined3d: Return a fake pixel format if gl is not loaded.

---

 dlls/wined3d/utils.c |   13 +++++++++----
 1 files changed, 9 insertions(+), 4 deletions(-)

diff --git a/dlls/wined3d/utils.c b/dlls/wined3d/utils.c
index 95abe20..d0285df 100644
--- a/dlls/wined3d/utils.c
+++ b/dlls/wined3d/utils.c
@@ -437,11 +437,16 @@ const StaticPixelFormatDesc *getFormatDescEntry(WINED3DFORMAT fmt, WineD3D_GL_In
         idx = getFmtIdx(WINED3DFMT_UNKNOWN);
     }
     if(glDesc) {
-        if(!gl_info) {
-            ERR("OpenGL pixel format information was requested, but no gl info structure passed\n");
-            return NULL;
+        if(!gl_info->gl_formats) {
+            /* If we do not have gl format information, provide a dummy NULL format. This is an easy way to make
+             * all gl caps check return "unsupported" than catching the lack of gl all over the code. ANSI C requires
+             * static variables to be initialized to 0.
+             */
+            static const GlPixelFormatDesc dummyFmt;
+            *glDesc = &dummyFmt;
+        } else {
+            *glDesc = &gl_info->gl_formats[idx];
         }
-        *glDesc = &gl_info->gl_formats[idx];
     }
     return &formats[idx];
 }




More information about the wine-cvs mailing list