From 54efbe0a03610497cd9feac54ec9f0d643556b3e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alejandro=20Pi=C3=B1eiro?= Date: Tue, 4 Aug 2020 23:12:51 +0200 Subject: [PATCH] v3dv/device: add assert for texture-related limits There are several limits that when added shouldn't be greater than V3D_MAX_TEXTURE_SAMPLERS (defined at common/v3d_limits.h), so let's assert it. Part-of: --- src/broadcom/vulkan/v3dv_device.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/broadcom/vulkan/v3dv_device.c b/src/broadcom/vulkan/v3dv_device.c index 39578f5667e..3e63bf43535 100644 --- a/src/broadcom/vulkan/v3dv_device.c +++ b/src/broadcom/vulkan/v3dv_device.c @@ -759,6 +759,9 @@ v3dv_GetPhysicalDeviceProperties(VkPhysicalDevice physicalDevice, const uint32_t max_dynamic_storage_buffers = 6; const uint32_t max_sampled_images = 16; const uint32_t max_storage_images = 4; + const uint32_t max_input_attachments = 4; + assert(max_sampled_images + max_storage_images + max_input_attachments + <= V3D_MAX_TEXTURE_SAMPLERS); const uint32_t max_varying_components = 16 * 4; const uint32_t max_render_targets = 4; @@ -791,7 +794,7 @@ v3dv_GetPhysicalDeviceProperties(VkPhysicalDevice physicalDevice, .maxPerStageDescriptorStorageBuffers = max_storage_buffers, .maxPerStageDescriptorSampledImages = max_sampled_images, .maxPerStageDescriptorStorageImages = max_storage_images, - .maxPerStageDescriptorInputAttachments = 4, + .maxPerStageDescriptorInputAttachments = max_input_attachments, .maxPerStageResources = 128, /* We multiply some limits by 6 to account for all shader stages */