[PATCH 3/7] wined3d: Introduce wined3d_device_context_set_depth_stencil_view().

Zebediah Figura z.figura12 at gmail.com
Thu Mar 18 23:16:35 CDT 2021


Signed-off-by: Zebediah Figura <z.figura12 at gmail.com>
---
 dlls/wined3d/device.c     | 58 ++++++++++++++++++++++-----------------
 dlls/wined3d/wined3d.spec |  1 +
 include/wine/wined3d.h    |  2 ++
 3 files changed, 36 insertions(+), 25 deletions(-)

diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c
index de4f38578a0..267a8cae17d 100644
--- a/dlls/wined3d/device.c
+++ b/dlls/wined3d/device.c
@@ -2372,6 +2372,38 @@ HRESULT CDECL wined3d_device_context_set_rendertarget_view(struct wined3d_device
     return WINED3D_OK;
 }
 
+HRESULT CDECL wined3d_device_context_set_depth_stencil_view(struct wined3d_device_context *context,
+        struct wined3d_rendertarget_view *view)
+{
+    struct wined3d_fb_state *fb = &context->state->fb;
+    struct wined3d_rendertarget_view *prev;
+
+    TRACE("context %p, view %p.\n", context, view);
+
+    if (view && !(view->resource->bind_flags & WINED3D_BIND_DEPTH_STENCIL))
+    {
+        WARN("View resource %p has incompatible %s bind flags.\n",
+                view->resource, wined3d_debug_bind_flags(view->resource->bind_flags));
+        return WINED3DERR_INVALIDCALL;
+    }
+
+    prev = fb->depth_stencil;
+    if (prev == view)
+    {
+        TRACE("Trying to do a NOP SetRenderTarget operation.\n");
+        return WINED3D_OK;
+    }
+
+    if ((fb->depth_stencil = view))
+        wined3d_rendertarget_view_incref(view);
+    wined3d_device_context_emit_set_depth_stencil_view(context, view);
+    if (prev)
+        wined3d_rendertarget_view_decref(prev);
+    wined3d_device_context_unbind_srv_for_rtv(context, view, TRUE);
+
+    return WINED3D_OK;
+}
+
 void CDECL wined3d_device_set_vertex_shader(struct wined3d_device *device, struct wined3d_shader *shader)
 {
     TRACE("device %p, shader %p.\n", device, shader);
@@ -5272,33 +5304,9 @@ HRESULT CDECL wined3d_device_set_rendertarget_view(struct wined3d_device *device
 HRESULT CDECL wined3d_device_set_depth_stencil_view(struct wined3d_device *device,
         struct wined3d_rendertarget_view *view)
 {
-    struct wined3d_fb_state *fb = &device->cs->c.state->fb;
-    struct wined3d_rendertarget_view *prev;
-
     TRACE("device %p, view %p.\n", device, view);
 
-    if (view && !(view->resource->bind_flags & WINED3D_BIND_DEPTH_STENCIL))
-    {
-        WARN("View resource %p has incompatible %s bind flags.\n",
-                view->resource, wined3d_debug_bind_flags(view->resource->bind_flags));
-        return WINED3DERR_INVALIDCALL;
-    }
-
-    prev = fb->depth_stencil;
-    if (prev == view)
-    {
-        TRACE("Trying to do a NOP SetRenderTarget operation.\n");
-        return WINED3D_OK;
-    }
-
-    if ((fb->depth_stencil = view))
-        wined3d_rendertarget_view_incref(view);
-    wined3d_device_context_emit_set_depth_stencil_view(&device->cs->c, view);
-    if (prev)
-        wined3d_rendertarget_view_decref(prev);
-    wined3d_device_context_unbind_srv_for_rtv(&device->cs->c, view, TRUE);
-
-    return WINED3D_OK;
+    return wined3d_device_context_set_depth_stencil_view(&device->cs->c, view);
 }
 
 static struct wined3d_texture *wined3d_device_create_cursor_texture(struct wined3d_device *device,
diff --git a/dlls/wined3d/wined3d.spec b/dlls/wined3d/wined3d.spec
index ad66cef0f9c..ae4244bcbfd 100644
--- a/dlls/wined3d/wined3d.spec
+++ b/dlls/wined3d/wined3d.spec
@@ -169,6 +169,7 @@
 @ cdecl wined3d_device_context_set_blend_state(ptr ptr ptr long)
 @ cdecl wined3d_device_context_set_constant_buffer(ptr long long ptr)
 @ cdecl wined3d_device_context_set_depth_stencil_state(ptr ptr long)
+@ cdecl wined3d_device_context_set_depth_stencil_view(ptr ptr)
 @ cdecl wined3d_device_context_set_rasterizer_state(ptr ptr)
 @ cdecl wined3d_device_context_set_rendertarget_view(ptr long ptr long)
 @ cdecl wined3d_device_context_set_sampler(ptr long long ptr)
diff --git a/include/wine/wined3d.h b/include/wine/wined3d.h
index e066e688125..60625eda5c5 100644
--- a/include/wine/wined3d.h
+++ b/include/wine/wined3d.h
@@ -2561,6 +2561,8 @@ void __cdecl wined3d_device_context_set_constant_buffer(struct wined3d_device_co
         enum wined3d_shader_type type, unsigned int idx, struct wined3d_buffer *buffer);
 void __cdecl wined3d_device_context_set_depth_stencil_state(struct wined3d_device_context *context,
         struct wined3d_depth_stencil_state *depth_stencil_state, unsigned int stencil_ref);
+HRESULT __cdecl wined3d_device_context_set_depth_stencil_view(struct wined3d_device_context *context,
+        struct wined3d_rendertarget_view *view);
 void __cdecl wined3d_device_context_set_rasterizer_state(struct wined3d_device_context *context,
         struct wined3d_rasterizer_state *rasterizer_state);
 HRESULT __cdecl wined3d_device_context_set_rendertarget_view(struct wined3d_device_context *context,
-- 
2.30.2




More information about the wine-devel mailing list