[PATCH] d3d11: Upgrade to ID3D11BlendState1.

Charles Davis cdavis5x at gmail.com
Sat May 14 22:57:33 CDT 2022


On Sat, May 14, 2022 at 2:35 AM James McDonnell <topgamer7 at gmail.com> wrote:
>
>
> On 2022-05-13 11:46, Chip Davis wrote:
> > diff --git a/dlls/d3d11/device.c b/dlls/d3d11/device.c
> > index ecf45e9ce33..263613911f8 100644
> > --- a/dlls/d3d11/device.c
> > +++ b/dlls/d3d11/device.c
> > @@ -2204,7 +2204,7 @@ static void STDMETHODCALLTYPE d3d11_device_context_OMGetBlendState(ID3D11DeviceC
> >           if (wined3d_state)
> >           {
> >               blend_state_impl = wined3d_blend_state_get_parent(wined3d_state);
> > -            ID3D11BlendState_AddRef(*blend_state = &blend_state_impl->ID3D11BlendState_iface);
> > +            ID3D11BlendState_AddRef(*blend_state = (ID3D11BlendState *)&blend_state_impl->ID3D11BlendState1_iface);
> >           }
> >           else
> >               *blend_state = NULL;
> > @@ -3632,23 +3632,53 @@ static HRESULT STDMETHODCALLTYPE d3d11_device_CreateClassLinkage(ID3D11Device2 *
> >       return S_OK;
> >   }
> >
> > -static HRESULT STDMETHODCALLTYPE d3d11_device_CreateBlendState(ID3D11Device2 *iface,
> > -        const D3D11_BLEND_DESC *desc, ID3D11BlendState **blend_state)
> > +static HRESULT STDMETHODCALLTYPE d3d11_device_CreateBlendState1(ID3D11Device2 *iface,
> > +        const D3D11_BLEND_DESC1 *desc, ID3D11BlendState1 **state)
> >   {
> >       struct d3d_device *device = impl_from_ID3D11Device2(iface);
> >       struct d3d_blend_state *object;
> >       HRESULT hr;
> >
> > -    TRACE("iface %p, desc %p, blend_state %p.\n", iface, desc, blend_state);
> > +    TRACE("iface %p, desc %p, state %p.\n", iface, desc, state);
> >
> >       if (FAILED(hr = d3d_blend_state_create(device, desc, &object)))
> >           return hr;
> >
> > -    *blend_state = &object->ID3D11BlendState_iface;
> > +    *state = &object->ID3D11BlendState1_iface;
> >
> >       return S_OK;
> >   }
> >
> > +static HRESULT STDMETHODCALLTYPE d3d11_device_CreateBlendState(ID3D11Device2 *iface,
> > +        const D3D11_BLEND_DESC *desc, ID3D11BlendState **blend_state)
> > +{
> > +    D3D11_BLEND_DESC1 d3d11_1_desc;
> > +    unsigned int i;
> > +
> > +    TRACE("iface %p, desc %p, blend_state %p.\n", iface, desc, blend_state);
> > +
> > +    if (!desc)
> > +        return E_INVALIDARG;
> > +
> > +    d3d11_1_desc.AlphaToCoverageEnable = desc->AlphaToCoverageEnable;
> > +    d3d11_1_desc.IndependentBlendEnable = desc->IndependentBlendEnable;
> > +    for (i = 0; i < D3D11_SIMULTANEOUS_RENDER_TARGET_COUNT; ++i)
> > +    {
> > +        d3d11_1_desc.RenderTarget[i].BlendEnable = desc->RenderTarget[i].BlendEnable;
> > +        d3d11_1_desc.RenderTarget[i].LogicOpEnable = FALSE;
> > +        d3d11_1_desc.RenderTarget[i].SrcBlend = desc->RenderTarget[i].SrcBlend;
> > +        d3d11_1_desc.RenderTarget[i].DestBlend = desc->RenderTarget[i].DestBlend;
> > +        d3d11_1_desc.RenderTarget[i].BlendOp = desc->RenderTarget[i].BlendOp;
> > +        d3d11_1_desc.RenderTarget[i].SrcBlendAlpha = desc->RenderTarget[i].SrcBlendAlpha;
> > +        d3d11_1_desc.RenderTarget[i].DestBlendAlpha = desc->RenderTarget[i].DestBlendAlpha;
> > +        d3d11_1_desc.RenderTarget[i].BlendOpAlpha = desc->RenderTarget[i].BlendOpAlpha;
> > +        d3d11_1_desc.RenderTarget[i].LogicOp = D3D11_LOGIC_OP_COPY;
> > +        d3d11_1_desc.RenderTarget[i].RenderTargetWriteMask = desc->RenderTarget[i].RenderTargetWriteMask;
> > +    }
> Shouldn't this include a FIXME to warn that LogicOp is hard coded?

No, because ID3D11Device1::CreateBlendState1() is implemented in this
patch; this is the old method, ID3D11Device::CreateBlendState(), which
doesn't support specifying the logic op.



More information about the wine-devel mailing list