Signed-off-by: Zebediah Figura zfigura@codeweavers.com --- dlls/wined3d/buffer.c | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-)
diff --git a/dlls/wined3d/buffer.c b/dlls/wined3d/buffer.c index d4efecb2241..56cce00301e 100644 --- a/dlls/wined3d/buffer.c +++ b/dlls/wined3d/buffer.c @@ -1399,10 +1399,10 @@ HRESULT wined3d_buffer_gl_init(struct wined3d_buffer_gl *buffer_gl, struct wined return wined3d_buffer_init(&buffer_gl->b, device, desc, data, parent, parent_ops, &wined3d_buffer_gl_ops); }
-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) { - struct wined3d_resource *resource = &buffer_vk->b.resource; + const struct wined3d_resource *resource = &buffer_vk->b.resource; uint32_t bind_flags = resource->bind_flags; VkMemoryPropertyFlags memory_type; VkBufferUsageFlags usage; @@ -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); }
const VkDescriptorBufferInfo *wined3d_buffer_vk_get_buffer_info(struct wined3d_buffer_vk *buffer_vk) @@ -1464,6 +1453,8 @@ const VkDescriptorBufferInfo *wined3d_buffer_vk_get_buffer_info(struct wined3d_b static BOOL wined3d_buffer_vk_prepare_location(struct wined3d_buffer *buffer, struct wined3d_context *context, unsigned int location) { + struct wined3d_buffer_vk *buffer_vk = wined3d_buffer_vk(buffer); + switch (location) { case WINED3D_LOCATION_SYSMEM: @@ -1473,7 +1464,16 @@ static BOOL wined3d_buffer_vk_prepare_location(struct wined3d_buffer *buffer, if (buffer->buffer_object) return TRUE;
- return wined3d_buffer_vk_create_buffer_object(wined3d_buffer_vk(buffer), wined3d_context_vk(context)); + if (!wined3d_buffer_vk_create_buffer_object(buffer_vk, wined3d_context_vk(context), &buffer_vk->bo)) + { + WARN("Failed to create Vulkan buffer.\n"); + return FALSE; + } + + 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;
default: FIXME("Unhandled location %s.\n", wined3d_debug_location(location));