From cd582fa0166d94ca5c3f8db5d4ce524eda563a2e Mon Sep 17 00:00:00 2001 From: Mike Blumenkrantz Date: Tue, 20 Feb 2024 09:05:23 -0500 Subject: [PATCH] zink: add checks/compat for low-spec descriptor buffer implementations for implementations that can only support 1 descriptor buffer: * prefer templates * allow db if explicitly requested, but disable bindless (for testing) fix #10640 Fixes: b8b51d96b01 ("zink: delete maxDescriptorBufferBindings checks") Part-of: (cherry picked from commit 83d1241cf5be73027531c6c341e4d896b1441792) --- .pick_status.json | 2 +- src/gallium/drivers/zink/zink_screen.c | 11 +++++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/.pick_status.json b/.pick_status.json index da743b8040a..8523b07a156 100644 --- a/.pick_status.json +++ b/.pick_status.json @@ -2314,7 +2314,7 @@ "description": "zink: add checks/compat for low-spec descriptor buffer implementations", "nominated": true, "nomination_type": 1, - "resolution": 0, + "resolution": 1, "main_sha": null, "because_sha": "b8b51d96b0146028ecb5c58703707fe994540119", "notes": null diff --git a/src/gallium/drivers/zink/zink_screen.c b/src/gallium/drivers/zink/zink_screen.c index dacad5cfa82..2c1b6c3ef37 100644 --- a/src/gallium/drivers/zink/zink_screen.c +++ b/src/gallium/drivers/zink/zink_screen.c @@ -837,6 +837,9 @@ zink_get_param(struct pipe_screen *pscreen, enum pipe_cap param) return 1; case PIPE_CAP_BINDLESS_TEXTURE: + if (zink_descriptor_mode == ZINK_DESCRIPTOR_MODE_DB && + (screen->info.db_props.maxDescriptorBufferBindings < 2 || screen->info.db_props.maxSamplerDescriptorBufferBindings < 2)) + return 0; return screen->info.have_EXT_descriptor_indexing; case PIPE_CAP_TEXTURE_BUFFER_OFFSET_ALIGNMENT: @@ -3465,6 +3468,14 @@ zink_internal_create_screen(const struct pipe_screen_config *config, int64_t dev mesa_logw("zink: bug detected: inputAttachmentDescriptorSize(%u) > %u", (unsigned)screen->info.db_props.inputAttachmentDescriptorSize, ZINK_FBFETCH_DESCRIPTOR_SIZE); can_db = false; } + if (screen->info.db_props.maxDescriptorBufferBindings < 2 || screen->info.db_props.maxSamplerDescriptorBufferBindings < 2) { + if (zink_descriptor_mode == ZINK_DESCRIPTOR_MODE_DB) { + /* allow for testing, but disable bindless */ + mesa_logw("Cannot use bindless and db descriptor mode with (maxDescriptorBufferBindings||maxSamplerDescriptorBufferBindings) < 2"); + } else { + can_db = false; + } + } } if (zink_descriptor_mode == ZINK_DESCRIPTOR_MODE_AUTO) { /* descriptor buffer is not performant with virt yet */