Module: wine Branch: master Commit: fd4f1d9c48f10ca7b08f850ba395d7b4c56e6ddb URL: http://source.winehq.org/git/wine.git/?a=commit;h=fd4f1d9c48f10ca7b08f850ba3...
Author: Józef Kucia jkucia@codeweavers.com Date: Mon Jul 4 12:26:20 2016 +0200
d3d11: Implement d3d11_immediate_context_OMGetBlendState().
Signed-off-by: Józef Kucia jkucia@codeweavers.com Signed-off-by: Henri Verbeet hverbeet@codeweavers.com Signed-off-by: Alexandre Julliard julliard@winehq.org
---
dlls/d3d11/d3d11_private.h | 5 +++++ dlls/d3d11/device.c | 25 ++++++++++++++++++------- dlls/d3d11/state.c | 5 ----- 3 files changed, 23 insertions(+), 12 deletions(-)
diff --git a/dlls/d3d11/d3d11_private.h b/dlls/d3d11/d3d11_private.h index bd43aa6..0dee4a1 100644 --- a/dlls/d3d11/d3d11_private.h +++ b/dlls/d3d11/d3d11_private.h @@ -359,6 +359,11 @@ struct d3d_blend_state ID3D11Device *device; };
+static inline struct d3d_blend_state *impl_from_ID3D11BlendState(ID3D11BlendState *iface) +{ + return CONTAINING_RECORD(iface, struct d3d_blend_state, ID3D11BlendState_iface); +} + HRESULT d3d_blend_state_init(struct d3d_blend_state *state, struct d3d_device *device, const D3D11_BLEND_DESC *desc) DECLSPEC_HIDDEN; struct d3d_blend_state *unsafe_impl_from_ID3D11BlendState(ID3D11BlendState *iface) DECLSPEC_HIDDEN; diff --git a/dlls/d3d11/device.c b/dlls/d3d11/device.c index 03fafc6..867b294 100644 --- a/dlls/d3d11/device.c +++ b/dlls/d3d11/device.c @@ -1655,8 +1655,17 @@ static void STDMETHODCALLTYPE d3d11_immediate_context_OMGetRenderTargetsAndUnord static void STDMETHODCALLTYPE d3d11_immediate_context_OMGetBlendState(ID3D11DeviceContext *iface, ID3D11BlendState **blend_state, FLOAT blend_factor[4], UINT *sample_mask) { - FIXME("iface %p, blend_state %p, blend_factor %p, sample_mask %p stub!\n", + struct d3d_device *device = device_from_immediate_ID3D11DeviceContext(iface); + + TRACE("iface %p, blend_state %p, blend_factor %p, sample_mask %p.\n", iface, blend_state, blend_factor, sample_mask); + + if ((*blend_state = device->blend_state ? &device->blend_state->ID3D11BlendState_iface : NULL)) + ID3D11BlendState_AddRef(*blend_state); + wined3d_mutex_lock(); + memcpy(blend_factor, device->blend_factor, 4 * sizeof(*blend_factor)); + *sample_mask = wined3d_device_get_render_state(device->wined3d_device, WINED3D_RS_MULTISAMPLEMASK); + wined3d_mutex_unlock(); }
static void STDMETHODCALLTYPE d3d11_immediate_context_OMGetDepthStencilState(ID3D11DeviceContext *iface, @@ -4063,16 +4072,18 @@ static void STDMETHODCALLTYPE d3d10_device_OMGetBlendState(ID3D10Device1 *iface, ID3D10BlendState **blend_state, FLOAT blend_factor[4], UINT *sample_mask) { struct d3d_device *device = impl_from_ID3D10Device(iface); + ID3D11BlendState *d3d11_blend_state;
TRACE("iface %p, blend_state %p, blend_factor %p, sample_mask %p.\n", iface, blend_state, blend_factor, sample_mask);
- if ((*blend_state = device->blend_state ? (ID3D10BlendState *)&device->blend_state->ID3D10BlendState1_iface : NULL)) - ID3D10BlendState_AddRef(*blend_state); - wined3d_mutex_lock(); - memcpy(blend_factor, device->blend_factor, 4 * sizeof(*blend_factor)); - *sample_mask = wined3d_device_get_render_state(device->wined3d_device, WINED3D_RS_MULTISAMPLEMASK); - wined3d_mutex_unlock(); + d3d11_immediate_context_OMGetBlendState(&device->immediate_context.ID3D11DeviceContext_iface, + &d3d11_blend_state, blend_factor, sample_mask); + + if (d3d11_blend_state) + *blend_state = (ID3D10BlendState *)&impl_from_ID3D11BlendState(d3d11_blend_state)->ID3D10BlendState1_iface; + else + *blend_state = NULL; }
static void STDMETHODCALLTYPE d3d10_device_OMGetDepthStencilState(ID3D10Device1 *iface, diff --git a/dlls/d3d11/state.c b/dlls/d3d11/state.c index 665d142..ba90664 100644 --- a/dlls/d3d11/state.c +++ b/dlls/d3d11/state.c @@ -26,11 +26,6 @@ WINE_DEFAULT_DEBUG_CHANNEL(d3d11);
/* ID3D11BlendState methods */
-static inline struct d3d_blend_state *impl_from_ID3D11BlendState(ID3D11BlendState *iface) -{ - return CONTAINING_RECORD(iface, struct d3d_blend_state, ID3D11BlendState_iface); -} - static HRESULT STDMETHODCALLTYPE d3d11_blend_state_QueryInterface(ID3D11BlendState *iface, REFIID riid, void **object) {