Zebediah Figura : wined3d: Pass a wined3d_device_context to wined3d_device_get_depth_stencil_view().

Alexandre Julliard julliard at winehq.org
Tue Apr 20 16:27:46 CDT 2021


Module: wine
Branch: master
Commit: a313daea70a066e01b8b838557cdb9fcb97bce65
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=a313daea70a066e01b8b838557cdb9fcb97bce65

Author: Zebediah Figura <z.figura12 at gmail.com>
Date:   Mon Apr 19 23:38:08 2021 -0500

wined3d: Pass a wined3d_device_context to wined3d_device_get_depth_stencil_view().

Signed-off-by: Zebediah Figura <z.figura12 at gmail.com>
Signed-off-by: Henri Verbeet <hverbeet at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/d3d11/device.c       | 5 ++---
 dlls/d3d8/device.c        | 6 +++---
 dlls/d3d9/device.c        | 4 ++--
 dlls/ddraw/ddraw.c        | 2 +-
 dlls/ddraw/device.c       | 2 +-
 dlls/ddraw/surface.c      | 5 +++--
 dlls/wined3d/device.c     | 7 ++++---
 dlls/wined3d/wined3d.spec | 2 +-
 include/wine/wined3d.h    | 3 ++-
 9 files changed, 19 insertions(+), 17 deletions(-)

