From 8c70c8f60ff95fdb2e7947cd97708f364bcb41b4 Mon Sep 17 00:00:00 2001 From: Mohamed Ahmed Date: Wed, 12 Feb 2025 18:37:47 +0200 Subject: [PATCH] nvk: Add NVK_MAX_IMAGE_PLANES for images Reviewed-by: Faith Ekstrand Part-of: --- src/nouveau/vulkan/nvk_descriptor_set.c | 2 +- src/nouveau/vulkan/nvk_image.h | 2 +- src/nouveau/vulkan/nvk_image_view.h | 4 ++-- src/nouveau/vulkan/nvk_physical_device.c | 2 +- src/nouveau/vulkan/nvk_private.h | 2 ++ 5 files changed, 7 insertions(+), 5 deletions(-) diff --git a/src/nouveau/vulkan/nvk_descriptor_set.c b/src/nouveau/vulkan/nvk_descriptor_set.c index 8d033ac4058..ab8bb9e6404 100644 --- a/src/nouveau/vulkan/nvk_descriptor_set.c +++ b/src/nouveau/vulkan/nvk_descriptor_set.c @@ -55,7 +55,7 @@ get_sampled_image_view_desc(VkDescriptorType descriptor_type, const VkDescriptorImageInfo *const info, void *dst, size_t dst_size) { - struct nvk_sampled_image_descriptor desc[3] = { }; + struct nvk_sampled_image_descriptor desc[NVK_MAX_IMAGE_PLANES] = { }; uint8_t plane_count = 1; if (descriptor_type != VK_DESCRIPTOR_TYPE_SAMPLER && diff --git a/src/nouveau/vulkan/nvk_image.h b/src/nouveau/vulkan/nvk_image.h index 491d250e01a..20084475c92 100644 --- a/src/nouveau/vulkan/nvk_image.h +++ b/src/nouveau/vulkan/nvk_image.h @@ -80,7 +80,7 @@ struct nvk_image { bool disjoint; uint8_t plane_count; - struct nvk_image_plane planes[3]; + struct nvk_image_plane planes[NVK_MAX_IMAGE_PLANES]; /* In order to support D32_SFLOAT_S8_UINT, a temp area is * needed. The stencil plane can't be a copied using the DMA diff --git a/src/nouveau/vulkan/nvk_image_view.h b/src/nouveau/vulkan/nvk_image_view.h index a2f402aec55..c818ef93256 100644 --- a/src/nouveau/vulkan/nvk_image_view.h +++ b/src/nouveau/vulkan/nvk_image_view.h @@ -27,7 +27,7 @@ struct nvk_image_view { /** Index in the image descriptor table for the storage image descriptor */ uint32_t storage_desc_index; - } planes[3]; + } planes[NVK_MAX_IMAGE_PLANES]; }; VK_DEFINE_NONDISP_HANDLE_CASTS(nvk_image_view, vk.base, VkImageView, @@ -37,7 +37,7 @@ struct nvk_image_view_capture { struct { uint32_t sampled_desc_index; uint32_t storage_desc_index; - } planes[3]; + } planes[NVK_MAX_IMAGE_PLANES]; }; VkResult nvk_image_view_init(struct nvk_device *dev, diff --git a/src/nouveau/vulkan/nvk_physical_device.c b/src/nouveau/vulkan/nvk_physical_device.c index 84056c49e90..afedf4d64fe 100644 --- a/src/nouveau/vulkan/nvk_physical_device.c +++ b/src/nouveau/vulkan/nvk_physical_device.c @@ -954,7 +954,7 @@ nvk_get_device_properties(const struct nvk_instance *instance, .nonStrictSinglePixelWideLinesUseParallelogram = false, .nonStrictWideLinesUseParallelogram = false, .blockTexelViewCompatibleMultipleLayers = true, - .maxCombinedImageSamplerDescriptorCount = 3, + .maxCombinedImageSamplerDescriptorCount = NVK_MAX_IMAGE_PLANES, .fragmentShadingRateClampCombinerInputs = false, /* TODO */ .defaultRobustnessStorageBuffers = VK_PIPELINE_ROBUSTNESS_BUFFER_BEHAVIOR_DISABLED_EXT, diff --git a/src/nouveau/vulkan/nvk_private.h b/src/nouveau/vulkan/nvk_private.h index 8ef6e6223c8..89ede97d9f0 100644 --- a/src/nouveau/vulkan/nvk_private.h +++ b/src/nouveau/vulkan/nvk_private.h @@ -35,6 +35,8 @@ /* Max size of a bound cbuf */ #define NVK_MAX_CBUF_SIZE (1u << 16) +#define NVK_MAX_IMAGE_PLANES 3 + struct nvk_addr_range { uint64_t addr; uint64_t range;