[PATCH 8/9] d3dx9: Add test for 'cmp' preshader opcode.

Matteo Bruni matteo.mystral at gmail.com
Thu May 11 09:43:49 CDT 2017


2017-05-08 17:39 GMT+02:00 Paul Gofman <gofmanp at gmail.com>:
> Signed-off-by: Paul Gofman <gofmanp at gmail.com>
> ---
>  dlls/d3dx9_36/tests/effect.c | 33 +++++++++++++++++++++++++++++----
>  1 file changed, 29 insertions(+), 4 deletions(-)
>
> diff --git a/dlls/d3dx9_36/tests/effect.c b/dlls/d3dx9_36/tests/effect.c
> index 015b505..dfc3f5b 100644
> --- a/dlls/d3dx9_36/tests/effect.c
> +++ b/dlls/d3dx9_36/tests/effect.c
> @@ -4490,7 +4490,8 @@ static void test_preshader_op(IDirect3DDevice9 *device, const DWORD *sample_effe
>      {
>          {0, 0, 0},
>          {5549, 0, 4},
> -        {5400, 2, 1}
> +        {5400, 2, 1},
> +        {4121, 0, 1}
>      };

You could add a ',' after the new array element so that, if we ever
need to add another test, that line doesn't need to be changed. Just
mentioning it since you have to resend anyway.

>      DWORD *test_effect_blob;
>      HRESULT hr;
> @@ -4506,8 +4507,30 @@ static void test_preshader_op(IDirect3DDevice9 *device, const DWORD *sample_effe
>
>      test_effect_blob = HeapAlloc(GetProcessHeap(), 0, sample_effect_blob_size);
>      memcpy(test_effect_blob, sample_effect_blob, sample_effect_blob_size);
> -    for (i = 0; i < blob_position[test->args_count].ins_count; ++i)
> -        test_effect_blob[op_pos + i * op_step] = test->opcode;
> +
> +    if (test->args_count == 3)
> +    {
> +        DWORD *pos;
> +
> +        pos = &test_effect_blob[op_pos - 1];
> +        *pos++ = 1;
> +        *pos++ = test->opcode;
> +        *pos++ = test->args_count;
> +        for (i = 0; i < 3; ++i)
> +        {
> +            *pos++ = 0;
> +            *pos++ = 2;
> +            *pos++ = i == 2 ? 4 : 0;
> +        }
> +        *pos++ = 0;
> +        *pos++ = 4;
> +        *pos++ = 0;
> +    }
> +    else
> +    {
> +        for (i = 0; i < blob_position[test->args_count].ins_count; ++i)
> +            test_effect_blob[op_pos + i * op_step] = test->opcode;
> +    }

I think this is getting more and more ugly. What about writing an
effect with those 3 preshaders by hand instead? You could start with
those edited effect fragments, fixing them up and putting them
together in a new effect blob. Sprinkle over some comments as
necessary.

I'm not going to block the patch for this reason but I think it's
something worth exploring.



More information about the wine-devel mailing list