[PATCH 2/8] wined3d: Implement depth clear in wined3d_device_clear_rendertarget_view().

Henri Verbeet hverbeet at gmail.com
Mon Mar 14 07:41:32 CDT 2016


On 14 March 2016 at 00:03, Józef Kucia <jkucia at codeweavers.com> wrote:
> @@ -4100,7 +4110,13 @@ HRESULT CDECL wined3d_device_clear_rendertarget_view(struct wined3d_device *devi
>          rect = &r;
>      }
>
> -    return wined3d_rendertarget_view_clear(view, rect, WINED3DCLEAR_TARGET, color, 0.0f, 0);
> +    if (!(flags & WINED3DCLEAR_TARGET) == !(flags & (WINED3DCLEAR_ZBUFFER | WINED3DCLEAR_STENCIL)))
> +    {
> +        ERR("Color and depth/stencil clears are mutually exclusive.\n");
> +        return WINED3DERR_INVALIDCALL;
> +    }
You may not need this. The documentation suggests depth/stencil views
can only be created on depth formats, and I'd be inclined to believe
it. IIRC it doesn't say much about creating rendertarget views on
depth/stencil formats, but I wouldn't be all that surprised if that's
not allowed either. In that case you'd just need to check the flags
against the format capabilities.

> +const char *debug_color(const struct wined3d_color *color)
> +{
> +    if (!color)
> +        return "(null)";
> +    return wine_dbg_sprintf("{%.8e, %.8e, %.8e, %.8e}",
> +            color->r, color->g, color->b, color->a);
> +}
This is fine, but might as well be a separate change. There are a
couple of other places where we trace wined3d_color values as well,
the easiest way to find them is probably to look for the format
string.



More information about the wine-devel mailing list