diff --git a/src/gallium/frontends/lavapipe/lvp_execute.c b/src/gallium/frontends/lavapipe/lvp_execute.c index 36ab1d82980..ff5662a089b 100644 --- a/src/gallium/frontends/lavapipe/lvp_execute.c +++ b/src/gallium/frontends/lavapipe/lvp_execute.c @@ -2134,10 +2134,10 @@ static void handle_copy_image_to_buffer2_khr(struct vk_cmd_queue_entry *cmd, box.x = copycmd->pRegions[i].imageOffset.x; box.y = copycmd->pRegions[i].imageOffset.y; - box.z = src_image->type == VK_IMAGE_TYPE_3D ? copycmd->pRegions[i].imageOffset.z : copycmd->pRegions[i].imageSubresource.baseArrayLayer; + box.z = src_image->vk.image_type == VK_IMAGE_TYPE_3D ? copycmd->pRegions[i].imageOffset.z : copycmd->pRegions[i].imageSubresource.baseArrayLayer; box.width = copycmd->pRegions[i].imageExtent.width; box.height = copycmd->pRegions[i].imageExtent.height; - box.depth = src_image->type == VK_IMAGE_TYPE_3D ? copycmd->pRegions[i].imageExtent.depth : copycmd->pRegions[i].imageSubresource.layerCount; + box.depth = src_image->vk.image_type == VK_IMAGE_TYPE_3D ? copycmd->pRegions[i].imageExtent.depth : copycmd->pRegions[i].imageSubresource.layerCount; src_data = state->pctx->texture_map(state->pctx, src_image->bo, @@ -2229,10 +2229,10 @@ static void handle_copy_buffer_to_image(struct vk_cmd_queue_entry *cmd, box.x = copycmd->pRegions[i].imageOffset.x; box.y = copycmd->pRegions[i].imageOffset.y; - box.z = dst_image->type == VK_IMAGE_TYPE_3D ? copycmd->pRegions[i].imageOffset.z : copycmd->pRegions[i].imageSubresource.baseArrayLayer; + box.z = dst_image->vk.image_type == VK_IMAGE_TYPE_3D ? copycmd->pRegions[i].imageOffset.z : copycmd->pRegions[i].imageSubresource.baseArrayLayer; box.width = copycmd->pRegions[i].imageExtent.width; box.height = copycmd->pRegions[i].imageExtent.height; - box.depth = dst_image->type == VK_IMAGE_TYPE_3D ? copycmd->pRegions[i].imageExtent.depth : copycmd->pRegions[i].imageSubresource.layerCount; + box.depth = dst_image->vk.image_type == VK_IMAGE_TYPE_3D ? copycmd->pRegions[i].imageExtent.depth : copycmd->pRegions[i].imageSubresource.layerCount; dst_data = state->pctx->texture_map(state->pctx, dst_image->bo, diff --git a/src/gallium/frontends/lavapipe/lvp_image.c b/src/gallium/frontends/lavapipe/lvp_image.c index 5ad64134ba3..57e93e24cc6 100644 --- a/src/gallium/frontends/lavapipe/lvp_image.c +++ b/src/gallium/frontends/lavapipe/lvp_image.c @@ -37,14 +37,11 @@ lvp_image_create(VkDevice _device, assert(pCreateInfo->sType == VK_STRUCTURE_TYPE_IMAGE_CREATE_INFO); - image = vk_zalloc2(&device->vk.alloc, alloc, sizeof(*image), 8, - VK_SYSTEM_ALLOCATION_SCOPE_OBJECT); + image = vk_image_create(&device->vk, pCreateInfo, alloc, sizeof(*image)); if (image == NULL) return vk_error(device->instance, VK_ERROR_OUT_OF_HOST_MEMORY); - vk_object_base_init(&device->vk, &image->base, VK_OBJECT_TYPE_IMAGE); image->alignment = 16; - image->type = pCreateInfo->imageType; { struct pipe_resource template; @@ -139,7 +136,7 @@ lvp_image_from_swapchain(VkDevice device, ASSERTED struct lvp_image *swapchain_image = lvp_swapchain_get_image(swapchain_info->swapchain, 0); assert(swapchain_image); - assert(swapchain_image->type == pCreateInfo->imageType); + assert(swapchain_image->vk.image_type == pCreateInfo->imageType); VkImageCreateInfo local_create_info; local_create_info = *pCreateInfo; @@ -179,8 +176,7 @@ lvp_DestroyImage(VkDevice _device, VkImage _image, if (!_image) return; pipe_resource_reference(&image->bo, NULL); - vk_object_base_finish(&image->base); - vk_free2(&device->vk.alloc, pAllocator, image); + vk_image_destroy(&device->vk, pAllocator, &image->vk); } VKAPI_ATTR VkResult VKAPI_CALL diff --git a/src/gallium/frontends/lavapipe/lvp_private.h b/src/gallium/frontends/lavapipe/lvp_private.h index fcb2f6d445f..978dd784c8f 100644 --- a/src/gallium/frontends/lavapipe/lvp_private.h +++ b/src/gallium/frontends/lavapipe/lvp_private.h @@ -55,6 +55,7 @@ typedef uint32_t xcb_window_t; #include "lvp_entrypoints.h" #include "vk_device.h" #include "vk_instance.h" +#include "vk_image.h" #include "vk_physical_device.h" #include "vk_shader_module.h" #include "vk_util.h" @@ -225,8 +226,7 @@ struct lvp_device_memory { }; struct lvp_image { - struct vk_object_base base; - VkImageType type; + struct vk_image vk; VkDeviceSize size; uint32_t alignment; struct pipe_memory_allocation *pmem; @@ -623,7 +623,7 @@ VK_DEFINE_NONDISP_HANDLE_CASTS(lvp_device_memory, base, VkDeviceMemory, VK_DEFINE_NONDISP_HANDLE_CASTS(lvp_event, base, VkEvent, VK_OBJECT_TYPE_EVENT) VK_DEFINE_NONDISP_HANDLE_CASTS(lvp_framebuffer, base, VkFramebuffer, VK_OBJECT_TYPE_FRAMEBUFFER) -VK_DEFINE_NONDISP_HANDLE_CASTS(lvp_image, base, VkImage, VK_OBJECT_TYPE_IMAGE) +VK_DEFINE_NONDISP_HANDLE_CASTS(lvp_image, vk.base, VkImage, VK_OBJECT_TYPE_IMAGE) VK_DEFINE_NONDISP_HANDLE_CASTS(lvp_image_view, base, VkImageView, VK_OBJECT_TYPE_IMAGE_VIEW); VK_DEFINE_NONDISP_HANDLE_CASTS(lvp_pipeline_cache, base, VkPipelineCache,