Re: [PATCH 3/9] d3d11: Implement d3d11_immediate_context_OMGetBlendState().
On 24 June 2016 at 11:45, Józef Kucia <jkucia(a)codeweavers.com> wrote:
@@ -4044,16 +4053,17 @@ 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; + struct d3d_blend_state *object;
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); + + object = unsafe_impl_from_ID3D11BlendState(d3d11_blend_state); Why not just impl_from_ID3D11BlendState() here?
On Fri, Jun 24, 2016 at 12:56 PM, Henri Verbeet <hverbeet(a)gmail.com> wrote:
On 24 June 2016 at 11:45, Józef Kucia <jkucia(a)codeweavers.com> wrote:
@@ -4044,16 +4053,17 @@ 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; + struct d3d_blend_state *object;
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); + + object = unsafe_impl_from_ID3D11BlendState(d3d11_blend_state); Why not just impl_from_ID3D11BlendState() here?
Mostly because we keep impl_from_* functions private to a file in which an interface is implemented.
On 24 June 2016 at 13:04, Józef Kucia <joseph.kucia(a)gmail.com> wrote:
On Fri, Jun 24, 2016 at 12:56 PM, Henri Verbeet <hverbeet(a)gmail.com> wrote:
On 24 June 2016 at 11:45, Józef Kucia <jkucia(a)codeweavers.com> wrote:
@@ -4044,16 +4053,17 @@ 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; + struct d3d_blend_state *object;
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); + + object = unsafe_impl_from_ID3D11BlendState(d3d11_blend_state); Why not just impl_from_ID3D11BlendState() here?
Mostly because we keep impl_from_* functions private to a file in which an interface is implemented.
Yeah, but that's just because in most cases there's no reason to expose them outside that file. E.g. impl_from_ID3D11Device() is in d3d11_private.h, and in ddraw several of them are.
On Fri, Jun 24, 2016 at 1:07 PM, Henri Verbeet <hverbeet(a)gmail.com> wrote:
Yeah, but that's just because in most cases there's no reason to expose them outside that file. E.g. impl_from_ID3D11Device() is in d3d11_private.h, and in ddraw several of them are.
My impression is that we want to keep them private unless there is a good reason to expose them. I guess my impression is mostly based on this comment https://www.winehq.org/pipermail/wine-devel/2015-August/108939.html. I can change to impl_from_ID3D11BlendState(). It doesn't make much different to me.
On 24 June 2016 at 13:21, Józef Kucia <joseph.kucia(a)gmail.com> wrote:
On Fri, Jun 24, 2016 at 1:07 PM, Henri Verbeet <hverbeet(a)gmail.com> wrote:
Yeah, but that's just because in most cases there's no reason to expose them outside that file. E.g. impl_from_ID3D11Device() is in d3d11_private.h, and in ddraw several of them are.
My impression is that we want to keep them private unless there is a good reason to expose them. I guess my impression is mostly based on this comment https://www.winehq.org/pipermail/wine-devel/2015-August/108939.html. I can change to impl_from_ID3D11BlendState(). It doesn't make much different to me.
Yeah, it's a bit of a trade-off. An alternative could be to introduce a helper function that just returns a d3d_blend_state structure.
participants (2)
-
Henri Verbeet -
Józef Kucia