[PATCH 4/5] wined3d: Get rid of the surface_type parameter to wined3d_check_device_format().
Henri Verbeet
hverbeet at codeweavers.com
Thu Jan 17 03:24:28 CST 2013
---
dlls/d3d8/directx.c | 2 +-
dlls/d3d9/directx.c | 2 +-
dlls/ddraw/ddraw.c | 34 +++++++++++++++-------------------
dlls/ddraw/ddraw_private.h | 14 +++++++-------
dlls/ddraw/device.c | 17 +++++++----------
dlls/ddraw/main.c | 10 +++++-----
dlls/wined3d/directx.c | 22 ++++++++++------------
dlls/wined3d/wined3d.spec | 2 +-
include/wine/wined3d.h | 9 +--------
9 files changed, 48 insertions(+), 64 deletions(-)
diff --git a/dlls/d3d8/directx.c b/dlls/d3d8/directx.c
index 4339251..4070b3e 100644
--- a/dlls/d3d8/directx.c
+++ b/dlls/d3d8/directx.c
@@ -254,7 +254,7 @@ static HRESULT WINAPI d3d8_CheckDeviceFormat(IDirect3D8 *iface, UINT adapter, D3
wined3d_mutex_lock();
hr = wined3d_check_device_format(d3d8->wined3d, adapter, device_type, wined3dformat_from_d3dformat(adapter_format),
- usage, wined3d_rtype, wined3dformat_from_d3dformat(format), WINED3D_SURFACE_TYPE_OPENGL);
+ usage, wined3d_rtype, wined3dformat_from_d3dformat(format));
wined3d_mutex_unlock();
return hr;
diff --git a/dlls/d3d9/directx.c b/dlls/d3d9/directx.c
index 3cb979f..a97ff57 100644
--- a/dlls/d3d9/directx.c
+++ b/dlls/d3d9/directx.c
@@ -264,7 +264,7 @@ static HRESULT WINAPI d3d9_CheckDeviceFormat(IDirect3D9Ex *iface, UINT adapter,
wined3d_mutex_lock();
hr = wined3d_check_device_format(d3d9->wined3d, adapter, device_type, wined3dformat_from_d3dformat(adapter_format),
- usage, wined3d_rtype, wined3dformat_from_d3dformat(format), WINED3D_SURFACE_TYPE_OPENGL);
+ usage, wined3d_rtype, wined3dformat_from_d3dformat(format));
wined3d_mutex_unlock();
return hr;
diff --git a/dlls/ddraw/ddraw.c b/dlls/ddraw/ddraw.c
index a338c32..266c779 100644
--- a/dlls/ddraw/ddraw.c
+++ b/dlls/ddraw/ddraw.c
@@ -366,7 +366,7 @@ void ddraw_destroy_swapchain(struct ddraw *ddraw)
wined3d_swapchain_decref(ddraw->wined3d_swapchain);
ddraw->wined3d_swapchain = NULL;
- if (DefaultSurfaceType == WINED3D_SURFACE_TYPE_OPENGL)
+ if (DefaultSurfaceType == DDRAW_SURFACE_TYPE_OPENGL)
{
UINT i;
@@ -629,7 +629,7 @@ static HRESULT ddraw_create_swapchain(struct ddraw *ddraw, HWND window, BOOL win
swapchain_desc.device_window = window;
swapchain_desc.windowed = windowed;
- if (DefaultSurfaceType == WINED3D_SURFACE_TYPE_OPENGL)
+ if (DefaultSurfaceType == DDRAW_SURFACE_TYPE_OPENGL)
hr = ddraw_attach_d3d_device(ddraw, &swapchain_desc);
else
hr = wined3d_device_init_gdi(ddraw->wined3d_device, &swapchain_desc);
@@ -850,7 +850,7 @@ static HRESULT WINAPI ddraw7_SetCooperativeLevel(IDirectDraw7 *iface, HWND windo
if (This->wined3d_swapchain)
{
- if (DefaultSurfaceType != WINED3D_SURFACE_TYPE_GDI)
+ if (DefaultSurfaceType != DDRAW_SURFACE_TYPE_GDI)
{
restore_state = TRUE;
@@ -1206,10 +1206,9 @@ static HRESULT WINAPI ddraw7_GetCaps(IDirectDraw7 *iface, DDCAPS *DriverCaps, DD
caps.dwSSBCKeyCaps = winecaps.ddraw_caps.ssb_color_key_caps;
caps.dwSSBFXCaps = winecaps.ddraw_caps.ssb_fx_caps;
- /* Even if WineD3D supports 3D rendering, remove the cap if ddraw is configured
- * not to use it
- */
- if (DefaultSurfaceType == WINED3D_SURFACE_TYPE_GDI)
+ /* Even if wined3d supports 3D rendering, remove the cap if ddraw is
+ * configured not to use it. */
+ if (DefaultSurfaceType == DDRAW_SURFACE_TYPE_GDI)
{
caps.dwCaps &= ~DDCAPS_3D;
caps.ddsCaps.dwCaps &= ~(DDSCAPS_3DDEVICE | DDSCAPS_MIPMAP | DDSCAPS_TEXTURE | DDSCAPS_ZBUFFER);
@@ -1446,9 +1445,8 @@ static HRESULT WINAPI ddraw7_GetFourCCCodes(IDirectDraw7 *iface, DWORD *NumCodes
for (i = 0; i < (sizeof(formats) / sizeof(formats[0])); ++i)
{
- hr = wined3d_check_device_format(ddraw->wined3d, WINED3DADAPTER_DEFAULT, WINED3D_DEVICE_TYPE_HAL,
- mode.format_id, 0, WINED3D_RTYPE_SURFACE, formats[i], DefaultSurfaceType);
- if (SUCCEEDED(hr))
+ if (SUCCEEDED(wined3d_check_device_format(ddraw->wined3d, WINED3DADAPTER_DEFAULT, WINED3D_DEVICE_TYPE_HAL,
+ mode.format_id, 0, WINED3D_RTYPE_SURFACE, formats[i])))
{
if (count < outsize)
Codes[count] = formats[i];
@@ -2490,7 +2488,7 @@ static HRESULT ddraw_create_surface(struct ddraw *ddraw, DDSURFACEDESC2 *pDDSD,
DDRAW_dump_surface_desc(pDDSD);
}
- if ((pDDSD->ddsCaps.dwCaps & DDSCAPS_3DDEVICE) && DefaultSurfaceType != WINED3D_SURFACE_TYPE_OPENGL)
+ if ((pDDSD->ddsCaps.dwCaps & DDSCAPS_3DDEVICE) && DefaultSurfaceType != DDRAW_SURFACE_TYPE_OPENGL)
{
WARN("The application requests a 3D capable surface, but a non-OpenGL surface type was set in the registry.\n");
/* Do not fail surface creation, only fail 3D device creation. */
@@ -4421,9 +4419,8 @@ static HRESULT WINAPI d3d7_EnumZBufferFormats(IDirect3D7 *iface, REFCLSID device
for (i = 0; i < (sizeof(formats) / sizeof(*formats)); ++i)
{
- hr = wined3d_check_device_format(ddraw->wined3d, WINED3DADAPTER_DEFAULT, type, mode.format_id,
- WINED3DUSAGE_DEPTHSTENCIL, WINED3D_RTYPE_SURFACE, formats[i], WINED3D_SURFACE_TYPE_OPENGL);
- if (SUCCEEDED(hr))
+ if (SUCCEEDED(wined3d_check_device_format(ddraw->wined3d, WINED3DADAPTER_DEFAULT, type, mode.format_id,
+ WINED3DUSAGE_DEPTHSTENCIL, WINED3D_RTYPE_SURFACE, formats[i])))
{
DDPIXELFORMAT pformat;
@@ -4446,9 +4443,8 @@ static HRESULT WINAPI d3d7_EnumZBufferFormats(IDirect3D7 *iface, REFCLSID device
* while others used dwZBufferBitDepth=32. In either case the pitch matches a 32 bits per
* pixel format, so we use dwZBufferBitDepth=32. Some games expect 24. Windows Vista and
* newer enumerate both versions, so we do the same(bug 22434) */
- hr = wined3d_check_device_format(ddraw->wined3d, WINED3DADAPTER_DEFAULT, type, mode.format_id,
- WINED3DUSAGE_DEPTHSTENCIL, WINED3D_RTYPE_SURFACE, WINED3DFMT_X8D24_UNORM, WINED3D_SURFACE_TYPE_OPENGL);
- if (SUCCEEDED(hr))
+ if (SUCCEEDED(wined3d_check_device_format(ddraw->wined3d, WINED3DADAPTER_DEFAULT, type, mode.format_id,
+ WINED3DUSAGE_DEPTHSTENCIL, WINED3D_RTYPE_SURFACE, WINED3DFMT_X8D24_UNORM)))
{
DDPIXELFORMAT x8d24 =
{
@@ -5258,7 +5254,7 @@ HRESULT ddraw_init(struct ddraw *ddraw, enum wined3d_device_type device_type)
ddraw->ref7 = 1;
flags = WINED3D_LEGACY_DEPTH_BIAS;
- if (DefaultSurfaceType != WINED3D_SURFACE_TYPE_OPENGL)
+ if (DefaultSurfaceType != DDRAW_SURFACE_TYPE_OPENGL)
flags |= WINED3D_NO3D;
if (!(ddraw->wined3d = wined3d_create(7, flags)))
@@ -5270,7 +5266,7 @@ HRESULT ddraw_init(struct ddraw *ddraw, enum wined3d_device_type device_type)
}
WARN("Created a wined3d object without 3D support.\n");
- DefaultSurfaceType = WINED3D_SURFACE_TYPE_GDI;
+ DefaultSurfaceType = DDRAW_SURFACE_TYPE_GDI;
}
hr = wined3d_device_create(ddraw->wined3d, WINED3DADAPTER_DEFAULT, device_type,
diff --git a/dlls/ddraw/ddraw_private.h b/dlls/ddraw/ddraw_private.h
index 1ae1054..25985bd 100644
--- a/dlls/ddraw/ddraw_private.h
+++ b/dlls/ddraw/ddraw_private.h
@@ -37,7 +37,14 @@
#include "wine/list.h"
#include "wine/wined3d.h"
+enum ddraw_surface_type
+{
+ DDRAW_SURFACE_TYPE_OPENGL,
+ DDRAW_SURFACE_TYPE_GDI,
+};
+
extern const struct wined3d_parent_ops ddraw_null_wined3d_parent_ops DECLSPEC_HIDDEN;
+extern enum ddraw_surface_type DefaultSurfaceType DECLSPEC_HIDDEN;
extern DWORD force_refresh_rate DECLSPEC_HIDDEN;
/*****************************************************************************
@@ -119,13 +126,6 @@ void DDRAW_Convert_DDSCAPS_1_To_2(const DDSCAPS *pIn, DDSCAPS2 *pOut) DECLSPEC_H
void DDRAW_Convert_DDDEVICEIDENTIFIER_2_To_1(const DDDEVICEIDENTIFIER2 *pIn, DDDEVICEIDENTIFIER *pOut) DECLSPEC_HIDDEN;
struct wined3d_vertex_declaration *ddraw_find_decl(struct ddraw *ddraw, DWORD fvf) DECLSPEC_HIDDEN;
-/* The default surface type */
-extern enum wined3d_surface_type DefaultSurfaceType DECLSPEC_HIDDEN;
-
-/*****************************************************************************
- * IDirectDrawSurface implementation structure
- *****************************************************************************/
-
struct ddraw_surface
{
/* IUnknown fields */
diff --git a/dlls/ddraw/device.c b/dlls/ddraw/device.c
index 8201d75..76bdcff 100644
--- a/dlls/ddraw/device.c
+++ b/dlls/ddraw/device.c
@@ -1079,9 +1079,8 @@ static HRESULT d3d_device7_EnumTextureFormats(IDirect3DDevice7 *iface,
for (i = 0; i < sizeof(FormatList) / sizeof(*FormatList); ++i)
{
- hr = wined3d_check_device_format(device->ddraw->wined3d, WINED3DADAPTER_DEFAULT, WINED3D_DEVICE_TYPE_HAL,
- mode.format_id, 0, WINED3D_RTYPE_TEXTURE, FormatList[i], WINED3D_SURFACE_TYPE_OPENGL);
- if (hr == D3D_OK)
+ if (wined3d_check_device_format(device->ddraw->wined3d, WINED3DADAPTER_DEFAULT, WINED3D_DEVICE_TYPE_HAL,
+ mode.format_id, 0, WINED3D_RTYPE_TEXTURE, FormatList[i]) == D3D_OK)
{
DDPIXELFORMAT pformat;
@@ -1102,10 +1101,9 @@ static HRESULT d3d_device7_EnumTextureFormats(IDirect3DDevice7 *iface,
for (i = 0; i < sizeof(BumpFormatList) / sizeof(*BumpFormatList); ++i)
{
- hr = wined3d_check_device_format(device->ddraw->wined3d, WINED3DADAPTER_DEFAULT,
+ if (wined3d_check_device_format(device->ddraw->wined3d, WINED3DADAPTER_DEFAULT,
WINED3D_DEVICE_TYPE_HAL, mode.format_id, WINED3DUSAGE_QUERY_LEGACYBUMPMAP,
- WINED3D_RTYPE_TEXTURE, BumpFormatList[i], WINED3D_SURFACE_TYPE_OPENGL);
- if (hr == D3D_OK)
+ WINED3D_RTYPE_TEXTURE, BumpFormatList[i]) == D3D_OK)
{
DDPIXELFORMAT pformat;
@@ -1209,9 +1207,8 @@ static HRESULT WINAPI d3d_device2_EnumTextureFormats(IDirect3DDevice2 *iface,
for (i = 0; i < sizeof(FormatList) / sizeof(*FormatList); ++i)
{
- hr = wined3d_check_device_format(device->ddraw->wined3d, 0, WINED3D_DEVICE_TYPE_HAL,
- mode.format_id, 0, WINED3D_RTYPE_TEXTURE, FormatList[i], WINED3D_SURFACE_TYPE_OPENGL);
- if (hr == D3D_OK)
+ if (wined3d_check_device_format(device->ddraw->wined3d, 0, WINED3D_DEVICE_TYPE_HAL,
+ mode.format_id, 0, WINED3D_RTYPE_TEXTURE, FormatList[i]) == D3D_OK)
{
DDSURFACEDESC sdesc;
@@ -6702,7 +6699,7 @@ HRESULT d3d_device_create(struct ddraw *ddraw, struct ddraw_surface *target,
TRACE("ddraw %p, target %p, version %u, device %p, outer_unknown %p.\n",
ddraw, target, version, device, outer_unknown);
- if (DefaultSurfaceType != WINED3D_SURFACE_TYPE_OPENGL)
+ if (DefaultSurfaceType != DDRAW_SURFACE_TYPE_OPENGL)
{
ERR_(winediag)("The application wants to create a Direct3D device, "
"but the current DirectDrawRenderer does not support this.\n");
diff --git a/dlls/ddraw/main.c b/dlls/ddraw/main.c
index 819dc7f..e4c1ac1 100644
--- a/dlls/ddraw/main.c
+++ b/dlls/ddraw/main.c
@@ -37,7 +37,7 @@
WINE_DEFAULT_DEBUG_CHANNEL(ddraw);
/* The configured default surface */
-enum wined3d_surface_type DefaultSurfaceType = WINED3D_SURFACE_TYPE_OPENGL;
+enum ddraw_surface_type DefaultSurfaceType = DDRAW_SURFACE_TYPE_OPENGL;
static struct list global_ddraw_list = LIST_INIT(global_ddraw_list);
@@ -384,7 +384,7 @@ HRESULT WINAPI DirectDrawEnumerateExA(LPDDENUMCALLBACKEXA callback, void *contex
FIXME("flags 0x%08x not handled\n", flags);
wined3d_flags = WINED3D_LEGACY_DEPTH_BIAS;
- if (DefaultSurfaceType != WINED3D_SURFACE_TYPE_OPENGL)
+ if (DefaultSurfaceType != DDRAW_SURFACE_TYPE_OPENGL)
wined3d_flags |= WINED3D_NO3D;
TRACE("Enumerating ddraw interfaces\n");
@@ -397,7 +397,7 @@ HRESULT WINAPI DirectDrawEnumerateExA(LPDDENUMCALLBACKEXA callback, void *contex
}
WARN("Created a wined3d object without 3D support.\n");
- DefaultSurfaceType = WINED3D_SURFACE_TYPE_GDI;
+ DefaultSurfaceType = DDRAW_SURFACE_TYPE_GDI;
}
__TRY
@@ -910,12 +910,12 @@ DllMain(HINSTANCE hInstDLL,
if (!strcmp(buffer,"gdi"))
{
TRACE("Defaulting to GDI surfaces\n");
- DefaultSurfaceType = WINED3D_SURFACE_TYPE_GDI;
+ DefaultSurfaceType = DDRAW_SURFACE_TYPE_GDI;
}
else if (!strcmp(buffer,"opengl"))
{
TRACE("Defaulting to opengl surfaces\n");
- DefaultSurfaceType = WINED3D_SURFACE_TYPE_OPENGL;
+ DefaultSurfaceType = DDRAW_SURFACE_TYPE_OPENGL;
}
else
{
diff --git a/dlls/wined3d/directx.c b/dlls/wined3d/directx.c
index adce77e..e5b7f33 100644
--- a/dlls/wined3d/directx.c
+++ b/dlls/wined3d/directx.c
@@ -3850,10 +3850,9 @@ static BOOL CheckTextureCapability(const struct wined3d_adapter *adapter, const
static BOOL CheckSurfaceCapability(const struct wined3d_adapter *adapter,
const struct wined3d_format *adapter_format,
- const struct wined3d_format *check_format,
- enum wined3d_surface_type surface_type)
+ const struct wined3d_format *check_format, BOOL no3d)
{
- if (surface_type == WINED3D_SURFACE_TYPE_GDI)
+ if (no3d)
{
switch (check_format->id)
{
@@ -3924,8 +3923,7 @@ static BOOL CheckVertexTextureCapability(const struct wined3d_adapter *adapter,
HRESULT CDECL wined3d_check_device_format(const struct wined3d *wined3d, UINT adapter_idx,
enum wined3d_device_type device_type, enum wined3d_format_id adapter_format_id, DWORD usage,
- enum wined3d_resource_type resource_type, enum wined3d_format_id check_format_id,
- enum wined3d_surface_type surface_type)
+ enum wined3d_resource_type resource_type, enum wined3d_format_id check_format_id)
{
const struct wined3d_adapter *adapter = &wined3d->adapters[adapter_idx];
const struct wined3d_gl_info *gl_info = &adapter->gl_info;
@@ -3934,10 +3932,10 @@ HRESULT CDECL wined3d_check_device_format(const struct wined3d *wined3d, UINT ad
DWORD usage_caps = 0;
TRACE("wined3d %p, adapter_idx %u, device_type %s, adapter_format %s, usage %s, %s,\n"
- "resource_type %s, check_format %s, surface_type %#x.\n",
+ "resource_type %s, check_format %s.\n",
wined3d, adapter_idx, debug_d3ddevicetype(device_type), debug_d3dformat(adapter_format_id),
debug_d3dusage(usage), debug_d3dusagequery(usage), debug_d3dresourcetype(resource_type),
- debug_d3dformat(check_format_id), surface_type);
+ debug_d3dformat(check_format_id));
if (adapter_idx >= wined3d->adapter_count)
return WINED3DERR_INVALIDCALL;
@@ -3954,7 +3952,7 @@ HRESULT CDECL wined3d_check_device_format(const struct wined3d *wined3d, UINT ad
* - WINED3DUSAGE_SOFTWAREPROCESSING
* - WINED3DUSAGE_QUERY_WRAPANDMIP
*/
- if (surface_type != WINED3D_SURFACE_TYPE_OPENGL)
+ if (wined3d->flags & WINED3D_NO3D)
{
TRACE("[FAILED]\n");
return WINED3DERR_NOTAVAILABLE;
@@ -4067,7 +4065,7 @@ HRESULT CDECL wined3d_check_device_format(const struct wined3d *wined3d, UINT ad
* - WINED3DUSAGE_NONSECURE (d3d9ex)
* - WINED3DUSAGE_RENDERTARGET
*/
- if (!CheckSurfaceCapability(adapter, adapter_format, format, surface_type))
+ if (!CheckSurfaceCapability(adapter, adapter_format, format, wined3d->flags & WINED3D_NO3D))
{
TRACE("[FAILED] - Not supported for plain surfaces.\n");
return WINED3DERR_NOTAVAILABLE;
@@ -4116,7 +4114,7 @@ HRESULT CDECL wined3d_check_device_format(const struct wined3d *wined3d, UINT ad
* - WINED3DUSAGE_TEXTAPI (d3d9ex)
* - WINED3DUSAGE_QUERY_WRAPANDMIP
*/
- if (surface_type != WINED3D_SURFACE_TYPE_OPENGL)
+ if (wined3d->flags & WINED3D_NO3D)
{
TRACE("[FAILED]\n");
return WINED3DERR_NOTAVAILABLE;
@@ -4254,7 +4252,7 @@ HRESULT CDECL wined3d_check_device_format(const struct wined3d *wined3d, UINT ad
* - D3DUSAGE_SOFTWAREPROCESSING
* - D3DUSAGE_QUERY_WRAPANDMIP
*/
- if (surface_type != WINED3D_SURFACE_TYPE_OPENGL)
+ if (wined3d->flags & WINED3D_NO3D)
{
TRACE("[FAILED]\n");
return WINED3DERR_NOTAVAILABLE;
@@ -4517,7 +4515,7 @@ HRESULT CDECL wined3d_check_device_type(const struct wined3d *wined3d, UINT adap
/* Use CheckDeviceFormat to see if the backbuffer_format is usable with the given display_format */
hr = wined3d_check_device_format(wined3d, adapter_idx, device_type, display_format,
- WINED3DUSAGE_RENDERTARGET, WINED3D_RTYPE_SURFACE, backbuffer_format, WINED3D_SURFACE_TYPE_OPENGL);
+ WINED3DUSAGE_RENDERTARGET, WINED3D_RTYPE_SURFACE, backbuffer_format);
if (FAILED(hr))
TRACE("Unsupported display/backbuffer format combination %s / %s.\n",
debug_d3dformat(display_format), debug_d3dformat(backbuffer_format));
diff --git a/dlls/wined3d/wined3d.spec b/dlls/wined3d/wined3d.spec
index c41da30..e8e52b6 100644
--- a/dlls/wined3d/wined3d.spec
+++ b/dlls/wined3d/wined3d.spec
@@ -2,7 +2,7 @@
@ stdcall wined3d_mutex_unlock()
@ cdecl wined3d_check_depth_stencil_match(ptr long long long long long)
-@ cdecl wined3d_check_device_format(ptr long long long long long long long)
+@ cdecl wined3d_check_device_format(ptr long long long long long long)
@ cdecl wined3d_check_device_format_conversion(ptr long long long long)
@ cdecl wined3d_check_device_multisample_type(ptr long long long long long ptr)
@ cdecl wined3d_check_device_type(ptr long long long long long)
diff --git a/include/wine/wined3d.h b/include/wine/wined3d.h
index 8334132..1d819fd 100644
--- a/include/wine/wined3d.h
+++ b/include/wine/wined3d.h
@@ -748,12 +748,6 @@ enum wined3d_decl_usage
WINED3D_DECL_USAGE_SAMPLE = 13
};
-enum wined3d_surface_type
-{
- WINED3D_SURFACE_TYPE_OPENGL, /* OpenGL surface: Renders using libGL, needed for 3D */
- WINED3D_SURFACE_TYPE_GDI, /* User surface. No 3D, DirectDraw rendering with GDI */
-};
-
enum wined3d_sysval_semantic
{
WINED3D_SV_DEPTH = 0xffffffff,
@@ -2024,8 +2018,7 @@ HRESULT __cdecl wined3d_check_depth_stencil_match(const struct wined3d *wined3d,
enum wined3d_format_id render_target_format_id, enum wined3d_format_id depth_stencil_format_id);
HRESULT __cdecl wined3d_check_device_format(const struct wined3d *wined3d, UINT adaper_idx,
enum wined3d_device_type device_type, enum wined3d_format_id adapter_format_id, DWORD usage,
- enum wined3d_resource_type resource_type, enum wined3d_format_id check_format_id,
- enum wined3d_surface_type surface_type);
+ enum wined3d_resource_type resource_type, enum wined3d_format_id check_format_id);
HRESULT __cdecl wined3d_check_device_format_conversion(const struct wined3d *wined3d, UINT adapter_idx,
enum wined3d_device_type device_type, enum wined3d_format_id source_format_id,
enum wined3d_format_id target_format_id);
--
1.7.12.4
More information about the wine-patches
mailing list