[PATCH 3/5] wined3d: Merge the device parent create_rendertarget() and create_depth_stencil() handlers.

Henri Verbeet hverbeet at codeweavers.com
Wed Jul 11 05:19:03 CDT 2012


---
 dlls/d3d10core/device.c  |   66 +++++++--------------------------------------
 dlls/d3d8/device.c       |   58 +++++++++-------------------------------
 dlls/d3d9/device.c       |   66 ++++++++++++---------------------------------
 dlls/ddraw/ddraw.c       |   37 +++++++++----------------
 dlls/dxgi/device.c       |    2 +-
 dlls/wined3d/device.c    |    9 +++---
 dlls/wined3d/swapchain.c |   23 +++++++++-------
 dlls/wined3d/texture.c   |   10 +++----
 include/wine/wined3d.h   |   12 +++-----
 9 files changed, 83 insertions(+), 200 deletions(-)

diff --git a/dlls/d3d10core/device.c b/dlls/d3d10core/device.c
index 3fd0c49..d4c0822 100644
--- a/dlls/d3d10core/device.c
+++ b/dlls/d3d10core/device.c
@@ -1356,7 +1356,7 @@ static void CDECL device_parent_mode_changed(struct wined3d_device_parent *devic
     TRACE("device_parent %p.\n", device_parent);
 }
 
