wined3d: Add fields from StaticPixelFormatDesc to struct GlPixelFormatDesc.
Henri Verbeet
hverbeet at codeweavers.com
Fri Mar 13 04:44:17 CDT 2009
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.
---
dlls/wined3d/directx.c | 2 +
dlls/wined3d/utils.c | 56 +++++++++++++++++++++++++++++----
dlls/wined3d/wined3d_private.h | 10 ++++++
dlls/wined3d/wined3d_private_types.h | 1 +
4 files changed, 62 insertions(+), 7 deletions(-)
diff --git a/dlls/wined3d/directx.c b/dlls/wined3d/directx.c
index 55b2b7e..fddc856 100644
--- a/dlls/wined3d/directx.c
+++ b/dlls/wined3d/directx.c
@@ -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;
}
diff --git a/dlls/wined3d/utils.c b/dlls/wined3d/utils.c
index e6a6de0..7385654 100644
--- a/dlls/wined3d/utils.c
+++ b/dlls/wined3d/utils.c
@@ -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) {
diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
index b2cc872..eade311 100644
--- a/dlls/wined3d/wined3d_private.h
+++ b/dlls/wined3d/wined3d_private.h
@@ -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;
diff --git a/dlls/wined3d/wined3d_private_types.h b/dlls/wined3d/wined3d_private_types.h
index 343244e..e5b4c3d 100644
--- a/dlls/wined3d/wined3d_private_types.h
+++ b/dlls/wined3d/wined3d_private_types.h
@@ -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
--
1.6.0.6
--------------050708060102030409080104--
More information about the wine-patches
mailing list