diff --git a/dlls/d3d11/device.c b/dlls/d3d11/device.c
index b95423c4c7c..e58b02038c8 100644
--- a/dlls/d3d11/device.c
+++ b/dlls/d3d11/device.c
@@ -2055,7 +2055,6 @@ static void STDMETHODCALLTYPE d3d11_immediate_context_OMGetRenderTargets(ID3D11D
         ID3D11DepthStencilView **depth_stencil_view)
 {
     struct d3d11_immediate_context *context = impl_from_ID3D11DeviceContext1(iface);
-    struct d3d_device *device = device_from_immediate_ID3D11DeviceContext1(iface);
     struct wined3d_rendertarget_view *wined3d_view;
 
     TRACE("iface %p, render_target_view_count %u, render_target_views %p, depth_stencil_view %p.\n",
@@ -2085,7 +2084,7 @@ static void STDMETHODCALLTYPE d3d11_immediate_context_OMGetRenderTargets(ID3D11D
     {
         struct d3d_depthstencil_view *view_impl;
 
-        if (!(wined3d_view = wined3d_device_get_depth_stencil_view(device->wined3d_device))
+        if (!(wined3d_view = wined3d_device_context_get_depth_stencil_view(context->wined3d_context))
                 || !(view_impl = wined3d_rendertarget_view_get_parent(wined3d_view)))
         {
             *depth_stencil_view = NULL;
@@ -5435,7 +5434,7 @@ static void STDMETHODCALLTYPE d3d10_device_OMGetRenderTargets(ID3D10Device1 *ifa
     {
         struct d3d_depthstencil_view *view_impl;
 
-        if (!(wined3d_view = wined3d_device_get_depth_stencil_view(device->wined3d_device))
+        if (!(wined3d_view = wined3d_device_context_get_depth_stencil_view(device->immediate_context.wined3d_context))
                 || !(view_impl = wined3d_rendertarget_view_get_parent(wined3d_view)))
         {
             *depth_stencil_view = NULL;
diff --git a/dlls/d3d8/device.c b/dlls/d3d8/device.c
index 4f76a55172c..938eb19c8f5 100644
--- a/dlls/d3d8/device.c
+++ b/dlls/d3d8/device.c
@@ -1535,7 +1535,7 @@ static HRESULT WINAPI d3d8_device_SetRenderTarget(IDirect3DDevice8 *iface,
         }
     }
 
-    original_dsv = wined3d_device_get_depth_stencil_view(device->wined3d_device);
+    original_dsv = wined3d_device_context_get_depth_stencil_view(device->immediate_context);
     rtv = ds_impl ? d3d8_surface_acquire_rendertarget_view(ds_impl) : NULL;
     hr = wined3d_device_context_set_depth_stencil_view(device->immediate_context, rtv);
     d3d8_surface_release_rendertarget_view(ds_impl, rtv);
@@ -1603,7 +1603,7 @@ static HRESULT WINAPI d3d8_device_GetDepthStencilSurface(IDirect3DDevice8 *iface
         return D3DERR_INVALIDCALL;
 
     wined3d_mutex_lock();
-    if ((wined3d_dsv = wined3d_device_get_depth_stencil_view(device->wined3d_device)))
+    if ((wined3d_dsv = wined3d_device_context_get_depth_stencil_view(device->immediate_context)))
     {
         /* We want the sub resource parent here, since the view itself may be
          * internal to wined3d and may not have a parent. */
@@ -1928,7 +1928,7 @@ static void resolve_depth_buffer(struct d3d8_device *device)
             && desc.format != WINED3DFMT_INTZ)
         return;
 
-    if (!(wined3d_dsv = wined3d_device_get_depth_stencil_view(device->wined3d_device)))
+    if (!(wined3d_dsv = wined3d_device_context_get_depth_stencil_view(device->immediate_context)))
         return;
     d3d8_dsv = wined3d_rendertarget_view_get_sub_resource_parent(wined3d_dsv);
 
diff --git a/dlls/d3d9/device.c b/dlls/d3d9/device.c
index f7a6e04beae..ee1cdc87567 100644
--- a/dlls/d3d9/device.c
+++ b/dlls/d3d9/device.c
@@ -2109,7 +2109,7 @@ static HRESULT WINAPI d3d9_device_GetDepthStencilSurface(IDirect3DDevice9Ex *ifa
         return D3DERR_INVALIDCALL;
 
     wined3d_mutex_lock();
-    if ((wined3d_dsv = wined3d_device_get_depth_stencil_view(device->wined3d_device)))
+    if ((wined3d_dsv = wined3d_device_context_get_depth_stencil_view(device->immediate_context)))
     {
         /* We want the sub resource parent here, since the view itself may be
          * internal to wined3d and may not have a parent. */
@@ -2425,7 +2425,7 @@ static void resolve_depth_buffer(struct d3d9_device *device)
             && desc.format != WINED3DFMT_INTZ)
         return;
 
-    if (!(wined3d_dsv = wined3d_device_get_depth_stencil_view(device->wined3d_device)))
+    if (!(wined3d_dsv = wined3d_device_context_get_depth_stencil_view(device->immediate_context)))
         return;
     d3d9_dsv = wined3d_rendertarget_view_get_sub_resource_parent(wined3d_dsv);
 
diff --git a/dlls/ddraw/ddraw.c b/dlls/ddraw/ddraw.c
index 9063c64b41f..972c18fbfe9 100644
--- a/dlls/ddraw/ddraw.c
+++ b/dlls/ddraw/ddraw.c
@@ -938,7 +938,7 @@ static HRESULT ddraw_set_cooperative_level(struct ddraw *ddraw, HWND window,
             else if (rtv)
                 wined3d_rendertarget_view_incref(rtv);
 
-            if ((dsv = wined3d_device_get_depth_stencil_view(ddraw->wined3d_device)))
+            if ((dsv = wined3d_device_context_get_depth_stencil_view(ddraw->immediate_context)))
                 wined3d_rendertarget_view_incref(dsv);
         }
 
diff --git a/dlls/ddraw/device.c b/dlls/ddraw/device.c
index c3681cc9440..898bef5e534 100644
--- a/dlls/ddraw/device.c
+++ b/dlls/ddraw/device.c
@@ -3437,7 +3437,7 @@ static void d3d_device_sync_rendertarget(struct d3d_device *device)
     if ((rtv = wined3d_device_context_get_rendertarget_view(device->immediate_context, 0)))
         ddraw_surface_get_draw_texture(wined3d_rendertarget_view_get_parent(rtv), DDRAW_SURFACE_RW);
 
-    if ((rtv = wined3d_device_get_depth_stencil_view(device->wined3d_device)))
+    if ((rtv = wined3d_device_context_get_depth_stencil_view(device->immediate_context)))
         ddraw_surface_get_draw_texture(wined3d_rendertarget_view_get_parent(rtv), DDRAW_SURFACE_RW);
 }
 
diff --git a/dlls/ddraw/surface.c b/dlls/ddraw/surface.c
index 51179db05dd..7834d9c943b 100644
--- a/dlls/ddraw/surface.c
+++ b/dlls/ddraw/surface.c
@@ -2136,6 +2136,7 @@ static HRESULT WINAPI ddraw_surface1_AddAttachedSurface(IDirectDrawSurface *ifac
 static HRESULT ddraw_surface_delete_attached_surface(struct ddraw_surface *surface,
         struct ddraw_surface *attachment, IUnknown *detach_iface)
 {
+    struct wined3d_rendertarget_view *dsv;
     struct ddraw_surface *prev = surface;
 
     TRACE("surface %p, attachment %p, detach_iface %p.\n", surface, attachment, detach_iface);
@@ -2183,8 +2184,8 @@ static HRESULT ddraw_surface_delete_attached_surface(struct ddraw_surface *surfa
      * QueryInterface(). Some applications, SCP - Containment Breach in
      * particular, modify the QueryInterface() pointer in the surface vtbl
      * but don't cleanup properly after the relevant dll is unloaded. */
-    if (attachment->surface_desc.ddsCaps.dwCaps & DDSCAPS_ZBUFFER
-            && wined3d_device_get_depth_stencil_view(surface->ddraw->wined3d_device) == attachment->wined3d_rtv)
+    dsv = wined3d_device_context_get_depth_stencil_view(surface->ddraw->immediate_context);
+    if (attachment->surface_desc.ddsCaps.dwCaps & DDSCAPS_ZBUFFER && dsv == attachment->wined3d_rtv)
         wined3d_device_context_set_depth_stencil_view(surface->ddraw->immediate_context, NULL);
     wined3d_mutex_unlock();
 
diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c
index 40ee9739c5e..9590c7d7341 100644
--- a/dlls/wined3d/device.c
+++ b/dlls/wined3d/device.c
@@ -5408,11 +5408,12 @@ struct wined3d_rendertarget_view * CDECL wined3d_device_context_get_rendertarget
     return context->state->fb.render_targets[view_idx];
 }
 
-struct wined3d_rendertarget_view * CDECL wined3d_device_get_depth_stencil_view(const struct wined3d_device *device)
+struct wined3d_rendertarget_view * CDECL wined3d_device_context_get_depth_stencil_view(
+        const struct wined3d_device_context *context)
 {
-    TRACE("device %p.\n", device);
+    TRACE("context %p.\n", context);
 
-    return device->cs->c.state->fb.depth_stencil;
+    return context->state->fb.depth_stencil;
 }
 
 HRESULT CDECL wined3d_device_set_rendertarget_view(struct wined3d_device *device,
diff --git a/dlls/wined3d/wined3d.spec b/dlls/wined3d/wined3d.spec
index 8a01bf1711f..0a5cb608fc1 100644
--- a/dlls/wined3d/wined3d.spec
+++ b/dlls/wined3d/wined3d.spec
@@ -61,7 +61,6 @@
 @ cdecl wined3d_device_get_cs_resource_view(ptr long)
 @ cdecl wined3d_device_get_cs_sampler(ptr long)
 @ cdecl wined3d_device_get_cs_uav(ptr long)
-@ cdecl wined3d_device_get_depth_stencil_view(ptr)
 @ cdecl wined3d_device_get_device_caps(ptr ptr)
 @ cdecl wined3d_device_get_display_mode(ptr long ptr ptr)
 @ cdecl wined3d_device_get_domain_shader(ptr)
@@ -167,6 +166,7 @@
 @ cdecl wined3d_device_context_get_blend_state(ptr ptr ptr)
 @ cdecl wined3d_device_context_get_constant_buffer(ptr long long)
 @ cdecl wined3d_device_context_get_depth_stencil_state(ptr ptr)
+@ cdecl wined3d_device_context_get_depth_stencil_view(ptr)
 @ cdecl wined3d_device_context_get_rasterizer_state(ptr)
 @ cdecl wined3d_device_context_get_rendertarget_view(ptr long)
 @ cdecl wined3d_device_context_get_sampler(ptr long long)
diff --git a/include/wine/wined3d.h b/include/wine/wined3d.h
index fd9840379d3..61162819ede 100644
--- a/include/wine/wined3d.h
+++ b/include/wine/wined3d.h
@@ -2385,7 +2385,8 @@ struct wined3d_shader_resource_view * __cdecl wined3d_device_get_cs_resource_vie
 struct wined3d_sampler * __cdecl wined3d_device_get_cs_sampler(const struct wined3d_device *device, unsigned int idx);
 struct wined3d_unordered_access_view * __cdecl wined3d_device_get_cs_uav(const struct wined3d_device *device,
         unsigned int idx);
-struct wined3d_rendertarget_view * __cdecl wined3d_device_get_depth_stencil_view(const struct wined3d_device *device);
+struct wined3d_rendertarget_view * __cdecl wined3d_device_context_get_depth_stencil_view(
+        const struct wined3d_device_context *context);
 HRESULT __cdecl wined3d_device_get_device_caps(const struct wined3d_device *device, struct wined3d_caps *caps);
 HRESULT __cdecl wined3d_device_get_display_mode(const struct wined3d_device *device, UINT swapchain_idx,
         struct wined3d_display_mode *mode, enum wined3d_display_rotation *rotation);




More information about the wine-cvs mailing list