[PATCH v2 09/10] ddraw: Track location for surfaces with the second texture.

Henri Verbeet hverbeet at gmail.com
Wed Mar 10 11:32:21 CST 2021


On Tue, 9 Mar 2021 at 10:58, Paul Gofman <pgofman at codeweavers.com> wrote:
> @@ -121,7 +122,10 @@ HRESULT ddraw_surface_update_frontbuffer(struct ddraw_surface *surface,
>          return hr;
>      }
>
> -    if (FAILED(hr = wined3d_texture_get_dc(surface->wined3d_texture, surface->sub_resource_idx, &surface_dc)))
> +    src_texture = ddraw_surface_get_default_texture(surface, read ? (rect ? DDRAW_SURFACE_RW : DDRAW_SURFACE_WRITE)
> +            : DDRAW_SURFACE_READ);
> +
> +    if (FAILED(hr = wined3d_texture_get_dc(src_texture, surface->sub_resource_idx, &surface_dc)))
>      {
>          ERR("Failed to get surface DC, hr %#x.\n", hr);
>          return hr;
"src_texture" isn't a great name here. Perhaps "primary_texture", or
simply "wined3d_texture" works?

> @@ -1057,9 +1061,9 @@ static HRESULT surface_lock(struct ddraw_surface *surface,
>      if (surface->surface_desc.ddsCaps.dwCaps & DDSCAPS_PRIMARYSURFACE)
>          hr = ddraw_surface_update_frontbuffer(surface, rect, TRUE, 0);
>      if (SUCCEEDED(hr))
> -        hr = wined3d_resource_map(wined3d_texture_get_resource(surface->wined3d_texture),
> -                surface->sub_resource_idx, &map_desc, rect ? &box : NULL,
> -                wined3dmapflags_from_ddrawmapflags(flags));
> +        hr = wined3d_resource_map(wined3d_texture_get_resource
> +                (ddraw_surface_get_default_texture(surface, DDRAW_SURFACE_RW)), surface->sub_resource_idx,
> +                &map_desc, rect ? &box : NULL, wined3dmapflags_from_ddrawmapflags(flags));
Note that for maps without WINED3D_MAP_WRITE, we could use
DDRAW_SURFACE_READ instead of DDRAW_SURFACE_RW. It would probably be
best to do that as a separate patch though.



More information about the wine-devel mailing list