Module: wine
Branch: master
Commit: ec3d2ba316994dec3d19337afab00062eef7d829
URL: http://source.winehq.org/git/wine.git/?a=commit;h=ec3d2ba316994dec3d19337af…
Author: Stefan Dösinger <stefan(a)codeweavers.com>
Date: Fri Apr 30 16:44:29 2010 +0200
wined3d: Fall back to other depth stencil formats if D24S8 isn't supported.
---
dlls/wined3d/swapchain.c | 27 ++++++++++++++++++++++-----
1 files changed, 22 insertions(+), 5 deletions(-)
diff --git a/dlls/wined3d/swapchain.c b/dlls/wined3d/swapchain.c
index 25c04b1..b5d2d70 100644
--- a/dlls/wined3d/swapchain.c
+++ b/dlls/wined3d/swapchain.c
@@ -802,6 +802,15 @@ HRESULT swapchain_init(IWineD3DSwapChainImpl *swapchain, WINED3DSURFTYPE surface
if (surface_type == SURFACE_OPENGL)
{
+ WINED3DFORMAT formats[] =
+ {
+ WINED3DFMT_D24_UNORM_S8_UINT,
+ WINED3DFMT_D32_UNORM,
+ WINED3DFMT_R24_UNORM_X8_TYPELESS,
+ WINED3DFMT_D16_UNORM,
+ WINED3DFMT_S1_UINT_D15_UNORM
+ };
+
const struct wined3d_gl_info *gl_info = &device->adapter->gl_info;
/* In WGL both color, depth and stencil are features of a pixel format. In case of D3D they are separate.
@@ -815,19 +824,27 @@ HRESULT swapchain_init(IWineD3DSwapChainImpl *swapchain, WINED3DSURFTYPE surface
* Likely a lot of other new bugs will be exposed. For that reason request a depth stencil surface all the
* time. It can cause a slight performance hit but fixes a lot of regressions. A fixme reminds of that this
* issue needs to be fixed. */
- if (!present_parameters->EnableAutoDepthStencil
- || swapchain->presentParms.AutoDepthStencilFormat != WINED3DFMT_D24_UNORM_S8_UINT)
+ for (i = 0; i < (sizeof(formats) / sizeof(*formats)); i++)
{
- FIXME("Add OpenGL context recreation support to context_validate_onscreen_formats\n");
+ swapchain->ds_format = getFormatDescEntry(formats[i], gl_info);
+ swapchain->context[0] = context_create(swapchain, swapchain->front_buffer, swapchain->ds_format);
+ if (swapchain->context[0]) break;
+ TRACE("Depth stencil format %s is not supported, trying next format\n",
+ debug_d3dformat(formats[i]));
}
- swapchain->ds_format = getFormatDescEntry(WINED3DFMT_D24_UNORM_S8_UINT, gl_info);
- swapchain->context[0] = context_create(swapchain, swapchain->front_buffer, swapchain->ds_format);
+
if (!swapchain->context[0])
{
WARN("Failed to create context.\n");
hr = WINED3DERR_NOTAVAILABLE;
goto err;
}
+
+ if (!present_parameters->EnableAutoDepthStencil
+ || swapchain->presentParms.AutoDepthStencilFormat != swapchain->ds_format->format)
+ {
+ FIXME("Add OpenGL context recreation support to context_validate_onscreen_formats\n");
+ }
context_release(swapchain->context[0]);
}
else
Module: wine
Branch: master
Commit: e7066a90e186525adaaa3f3b77df71c826a91a25
URL: http://source.winehq.org/git/wine.git/?a=commit;h=e7066a90e186525adaaa3f3b7…
Author: Stefan Dösinger <stefan(a)codeweavers.com>
Date: Fri Apr 30 16:39:02 2010 +0200
wined3d: Don't grab the implicit depth stencil format in the wrong place.
This format is now explicitly passed to create_context.
---
dlls/wined3d/context.c | 10 ----------
1 files changed, 0 insertions(+), 10 deletions(-)
diff --git a/dlls/wined3d/context.c b/dlls/wined3d/context.c
index 1d366a7..4db678d 100644
--- a/dlls/wined3d/context.c
+++ b/dlls/wined3d/context.c
@@ -1261,16 +1261,6 @@ struct wined3d_context *context_create(IWineD3DSwapChainImpl *swapchain, IWineD3
if (color_format_desc->format == WINED3DFMT_P8_UINT)
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
- * in case of GPU limited programs. */
- if (swapchain->presentParms.EnableAutoDepthStencil)
- {
- TRACE("Auto depth stencil enabled, using format %s.\n",
- debug_d3dformat(swapchain->presentParms.AutoDepthStencilFormat));
- ds_format_desc = getFormatDescEntry(swapchain->presentParms.AutoDepthStencilFormat, gl_info);
- }
-
/* D3D only allows multisampling when SwapEffect is set to WINED3DSWAPEFFECT_DISCARD. */
if (swapchain->presentParms.MultiSampleType && (swapchain->presentParms.SwapEffect == WINED3DSWAPEFFECT_DISCARD))
{