lavapipe: inherit from vk_image
simple and easy since we don't use much of this anyway Reviewed-by: Dave Airlie <airlied@redhat.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13146>
This commit is contained in:

committed by
Marge Bot

parent
9392bd89e9
commit
2f6debfd6d
@@ -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.x = copycmd->pRegions[i].imageOffset.x;
|
||||||
box.y = copycmd->pRegions[i].imageOffset.y;
|
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.width = copycmd->pRegions[i].imageExtent.width;
|
||||||
box.height = copycmd->pRegions[i].imageExtent.height;
|
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_data = state->pctx->texture_map(state->pctx,
|
||||||
src_image->bo,
|
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.x = copycmd->pRegions[i].imageOffset.x;
|
||||||
box.y = copycmd->pRegions[i].imageOffset.y;
|
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.width = copycmd->pRegions[i].imageExtent.width;
|
||||||
box.height = copycmd->pRegions[i].imageExtent.height;
|
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_data = state->pctx->texture_map(state->pctx,
|
||||||
dst_image->bo,
|
dst_image->bo,
|
||||||
|
@@ -37,14 +37,11 @@ lvp_image_create(VkDevice _device,
|
|||||||
|
|
||||||
assert(pCreateInfo->sType == VK_STRUCTURE_TYPE_IMAGE_CREATE_INFO);
|
assert(pCreateInfo->sType == VK_STRUCTURE_TYPE_IMAGE_CREATE_INFO);
|
||||||
|
|
||||||
image = vk_zalloc2(&device->vk.alloc, alloc, sizeof(*image), 8,
|
image = vk_image_create(&device->vk, pCreateInfo, alloc, sizeof(*image));
|
||||||
VK_SYSTEM_ALLOCATION_SCOPE_OBJECT);
|
|
||||||
if (image == NULL)
|
if (image == NULL)
|
||||||
return vk_error(device->instance, VK_ERROR_OUT_OF_HOST_MEMORY);
|
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->alignment = 16;
|
||||||
image->type = pCreateInfo->imageType;
|
|
||||||
{
|
{
|
||||||
struct pipe_resource template;
|
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);
|
ASSERTED struct lvp_image *swapchain_image = lvp_swapchain_get_image(swapchain_info->swapchain, 0);
|
||||||
assert(swapchain_image);
|
assert(swapchain_image);
|
||||||
|
|
||||||
assert(swapchain_image->type == pCreateInfo->imageType);
|
assert(swapchain_image->vk.image_type == pCreateInfo->imageType);
|
||||||
|
|
||||||
VkImageCreateInfo local_create_info;
|
VkImageCreateInfo local_create_info;
|
||||||
local_create_info = *pCreateInfo;
|
local_create_info = *pCreateInfo;
|
||||||
@@ -179,8 +176,7 @@ lvp_DestroyImage(VkDevice _device, VkImage _image,
|
|||||||
if (!_image)
|
if (!_image)
|
||||||
return;
|
return;
|
||||||
pipe_resource_reference(&image->bo, NULL);
|
pipe_resource_reference(&image->bo, NULL);
|
||||||
vk_object_base_finish(&image->base);
|
vk_image_destroy(&device->vk, pAllocator, &image->vk);
|
||||||
vk_free2(&device->vk.alloc, pAllocator, image);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
VKAPI_ATTR VkResult VKAPI_CALL
|
VKAPI_ATTR VkResult VKAPI_CALL
|
||||||
|
@@ -55,6 +55,7 @@ typedef uint32_t xcb_window_t;
|
|||||||
#include "lvp_entrypoints.h"
|
#include "lvp_entrypoints.h"
|
||||||
#include "vk_device.h"
|
#include "vk_device.h"
|
||||||
#include "vk_instance.h"
|
#include "vk_instance.h"
|
||||||
|
#include "vk_image.h"
|
||||||
#include "vk_physical_device.h"
|
#include "vk_physical_device.h"
|
||||||
#include "vk_shader_module.h"
|
#include "vk_shader_module.h"
|
||||||
#include "vk_util.h"
|
#include "vk_util.h"
|
||||||
@@ -225,8 +226,7 @@ struct lvp_device_memory {
|
|||||||
};
|
};
|
||||||
|
|
||||||
struct lvp_image {
|
struct lvp_image {
|
||||||
struct vk_object_base base;
|
struct vk_image vk;
|
||||||
VkImageType type;
|
|
||||||
VkDeviceSize size;
|
VkDeviceSize size;
|
||||||
uint32_t alignment;
|
uint32_t alignment;
|
||||||
struct pipe_memory_allocation *pmem;
|
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_event, base, VkEvent, VK_OBJECT_TYPE_EVENT)
|
||||||
VK_DEFINE_NONDISP_HANDLE_CASTS(lvp_framebuffer, base, VkFramebuffer,
|
VK_DEFINE_NONDISP_HANDLE_CASTS(lvp_framebuffer, base, VkFramebuffer,
|
||||||
VK_OBJECT_TYPE_FRAMEBUFFER)
|
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_DEFINE_NONDISP_HANDLE_CASTS(lvp_image_view, base, VkImageView,
|
||||||
VK_OBJECT_TYPE_IMAGE_VIEW);
|
VK_OBJECT_TYPE_IMAGE_VIEW);
|
||||||
VK_DEFINE_NONDISP_HANDLE_CASTS(lvp_pipeline_cache, base, VkPipelineCache,
|
VK_DEFINE_NONDISP_HANDLE_CASTS(lvp_pipeline_cache, base, VkPipelineCache,
|
||||||
|
Reference in New Issue
Block a user