Mesa (main): dzn: Make sure sampler heaps don't contain more than 2048 samplers
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Thu Apr 14 14:11:54 UTC 2022
Module: Mesa
Branch: main
Commit: 31ea1fcd14831ff3df2b06c921eecc4261502c65
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=31ea1fcd14831ff3df2b06c921eecc4261502c65
Author: Boris Brezillon <boris.brezillon at collabora.com>
Date: Mon Apr 11 05:20:04 2022 -0700
dzn: Make sure sampler heaps don't contain more than 2048 samplers
The spec says "The maximum number of samplers in a shader visible
descriptor heap is 2048.". Let's make sure we follow this rule
in dozen.
Acked-by: Erik Faye-Lund <erik.faye-lund at collabora.com>
Reviewed-by: Jesse Natalie <jenatali at microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15884>
---
src/microsoft/vulkan/dzn_descriptor_set.cpp | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/src/microsoft/vulkan/dzn_descriptor_set.cpp b/src/microsoft/vulkan/dzn_descriptor_set.cpp
index b98d51373d2..7cfba972930 100644
--- a/src/microsoft/vulkan/dzn_descriptor_set.cpp
+++ b/src/microsoft/vulkan/dzn_descriptor_set.cpp
@@ -1446,6 +1446,14 @@ dzn_descriptor_heap_pool_alloc_slots(dzn_descriptor_heap_pool *pool,
64 * 1024 : 4 * 1024;
uint32_t alloc_step = ALIGN_POT(desc_count * pool->desc_sz, granularity);
uint32_t heap_desc_count = MAX2(alloc_step / pool->desc_sz, 16);
+
+ /* Maximum of 2048 samplers per heap when shader_visible is true. */
+ if (pool->shader_visible &&
+ pool->type == D3D12_DESCRIPTOR_HEAP_TYPE_SAMPLER) {
+ assert(desc_count <= 2048);
+ heap_desc_count = MIN2(heap_desc_count, 2048);
+ }
+
dzn_descriptor_heap_pool_entry *new_heap = NULL;
list_for_each_entry_safe(dzn_descriptor_heap_pool_entry, entry, &pool->free_heaps, link) {
More information about the mesa-commit
mailing list