From: Mike Blumenkrantz Date: Mon, 20 Feb 2023 13:51:31 +0000 (-0500) Subject: zink: move db input attachment size check to screen init X-Git-Tag: upstream/23.3.3~12809 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=685bd95de9187faa8e17115f48dbe5456ef310ec;p=platform%2Fupstream%2Fmesa.git zink: move db input attachment size check to screen init it'd be weird to crash later on after allowing db mode to init Part-of: --- diff --git a/src/gallium/drivers/zink/zink_context.c b/src/gallium/drivers/zink/zink_context.c index bf5ac2f..489b722 100644 --- a/src/gallium/drivers/zink/zink_context.c +++ b/src/gallium/drivers/zink/zink_context.c @@ -5220,7 +5220,6 @@ zink_context_create(struct pipe_screen *pscreen, void *priv, unsigned flags) } } if (zink_descriptor_mode == ZINK_DESCRIPTOR_MODE_DB) { - assert(sizeof(ctx->di.fbfetch_db) <= screen->info.db_props.inputAttachmentDescriptorSize); /* cache null fbfetch descriptor info */ ctx->di.fbfetch.imageView = zink_get_dummy_surface(ctx, 0)->image_view; ctx->di.fbfetch.imageLayout = VK_IMAGE_LAYOUT_GENERAL; diff --git a/src/gallium/drivers/zink/zink_screen.c b/src/gallium/drivers/zink/zink_screen.c index 9e68faf..d468913 100644 --- a/src/gallium/drivers/zink/zink_screen.c +++ b/src/gallium/drivers/zink/zink_screen.c @@ -2905,6 +2905,10 @@ zink_internal_create_screen(const struct pipe_screen_config *config) mesa_loge("Cannot use db descriptor mode without robustness2.nullDescriptor"); goto fail; } + if (ZINK_FBFETCH_DESCRIPTOR_SIZE < screen->info.db_props.inputAttachmentDescriptorSize) { + mesa_loge("Cannot use db descriptor mode with inputAttachmentDescriptorSize(%u) > %u", (unsigned)screen->info.db_props.inputAttachmentDescriptorSize, ZINK_FBFETCH_DESCRIPTOR_SIZE); + goto fail; + } if (screen->compact_descriptors) { /* TODO: bindless */ if (screen->info.db_props.maxDescriptorBufferBindings < 3) { diff --git a/src/gallium/drivers/zink/zink_types.h b/src/gallium/drivers/zink/zink_types.h index 2aa87c9..c0025b7 100644 --- a/src/gallium/drivers/zink/zink_types.h +++ b/src/gallium/drivers/zink/zink_types.h @@ -79,6 +79,8 @@ /* enum zink_descriptor_type */ #define ZINK_MAX_DESCRIPTOR_SETS 6 #define ZINK_MAX_DESCRIPTORS_PER_TYPE (32 * ZINK_GFX_SHADER_COUNT) +/* max size from gpuinfo */ +#define ZINK_FBFETCH_DESCRIPTOR_SIZE 64 /* suballocator defines */ #define NUM_SLAB_ALLOCATORS 3 @@ -1775,7 +1777,7 @@ struct zink_context { }; VkDescriptorImageInfo fbfetch; - uint8_t fbfetch_db[64]; //max size from gpuinfo + uint8_t fbfetch_db[ZINK_FBFETCH_DESCRIPTOR_SIZE]; /* the current state of the shadow swizzle data */ struct zink_fs_shadow_key shadow;