[PATCH 4/5] wined3d: Set a valid map pointer in wined3d_device_gl_create_bo() if possible.

Henri Verbeet hverbeet at gmail.com
Thu Feb 17 09:11:25 CST 2022


On Thu, 17 Feb 2022 at 07:31, Zebediah Figura <zfigura at codeweavers.com> wrote:
> @@ -1175,6 +1175,18 @@ bool wined3d_device_gl_create_bo(struct wined3d_device_gl *device_gl, struct win
>      bo->b.map_ptr = NULL;
>      bo->b.client_map_count = 0;
>
> +    if (memory)
> +    {
> +        struct wined3d_allocator_chunk_gl *chunk = wined3d_allocator_chunk_gl(memory->chunk);
> +
> +        wined3d_allocator_chunk_gl_lock(chunk);
> +
> +        if ((bo->b.map_ptr = chunk->c.map_ptr))
> +            ++chunk->c.map_count;
> +
> +        wined3d_allocator_chunk_gl_unlock(chunk);
> +    }
> +
>      return true;
>  }
>
I think it would make sense to do this in adapter_gl_alloc_bo(),
analogous to the wined3d_bo_vk_map() call in adapter_vk_alloc_bo(),
but it seems a little more questionable in
wined3d_device_gl_create_bo() itself. In particular,
adapter_gl_alloc_bo() is expected to return a mapped bo that in
principle is expected to be unmapped once we're done with it (although
I'm not sure we currently consistently do that in all cases), but
there's no such expectation for wined3d_device_gl_create_bo(), so this
is never going to get unmapped in the general case.



More information about the wine-devel mailing list