Commit 43ad90ce authored by Henri Verbeet's avatar Henri Verbeet Committed by Alexandre Julliard

ddraw: Get rid of the ImplType fields in IDirectDrawImpl and IDirectDrawSurfaceImpl.

parent c89a3ffe
......@@ -206,7 +206,7 @@ static HRESULT WINAPI ddraw7_QueryInterface(IDirectDraw7 *iface, REFIID refiid,
IsEqualGUID( &IID_IDirect3D7 , refiid ) )
{
/* Check the surface implementation */
if (This->ImplType != SURFACE_OPENGL)
if (DefaultSurfaceType != SURFACE_OPENGL)
{
WARN("The app requests a Direct3D interface, but non-opengl surfaces where set in winecfg\n");
/* Do not abort here, only reject 3D Device creation */
......@@ -1378,7 +1378,6 @@ static HRESULT WINAPI ddraw7_GetFourCCCodes(IDirectDraw7 *iface, DWORD *NumCodes
DWORD count = 0, i, outsize;
HRESULT hr;
WINED3DDISPLAYMODE d3ddm;
WINED3DSURFTYPE type = This->ImplType;
TRACE("iface %p, codes_count %p, codes %p.\n", iface, NumCodes, Codes);
......@@ -1389,7 +1388,7 @@ static HRESULT WINAPI ddraw7_GetFourCCCodes(IDirectDraw7 *iface, DWORD *NumCodes
for (i = 0; i < (sizeof(formats) / sizeof(formats[0])); ++i)
{
hr = wined3d_check_device_format(This->wineD3D, WINED3DADAPTER_DEFAULT, WINED3DDEVTYPE_HAL,
d3ddm.Format, 0, WINED3DRTYPE_SURFACE, formats[i], type);
d3ddm.Format, 0, WINED3DRTYPE_SURFACE, formats[i], DefaultSurfaceType);
if (SUCCEEDED(hr))
{
if (count < outsize)
......@@ -2600,7 +2599,6 @@ static HRESULT WINAPI ddraw7_StartModeTest(IDirectDraw7 *iface, SIZE *Modes, DWO
static HRESULT ddraw_create_surface(IDirectDrawImpl *This, DDSURFACEDESC2 *pDDSD,
IDirectDrawSurfaceImpl **ppSurf, UINT level, UINT version)
{
WINED3DSURFTYPE ImplType = This->ImplType;
HRESULT hr;
TRACE("ddraw %p, surface_desc %p, surface %p, level %u.\n",
......@@ -2612,7 +2610,7 @@ static HRESULT ddraw_create_surface(IDirectDrawImpl *This, DDSURFACEDESC2 *pDDSD
DDRAW_dump_surface_desc(pDDSD);
}
if ((pDDSD->ddsCaps.dwCaps & DDSCAPS_3DDEVICE) && This->ImplType != SURFACE_OPENGL)
if ((pDDSD->ddsCaps.dwCaps & DDSCAPS_3DDEVICE) && DefaultSurfaceType != SURFACE_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. */
......@@ -2626,7 +2624,7 @@ static HRESULT ddraw_create_surface(IDirectDrawImpl *This, DDSURFACEDESC2 *pDDSD
return DDERR_OUTOFVIDEOMEMORY;
}
hr = ddraw_surface_init(*ppSurf, This, pDDSD, level, ImplType, version);
hr = ddraw_surface_init(*ppSurf, This, pDDSD, level, version);
if (FAILED(hr))
{
WARN("Failed to initialize surface, hr %#x.\n", hr);
......@@ -3248,10 +3246,9 @@ static HRESULT CreateSurface(IDirectDrawImpl *ddraw, DDSURFACEDESC2 *DDSD,
* The only case I can think of where this doesn't apply is when a
* 2D app was configured by the user to run with OpenGL and it didn't create
* the render target as first surface. In this case the render target creation
* will cause the 3D init.
*/
if( (ddraw->ImplType == SURFACE_OPENGL) && !(ddraw->d3d_initialized) &&
desc2.ddsCaps.dwCaps & (DDSCAPS_PRIMARYSURFACE | DDSCAPS_3DDEVICE) )
* will cause the 3D init. */
if (DefaultSurfaceType == SURFACE_OPENGL && !ddraw->d3d_initialized
&& desc2.ddsCaps.dwCaps & (DDSCAPS_PRIMARYSURFACE | DDSCAPS_3DDEVICE))
{
IDirectDrawSurfaceImpl *target = object, *surface;
struct list *entry;
......@@ -4695,7 +4692,7 @@ static HRESULT WINAPI d3d7_CreateDevice(IDirect3D7 *iface, REFCLSID riid,
*device = NULL;
/* Fail device creation if non-opengl surfaces are used. */
if (This->ImplType != SURFACE_OPENGL)
if (DefaultSurfaceType != SURFACE_OPENGL)
{
ERR("The application wants to create a Direct3D device, but non-opengl surfaces are set in the registry.\n");
ERR("Please set the surface implementation to opengl or autodetection to allow 3D rendering.\n");
......@@ -5799,7 +5796,7 @@ static HRESULT CDECL device_parent_create_swapchain(struct wined3d_device_parent
TRACE("device_parent %p, present_parameters %p, swapchain %p.\n", device_parent, present_parameters, swapchain);
hr = wined3d_swapchain_create(ddraw->wined3d_device, present_parameters,
ddraw->ImplType, NULL, &ddraw_null_wined3d_parent_ops, swapchain);
DefaultSurfaceType, NULL, &ddraw_null_wined3d_parent_ops, swapchain);
if (FAILED(hr))
{
WARN("Failed to create swapchain, hr %#x.\n", hr);
......@@ -5846,10 +5843,6 @@ HRESULT ddraw_init(IDirectDrawImpl *ddraw, WINED3DDEVTYPE device_type)
ddraw->numIfaces = 1;
ddraw->ref7 = 1;
/* See comments in IDirectDrawImpl_CreateNewSurface for a description of
* this field. */
ddraw->ImplType = DefaultSurfaceType;
/* Get the current screen settings. */
hDC = GetDC(0);
ddraw->orig_bpp = GetDeviceCaps(hDC, BITSPIXEL) * GetDeviceCaps(hDC, PLANES);
......
......@@ -111,9 +111,6 @@ struct IDirectDrawImpl
HWND devicewindow;
HWND dest_window;
/* The surface type to request */
WINED3DSURFTYPE ImplType;
/* Helpers for surface creation */
IDirectDrawSurfaceImpl *tex_root;
BOOL depthstencil;
......@@ -194,7 +191,6 @@ struct IDirectDrawSurfaceImpl
/* Misc things */
DWORD uniqueness_value;
UINT mipmap_level;
WINED3DSURFTYPE ImplType;
/* For D3DDevice creation */
BOOL isRenderTarget;
......@@ -211,7 +207,7 @@ struct IDirectDrawSurfaceImpl
HRESULT ddraw_surface_create_texture(IDirectDrawSurfaceImpl *surface) DECLSPEC_HIDDEN;
void ddraw_surface_destroy(IDirectDrawSurfaceImpl *surface) DECLSPEC_HIDDEN;
HRESULT ddraw_surface_init(IDirectDrawSurfaceImpl *surface, IDirectDrawImpl *ddraw,
DDSURFACEDESC2 *desc, UINT mip_level, WINED3DSURFTYPE surface_type, UINT version) DECLSPEC_HIDDEN;
DDSURFACEDESC2 *desc, UINT mip_level, UINT version) DECLSPEC_HIDDEN;
ULONG ddraw_surface_release_iface(IDirectDrawSurfaceImpl *This) DECLSPEC_HIDDEN;
static inline IDirectDrawSurfaceImpl *impl_from_IDirect3DTexture(IDirect3DTexture *iface)
......
......@@ -5085,7 +5085,7 @@ HRESULT ddraw_surface_create_texture(IDirectDrawSurfaceImpl *surface)
}
HRESULT ddraw_surface_init(IDirectDrawSurfaceImpl *surface, IDirectDrawImpl *ddraw,
DDSURFACEDESC2 *desc, UINT mip_level, WINED3DSURFTYPE surface_type, UINT version)
DDSURFACEDESC2 *desc, UINT mip_level, UINT version)
{
WINED3DPOOL pool = WINED3DPOOL_DEFAULT;
enum wined3d_format_id format;
......@@ -5176,11 +5176,10 @@ HRESULT ddraw_surface_init(IDirectDrawSurfaceImpl *surface, IDirectDrawImpl *ddr
copy_to_surfacedesc2(&surface->surface_desc, desc);
surface->first_attached = surface;
surface->ImplType = surface_type;
hr = wined3d_surface_create(ddraw->wined3d_device, desc->dwWidth, desc->dwHeight, format,
TRUE /* Lockable */, FALSE /* Discard */, mip_level, usage, pool,
WINED3DMULTISAMPLE_NONE, 0 /* MultiSampleQuality */, surface_type, surface,
WINED3DMULTISAMPLE_NONE, 0 /* MultiSampleQuality */, DefaultSurfaceType, surface,
&ddraw_surface_wined3d_parent_ops, &surface->wined3d_surface);
if (FAILED(hr))
{
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment