zink: add a fixup method for extra driver props

some extensions have "extra" props which need the get_count -> get_prop_array
dance, and codegen is too stupid to figure this out (and probably always will be)

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24775>
This commit is contained in:
Mike Blumenkrantz 2023-08-18 11:06:49 -04:00 committed by Marge Bot
parent 9ff5026100
commit 9907573d98
2 changed files with 29 additions and 0 deletions

View file

@ -2839,6 +2839,32 @@ init_driver_workarounds(struct zink_screen *screen)
screen->info.have_EXT_host_image_copy = false;
}
static void
fixup_driver_props(struct zink_screen *screen)
{
VkPhysicalDeviceProperties2 props = {
VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PROPERTIES_2
};
if (screen->info.have_EXT_host_image_copy) {
/* fill in layouts */
screen->info.hic_props.pNext = props.pNext;
props.pNext = &screen->info.hic_props;
screen->info.hic_props.pCopySrcLayouts = ralloc_array(screen, VkImageLayout, screen->info.hic_props.copySrcLayoutCount);
screen->info.hic_props.pCopyDstLayouts = ralloc_array(screen, VkImageLayout, screen->info.hic_props.copyDstLayoutCount);
}
if (props.pNext)
screen->vk.GetPhysicalDeviceProperties2(screen->pdev, &props);
if (screen->info.have_EXT_host_image_copy) {
for (unsigned i = 0; i < screen->info.hic_props.copyDstLayoutCount; i++) {
if (screen->info.hic_props.pCopyDstLayouts[i] == VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL) {
screen->can_hic_shader_read = true;
break;
}
}
}
}
static void
init_optimal_keys(struct zink_screen *screen)
{
@ -3160,6 +3186,8 @@ zink_internal_create_screen(const struct pipe_screen_config *config, int64_t dev
screen->debug_mem_sizes = _mesa_hash_table_create(screen, _mesa_hash_string, _mesa_key_string_equal);
}
fixup_driver_props(screen);
init_driver_workarounds(screen);
screen->dev = zink_create_logical_device(screen);

View file

@ -1469,6 +1469,7 @@ struct zink_screen {
bool need_2D_zs;
bool need_2D_sparse;
bool faked_e5sparse; //drivers may not expose R9G9B9E5 but cts requires it
bool can_hic_shader_read;
uint32_t gfx_queue;
uint32_t sparse_queue;