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

This commit is contained in:
Stefan Dösinger 2008-03-28 23:04:34 +01:00 committed by Alexandre Julliard
parent 9e831a8733
commit 8673be0bd7
1 changed files with 9 additions and 4 deletions

View File

@ -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];
}