[PATCH 1/3] wined3d: Handle discarded buffers in buffer_resource_sub_resource_map().

Henri Verbeet hverbeet at gmail.com
Wed Jan 26 07:47:03 CST 2022


On Tue, 25 Jan 2022 at 03:21, Zebediah Figura <zfigura at codeweavers.com> wrote:
> @@ -927,10 +928,13 @@ static HRESULT buffer_resource_sub_resource_map(struct wined3d_resource *resourc
>
>      count = ++resource->map_count;
>
> -    if (buffer->buffer_object)
> +    context = context_acquire(device, NULL, 0);
> +
> +    wined3d_buffer_get_memory(buffer, context, &addr);
> +
> +    if (addr.buffer_object)
>      {
I think that potentially changes the location we map in some cases.
(In particular, when buffer->buffer_object is non-NULL, but
WINED3D_LOCATION_BUFFER is not current.) I don't know for sure whether
that would cause issues for applications, but this code is sensitive
enough that I'd prefer avoiding wined3d_buffer_get_memory() here
unless we have a good reason not to.

What is the issue exactly? Is it that buffer->buffer_object may not
have been created yet for discarded resources?



More information about the wine-devel mailing list