Mesa (staging/19.0): anv: Add a #define for the max binding table size
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Mon Apr 22 16:08:13 UTC 2019
Module: Mesa
Branch: staging/19.0
Commit: 2397f5d99dc3f39c83fda1836da160e54366d377
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=2397f5d99dc3f39c83fda1836da160e54366d377
Author: Jason Ekstrand <jason at jlekstrand.net>
Date: Tue Apr 16 17:35:05 2019 -0500
anv: Add a #define for the max binding table size
This also fixes a bug where we mis-calculate maximum binding table sizes
and may return true in vkGetDescriptorSetLayoutSupport even for sets too
large to fit in a binding table.
Fixes: ddc40691221 "anv: Implement VK_KHR_maintenance3"
Reviewed-by: Caio Marcelo de Oliveira Filho <caio.oliveira at intel.com>
(cherry picked from commit a5a0dc08f18928a080e3393ebc694bc7053216fb)
---
src/intel/vulkan/anv_descriptor_set.c | 6 +++---
src/intel/vulkan/anv_device.c | 2 +-
src/intel/vulkan/anv_private.h | 12 ++++++++++++
3 files changed, 16 insertions(+), 4 deletions(-)
diff --git a/src/intel/vulkan/anv_descriptor_set.c b/src/intel/vulkan/anv_descriptor_set.c
index 26fb9c9169a..5bb5d5d85fa 100644
--- a/src/intel/vulkan/anv_descriptor_set.c
+++ b/src/intel/vulkan/anv_descriptor_set.c
@@ -73,10 +73,10 @@ void anv_GetDescriptorSetLayoutSupport(
bool supported = true;
for (unsigned s = 0; s < MESA_SHADER_STAGES; s++) {
- /* Our maximum binding table size is 250 and we need to reserve 8 for
- * render targets. 240 is a nice round number.
+ /* Our maximum binding table size is 240 and we need to reserve 8 for
+ * render targets.
*/
- if (surface_count[s] >= 240)
+ if (surface_count[s] >= MAX_BINDING_TABLE_SIZE - MAX_RTS)
supported = false;
}
diff --git a/src/intel/vulkan/anv_device.c b/src/intel/vulkan/anv_device.c
index aa3d948042f..a71bba806f8 100644
--- a/src/intel/vulkan/anv_device.c
+++ b/src/intel/vulkan/anv_device.c
@@ -1029,7 +1029,7 @@ void anv_GetPhysicalDeviceProperties(
.maxPerStageDescriptorSampledImages = max_samplers,
.maxPerStageDescriptorStorageImages = max_images,
.maxPerStageDescriptorInputAttachments = 64,
- .maxPerStageResources = 250,
+ .maxPerStageResources = MAX_BINDING_TABLE_SIZE - MAX_RTS,
.maxDescriptorSetSamplers = 6 * max_samplers, /* number of stages * maxPerStageDescriptorSamplers */
.maxDescriptorSetUniformBuffers = 6 * 64, /* number of stages * maxPerStageDescriptorUniformBuffers */
.maxDescriptorSetUniformBuffersDynamic = MAX_DYNAMIC_BUFFERS / 2,
diff --git a/src/intel/vulkan/anv_private.h b/src/intel/vulkan/anv_private.h
index 1d42332a370..75de9c24e2e 100644
--- a/src/intel/vulkan/anv_private.h
+++ b/src/intel/vulkan/anv_private.h
@@ -163,6 +163,18 @@ struct gen_l3_config;
#define MAX_GEN8_IMAGES 8
#define MAX_PUSH_DESCRIPTORS 32 /* Minimum requirement */
+/* From the Skylake PRM Vol. 7 "Binding Table Surface State Model":
+ *
+ * "The surface state model is used when a Binding Table Index (specified
+ * in the message descriptor) of less than 240 is specified. In this model,
+ * the Binding Table Index is used to index into the binding table, and the
+ * binding table entry contains a pointer to the SURFACE_STATE."
+ *
+ * Binding table values above 240 are used for various things in the hardware
+ * such as stateless, stateless with incoherent cache, SLM, and bindless.
+ */
+#define MAX_BINDING_TABLE_SIZE 240
+
/* The kernel relocation API has a limitation of a 32-bit delta value
* applied to the address before it is written which, in spite of it being
* unsigned, is treated as signed . Because of the way that this maps to
More information about the mesa-commit
mailing list