diff options
author | Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl> | 2019-11-28 00:36:24 +0100 |
---|---|---|
committer | Dylan Baker <dylan@pnwbakers.com> | 2019-12-04 13:43:32 -0800 |
commit | 52a8d43a24f2e61347ab3a8b15a7742742863114 (patch) | |
tree | e4e7cef18c8d120a889001e47bccea42599538c5 | |
parent | 2e379b0a65c416cf94d21128ab2460b093333681 (diff) |
radv: Unify max_descriptor_set_size.
They were out of sync. Besides syncing, lets ensure they never diverge
again.
Fixes: 8d2654a4197 "radv: Support VK_EXT_inline_uniform_block."
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
(cherry picked from commit 4cde0e04e38ad2b9212d451cb5a84ed4ceaffd03)
-rw-r--r-- | src/amd/vulkan/radv_device.c | 29 |
1 files changed, 15 insertions, 14 deletions
diff --git a/src/amd/vulkan/radv_device.c b/src/amd/vulkan/radv_device.c index 098e9fdfe5b..b9ce8e1c02e 100644 --- a/src/amd/vulkan/radv_device.c +++ b/src/amd/vulkan/radv_device.c @@ -1075,25 +1075,32 @@ void radv_GetPhysicalDeviceFeatures2( return radv_GetPhysicalDeviceFeatures(physicalDevice, &pFeatures->features); } -void radv_GetPhysicalDeviceProperties( - VkPhysicalDevice physicalDevice, - VkPhysicalDeviceProperties* pProperties) +static size_t +radv_max_descriptor_set_size() { - RADV_FROM_HANDLE(radv_physical_device, pdevice, physicalDevice); - VkSampleCountFlags sample_counts = 0xf; - /* make sure that the entire descriptor set is addressable with a signed * 32-bit int. So the sum of all limits scaled by descriptor size has to * be at most 2 GiB. the combined image & samples object count as one of * both. This limit is for the pipeline layout, not for the set layout, but * there is no set limit, so we just set a pipeline limit. I don't think * any app is going to hit this soon. */ - size_t max_descriptor_set_size = ((1ull << 31) - 16 * MAX_DYNAMIC_BUFFERS) / + return ((1ull << 31) - 16 * MAX_DYNAMIC_BUFFERS + - MAX_INLINE_UNIFORM_BLOCK_SIZE * MAX_INLINE_UNIFORM_BLOCK_COUNT) / (32 /* uniform buffer, 32 due to potential space wasted on alignment */ + 32 /* storage buffer, 32 due to potential space wasted on alignment */ + 32 /* sampler, largest when combined with image */ + 64 /* sampled image */ + 64 /* storage image */); +} + +void radv_GetPhysicalDeviceProperties( + VkPhysicalDevice physicalDevice, + VkPhysicalDeviceProperties* pProperties) +{ + RADV_FROM_HANDLE(radv_physical_device, pdevice, physicalDevice); + VkSampleCountFlags sample_counts = 0xf; + + size_t max_descriptor_set_size = radv_max_descriptor_set_size(); VkPhysicalDeviceLimits limits = { .maxImageDimension1D = (1 << 14), @@ -1362,13 +1369,7 @@ void radv_GetPhysicalDeviceProperties2( properties->robustBufferAccessUpdateAfterBind = false; properties->quadDivergentImplicitLod = false; - size_t max_descriptor_set_size = ((1ull << 31) - 16 * MAX_DYNAMIC_BUFFERS - - MAX_INLINE_UNIFORM_BLOCK_SIZE * MAX_INLINE_UNIFORM_BLOCK_COUNT) / - (32 /* uniform buffer, 32 due to potential space wasted on alignment */ + - 32 /* storage buffer, 32 due to potential space wasted on alignment */ + - 32 /* sampler, largest when combined with image */ + - 64 /* sampled image */ + - 64 /* storage image */); + size_t max_descriptor_set_size = radv_max_descriptor_set_size(); properties->maxPerStageDescriptorUpdateAfterBindSamplers = max_descriptor_set_size; properties->maxPerStageDescriptorUpdateAfterBindUniformBuffers = max_descriptor_set_size; properties->maxPerStageDescriptorUpdateAfterBindStorageBuffers = max_descriptor_set_size; |