Commit 53bf5c26 authored by Henri Verbeet's avatar Henri Verbeet Committed by Alexandre Julliard

wined3d: Add fields from StaticPixelFormatDesc to struct GlPixelFormatDesc.

The idea here is that we should lookup format information in struct GlPixelFormatDesc, while StaticPixelFormatDesc and GlPixelFormatDescTemplate will only be used to build the table.
parent fbfc7c97
......@@ -4458,6 +4458,8 @@ nogl_adapter:
This->adapters[0].TextureRam = 8 * 1024 * 1024; /* This is plenty for a DDraw-only card */
}
initPixelFormatsNoGL(&This->adapters[0].gl_info);
This->adapter_count = 1;
return FALSE;
}
......
......@@ -365,6 +365,35 @@ static inline int getFmtIdx(WINED3DFORMAT fmt) {
return -1;
}
BOOL initPixelFormatsNoGL(WineD3D_GL_Info *gl_info)
{
UINT format_count = sizeof(formats) / sizeof(*formats);
UINT i;
gl_info->gl_formats = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, format_count * sizeof(*gl_info->gl_formats));
if (!gl_info->gl_formats)
{
ERR("Failed to allocate memory.\n");
return FALSE;
}
for (i = 0; i < format_count; ++i)
{
struct GlPixelFormatDesc *desc = &gl_info->gl_formats[i];
desc->format = formats[i].format;
desc->red_mask = formats[i].redMask;
desc->green_mask = formats[i].greenMask;
desc->blue_mask = formats[i].blueMask;
desc->alpha_mask = formats[i].alphaMask;
desc->byte_count = formats[i].bpp;
desc->depth_size = formats[i].depthSize;
desc->stencil_size = formats[i].stencilSize;
if (formats[i].isFourcc) desc->Flags |= WINED3DFMT_FLAG_FOURCC;
}
return TRUE;
}
#define GLINFO_LOCATION (*gl_info)
BOOL initPixelFormats(WineD3D_GL_Info *gl_info)
{
......@@ -379,14 +408,27 @@ BOOL initPixelFormats(WineD3D_GL_Info *gl_info)
* after this loop
*/
for(src = 0; src < sizeof(gl_formats_template) / sizeof(gl_formats_template[0]); src++) {
struct GlPixelFormatDesc *desc;
dst = getFmtIdx(gl_formats_template[src].fmt);
gl_info->gl_formats[dst].glInternal = gl_formats_template[src].glInternal;
gl_info->gl_formats[dst].glGammaInternal = gl_formats_template[src].glGammaInternal;
gl_info->gl_formats[dst].glFormat = gl_formats_template[src].glFormat;
gl_info->gl_formats[dst].glType = gl_formats_template[src].glType;
gl_info->gl_formats[dst].color_fixup = COLOR_FIXUP_IDENTITY;
gl_info->gl_formats[dst].Flags = gl_formats_template[src].Flags;
gl_info->gl_formats[dst].heightscale = 1.0;
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->glGammaInternal = gl_formats_template[src].glGammaInternal;
desc->glFormat = gl_formats_template[src].glFormat;
desc->glType = gl_formats_template[src].glType;
desc->color_fixup = COLOR_FIXUP_IDENTITY;
desc->Flags |= gl_formats_template[src].Flags;
desc->heightscale = 1.0;
if(wined3d_settings.offscreen_rendering_mode == ORM_FBO &&
gl_formats_template[src].rtInternal != 0) {
......
......@@ -939,6 +939,7 @@ struct WineD3DAdapter
};
extern BOOL initPixelFormats(WineD3D_GL_Info *gl_info);
BOOL initPixelFormatsNoGL(WineD3D_GL_Info *gl_info);
extern long WineD3DAdapterChangeGLRam(IWineD3DDeviceImpl *D3DDevice, long glram);
extern void add_gl_compat_wrappers(WineD3D_GL_Info *gl_info);
......@@ -2479,6 +2480,15 @@ extern WINED3DFORMAT pixelformat_for_depth(DWORD depth);
struct GlPixelFormatDesc
{
WINED3DFORMAT format;
DWORD red_mask;
DWORD green_mask;
DWORD blue_mask;
DWORD alpha_mask;
UINT byte_count;
WORD depth_size;
WORD stencil_size;
GLint glInternal;
GLint glGammaInternal;
GLint rtInternal;
......
......@@ -29,6 +29,7 @@
#define WINED3DFMT_FLAG_DEPTH 0x4
#define WINED3DFMT_FLAG_STENCIL 0x8
#define WINED3DFMT_FLAG_RENDERTARGET 0x10
#define WINED3DFMT_FLAG_FOURCC 0x20
/** DCL usage masks **/
#define WINED3DSP_DCL_USAGE_SHIFT 0
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment