[PATCH] d3d11: OMSetBlendState blend states is optional (try 2)

Józef Kucia joseph.kucia at gmail.com
Fri Nov 20 05:59:46 CST 2015


Hi,

The subject is not very accurate.

On Thu, Nov 19, 2015 at 10:29 AM, Alistair Leslie-Hughes
<leslie_alistair at hotmail.com> wrote:
> Fixed failed tests.
>
> Signed-off-by: Alistair Leslie-Hughes <leslie_alistair at hotmail.com>
> ---
>  dlls/d3d11/device.c      | 7 ++++++-
>  dlls/d3d11/tests/d3d11.c | 2 ++
>  2 files changed, 8 insertions(+), 1 deletion(-)
>
> diff --git a/dlls/d3d11/device.c b/dlls/d3d11/device.c
> index f2bc4d6..c6e54cf 100644
> --- a/dlls/d3d11/device.c
> +++ b/dlls/d3d11/device.c
> @@ -603,10 +603,15 @@ static void STDMETHODCALLTYPE d3d11_immediate_context_OMSetRenderTargetsAndUnord
>  }
>
>  static void STDMETHODCALLTYPE d3d11_immediate_context_OMSetBlendState(ID3D11DeviceContext *iface,
> -        ID3D11BlendState *blend_state, const FLOAT blend_factor[4], UINT sample_mask)
> +        ID3D11BlendState *blend_state, const FLOAT arg_blend_factor[4], UINT sample_mask)
>  {
>      struct d3d_device *device = device_from_immediate_ID3D11DeviceContext(iface);
>      const D3D11_BLEND_DESC *desc;
> +    const FLOAT blend_default[4] = {1.0f, 1.0f, 1.0f, 1.0f};
> +    const FLOAT *blend_factor = blend_default;
> +
> +    if(arg_blend_factor)
> +        blend_factor = arg_blend_factor;

There is a missing space after "if".

>
>      TRACE("iface %p, blend_state %p, blend_factor {%.8e %.8e %.8e %.8e}, sample_mask 0x%08x.\n",
>              iface, blend_state, blend_factor[0], blend_factor[1], blend_factor[2], blend_factor[3], sample_mask);

We should print actual arguments. If blend_factor is allowed to be
NULL it should be treated as a pointer.

> diff --git a/dlls/d3d11/tests/d3d11.c b/dlls/d3d11/tests/d3d11.c
> index 7021c6f..f42edf7 100644
> --- a/dlls/d3d11/tests/d3d11.c
> +++ b/dlls/d3d11/tests/d3d11.c
> @@ -2777,6 +2777,8 @@ static void test_blend(void)
>
>      ID3D11DeviceContext_ClearRenderTargetView(context, backbuffer_rtv, red);
>
> +    ID3D11DeviceContext_OMSetBlendState(context, src_blend, NULL, D3D11_DEFAULT_SAMPLE_MASK);
> +

A test showing that passing NULL to OmSetBlendState() resets the blend
factor to (1.0, 1.0, 1.0 ,1.0) would be useful. Unfortunately,
d3d11_immediate_context_OMGetBlendState() is not implemented yet.
Also, the test_blend() is not the best place for this test as it is a
visual test. The test should be probably placed in test_clear_state()
but it is not ported from d3d10core tests yet.

I think the best way would be to fix this issue in D3D10 as well and
add a test in test_clear_state(). The test_clear_state() will be
eventually ported to d3d11 tests.

Thanks,
Józef Kucia



More information about the wine-devel mailing list