[PATCH 4/8] wined3d: Pass a wined3d_bo_vk pointer to wined3d_buffer_vk_create_buffer_object().
Henri Verbeet
hverbeet at gmail.com
Wed Nov 3 12:11:11 CDT 2021
On Wed, 3 Nov 2021 at 00:20, Zebediah Figura <zfigura at codeweavers.com> wrote:
> -static BOOL wined3d_buffer_vk_create_buffer_object(struct wined3d_buffer_vk *buffer_vk,
> - struct wined3d_context_vk *context_vk)
> +static BOOL wined3d_buffer_vk_create_buffer_object(const struct wined3d_buffer_vk *buffer_vk,
> + struct wined3d_context_vk *context_vk, struct wined3d_bo_vk *bo)
> {
"bo_vk" by convention, although we're not terribly consistent about
that everywhere. "BOOL" -> "bool" if we're touching it.
> @@ -1433,19 +1433,8 @@ static BOOL wined3d_buffer_vk_create_buffer_object(struct wined3d_buffer_vk *buf
> else if (!(resource->usage & WINED3DUSAGE_DYNAMIC))
> memory_type |= VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT;
>
> - if (!(wined3d_device_vk_create_bo(wined3d_device_vk(resource->device),
> - context_vk, resource->size, usage, memory_type, &buffer_vk->bo)))
> - {
> - WARN("Failed to create Vulkan buffer.\n");
> - return FALSE;
> - }
> -
> - list_init(&buffer_vk->b.bo_user.entry);
> - list_add_head(&buffer_vk->bo.b.users, &buffer_vk->b.bo_user.entry);
> - buffer_vk->b.buffer_object = (uintptr_t)&buffer_vk->bo;
> - buffer_invalidate_bo_range(&buffer_vk->b, 0, 0);
> -
> - return TRUE;
> + return wined3d_device_vk_create_bo(wined3d_device_vk(resource->device),
> + context_vk, resource->size, usage, memory_type, bo);
> }
>
Is this the best way to handle this particular issue? I gather we're
doing this primarily in order to create a bo with the correct "usage"
and "memory_type" in patch 8/8. However, we could also achieve that by
introducing helpers along the lines of
vk_access_mask_from_bind_flags() to determine the correct "usage" and
"memory_type", and then just call wined3d_device_vk_create_bo()
directly from adapter_vk_alloc_bo() in patch 8/8. We may not
necessarily need to pass a resource to adapter_alloc_bo() in that case
either.
More information about the wine-devel
mailing list