From 006ff5aa3a1ec5684cffefbc715ec81366382a14 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B3zef=20Kucia?= Date: Mon, 4 Jul 2016 12:26:21 +0200 Subject: [PATCH] d3d11: Implement d3d11_immediate_context_OMGetDepthStencilState(). MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Józef Kucia Signed-off-by: Henri Verbeet Signed-off-by: Alexandre Julliard --- 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 0dee4a1edb0..55cd579dc4d 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 867b294ce86..74a6055aa53 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 ba906644c14..68ad1bdcdd7 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) {