From 5a5d18bda49b42e743bff69b2de35eb3e15f1424 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B3zef=20Kucia?= Date: Thu, 28 Mar 2019 09:53:54 +0100 Subject: [PATCH] wined3d: Use adapter_check_format() in wined3d_check_depth_stencil_format(). MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Józef Kucia Signed-off-by: Henri Verbeet Signed-off-by: Alexandre Julliard --- dlls/wined3d/adapter_gl.c | 3 ++- dlls/wined3d/directx.c | 21 ++------------------- 2 files changed, 4 insertions(+), 20 deletions(-) diff --git a/dlls/wined3d/adapter_gl.c b/dlls/wined3d/adapter_gl.c index a076a988eb3..30c1515bbda 100644 --- a/dlls/wined3d/adapter_gl.c +++ b/dlls/wined3d/adapter_gl.c @@ -4398,7 +4398,8 @@ static BOOL adapter_gl_check_format(const struct wined3d_adapter *adapter, { const struct wined3d_pixel_format *cfg = &adapter->cfgs[i]; - if (wined3d_check_pixel_format_color(cfg, rt_format) + if ((!adapter_format || wined3d_check_pixel_format_color(cfg, adapter_format)) + && (!rt_format || wined3d_check_pixel_format_color(cfg, rt_format)) && wined3d_check_pixel_format_depth(cfg, ds_format)) { return TRUE; diff --git a/dlls/wined3d/directx.c b/dlls/wined3d/directx.c index 8e7713858a8..801d11c89f4 100644 --- a/dlls/wined3d/directx.c +++ b/dlls/wined3d/directx.c @@ -1331,7 +1331,6 @@ HRESULT CDECL wined3d_check_depth_stencil_match(const struct wined3d *wined3d, UINT adapter_idx, enum wined3d_device_type device_type, enum wined3d_format_id adapter_format_id, enum wined3d_format_id render_target_format_id, enum wined3d_format_id depth_stencil_format_id) { - const struct wined3d_format *adapter_format; const struct wined3d_format *rt_format; const struct wined3d_format *ds_format; const struct wined3d_adapter *adapter; @@ -1346,7 +1345,6 @@ HRESULT CDECL wined3d_check_depth_stencil_match(const struct wined3d *wined3d, adapter = wined3d->adapters[adapter_idx]; - adapter_format = wined3d_get_format(adapter, adapter_format_id, WINED3D_BIND_RENDER_TARGET); rt_format = wined3d_get_format(adapter, render_target_format_id, WINED3D_BIND_RENDER_TARGET); ds_format = wined3d_get_format(adapter, depth_stencil_format_id, WINED3D_BIND_DEPTH_STENCIL); @@ -1361,7 +1359,7 @@ HRESULT CDECL wined3d_check_depth_stencil_match(const struct wined3d *wined3d, return WINED3DERR_NOTAVAILABLE; } - if (adapter->adapter_ops->adapter_check_format(adapter, adapter_format, rt_format, ds_format)) + if (adapter->adapter_ops->adapter_check_format(adapter, NULL, rt_format, ds_format)) { TRACE("Formats match.\n"); return WINED3D_OK; @@ -1438,22 +1436,7 @@ static BOOL wined3d_check_depth_stencil_format(const struct wined3d_adapter *ada return FALSE; } - if (wined3d_settings.offscreen_rendering_mode == ORM_BACKBUFFER) - { - unsigned int i; - - for (i = 0; i < adapter->cfg_count; ++i) - { - const struct wined3d_pixel_format *cfg = &adapter->cfgs[i]; - if (wined3d_check_pixel_format_color(cfg, adapter_format) - && wined3d_check_pixel_format_depth(cfg, ds_format)) - return TRUE; - } - - return FALSE; - } - - return TRUE; + return adapter->adapter_ops->adapter_check_format(adapter, adapter_format, NULL, ds_format); } static BOOL wined3d_check_render_target_format(const struct wined3d_adapter *adapter,