[PATCH v2 1/3] d3dcompiler/tests: Rewrite to use a separate d3d9 device for each test.

Matteo Bruni matteo.mystral at gmail.com
Thu Feb 27 04:25:17 CST 2020


On Tue, Feb 25, 2020 at 6:59 PM Zebediah Figura <zfigura at codeweavers.com> wrote:
>
> On 2/25/20 11:30 AM, Matteo Bruni wrote:
> > On Tue, Feb 18, 2020 at 9:32 PM Zebediah Figura <z.figura12 at gmail.com> wrote:
> >> @@ -474,73 +475,58 @@ static void test_float_vectors(IDirect3DDevice9 *device, IDirect3DVertexBuffer9
> >>          "    return color;\n"
> >>          "}";
> >>
> >> -    ID3DXConstantTable *constants;
> >> -    IDirect3DPixelShader9 *pshader;
> >> +    window = create_window();
> >> +    ok(!!window, "Failed to create a window.\n");
> >>
> >> -    pshader = compile_pixel_shader9(device, vec4_indexing_test1_shader, "ps_2_0", &constants);
> >> -    if (pshader != NULL)
> >> +    if (!(device = create_d3d9_device(window)))
> >>      {
> >> -        compute_shader_probe9(device, vshader_passthru, pshader, quad_geometry, vec4_indexing_test1_probes,
> >> -                ARRAY_SIZE(vec4_indexing_test1_probes), 1, 1, __LINE__);
> >> -
> >> -        ID3DXConstantTable_Release(constants);
> >> -        IDirect3DPixelShader9_Release(pshader);
> >> +        DestroyWindow(window);
> >> +        return;
> >>      }
> >>
> >> -    pshader = compile_pixel_shader9(device, vec4_indexing_test2_shader, "ps_2_0", &constants);
> >> -    if (pshader != NULL)
> >> +    todo_wine ps_code = compile_shader(ps_indexing_source, "ps_2_0");
> >> +    if (ps_code)
> >>      {
> >> -        ID3DXConstantTable_SetInt(constants, device, "i", 2);
> >> +        draw_quad(device, ps_code);
> >> +
> >> +        v = get_readback_vec4_d3d9(device, 0, 0);
> >> +        ok(compare_vec4(&v, 0.02f, 0.245f, 0.351f, 1.0f, 0),
> >> +                "Got unexpected value {%.8e, %.8e, %.8e, %.8e}.\n", v.x, v.y, v.z, v.w);
> >
> > Something for a separate patch: this test could be extended to check
> > what happens if 'i' is outside of the valid range. If it turns out to
> > be undefined behavior, a small comment will suffice.
> >
>
> I guess that strikes me as more of a d3d core test than a d3dcompiler
> test, but I don't feel strongly about it.

Not necessarily, depending on whether the natively generated shader
does or doesn't have explicit bounds checking. I guess it probably
doesn't so this is no concern, but worth a look IMO.



More information about the wine-devel mailing list