summaryrefslogtreecommitdiff
path: root/src/amd
diff options
context:
space:
mode:
authorBas Nieuwenhuizen <bas@basnieuwenhuizen.nl>2017-04-13 22:34:33 +0200
committerBas Nieuwenhuizen <bas@basnieuwenhuizen.nl>2017-04-13 22:55:11 +0200
commit17a75b4da4417226e4b4c34ae87e9b9453187625 (patch)
tree6fb8fda1b6e228bc633df457890c46b612865472 /src/amd
parent24ccf1a8b692ae039a778438dd1fe49c6e048b84 (diff)
radv: Set descriptor set limits.
Properly and with comments this time. Signed-off-by: Bas Nieuwenhuizen <bansi@google.com> Reviewed-by: Dave Airlie <airlied@redhat.com>
Diffstat (limited to 'src/amd')
-rw-r--r--src/amd/vulkan/radv_device.c44
1 files changed, 29 insertions, 15 deletions
diff --git a/src/amd/vulkan/radv_device.c b/src/amd/vulkan/radv_device.c
index 69b6a115c1..8783ad4e1b 100644
--- a/src/amd/vulkan/radv_device.c
+++ b/src/amd/vulkan/radv_device.c
@@ -542,6 +542,20 @@ void radv_GetPhysicalDeviceProperties(
{
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) /
+ (32 /* uniform buffer, 32 due to potential space wasted on alignement */ +
+ 32 /* storage buffer, 32 due to potential space wasted on alignement */ +
+ 32 /* sampler, largest when combined with image */ +
+ 64 /* sampled image */ +
+ 64 /* storage image */);
+
VkPhysicalDeviceLimits limits = {
.maxImageDimension1D = (1 << 14),
.maxImageDimension2D = (1 << 14),
@@ -557,21 +571,21 @@ void radv_GetPhysicalDeviceProperties(
.bufferImageGranularity = 64, /* A cache line */
.sparseAddressSpaceSize = 0xffffffffu, /* buffer max size */
.maxBoundDescriptorSets = MAX_SETS,
- .maxPerStageDescriptorSamplers = (1u << 31) / 16,
- .maxPerStageDescriptorUniformBuffers = (1u << 31) / 16,
- .maxPerStageDescriptorStorageBuffers = (1u << 31) / 16,
- .maxPerStageDescriptorSampledImages = (1u << 31) / 96,
- .maxPerStageDescriptorStorageImages = (1u << 31) / 64,
- .maxPerStageDescriptorInputAttachments = (1u << 31) / 64,
- .maxPerStageResources = (1u << 31) / 32,
- .maxDescriptorSetSamplers = 256,
- .maxDescriptorSetUniformBuffers = (1u << 31) / 16,
- .maxDescriptorSetUniformBuffersDynamic = 8,
- .maxDescriptorSetStorageBuffers = (1u << 31) / 16,
- .maxDescriptorSetStorageBuffersDynamic = 8,
- .maxDescriptorSetSampledImages = (1u << 31) / 96,
- .maxDescriptorSetStorageImages = (1u << 31) / 64,
- .maxDescriptorSetInputAttachments = (1u << 31) / 64,
+ .maxPerStageDescriptorSamplers = max_descriptor_set_size,
+ .maxPerStageDescriptorUniformBuffers = max_descriptor_set_size,
+ .maxPerStageDescriptorStorageBuffers = max_descriptor_set_size,
+ .maxPerStageDescriptorSampledImages = max_descriptor_set_size,
+ .maxPerStageDescriptorStorageImages = max_descriptor_set_size,
+ .maxPerStageDescriptorInputAttachments = max_descriptor_set_size,
+ .maxPerStageResources = max_descriptor_set_size,
+ .maxDescriptorSetSamplers = max_descriptor_set_size,
+ .maxDescriptorSetUniformBuffers = max_descriptor_set_size,
+ .maxDescriptorSetUniformBuffersDynamic = MAX_DYNAMIC_BUFFERS / 2,
+ .maxDescriptorSetStorageBuffers = max_descriptor_set_size,
+ .maxDescriptorSetStorageBuffersDynamic = MAX_DYNAMIC_BUFFERS / 2,
+ .maxDescriptorSetSampledImages = max_descriptor_set_size,
+ .maxDescriptorSetStorageImages = max_descriptor_set_size,
+ .maxDescriptorSetInputAttachments = max_descriptor_set_size,
.maxVertexInputAttributes = 32,
.maxVertexInputBindings = 32,
.maxVertexInputAttributeOffset = 2047,