[PATCH v2 02/11] d3d11: Implement d3d11_immediate_context_OMGetDepthStencilState().

Józef Kucia jkucia at codeweavers.com
Mon Jul 4 05:26:21 CDT 2016


Signed-off-by: Józef Kucia <jkucia at codeweavers.com>
---
Version 2: Use impl_from_ID3D11DepthStencilState() instead of
unsafe_impl_from_ID3D11DepthStencilState().
---
 dlls/d3d11/d3d11_private.h |  5 +++++
 dlls/d3d11/device.c        | 22 +++++++++++++++++-----
 dlls/d3d11/state.c         |  5 -----
 3 files changed, 22 insertions(+), 10 deletions(-)

diff --git a/dlls/d3d11/d3d11_private.h b/dlls/d3d11/d3d11_private.h
index 0dee4a1..55cd579 100644
--- a/dlls/d3d11/d3d11_private.h
+++ b/dlls/d3d11/d3d11_private.h
@@ -382,6 +382,11 @@ struct d3d_depthstencil_state
     ID3D11Device *device;
 };
 
+static inline struct d3d_depthstencil_state *impl_from_ID3D11DepthStencilState(ID3D11DepthStencilState *iface)
+{
+    return CONTAINING_RECORD(iface, struct d3d_depthstencil_state, ID3D11DepthStencilState_iface);
+}
+
 HRESULT d3d_depthstencil_state_init(struct d3d_depthstencil_state *state, struct d3d_device *device,
         const D3D11_DEPTH_STENCIL_DESC *desc) DECLSPEC_HIDDEN;
 struct d3d_depthstencil_state *unsafe_impl_from_ID3D11DepthStencilState(
diff --git a/dlls/d3d11/device.c b/dlls/d3d11/device.c
index 867b294..74a6055 100644
--- a/dlls/d3d11/device.c
+++ b/dlls/d3d11/device.c
@@ -1671,7 +1671,15 @@ static void STDMETHODCALLTYPE d3d11_immediate_context_OMGetBlendState(ID3D11Devi
 static void STDMETHODCALLTYPE d3d11_immediate_context_OMGetDepthStencilState(ID3D11DeviceContext *iface,
         ID3D11DepthStencilState **depth_stencil_state, UINT *stencil_ref)
 {
-    FIXME("iface %p, depth_stencil_state %p, stencil_ref %p stub!\n", iface, depth_stencil_state, stencil_ref);
+    struct d3d_device *device = device_from_immediate_ID3D11DeviceContext(iface);
+
+    TRACE("iface %p, depth_stencil_state %p, stencil_ref %p.\n",
+            iface, depth_stencil_state, stencil_ref);
+
+    if ((*depth_stencil_state = device->depth_stencil_state
+            ? &device->depth_stencil_state->ID3D11DepthStencilState_iface : NULL))
+        ID3D11DepthStencilState_AddRef(*depth_stencil_state);
+    *stencil_ref = device->stencil_ref;
 }
 
 static void STDMETHODCALLTYPE d3d11_immediate_context_SOGetTargets(ID3D11DeviceContext *iface,
@@ -4090,14 +4098,18 @@ static void STDMETHODCALLTYPE d3d10_device_OMGetDepthStencilState(ID3D10Device1
         ID3D10DepthStencilState **depth_stencil_state, UINT *stencil_ref)
 {
     struct d3d_device *device = impl_from_ID3D10Device(iface);
+    ID3D11DepthStencilState *d3d11_iface;
 
     TRACE("iface %p, depth_stencil_state %p, stencil_ref %p.\n",
             iface, depth_stencil_state, stencil_ref);
 
-    if ((*depth_stencil_state = device->depth_stencil_state
-            ? &device->depth_stencil_state->ID3D10DepthStencilState_iface : NULL))
-        ID3D10DepthStencilState_AddRef(*depth_stencil_state);
-    *stencil_ref = device->stencil_ref;
+    d3d11_immediate_context_OMGetDepthStencilState(&device->immediate_context.ID3D11DeviceContext_iface,
+            &d3d11_iface, stencil_ref);
+
+    if (d3d11_iface)
+        *depth_stencil_state = &impl_from_ID3D11DepthStencilState(d3d11_iface)->ID3D10DepthStencilState_iface;
+    else
+        *depth_stencil_state = NULL;
 }
 
 static void STDMETHODCALLTYPE d3d10_device_SOGetTargets(ID3D10Device1 *iface,
diff --git a/dlls/d3d11/state.c b/dlls/d3d11/state.c
index ba90664..68ad1bd 100644
--- a/dlls/d3d11/state.c
+++ b/dlls/d3d11/state.c
@@ -328,11 +328,6 @@ struct d3d_blend_state *unsafe_impl_from_ID3D10BlendState(ID3D10BlendState *ifac
 
 /* ID3D11DepthStencilState methods */
 
-static inline struct d3d_depthstencil_state *impl_from_ID3D11DepthStencilState(ID3D11DepthStencilState *iface)
-{
-    return CONTAINING_RECORD(iface, struct d3d_depthstencil_state, ID3D11DepthStencilState_iface);
-}
-
 static HRESULT STDMETHODCALLTYPE d3d11_depthstencil_state_QueryInterface(ID3D11DepthStencilState *iface,
         REFIID riid, void **object)
 {
-- 
2.7.3




More information about the wine-patches mailing list