wined3d: Create a separate function for setting basic format info.

This commit is contained in:
Henri Verbeet 2009-03-27 10:25:54 +01:00 committed by Alexandre Julliard
parent 5a960ae807
commit 1407bd6b1a
1 changed files with 7 additions and 14 deletions

View File

@ -375,7 +375,7 @@ static inline int getFmtIdx(WINED3DFORMAT fmt) {
return -1; return -1;
} }
BOOL initPixelFormatsNoGL(WineD3D_GL_Info *gl_info) static BOOL init_format_base_info(WineD3D_GL_Info *gl_info)
{ {
UINT format_count = sizeof(formats) / sizeof(*formats); UINT format_count = sizeof(formats) / sizeof(*formats);
UINT i; UINT i;
@ -404,15 +404,18 @@ BOOL initPixelFormatsNoGL(WineD3D_GL_Info *gl_info)
return TRUE; return TRUE;
} }
BOOL initPixelFormatsNoGL(WineD3D_GL_Info *gl_info)
{
return init_format_base_info(gl_info);
}
#define GLINFO_LOCATION (*gl_info) #define GLINFO_LOCATION (*gl_info)
BOOL initPixelFormats(WineD3D_GL_Info *gl_info) BOOL initPixelFormats(WineD3D_GL_Info *gl_info)
{ {
unsigned int src; unsigned int src;
int dst; int dst;
gl_info->gl_formats = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, if (!init_format_base_info(gl_info)) return FALSE;
sizeof(formats) / sizeof(formats[0]) * sizeof(gl_info->gl_formats[0]));
if(!gl_info->gl_formats) return FALSE;
/* If a format depends on some extensions, remove them from the table above and initialize them /* If a format depends on some extensions, remove them from the table above and initialize them
* after this loop * after this loop
@ -422,16 +425,6 @@ BOOL initPixelFormats(WineD3D_GL_Info *gl_info)
dst = getFmtIdx(gl_formats_template[src].fmt); dst = getFmtIdx(gl_formats_template[src].fmt);
desc = &gl_info->gl_formats[dst]; desc = &gl_info->gl_formats[dst];
desc->format = formats[dst].format;
desc->red_mask = formats[dst].redMask;
desc->green_mask = formats[dst].greenMask;
desc->blue_mask = formats[dst].blueMask;
desc->alpha_mask = formats[dst].alphaMask;
desc->byte_count = formats[dst].bpp;
desc->depth_size = formats[dst].depthSize;
desc->stencil_size = formats[dst].stencilSize;
if (formats[dst].isFourcc) desc->Flags |= WINED3DFMT_FLAG_FOURCC;
desc->glInternal = gl_formats_template[src].glInternal; desc->glInternal = gl_formats_template[src].glInternal;
desc->glGammaInternal = gl_formats_template[src].glGammaInternal; desc->glGammaInternal = gl_formats_template[src].glGammaInternal;
desc->glFormat = gl_formats_template[src].glFormat; desc->glFormat = gl_formats_template[src].glFormat;