[PATCH 2/7] ddraw/tests: Pass in device to create with create_device.

Matteo Bruni matteo.mystral at gmail.com
Wed Jan 22 09:53:58 CST 2020


On Fri, Dec 13, 2019 at 6:01 AM Jeff Smith <whydoubt at gmail.com> wrote:
>
> This allows the function to create devices other than HAL.
>
> Signed-off-by: Jeff Smith <whydoubt at gmail.com>
> ---
>  dlls/ddraw/tests/ddraw1.c |  75 +++++++++++----------
>  dlls/ddraw/tests/ddraw2.c |  81 ++++++++++++-----------
>  dlls/ddraw/tests/ddraw4.c | 101 ++++++++++++++--------------
>  dlls/ddraw/tests/ddraw7.c | 135 +++++++++++++++++++++-----------------
>  4 files changed, 210 insertions(+), 182 deletions(-)
>
> diff --git a/dlls/ddraw/tests/ddraw1.c b/dlls/ddraw/tests/ddraw1.c
> index 3a27e91aa1..862c98353e 100644
> --- a/dlls/ddraw/tests/ddraw1.c
> +++ b/dlls/ddraw/tests/ddraw1.c
> @@ -513,7 +513,7 @@ static IDirectDraw *create_ddraw(void)
>      return ddraw;
>  }
>
> -static IDirect3DDevice *create_device(IDirectDraw *ddraw, HWND window, DWORD coop_level)
> +static IDirect3DDevice *create_device(IDirectDraw *ddraw, HWND window, DWORD coop_level, REFCLSID riid)
>  {
>      /* Prefer 16 bit depth buffers because Nvidia gives us an unpadded D24 buffer if we ask
>       * for 24 bit and handles such buffers incorrectly in DDBLT_DEPTHFILL. AMD only supports
> @@ -573,7 +573,7 @@ static IDirect3DDevice *create_device(IDirectDraw *ddraw, HWND window, DWORD coo
>          if (FAILED(hr))
>              continue;
>
> -        if (SUCCEEDED(IDirectDrawSurface_QueryInterface(surface, &IID_IDirect3DHALDevice, (void **)&device)))
> +        if (SUCCEEDED(IDirectDrawSurface_QueryInterface(surface, riid, (void **)&device)))
>              break;
>
>          IDirectDrawSurface_DeleteAttachedSurface(surface, 0, ds);
> @@ -583,6 +583,11 @@ static IDirect3DDevice *create_device(IDirectDraw *ddraw, HWND window, DWORD coo
>      return device;
>  }
>
> +static IDirect3DDevice *create_device_hal(IDirectDraw *ddraw, HWND window, DWORD coop_level)
> +{
> +    return create_device(ddraw, window, coop_level, &IID_IDirect3DHALDevice);
> +}

Just an idea: what about introducing a create_device_riid() and keep
create_device() for the HAL case (i.e. rename your create_device() to
create_device_riid() and create_device_hal() to create_device())? That
way you don't have to change all the current callers of
create_device().



More information about the wine-devel mailing list