From af406dccfd4f2105dc475145351f910bd50061e7 Mon Sep 17 00:00:00 2001 From: Faith Ekstrand Date: Thu, 27 Feb 2025 13:47:40 -0600 Subject: [PATCH] nvk/image: Prefer vk_image values over pCreateInfo Part-of: --- src/nouveau/vulkan/nvk_image.c | 60 +++++++++++++++++----------------- 1 file changed, 30 insertions(+), 30 deletions(-) diff --git a/src/nouveau/vulkan/nvk_image.c b/src/nouveau/vulkan/nvk_image.c index c2906f210b9..dba738ea671 100644 --- a/src/nouveau/vulkan/nvk_image.c +++ b/src/nouveau/vulkan/nvk_image.c @@ -757,11 +757,11 @@ nvk_image_init(struct nvk_device *dev, image->vk.usage |= VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT; nil_image_usage_flags usage = 0; - if (pCreateInfo->tiling == VK_IMAGE_TILING_LINEAR) + if (image->vk.tiling == VK_IMAGE_TILING_LINEAR) usage |= NIL_IMAGE_USAGE_LINEAR_BIT; - if (pCreateInfo->flags & VK_IMAGE_CREATE_2D_ARRAY_COMPATIBLE_BIT) + if (image->vk.create_flags & VK_IMAGE_CREATE_2D_ARRAY_COMPATIBLE_BIT) usage |= NIL_IMAGE_USAGE_2D_VIEW_BIT; - if (pCreateInfo->flags & VK_IMAGE_CREATE_2D_VIEW_COMPATIBLE_BIT_EXT) + if (image->vk.create_flags & VK_IMAGE_CREATE_2D_VIEW_COMPATIBLE_BIT_EXT) usage |= NIL_IMAGE_USAGE_2D_VIEW_BIT; /* In order to be able to clear 3D depth/stencil images, we need to bind @@ -769,12 +769,12 @@ nvk_image_init(struct nvk_device *dev, */ if ((image->vk.aspects & (VK_IMAGE_ASPECT_DEPTH_BIT | VK_IMAGE_ASPECT_STENCIL_BIT)) && - pCreateInfo->imageType == VK_IMAGE_TYPE_3D) + image->vk.image_type == VK_IMAGE_TYPE_3D) usage |= NIL_IMAGE_USAGE_2D_VIEW_BIT; - image->plane_count = vk_format_get_plane_count(pCreateInfo->format); + image->plane_count = vk_format_get_plane_count(image->vk.format); image->disjoint = image->plane_count > 1 && - (pCreateInfo->flags & VK_IMAGE_CREATE_DISJOINT_BIT); + (image->vk.create_flags & VK_IMAGE_CREATE_DISJOINT_BIT); if (image->vk.create_flags & VK_IMAGE_CREATE_SPARSE_RESIDENCY_BIT) { /* Sparse multiplane is not supported */ @@ -835,7 +835,7 @@ nvk_image_init(struct nvk_device *dev, IMAGE_DRM_FORMAT_MODIFIER_LIST_CREATE_INFO_EXT); enum pipe_format p_format = - nvk_format_to_pipe_format(pCreateInfo->format); + nvk_format_to_pipe_format(image->vk.format); image->vk.drm_format_mod = nil_select_best_drm_format_mod(&pdev->info, nil_format(p_format), mod_list_info->drmFormatModifierCount, @@ -848,17 +848,17 @@ nvk_image_init(struct nvk_device *dev, assert(image->plane_count == 1); struct nil_image_init_info tiled_shadow_nil_info = { - .dim = vk_image_type_to_nil_dim(pCreateInfo->imageType), + .dim = vk_image_type_to_nil_dim(image->vk.image_type), .format = nil_format(nvk_format_to_pipe_format(image->vk.format)), .modifier = DRM_FORMAT_MOD_INVALID, .extent_px = { - .width = pCreateInfo->extent.width, - .height = pCreateInfo->extent.height, - .depth = pCreateInfo->extent.depth, - .array_len = pCreateInfo->arrayLayers, + .width = image->vk.extent.width, + .height = image->vk.extent.height, + .depth = image->vk.extent.depth, + .array_len = image->vk.array_layers, }, - .levels = pCreateInfo->mipLevels, - .samples = pCreateInfo->samples, + .levels = image->vk.mip_levels, + .samples = image->vk.samples, .usage = usage & ~NIL_IMAGE_USAGE_LINEAR_BIT, .explicit_row_stride_B = 0, .max_alignment_B = 0, @@ -874,28 +874,28 @@ nvk_image_init(struct nvk_device *dev, * use the smallest block size for all planes. */ const struct vk_format_ycbcr_info *ycbcr_info = - vk_format_get_ycbcr_info(pCreateInfo->format); + vk_format_get_ycbcr_info(image->vk.format); struct nil_image_init_info nil_info[NVK_MAX_IMAGE_PLANES]; for (uint8_t plane = 0; plane < image->plane_count; plane++) { VkFormat format = ycbcr_info ? - ycbcr_info->planes[plane].format : pCreateInfo->format; + ycbcr_info->planes[plane].format : image->vk.format; const uint8_t width_scale = ycbcr_info ? ycbcr_info->planes[plane].denominator_scales[0] : 1; const uint8_t height_scale = ycbcr_info ? ycbcr_info->planes[plane].denominator_scales[1] : 1; nil_info[plane] = (struct nil_image_init_info) { - .dim = vk_image_type_to_nil_dim(pCreateInfo->imageType), + .dim = vk_image_type_to_nil_dim(image->vk.image_type), .format = nil_format(nvk_format_to_pipe_format(format)), .modifier = image->vk.drm_format_mod, .extent_px = { - .width = pCreateInfo->extent.width / width_scale, - .height = pCreateInfo->extent.height / height_scale, - .depth = pCreateInfo->extent.depth, - .array_len = pCreateInfo->arrayLayers, + .width = image->vk.extent.width / width_scale, + .height = image->vk.extent.height / height_scale, + .depth = image->vk.extent.depth, + .array_len = image->vk.array_layers, }, - .levels = pCreateInfo->mipLevels, - .samples = pCreateInfo->samples, + .levels = image->vk.mip_levels, + .samples = image->vk.samples, .usage = usage, .explicit_row_stride_B = explicit_row_stride_B, .max_alignment_B = max_alignment_B, @@ -917,17 +917,17 @@ nvk_image_init(struct nvk_device *dev, if (image->vk.format == VK_FORMAT_D32_SFLOAT_S8_UINT) { struct nil_image_init_info stencil_nil_info = { - .dim = vk_image_type_to_nil_dim(pCreateInfo->imageType), + .dim = vk_image_type_to_nil_dim(image->vk.image_type), .format = nil_format(PIPE_FORMAT_R32_UINT), .modifier = DRM_FORMAT_MOD_INVALID, .extent_px = { - .width = pCreateInfo->extent.width, - .height = pCreateInfo->extent.height, - .depth = pCreateInfo->extent.depth, - .array_len = pCreateInfo->arrayLayers, + .width = image->vk.extent.width, + .height = image->vk.extent.height, + .depth = image->vk.extent.depth, + .array_len = image->vk.array_layers, }, - .levels = pCreateInfo->mipLevels, - .samples = pCreateInfo->samples, + .levels = image->vk.mip_levels, + .samples = image->vk.samples, .usage = usage, .explicit_row_stride_B = 0, .max_alignment_B = 0,