[PATCHv5 3/3] d3d9/tests: Add tests for different YUV texture layouts

Henri Verbeet hverbeet at gmail.com
Fri Feb 14 13:04:25 CST 2014


On 13 February 2014 14:52, Martin Storsjo <martin at martin.st> wrote:
> +    IDirect3DSurface9 *surface = NULL, *target = NULL;
You don't need those to be NULL.

> +    HRESULT color;
You'll want to use D3DCOLOR instead of HRESULT here.

> +        /* Some (all?) Windows drivers do not support YUV 3D textures, only 2D surfaces in
> +         * StretchRect. Thus use StretchRect to draw the YUV surface onto the screen instead
> +         * of drawPrimitive. */
> +        if (IDirect3D9_CheckDeviceFormat(d3d, 0, D3DDEVTYPE_HAL, D3DFMT_X8R8G8B8, 0,
> +                D3DRTYPE_SURFACE, format) != D3D_OK)
> +        {
> +            skip("%s is not supported.\n", fmt_string);
> +            continue;
> +        }
You should also verify the StretchRect() is supported with
CheckDeviceFormatConversion().

> +                    BYTE Y = (color >> 16) & 0xff;
> +                    BYTE U = (color >>  8) & 0xff;
> +                    BYTE V = (color >>  0) & 0xff;
It's probably just as easy to just store the separate components to begin with.

> +            hr = IDirect3DDevice9_StretchRect(device, surface, NULL, target, NULL, D3DTEXF_POINT);
> +            ok(hr == D3D_OK, "IDirect3DDevice9_StretchRect failed with %#x.\n", hr);
> +
> +            /* Native D3D can't resist filtering the YUY surface, even though we asked it not to
> +             * do so above. To prevent running into precision problems, read at points with some
> +             * margin within the rect. */
That's not technically true, no filtering would be D3DTEXF_NONE. I
don't know if that's going to make a difference in practice though.



More information about the wine-devel mailing list