Commit 4735690d authored by Henri Verbeet's avatar Henri Verbeet Committed by Alexandre Julliard

ddraw: Introduce a helper function for initializing a D3DDEVICEDESC structure…

ddraw: Introduce a helper function for initializing a D3DDEVICEDESC structure from a D3DDEVICEDESC7 structure.
parent 7859509f
...@@ -112,7 +112,9 @@ struct ddraw ...@@ -112,7 +112,9 @@ struct ddraw
#define DDRAW_WINDOW_CLASS_NAME "DirectDrawDeviceWnd" #define DDRAW_WINDOW_CLASS_NAME "DirectDrawDeviceWnd"
HRESULT ddraw_init(struct ddraw *ddraw, enum wined3d_device_type device_type) DECLSPEC_HIDDEN; HRESULT ddraw_init(struct ddraw *ddraw, enum wined3d_device_type device_type) DECLSPEC_HIDDEN;
void ddraw_d3dcaps1_from_7(D3DDEVICEDESC *caps1, D3DDEVICEDESC7 *caps7) DECLSPEC_HIDDEN;
void ddraw_destroy_swapchain(struct ddraw *ddraw) DECLSPEC_HIDDEN; void ddraw_destroy_swapchain(struct ddraw *ddraw) DECLSPEC_HIDDEN;
HRESULT ddraw_get_d3dcaps(const struct ddraw *ddraw, D3DDEVICEDESC7 *caps) DECLSPEC_HIDDEN;
static inline void ddraw_set_swapchain_window(struct ddraw *ddraw, HWND window) static inline void ddraw_set_swapchain_window(struct ddraw *ddraw, HWND window)
{ {
...@@ -320,10 +322,6 @@ enum wined3d_depth_buffer_type d3d_device_update_depth_stencil(struct d3d_device ...@@ -320,10 +322,6 @@ enum wined3d_depth_buffer_type d3d_device_update_depth_stencil(struct d3d_device
/* The IID */ /* The IID */
extern const GUID IID_D3DDEVICE_WineD3D DECLSPEC_HIDDEN; extern const GUID IID_D3DDEVICE_WineD3D DECLSPEC_HIDDEN;
/* Helper functions */
HRESULT IDirect3DImpl_GetCaps(const struct wined3d *wined3d,
D3DDEVICEDESC *Desc123, D3DDEVICEDESC7 *Desc7) DECLSPEC_HIDDEN;
static inline struct d3d_device *impl_from_IDirect3DDevice(IDirect3DDevice *iface) static inline struct d3d_device *impl_from_IDirect3DDevice(IDirect3DDevice *iface)
{ {
return CONTAINING_RECORD(iface, struct d3d_device, IDirect3DDevice_iface); return CONTAINING_RECORD(iface, struct d3d_device, IDirect3DDevice_iface);
......
...@@ -393,37 +393,20 @@ static HRESULT WINAPI d3d_device1_Initialize(IDirect3DDevice *iface, ...@@ -393,37 +393,20 @@ static HRESULT WINAPI d3d_device1_Initialize(IDirect3DDevice *iface,
return D3D_OK; return D3D_OK;
} }
/***************************************************************************** static HRESULT d3d_device7_GetCaps(IDirect3DDevice7 *iface, D3DDEVICEDESC7 *device_desc)
* IDirect3DDevice7::GetCaps
*
* Retrieves the device's capabilities
*
* This implementation is used for Version 7 only, the older versions have
* their own implementation.
*
* Parameters:
* Desc: Pointer to a D3DDEVICEDESC7 structure to fill
*
* Returns:
* D3D_OK on success
* D3DERR_* if a problem occurs. See WineD3D
*
*****************************************************************************/
static HRESULT d3d_device7_GetCaps(IDirect3DDevice7 *iface, D3DDEVICEDESC7 *Desc)
{ {
struct d3d_device *device = impl_from_IDirect3DDevice7(iface); struct d3d_device *device = impl_from_IDirect3DDevice7(iface);
D3DDEVICEDESC OldDesc;
TRACE("iface %p, device_desc %p.\n", iface, Desc); TRACE("iface %p, device_desc %p.\n", iface, device_desc);
if (!Desc) if (!device_desc)
{ {
WARN("Desc is NULL, returning DDERR_INVALIDPARAMS.\n"); WARN("device_desc is NULL, returning DDERR_INVALIDPARAMS.\n");
return DDERR_INVALIDPARAMS; return DDERR_INVALIDPARAMS;
} }
/* Call the same function used by IDirect3D, this saves code */ /* Call the same function used by IDirect3D, this saves code */
return IDirect3DImpl_GetCaps(device->ddraw->wined3d, &OldDesc, Desc); return ddraw_get_d3dcaps(device->ddraw, device_desc);
} }
static HRESULT WINAPI d3d_device7_GetCaps_FPUSetup(IDirect3DDevice7 *iface, D3DDEVICEDESC7 *desc) static HRESULT WINAPI d3d_device7_GetCaps_FPUSetup(IDirect3DDevice7 *iface, D3DDEVICEDESC7 *desc)
...@@ -485,8 +468,8 @@ static HRESULT WINAPI d3d_device3_GetCaps(IDirect3DDevice3 *iface, ...@@ -485,8 +468,8 @@ static HRESULT WINAPI d3d_device3_GetCaps(IDirect3DDevice3 *iface,
D3DDEVICEDESC *HWDesc, D3DDEVICEDESC *HelDesc) D3DDEVICEDESC *HWDesc, D3DDEVICEDESC *HelDesc)
{ {
struct d3d_device *device = impl_from_IDirect3DDevice3(iface); struct d3d_device *device = impl_from_IDirect3DDevice3(iface);
D3DDEVICEDESC oldDesc; D3DDEVICEDESC7 desc7;
D3DDEVICEDESC7 newDesc; D3DDEVICEDESC desc1;
HRESULT hr; HRESULT hr;
TRACE("iface %p, hw_desc %p, hel_desc %p.\n", iface, HWDesc, HelDesc); TRACE("iface %p, hw_desc %p, hel_desc %p.\n", iface, HWDesc, HelDesc);
...@@ -512,12 +495,12 @@ static HRESULT WINAPI d3d_device3_GetCaps(IDirect3DDevice3 *iface, ...@@ -512,12 +495,12 @@ static HRESULT WINAPI d3d_device3_GetCaps(IDirect3DDevice3 *iface,
return DDERR_INVALIDPARAMS; return DDERR_INVALIDPARAMS;
} }
hr = IDirect3DImpl_GetCaps(device->ddraw->wined3d, &oldDesc, &newDesc); if (FAILED(hr = ddraw_get_d3dcaps(device->ddraw, &desc7)))
if (hr != D3D_OK)
return hr; return hr;
DD_STRUCT_COPY_BYSIZE(HWDesc, &oldDesc); ddraw_d3dcaps1_from_7(&desc1, &desc7);
DD_STRUCT_COPY_BYSIZE(HelDesc, &oldDesc); DD_STRUCT_COPY_BYSIZE(HWDesc, &desc1);
DD_STRUCT_COPY_BYSIZE(HelDesc, &desc1);
return D3D_OK; return D3D_OK;
} }
......
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