-static HRESULT CDECL device_parent_create_surface(struct wined3d_device_parent *device_parent,
+static HRESULT CDECL device_parent_create_texture_surface(struct wined3d_device_parent *device_parent,
         void *container_parent, UINT width, UINT height, enum wined3d_format_id format, DWORD usage,
         enum wined3d_pool pool, UINT level, enum wined3d_cubemap_face face, struct wined3d_surface **surface)
 {
@@ -1398,20 +1398,19 @@ static HRESULT CDECL device_parent_create_surface(struct wined3d_device_parent *
     return S_OK;
 }
 
-static HRESULT CDECL device_parent_create_rendertarget(struct wined3d_device_parent *device_parent,
-        void *container_parent, UINT width, UINT height, enum wined3d_format_id format,
-        enum wined3d_multisample_type multisample_type, DWORD multisample_quality,
-        struct wined3d_surface **surface)
+static HRESULT CDECL device_parent_create_swapchain_surface(struct wined3d_device_parent *device_parent,
+        void *container_parent, UINT width, UINT height, enum wined3d_format_id format_id, DWORD usage,
+        enum wined3d_multisample_type multisample_type, DWORD multisample_quality, struct wined3d_surface **surface)
 {
     struct d3d10_device *device = device_from_wined3d_device_parent(device_parent);
     struct d3d10_texture2d *texture;
     D3D10_TEXTURE2D_DESC desc;
     HRESULT hr;
 
-    FIXME("device_parent %p, container_parent %p, width %u, height %u, format %#x, multisample_type %#x,\n"
-            "\tmultisample_quality %u, surface %p partial stub!\n",
-            device_parent, container_parent, width, height, format, multisample_type,
-            multisample_quality, surface);
+    FIXME("device_parent %p, container_parent %p, width %u, height %u, format_id %#x, usage %#x,\n"
+            "\tmultisample_type %#x, multisample_quality %u, surface %p partial stub!\n",
+            device_parent, container_parent, width, height, format_id, usage,
+            multisample_type, multisample_quality, surface);
 
     FIXME("Implement DXGI<->wined3d usage conversion\n");
 
@@ -1419,49 +1418,7 @@ static HRESULT CDECL device_parent_create_rendertarget(struct wined3d_device_par
     desc.Height = height;
     desc.MipLevels = 1;
     desc.ArraySize = 1;
-    desc.Format = dxgi_format_from_wined3dformat(format);
-    desc.SampleDesc.Count = multisample_type ? multisample_type : 1;
-    desc.SampleDesc.Quality = multisample_quality;
-    desc.Usage = D3D10_USAGE_DEFAULT;
-    desc.BindFlags = D3D10_BIND_RENDER_TARGET;
-    desc.CPUAccessFlags = 0;
-    desc.MiscFlags = 0;
-
-    hr = d3d10_device_CreateTexture2D(&device->ID3D10Device_iface, &desc, NULL,
-            (ID3D10Texture2D **)&texture);
-    if (FAILED(hr))
-    {
-        ERR("CreateTexture2D failed, returning %#x\n", hr);
-        return hr;
-    }
-
-    *surface = texture->wined3d_surface;
-    wined3d_surface_incref(*surface);
-    ID3D10Texture2D_Release(&texture->ID3D10Texture2D_iface);
-
-    return S_OK;
-}
-
-static HRESULT CDECL device_parent_create_depth_stencil(struct wined3d_device_parent *device_parent,
-        UINT width, UINT height, enum wined3d_format_id format, enum wined3d_multisample_type multisample_type,
-        DWORD multisample_quality, struct wined3d_surface **surface)
-{
-    struct d3d10_device *device = device_from_wined3d_device_parent(device_parent);
-    struct d3d10_texture2d *texture;
-    D3D10_TEXTURE2D_DESC desc;
-    HRESULT hr;
-
-    FIXME("device_parent %p, width %u, height %u, format %#x, multisample_type %#x,\n"
-            "\tmultisample_quality %u, surface %p partial stub!\n",
-            device_parent, width, height, format, multisample_type, multisample_quality, surface);
-
-    FIXME("Implement DXGI<->wined3d usage conversion\n");
-
-    desc.Width = width;
-    desc.Height = height;
-    desc.MipLevels = 1;
-    desc.ArraySize = 1;
-    desc.Format = dxgi_format_from_wined3dformat(format);
+    desc.Format = dxgi_format_from_wined3dformat(format_id);
     desc.SampleDesc.Count = multisample_type ? multisample_type : 1;
     desc.SampleDesc.Quality = multisample_quality;
     desc.Usage = D3D10_USAGE_DEFAULT;
@@ -1538,9 +1495,8 @@ static const struct wined3d_device_parent_ops d3d10_wined3d_device_parent_ops =
 {
     device_parent_wined3d_device_created,
     device_parent_mode_changed,
-    device_parent_create_surface,
-    device_parent_create_rendertarget,
-    device_parent_create_depth_stencil,
+    device_parent_create_swapchain_surface,
+    device_parent_create_texture_surface,
     device_parent_create_volume,
     device_parent_create_swapchain,
 };
diff --git a/dlls/d3d8/device.c b/dlls/d3d8/device.c
index 50a09e9..fa7cb48 100644
--- a/dlls/d3d8/device.c
+++ b/dlls/d3d8/device.c
@@ -2815,7 +2815,7 @@ static void CDECL device_parent_mode_changed(struct wined3d_device_parent *devic
     TRACE("device_parent %p.\n", device_parent);
 }
 
-static HRESULT CDECL device_parent_create_surface(struct wined3d_device_parent *device_parent,
+static HRESULT CDECL device_parent_create_texture_surface(struct wined3d_device_parent *device_parent,
         void *container_parent, UINT width, UINT height, enum wined3d_format_id format, DWORD usage,
         enum wined3d_pool pool, UINT level, enum wined3d_cubemap_face face, struct wined3d_surface **surface)
 {
@@ -2854,55 +2854,24 @@ static HRESULT CDECL device_parent_create_surface(struct wined3d_device_parent *
     return hr;
 }
 
-static HRESULT CDECL device_parent_create_rendertarget(struct wined3d_device_parent *device_parent,
-        void *container_parent, UINT width, UINT height, enum wined3d_format_id format,
-        enum wined3d_multisample_type multisample_type, DWORD multisample_quality,
-        struct wined3d_surface **surface)
+static HRESULT CDECL device_parent_create_swapchain_surface(struct wined3d_device_parent *device_parent,
+        void *container_parent, UINT width, UINT height, enum wined3d_format_id format_id, DWORD usage,
+        enum wined3d_multisample_type multisample_type, DWORD multisample_quality, struct wined3d_surface **surface)
 {
     struct d3d8_device *device = device_from_device_parent(device_parent);
     struct d3d8_surface *d3d_surface;
     HRESULT hr;
 
-    TRACE("device_parent %p, container_parent %p, width %u, height %u, format %#x, multisample_type %#x,\n"
-            "\tmultisample_quality %u, surface %p.\n",
-            device_parent, container_parent, width, height, format,
+    TRACE("device_parent %p, container_parent %p, width %u, height %u, format_id %#x, usage %#x,\n"
+            "\tmultisample_type %#x, multisample_quality %u, surface %p.\n",
+            device_parent, container_parent, width, height, format_id, usage,
             multisample_type, multisample_quality, surface);
 
-    hr = IDirect3DDevice8_CreateRenderTarget(&device->IDirect3DDevice8_iface, width, height,
-            d3dformat_from_wined3dformat(format), multisample_type, TRUE, (IDirect3DSurface8 **)&d3d_surface);
-    if (FAILED(hr))
+    if (FAILED(hr = d3d8_device_CreateSurface(device, width, height, d3dformat_from_wined3dformat(format_id),
+            TRUE, FALSE, 0, (IDirect3DSurface8 **)&d3d_surface, usage, D3DPOOL_DEFAULT, multisample_type,
+            multisample_quality)))
     {
-        WARN("Failed to create rendertarget, hr %#x.\n", hr);
-        return hr;
-    }
-
-    *surface = d3d_surface->wined3d_surface;
-    wined3d_surface_incref(*surface);
-
-    d3d_surface->container = (IUnknown *)&device->IDirect3DDevice8_iface;
-    /* Implicit surfaces are created with an refcount of 0 */
-    IDirect3DSurface8_Release(&d3d_surface->IDirect3DSurface8_iface);
-
-    return hr;
-}
-
-static HRESULT CDECL device_parent_create_depth_stencil(struct wined3d_device_parent *device_parent,
-        UINT width, UINT height, enum wined3d_format_id format, enum wined3d_multisample_type multisample_type,
-        DWORD multisample_quality, struct wined3d_surface **surface)
-{
-    struct d3d8_device *device = device_from_device_parent(device_parent);
-    struct d3d8_surface *d3d_surface;
-    HRESULT hr;
-
-    TRACE("device_parent %p, width %u, height %u, format %#x, multisample_type %#x,\n"
-            "\tmultisample_quality %u, surface %p.\n",
-            device_parent, width, height, format, multisample_type, multisample_quality, surface);
-
-    hr = IDirect3DDevice8_CreateDepthStencilSurface(&device->IDirect3DDevice8_iface, width, height,
-            d3dformat_from_wined3dformat(format), multisample_type, (IDirect3DSurface8 **)&d3d_surface);
-    if (FAILED(hr))
-    {
-        WARN("Failed to create depth/stencil surface, hr %#x.\n", hr);
+        WARN("Failed to create surface, hr %#x.\n", hr);
         return hr;
     }
 
@@ -2985,9 +2954,8 @@ static const struct wined3d_device_parent_ops d3d8_wined3d_device_parent_ops =
 {
     device_parent_wined3d_device_created,
     device_parent_mode_changed,
-    device_parent_create_surface,
-    device_parent_create_rendertarget,
-    device_parent_create_depth_stencil,
+    device_parent_create_swapchain_surface,
+    device_parent_create_texture_surface,
     device_parent_create_volume,
     device_parent_create_swapchain,
 };
diff --git a/dlls/d3d9/device.c b/dlls/d3d9/device.c
index 1f195d6..dff1ed0 100644
--- a/dlls/d3d9/device.c
+++ b/dlls/d3d9/device.c
@@ -3170,7 +3170,7 @@ static void CDECL device_parent_mode_changed(struct wined3d_device_parent *devic
     TRACE("device_parent %p.\n", device_parent);
 }
 
-static HRESULT CDECL device_parent_create_surface(struct wined3d_device_parent *device_parent,
+static HRESULT CDECL device_parent_create_texture_surface(struct wined3d_device_parent *device_parent,
         void *container_parent, UINT width, UINT height, enum wined3d_format_id format, DWORD usage,
         enum wined3d_pool pool, UINT level, enum wined3d_cubemap_face face, struct wined3d_surface **surface)
 {
@@ -3208,63 +3208,34 @@ static HRESULT CDECL device_parent_create_surface(struct wined3d_device_parent *
     return hr;
 }
 
-static HRESULT CDECL device_parent_create_rendertarget(struct wined3d_device_parent *device_parent,
-        void *container_parent, UINT width, UINT height, enum wined3d_format_id format,
-        enum wined3d_multisample_type multisample_type, DWORD multisample_quality,
-        struct wined3d_surface **surface)
+static HRESULT CDECL device_parent_create_swapchain_surface(struct wined3d_device_parent *device_parent,
+        void *container_parent, UINT width, UINT height, enum wined3d_format_id format_id, DWORD usage,
+        enum wined3d_multisample_type multisample_type, DWORD multisample_quality, struct wined3d_surface **surface)
 {
     struct d3d9_device *device = device_from_device_parent(device_parent);
     struct d3d9_surface *d3d_surface;
     HRESULT hr;
 
-    TRACE("device_parent %p, container_parent %p, width %u, height %u, format %#x, multisample_type %#x,\n"
-            "\tmultisample_quality %u, surface %p.\n",
-            device_parent, container_parent, width, height, format, multisample_type,
-            multisample_quality, surface);
+    TRACE("device_parent %p, container_parent %p, width %u, height %u, format_id %#x, usage %#x,\n"
+            "\tmultisample_type %#x, multisample_quality %u, surface %p.\n",
+            device_parent, container_parent, width, height, format_id, usage,
+            multisample_type, multisample_quality, surface);
 
-    hr = d3d9_device_CreateRenderTarget(&device->IDirect3DDevice9Ex_iface, width, height,
-            d3dformat_from_wined3dformat(format), multisample_type, multisample_quality, TRUE,
-            (IDirect3DSurface9 **)&d3d_surface, NULL);
-    if (FAILED(hr))
+    if (FAILED(hr = d3d9_device_create_surface(device, width, height, d3dformat_from_wined3dformat(format_id),
+            TRUE, FALSE, 0, (IDirect3DSurface9 **)&d3d_surface, usage, D3DPOOL_DEFAULT, multisample_type,
+            multisample_quality)))
     {
-        WARN("Failed to create rendertarget, hr %#x.\n", hr);
+        WARN("Failed to create surface, hr %#x.\n", hr);
         return hr;
     }
 
     *surface = d3d_surface->wined3d_surface;
     wined3d_surface_incref(*surface);
 
-    d3d_surface->container = container_parent;
-    /* Implicit surfaces are created with an refcount of 0 */
-    IDirect3DSurface9_Release(&d3d_surface->IDirect3DSurface9_iface);
-
-    return hr;
-}
-
-static HRESULT CDECL device_parent_create_depth_stencil(struct wined3d_device_parent *device_parent,
-        UINT width, UINT height, enum wined3d_format_id format, enum wined3d_multisample_type multisample_type,
-        DWORD multisample_quality, struct wined3d_surface **surface)
-{
-    struct d3d9_device *device = device_from_device_parent(device_parent);
-    struct d3d9_surface *d3d_surface;
-    HRESULT hr;
-
-    TRACE("device_parent %p, width %u, height %u, format %#x, multisample_type %#x,\n"
-            "\tmultisample_quality %u, surface %p.\n",
-            device_parent, width, height, format, multisample_type, multisample_quality, surface);
-
-    hr = d3d9_device_CreateDepthStencilSurface(&device->IDirect3DDevice9Ex_iface, width,
-            height, d3dformat_from_wined3dformat(format), multisample_type, multisample_quality,
-            FALSE, (IDirect3DSurface9 **)&d3d_surface, NULL);
-    if (FAILED(hr))
-    {
-        WARN("Failed to create depth/stencil surface, hr %#x.\n", hr);
-        return hr;
-    }
-
-    *surface = d3d_surface->wined3d_surface;
-    wined3d_surface_incref(*surface);
-    d3d_surface->container = (IUnknown *)&device->IDirect3DDevice9Ex_iface;
+    if (container_parent == device_parent)
+        d3d_surface->container = (IUnknown *)&device->IDirect3DDevice9Ex_iface;
+    else
+        d3d_surface->container = container_parent;
     /* Implicit surfaces are created with an refcount of 0 */
     IDirect3DSurface9_Release(&d3d_surface->IDirect3DSurface9_iface);
 
@@ -3341,9 +3312,8 @@ static const struct wined3d_device_parent_ops d3d9_wined3d_device_parent_ops =
 {
     device_parent_wined3d_device_created,
     device_parent_mode_changed,
-    device_parent_create_surface,
-    device_parent_create_rendertarget,
-    device_parent_create_depth_stencil,
+    device_parent_create_swapchain_surface,
+    device_parent_create_texture_surface,
     device_parent_create_volume,
     device_parent_create_swapchain,
 };
diff --git a/dlls/ddraw/ddraw.c b/dlls/ddraw/ddraw.c
index 4e2be26..7b72e5e 100644
--- a/dlls/ddraw/ddraw.c
+++ b/dlls/ddraw/ddraw.c
@@ -5360,7 +5360,7 @@ static void CDECL device_parent_mode_changed(struct wined3d_device_parent *devic
         ERR("Failed to resize window.\n");
 }
 
-static HRESULT CDECL device_parent_create_surface(struct wined3d_device_parent *device_parent,
+static HRESULT CDECL device_parent_create_texture_surface(struct wined3d_device_parent *device_parent,
         void *container_parent, UINT width, UINT height, enum wined3d_format_id format, DWORD usage,
         enum wined3d_pool pool, UINT level, enum wined3d_cubemap_face face, struct wined3d_surface **surface)
 {
@@ -5442,18 +5442,17 @@ static const struct wined3d_parent_ops ddraw_frontbuffer_parent_ops =
     ddraw_frontbuffer_destroyed,
 };
 
-static HRESULT CDECL device_parent_create_rendertarget(struct wined3d_device_parent *device_parent,
-        void *container_parent, UINT width, UINT height, enum wined3d_format_id format,
-        enum wined3d_multisample_type multisample_type, DWORD multisample_quality,
-        struct wined3d_surface **surface)
+static HRESULT CDECL device_parent_create_swapchain_surface(struct wined3d_device_parent *device_parent,
+        void *container_parent, UINT width, UINT height, enum wined3d_format_id format_id, DWORD usage,
+        enum wined3d_multisample_type multisample_type, DWORD multisample_quality, struct wined3d_surface **surface)
 {
     struct ddraw *ddraw = ddraw_from_device_parent(device_parent);
     HRESULT hr;
 
-    TRACE("device_parent %p, container_parent %p, width %u, height %u, format %#x, multisample_type %#x,\n"
-            "\tmultisample_quality %u, surface %p.\n",
-            device_parent, container_parent, width, height, format, multisample_type,
-            multisample_quality, surface);
+    TRACE("device_parent %p, container_parent %p, width %u, height %u, format_id %#x, usage %#x,\n"
+            "\tmultisample_type %#x, multisample_quality %u, surface %p.\n",
+            device_parent, container_parent, width, height, format_id, usage,
+            multisample_type, multisample_quality, surface);
 
     if (ddraw->wined3d_frontbuffer)
     {
@@ -5461,23 +5460,14 @@ static HRESULT CDECL device_parent_create_rendertarget(struct wined3d_device_par
         return E_FAIL;
     }
 
-    hr = wined3d_surface_create(ddraw->wined3d_device, width, height, format, 0,
-            WINED3DUSAGE_RENDERTARGET, WINED3D_POOL_DEFAULT, multisample_type, multisample_quality,
-            DefaultSurfaceType, WINED3D_SURFACE_MAPPABLE, ddraw, &ddraw_frontbuffer_parent_ops, surface);
-    if (SUCCEEDED(hr))
+    if (SUCCEEDED(hr = wined3d_surface_create(ddraw->wined3d_device, width, height, format_id, 0,
+            usage, WINED3D_POOL_DEFAULT, multisample_type, multisample_quality, DefaultSurfaceType,
+            WINED3D_SURFACE_MAPPABLE, ddraw, &ddraw_frontbuffer_parent_ops, surface)))
         ddraw->wined3d_frontbuffer = *surface;
 
     return hr;
 }
 
-static HRESULT CDECL device_parent_create_depth_stencil(struct wined3d_device_parent *device_parent,
-        UINT width, UINT height, enum wined3d_format_id format, enum wined3d_multisample_type multisample_type,
-        DWORD multisample_quality, struct wined3d_surface **surface)
-{
-    ERR("DirectDraw doesn't have and shouldn't try creating implicit depth buffers.\n");
-    return E_NOTIMPL;
-}
-
 static HRESULT CDECL device_parent_create_volume(struct wined3d_device_parent *device_parent,
         void *container_parent, UINT width, UINT height, UINT depth, enum wined3d_format_id format,
         enum wined3d_pool pool, DWORD usage, struct wined3d_volume **volume)
@@ -5518,9 +5508,8 @@ static const struct wined3d_device_parent_ops ddraw_wined3d_device_parent_ops =
 {
     device_parent_wined3d_device_created,
     device_parent_mode_changed,
-    device_parent_create_surface,
-    device_parent_create_rendertarget,
-    device_parent_create_depth_stencil,
+    device_parent_create_swapchain_surface,
+    device_parent_create_texture_surface,
     device_parent_create_volume,
     device_parent_create_swapchain,
 };
diff --git a/dlls/dxgi/device.c b/dlls/dxgi/device.c
index 3115032..0f78642 100644
--- a/dlls/dxgi/device.c
+++ b/dlls/dxgi/device.c
@@ -189,7 +189,7 @@ static HRESULT STDMETHODCALLTYPE dxgi_device_CreateSurface(IWineDXGIDevice *ifac
         struct wined3d_surface *wined3d_surface;
         IUnknown *parent;
 
-        hr = device_parent->ops->create_surface(device_parent, NULL, desc->Width, desc->Height,
+        hr = device_parent->ops->create_texture_surface(device_parent, NULL, desc->Width, desc->Height,
                 wined3dformat_from_dxgi_format(desc->Format), usage, WINED3D_POOL_DEFAULT, 0,
                 WINED3D_CUBEMAP_FACE_POSITIVE_X, &wined3d_surface);
         if (FAILED(hr))
diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c
index 0b74142..62cac84 100644
--- a/dlls/wined3d/device.c
+++ b/dlls/wined3d/device.c
@@ -5234,10 +5234,11 @@ HRESULT CDECL wined3d_device_reset(struct wined3d_device *device,
 
         TRACE("Creating the depth stencil buffer\n");
 
-        if (FAILED(hr = device->device_parent->ops->create_depth_stencil(device->device_parent,
-                swapchain_desc->backbuffer_width, swapchain_desc->backbuffer_height,
-                swapchain_desc->auto_depth_stencil_format, swapchain_desc->multisample_type,
-                swapchain_desc->multisample_quality, &device->auto_depth_stencil)))
+        if (FAILED(hr = device->device_parent->ops->create_swapchain_surface(device->device_parent,
+                device->device_parent, swapchain_desc->backbuffer_width, swapchain_desc->backbuffer_height,
+                swapchain_desc->auto_depth_stencil_format, WINED3DUSAGE_DEPTHSTENCIL,
+                swapchain_desc->multisample_type, swapchain_desc->multisample_quality,
+                &device->auto_depth_stencil)))
         {
             ERR("Failed to create the depth stencil buffer, hr %#x.\n", hr);
             wined3d_swapchain_decref(swapchain);
diff --git a/dlls/wined3d/swapchain.c b/dlls/wined3d/swapchain.c
index a389497..dd00e55 100644
--- a/dlls/wined3d/swapchain.c
+++ b/dlls/wined3d/swapchain.c
@@ -943,10 +943,11 @@ static HRESULT swapchain_init(struct wined3d_swapchain *swapchain, enum wined3d_
     swapchain_update_render_to_fbo(swapchain);
 
     TRACE("Creating front buffer.\n");
-    if (FAILED(hr = device->device_parent->ops->create_rendertarget(device->device_parent, parent,
+    if (FAILED(hr = device->device_parent->ops->create_swapchain_surface(device->device_parent, parent,
             swapchain->desc.backbuffer_width, swapchain->desc.backbuffer_height,
-            swapchain->desc.backbuffer_format, swapchain->desc.multisample_type,
-            swapchain->desc.multisample_quality, &swapchain->front_buffer)))
+            swapchain->desc.backbuffer_format, WINED3DUSAGE_RENDERTARGET,
+            swapchain->desc.multisample_type, swapchain->desc.multisample_quality,
+            &swapchain->front_buffer)))
     {
         WARN("Failed to create front buffer, hr %#x.\n", hr);
         goto err;
@@ -1051,10 +1052,11 @@ static HRESULT swapchain_init(struct wined3d_swapchain *swapchain, enum wined3d_
         for (i = 0; i < swapchain->desc.backbuffer_count; ++i)
         {
             TRACE("Creating back buffer %u.\n", i);
-            if (FAILED(hr = device->device_parent->ops->create_rendertarget(device->device_parent, parent,
+            if (FAILED(hr = device->device_parent->ops->create_swapchain_surface(device->device_parent, parent,
                     swapchain->desc.backbuffer_width, swapchain->desc.backbuffer_height,
-                    swapchain->desc.backbuffer_format, swapchain->desc.multisample_type,
-                    swapchain->desc.multisample_quality, &swapchain->back_buffers[i])))
+                    swapchain->desc.backbuffer_format, WINED3DUSAGE_RENDERTARGET,
+                    swapchain->desc.multisample_type, swapchain->desc.multisample_quality,
+                    &swapchain->back_buffers[i])))
             {
                 WARN("Failed to create back buffer %u, hr %#x.\n", i, hr);
                 goto err;
@@ -1070,10 +1072,11 @@ static HRESULT swapchain_init(struct wined3d_swapchain *swapchain, enum wined3d_
         TRACE("Creating depth/stencil buffer.\n");
         if (!device->auto_depth_stencil)
         {
-            if (FAILED(hr = device->device_parent->ops->create_depth_stencil(device->device_parent,
-                    swapchain->desc.backbuffer_width, swapchain->desc.backbuffer_height,
-                    swapchain->desc.auto_depth_stencil_format, swapchain->desc.multisample_type,
-                    swapchain->desc.multisample_quality, &device->auto_depth_stencil)))
+            if (FAILED(hr = device->device_parent->ops->create_swapchain_surface(device->device_parent,
+                    device->device_parent, swapchain->desc.backbuffer_width, swapchain->desc.backbuffer_height,
+                    swapchain->desc.auto_depth_stencil_format, WINED3DUSAGE_DEPTHSTENCIL,
+                    swapchain->desc.multisample_type, swapchain->desc.multisample_quality,
+                    &device->auto_depth_stencil)))
             {
                 WARN("Failed to create the auto depth stencil, hr %#x.\n", hr);
                 goto err;
diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c
index 5a78700..9d14beb 100644
--- a/dlls/wined3d/texture.c
+++ b/dlls/wined3d/texture.c
@@ -857,9 +857,8 @@ static HRESULT cubetexture_init(struct wined3d_texture *texture, UINT edge_lengt
             UINT idx = j * texture->level_count + i;
             struct wined3d_surface *surface;
 
-            hr = device->device_parent->ops->create_surface(device->device_parent, parent, tmp_w, tmp_w,
-                    format_id, usage, pool, i /* Level */, j, &surface);
-            if (FAILED(hr))
+            if (FAILED(hr = device->device_parent->ops->create_texture_surface(device->device_parent, parent,
+                    tmp_w, tmp_w, format_id, usage, pool, i /* Level */, j, &surface)))
             {
                 FIXME("(%p) Failed to create surface, hr %#x.\n", texture, hr);
                 wined3d_texture_cleanup(texture);
@@ -1013,9 +1012,8 @@ static HRESULT texture_init(struct wined3d_texture *texture, UINT width, UINT he
         struct wined3d_surface *surface;
 
         /* Use the callback to create the texture surface. */
-        hr = device->device_parent->ops->create_surface(device->device_parent, parent, tmp_w, tmp_h,
-                format->id, usage, pool, i, 0, &surface);
-        if (FAILED(hr))
+        if (FAILED(hr = device->device_parent->ops->create_texture_surface(device->device_parent, parent,
+                tmp_w, tmp_h, format->id, usage, pool, i, 0, &surface)))
         {
             FIXME("Failed to create surface %p, hr %#x\n", texture, hr);
             wined3d_texture_cleanup(texture);
diff --git a/include/wine/wined3d.h b/include/wine/wined3d.h
index 5049360..c253230 100644
--- a/include/wine/wined3d.h
+++ b/include/wine/wined3d.h
@@ -1997,15 +1997,13 @@ struct wined3d_device_parent_ops
 {
     void (__cdecl *wined3d_device_created)(struct wined3d_device_parent *device_parent, struct wined3d_device *device);
     void (__cdecl *mode_changed)(struct wined3d_device_parent *device_parent);
-    HRESULT (__cdecl *create_surface)(struct wined3d_device_parent *device_parent, void *container_parent,
+    HRESULT (__cdecl *create_swapchain_surface)(struct wined3d_device_parent *device_parent, void *container_parent,
+            UINT width, UINT height, enum wined3d_format_id format_id, DWORD usage,
+            enum wined3d_multisample_type multisample_type, DWORD multisample_quality,
+            struct wined3d_surface **surface);
+    HRESULT (__cdecl *create_texture_surface)(struct wined3d_device_parent *device_parent, void *container_parent,
             UINT width, UINT height, enum wined3d_format_id format_id, DWORD usage, enum wined3d_pool pool,
             UINT level, enum wined3d_cubemap_face face, struct wined3d_surface **surface);
-    HRESULT (__cdecl *create_rendertarget)(struct wined3d_device_parent *device_parent, void *container_parent,
-            UINT width, UINT height, enum wined3d_format_id format_id, enum wined3d_multisample_type multisample_type,
-            DWORD multisample_quality, struct wined3d_surface **surface);
-    HRESULT (__cdecl *create_depth_stencil)(struct wined3d_device_parent *device_parent,
-            UINT width, UINT height, enum wined3d_format_id format_id, enum wined3d_multisample_type multisample_type,
-            DWORD multisample_quality, struct wined3d_surface **surface);
     HRESULT (__cdecl *create_volume)(struct wined3d_device_parent *device_parent, void *container_parent,
             UINT width, UINT height, UINT depth, enum wined3d_format_id format_id, enum wined3d_pool pool, DWORD usage,
             struct wined3d_volume **volume);
-- 
1.7.8.6




More information about the wine-patches mailing list