Module: wine
Branch: master
Commit: b281f23efef0b2de3aaee90497814d59777facf2
URL: http://source.winehq.org/git/wine.git/?a=commit;h=b281f23efef0b2de3aaee9049…
Author: Henri Verbeet <hverbeet(a)codeweavers.com>
Date: Mon Mar 15 21:07:24 2010 +0100
wined3d: Add a separate function to set the pixel format in context_create().
---
dlls/wined3d/context.c | 81 ++++++++++++++++++++++++++----------------------
1 files changed, 44 insertions(+), 37 deletions(-)
diff --git a/dlls/wined3d/context.c b/dlls/wined3d/context.c
index bb7be47..e972721 100644
--- a/dlls/wined3d/context.c
+++ b/dlls/wined3d/context.c
@@ -647,6 +647,47 @@ void context_resource_released(IWineD3DDevice *iface, IWineD3DResource *resource
}
}
+static BOOL context_set_pixel_format(const struct wined3d_gl_info *gl_info, HDC dc, int format)
+{
+ int current = GetPixelFormat(dc);
+
+ if (current == format) return TRUE;
+
+ if (!current)
+ {
+ if (!SetPixelFormat(dc, format, NULL))
+ {
+ ERR("Failed to set pixel format %d on device context %p, last error %#x.\n",
+ format, dc, GetLastError());
+ return FALSE;
+ }
+ return TRUE;
+ }
+
+ /* By default WGL doesn't allow pixel format adjustments but we need it
+ * here. For this reason there's a Wine specific wglSetPixelFormat()
+ * which allows us to set the pixel format multiple times. Only use it
+ * when really needed. */
+ if (gl_info->supported[WGL_WINE_PIXEL_FORMAT_PASSTHROUGH])
+ {
+ if (!GL_EXTCALL(wglSetPixelFormatWINE(dc, format, NULL)))
+ {
+ ERR("wglSetPixelFormatWINE failed to set pixel format %d on device context %p.\n",
+ format, dc);
+ return FALSE;
+ }
+ return TRUE;
+ }
+
+ /* OpenGL doesn't allow pixel format adjustments. Print an error and
+ * continue using the old format. There's a big chance that the old
+ * format works although with a performance hit and perhaps rendering
+ * errors. */
+ ERR("Unable to set pixel format %d on device context %p. Already using format %d.\n",
+ format, dc, current);
+ return TRUE;
+}
+
static void context_validate(struct wined3d_context *context)
{
HWND wnd = WindowFromDC(context->hdc);
@@ -1121,7 +1162,6 @@ struct wined3d_context *context_create(IWineD3DDeviceImpl *This, IWineD3DSurface
DWORD state;
HGLRC ctx;
HDC hdc;
- int res;
TRACE("device %p, target %p, window %p, present parameters %p.\n",
This, target, win_handle, pPresentParms);
@@ -1205,43 +1245,10 @@ struct wined3d_context *context_create(IWineD3DDeviceImpl *This, IWineD3DSurface
}
DescribePixelFormat(hdc, pixel_format, sizeof(pfd), &pfd);
- res = SetPixelFormat(hdc, pixel_format, NULL);
- if (!res)
+ if (!context_set_pixel_format(gl_info, hdc, pixel_format))
{
- int oldPixelFormat = GetPixelFormat(hdc);
-
- /* By default WGL doesn't allow pixel format adjustments but we need
- * it here. For this reason there is a WINE-specific wglSetPixelFormat
- * which allows you to set the pixel format multiple times. Only use
- * it when it is really needed. */
-
- if (oldPixelFormat == pixel_format)
- {
- /* We don't have to do anything as the formats are the same :) */
- }
- else if (oldPixelFormat && gl_info->supported[WGL_WINE_PIXEL_FORMAT_PASSTHROUGH])
- {
- res = GL_EXTCALL(wglSetPixelFormatWINE(hdc, pixel_format, NULL));
-
- if (!res)
- {
- ERR("wglSetPixelFormatWINE failed on HDC %p for pixel_format %d.\n", hdc, pixel_format);
- goto out;
- }
- }
- else if (oldPixelFormat)
- {
- /* OpenGL doesn't allow pixel format adjustments. Print an error
- * and continue using the old format. There's a big chance that
- * the old format works although with a performance hit and perhaps
- * rendering errors. */
- ERR("HDC %p is already set to pixel_format %d and OpenGL doesn't allow changes.\n", hdc, oldPixelFormat);
- }
- else
- {
- ERR("SetPixelFormat failed on HDC %p for pixel format %d.\n", hdc, pixel_format);
- goto out;
- }
+ ERR("Failed to set pixel format %d on device context %p.\n", pixel_format, hdc);
+ goto out;
}
ctx = pwglCreateContext(hdc);
Module: wine
Branch: master
Commit: 4133a0a4ff77c115648925561a0d2f7804fd6159
URL: http://source.winehq.org/git/wine.git/?a=commit;h=4133a0a4ff77c115648925561…
Author: Henri Verbeet <hverbeet(a)codeweavers.com>
Date: Mon Mar 15 21:07:23 2010 +0100
wined3d: Use "gl_info" in some more places in context_create().
---
dlls/wined3d/context.c | 10 +++++-----
1 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/dlls/wined3d/context.c b/dlls/wined3d/context.c
index c8dcb6e..bb7be47 100644
--- a/dlls/wined3d/context.c
+++ b/dlls/wined3d/context.c
@@ -1149,9 +1149,9 @@ struct wined3d_context *context_create(IWineD3DDeviceImpl *This, IWineD3DSurface
auxBuffers = TRUE;
if (color_format_desc->format == WINED3DFMT_B4G4R4X4_UNORM)
- color_format_desc = getFormatDescEntry(WINED3DFMT_B4G4R4A4_UNORM, &This->adapter->gl_info);
+ color_format_desc = getFormatDescEntry(WINED3DFMT_B4G4R4A4_UNORM, gl_info);
else if (color_format_desc->format == WINED3DFMT_B8G8R8X8_UNORM)
- color_format_desc = getFormatDescEntry(WINED3DFMT_B8G8R8A8_UNORM, &This->adapter->gl_info);
+ color_format_desc = getFormatDescEntry(WINED3DFMT_B8G8R8A8_UNORM, gl_info);
}
/* DirectDraw supports 8bit paletted render targets and these are used by
@@ -1161,7 +1161,7 @@ struct wined3d_context *context_create(IWineD3DDeviceImpl *This, IWineD3DSurface
* For this reason we require a format with 8bit alpha, so request
* A8R8G8B8. */
if (color_format_desc->format == WINED3DFMT_P8_UINT)
- color_format_desc = getFormatDescEntry(WINED3DFMT_B8G8R8A8_UNORM, &This->adapter->gl_info);
+ color_format_desc = getFormatDescEntry(WINED3DFMT_B8G8R8A8_UNORM, gl_info);
/* Retrieve the depth stencil format from the present parameters.
* The choice of the proper format can give a nice performance boost
@@ -1170,7 +1170,7 @@ struct wined3d_context *context_create(IWineD3DDeviceImpl *This, IWineD3DSurface
{
TRACE("Auto depth stencil enabled, using format %s.\n",
debug_d3dformat(pPresentParms->AutoDepthStencilFormat));
- ds_format_desc = getFormatDescEntry(pPresentParms->AutoDepthStencilFormat, &This->adapter->gl_info);
+ ds_format_desc = getFormatDescEntry(pPresentParms->AutoDepthStencilFormat, gl_info);
}
/* D3D only allows multisampling when SwapEffect is set to WINED3DSWAPEFFECT_DISCARD. */
@@ -1271,7 +1271,7 @@ struct wined3d_context *context_create(IWineD3DDeviceImpl *This, IWineD3DSurface
goto out;
}
- ret->gl_info = &This->adapter->gl_info;
+ ret->gl_info = gl_info;
/* Mark all states dirty to force a proper initialization of the states
* on the first use of the context. */
Module: wine
Branch: master
Commit: fd96c54641e500952233d0ac5a1a2730f82a60d7
URL: http://source.winehq.org/git/wine.git/?a=commit;h=fd96c54641e500952233d0ac5…
Author: Rob Shearman <robertshearman(a)gmail.com>
Date: Mon Mar 15 19:31:10 2010 +0000
widl: Simplify write_parameter_conf_or_var_exprs by making use of typegen_detect_type.
Remove the difficult manual walking of the alias tree and make the
code easier to read and less likely to break if a new type is added.
---
tools/widl/typegen.c | 36 ++++++++++++++++++++----------------
1 files changed, 20 insertions(+), 16 deletions(-)
diff --git a/tools/widl/typegen.c b/tools/widl/typegen.c
index e42d657..ca0faf1 100644
--- a/tools/widl/typegen.c
+++ b/tools/widl/typegen.c
@@ -3324,15 +3324,10 @@ static void write_parameter_conf_or_var_exprs(FILE *file, int indent, const char
/* get fundamental type for the argument */
for (;;)
{
- if (is_attr(type->attrs, ATTR_WIREMARSHAL))
- break;
- else if (is_attr(type->attrs, ATTR_CONTEXTHANDLE))
- break;
- else if (type_is_alias(type))
- type = type_alias_get_aliasee(type);
- else if (is_array(type))
+ switch (typegen_detect_type(type, var->attrs, TDT_IGNORE_STRINGS|TDT_IGNORE_RANGES))
{
- if (is_conformance_needed_for_phase(phase) && is_array(type))
+ case TGT_ARRAY:
+ if (is_conformance_needed_for_phase(phase))
{
if (type_array_has_conformance(type))
{
@@ -3349,18 +3344,16 @@ static void write_parameter_conf_or_var_exprs(FILE *file, int indent, const char
}
}
break;
- }
- else if (type_get_type(type) == TYPE_UNION)
- {
- if (is_conformance_needed_for_phase(phase))
+ case TGT_UNION:
+ if (type_get_type(type) == TYPE_UNION &&
+ is_conformance_needed_for_phase(phase))
{
print_file(file, indent, "__frame->_StubMsg.MaxCount = (ULONG_PTR)");
write_expr(file, get_attrp(var->attrs, ATTR_SWITCHIS), 1, 1, NULL, NULL, local_var_prefix);
fprintf(file, ";\n\n");
}
break;
- }
- else if (type_get_type(type) == TYPE_INTERFACE || is_void(type))
+ case TGT_IFACE_POINTER:
{
expr_t *iid;
@@ -3372,10 +3365,21 @@ static void write_parameter_conf_or_var_exprs(FILE *file, int indent, const char
}
break;
}
- else if (is_ptr(type))
+ case TGT_POINTER:
type = type_pointer_get_ref(type);
- else
+ continue;
+ case TGT_INVALID:
+ case TGT_USER_TYPE:
+ case TGT_CTXT_HANDLE:
+ case TGT_CTXT_HANDLE_POINTER:
+ case TGT_STRING:
+ case TGT_BASIC:
+ case TGT_ENUM:
+ case TGT_STRUCT:
+ case TGT_RANGE:
break;
+ }
+ break;
}
}