mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-08 11:18:08 +02:00
zink: cache and reuse dummy inputattachment for fbfetch
apparently an actual null descriptor is illegal here, and it's wasted cpu
anyway, so just cache the dummy surface on init and use that data when
fbfetch isn't active but the layout requires it
Fixes: 7ab5c5d36d ("zink: use EXT_descriptor_buffer with ZINK_DESCRIPTORS=db")
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21100>
This commit is contained in:
parent
abf63b7c68
commit
813bb9e442
3 changed files with 27 additions and 7 deletions
|
|
@ -5149,6 +5149,19 @@ zink_context_create(struct pipe_screen *pscreen, void *priv, unsigned flags)
|
|||
ctx->di.db.texel_images[i][j].sType = VK_STRUCTURE_TYPE_DESCRIPTOR_ADDRESS_INFO_EXT;
|
||||
}
|
||||
}
|
||||
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;
|
||||
VkDescriptorGetInfoEXT info;
|
||||
info.sType = VK_STRUCTURE_TYPE_DESCRIPTOR_GET_INFO_EXT;
|
||||
info.pNext = NULL;
|
||||
info.type = VK_DESCRIPTOR_TYPE_INPUT_ATTACHMENT;
|
||||
info.data.pInputAttachmentImage = &ctx->di.fbfetch;
|
||||
VKSCR(GetDescriptorEXT)(screen->dev, &info, screen->info.db_props.inputAttachmentDescriptorSize, ctx->di.fbfetch_db);
|
||||
memset(&ctx->di.fbfetch, 0, sizeof(ctx->di.fbfetch));
|
||||
}
|
||||
if (!screen->info.rb2_feats.nullDescriptor)
|
||||
ctx->di.fbfetch.imageView = zink_get_dummy_surface(ctx, 0)->image_view;
|
||||
|
||||
|
|
|
|||
|
|
@ -1140,14 +1140,20 @@ zink_descriptors_update(struct zink_context *ctx, bool is_compute)
|
|||
bs->dd.db_map[ZINK_DESCRIPTOR_TYPE_UNIFORMS] + stage_offset);
|
||||
}
|
||||
if (!is_compute && ctx->dd.has_fbfetch) {
|
||||
VkDescriptorGetInfoEXT info;
|
||||
info.sType = VK_STRUCTURE_TYPE_DESCRIPTOR_GET_INFO_EXT;
|
||||
info.pNext = NULL;
|
||||
info.type = VK_DESCRIPTOR_TYPE_INPUT_ATTACHMENT;
|
||||
info.data.pInputAttachmentImage = &ctx->di.fbfetch;
|
||||
uint64_t stage_offset = offset + ctx->dd.db_offset[MESA_SHADER_FRAGMENT + 1];
|
||||
VKSCR(GetDescriptorEXT)(screen->dev, &info, screen->info.db_props.robustUniformBufferDescriptorSize,
|
||||
bs->dd.db_map[ZINK_DESCRIPTOR_TYPE_UNIFORMS] + stage_offset);
|
||||
if (pg->dd.fbfetch) {
|
||||
/* real fbfetch descriptor */
|
||||
VkDescriptorGetInfoEXT info;
|
||||
info.sType = VK_STRUCTURE_TYPE_DESCRIPTOR_GET_INFO_EXT;
|
||||
info.pNext = NULL;
|
||||
info.type = VK_DESCRIPTOR_TYPE_INPUT_ATTACHMENT;
|
||||
info.data.pInputAttachmentImage = &ctx->di.fbfetch;
|
||||
VKSCR(GetDescriptorEXT)(screen->dev, &info, screen->info.db_props.inputAttachmentDescriptorSize,
|
||||
bs->dd.db_map[ZINK_DESCRIPTOR_TYPE_UNIFORMS] + stage_offset);
|
||||
} else {
|
||||
/* reuse cached dummy descriptor */
|
||||
memcpy(bs->dd.db_map[ZINK_DESCRIPTOR_TYPE_UNIFORMS] + stage_offset, ctx->di.fbfetch_db, screen->info.db_props.inputAttachmentDescriptorSize);
|
||||
}
|
||||
}
|
||||
bs->dd.cur_db_offset[ZINK_DESCRIPTOR_TYPE_UNIFORMS] = bs->dd.db_offset[ZINK_DESCRIPTOR_TYPE_UNIFORMS];
|
||||
bs->dd.db_offset[ZINK_DESCRIPTOR_TYPE_UNIFORMS] += ctx->dd.db_size[is_compute];
|
||||
|
|
|
|||
|
|
@ -1737,6 +1737,7 @@ struct zink_context {
|
|||
};
|
||||
|
||||
VkDescriptorImageInfo fbfetch;
|
||||
uint8_t fbfetch_db[64]; //max size from gpuinfo
|
||||
|
||||
/* the current state of the shadow swizzle data */
|
||||
struct zink_fs_shadow_key shadow;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue