[PATCH 3/4] wined3d: Store clear colors in subresources (v2).

Zebediah Figura zfigura at codeweavers.com
Thu May 19 16:32:41 CDT 2022


On 5/17/22 10:27, Stefan Dösinger wrote:
> Signed-off-by: Stefan Dösinger <stefan at codeweavers.com>
> 
> Version 2: Take the new wined3d_texture_vk_clear into account.
> ---
>   dlls/wined3d/context_vk.c      | 41 +++++++++++++++++---
>   dlls/wined3d/texture.c         | 70 ++++++++++++++++++----------------
>   dlls/wined3d/utils.c           | 19 +++++++++
>   dlls/wined3d/wined3d_private.h | 11 ++++++
>   4 files changed, 104 insertions(+), 37 deletions(-)
> 

This seems to be missing changes to wined3d_texture_gl_clear(), isn't it?

> diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c
> index 0f45d5c844e..a523043cf24 100644
> --- a/dlls/wined3d/texture.c
> +++ b/dlls/wined3d/texture.c
> @@ -823,10 +823,22 @@ BOOL wined3d_texture_load_location(struct wined3d_texture *texture,
>           range.size = texture->sub_resources[sub_resource_idx].size;
>           if (current & WINED3D_LOCATION_CLEARED)
>           {
> -            static const struct wined3d_color black;
>               unsigned int level_idx = sub_resource_idx % texture->level_count;
>               struct wined3d_map_desc map;
>               struct wined3d_box box;
> +            struct wined3d_color c;
> +
> +            if (texture->resource.format->flags[WINED3D_GL_RES_TYPE_TEX_2D]
> +                    & WINED3DFMT_FLAG_DEPTH_STENCIL)
> +            {
> +                c.r = texture->sub_resources[sub_resource_idx].clear_value.depth;
> +                c.g = texture->sub_resources[sub_resource_idx].clear_value.stencil;
> +                c.b = c.a = 0.0f;
> +            }
> +            else
> +            {
> +                c = texture->sub_resources[sub_resource_idx].clear_value.colour;
> +            }

It feels awkward to me that we're storing depth/stencil separately in 
the sub-resource structure, but collapsing it together here. Could we 
pass, say, a "union wined3d_clear_value" to 
wined3d_resource_memory_colour_fill() [and 
wined3d_format_convert_from_float()]?



More information about the wine-devel mailing list