tu: Use common vk_image_view base struct

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17378>
This commit is contained in:
Connor Abbott 2022-07-18 13:07:57 +02:00 committed by Marge Bot
parent 89263fde20
commit b90d628a7d
3 changed files with 10 additions and 18 deletions

View File

@ -161,8 +161,9 @@ tu_cs_image_flag_ref(struct tu_cs *cs, const struct fdl6_view *iview, uint32_t l
tu_cs_emit(cs, iview->FLAG_BUFFER_PITCH);
}
void
tu_image_view_init(struct tu_image_view *iview,
static void
tu_image_view_init(struct tu_device *device,
struct tu_image_view *iview,
const VkImageViewCreateInfo *pCreateInfo,
bool has_z24uint_s8uint)
{
@ -176,11 +177,9 @@ tu_image_view_init(struct tu_image_view *iview,
const struct tu_sampler_ycbcr_conversion *conversion = ycbcr_conversion ?
tu_sampler_ycbcr_conversion_from_handle(ycbcr_conversion->conversion) : NULL;
const struct VkImageViewMinLodCreateInfoEXT *min_lod =
vk_find_struct_const(pCreateInfo->pNext, IMAGE_VIEW_MIN_LOD_CREATE_INFO_EXT);
vk_image_view_init(&device->vk, &iview->vk, false, pCreateInfo);
iview->image = image;
iview->format = pCreateInfo->format;
const struct fdl_layout *layouts[3];
@ -218,7 +217,7 @@ tu_image_view_init(struct tu_image_view *iview,
args.base_miplevel = range->baseMipLevel;
args.layer_count = vk_image_subresource_layer_count(&image->vk, range);
args.level_count = vk_image_subresource_level_count(&image->vk, range);
args.min_lod_clamp = min_lod ? min_lod->minLod : 0.f;
args.min_lod_clamp = iview->vk.min_lod;
args.format = tu_format_for_aspect(format, aspect_mask);
vk_component_mapping_to_pipe_swizzle(pCreateInfo->components, args.swiz);
if (conversion) {
@ -804,7 +803,7 @@ tu_CreateImageView(VkDevice _device,
if (view == NULL)
return vk_error(device, VK_ERROR_OUT_OF_HOST_MEMORY);
tu_image_view_init(view, pCreateInfo, device->use_z24uint_s8uint);
tu_image_view_init(device, view, pCreateInfo, device->use_z24uint_s8uint);
*pView = tu_image_view_to_handle(view);

View File

@ -951,7 +951,7 @@ static void
tu_setup_dynamic_attachment(struct tu_render_pass_attachment *att,
struct tu_image_view *view)
{
att->format = view->format;
att->format = view->vk.format;
att->samples = view->image->layout->nr_samples;
/* for d32s8, cpp is for the depth image, and
@ -1006,7 +1006,7 @@ tu_setup_dynamic_render_pass(struct tu_cmd_buffer *cmd_buffer,
subpass->samples = view->image->layout->nr_samples;
if (vk_format_is_srgb(view->format))
if (vk_format_is_srgb(view->vk.format))
subpass->srgb_cntl |= 1 << i;
if (att_info->resolveMode != VK_RESOLVE_MODE_NONE) {

View File

@ -2100,12 +2100,10 @@ enum pipe_format tu_format_for_aspect(enum pipe_format format,
struct tu_image_view
{
struct vk_object_base base;
struct vk_image_view vk;
struct tu_image *image; /**< VkImageViewCreateInfo::image */
VkFormat format;
struct fdl6_view view;
/* for d32s8 separate depth */
@ -2170,11 +2168,6 @@ tu_import_memory_from_gralloc_handle(VkDevice device_h,
const VkAllocationCallbacks *alloc,
VkImage image_h);
void
tu_image_view_init(struct tu_image_view *iview,
const VkImageViewCreateInfo *pCreateInfo,
bool limited_z24s8);
bool
tiling_possible(VkFormat format);
@ -2350,7 +2343,7 @@ VK_DEFINE_NONDISP_HANDLE_CASTS(tu_event, base, VkEvent, VK_OBJECT_TYPE_EVENT)
VK_DEFINE_NONDISP_HANDLE_CASTS(tu_framebuffer, base, VkFramebuffer,
VK_OBJECT_TYPE_FRAMEBUFFER)
VK_DEFINE_NONDISP_HANDLE_CASTS(tu_image, vk.base, VkImage, VK_OBJECT_TYPE_IMAGE)
VK_DEFINE_NONDISP_HANDLE_CASTS(tu_image_view, base, VkImageView,
VK_DEFINE_NONDISP_HANDLE_CASTS(tu_image_view, vk.base, VkImageView,
VK_OBJECT_TYPE_IMAGE_VIEW);
VK_DEFINE_NONDISP_HANDLE_CASTS(tu_pipeline_cache, base, VkPipelineCache,
VK_OBJECT_TYPE_PIPELINE_CACHE)