zink: pass screen to zink_create_instance

This allows us to pass in some more details, like handles to the
loader-library to avoid a hard dependency.

Reviewed-by: Hoe Hao Cheng <haochengho12907@gmail.com>
Reviewed-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11550>
This commit is contained in:
Erik Faye-Lund
2021-06-23 10:01:25 +02:00
committed by Marge Bot
parent 4654a57bb5
commit d91cb5cbcc
2 changed files with 10 additions and 10 deletions

View File

@@ -91,8 +91,8 @@ struct zink_instance_info {
%endfor
};
VkInstance
zink_create_instance(struct zink_instance_info *instance_info);
bool
zink_create_instance(struct zink_screen *screen);
void
zink_verify_instance_extensions(struct zink_screen *screen);
@@ -121,9 +121,11 @@ impl_code = """
#include "zink_instance.h"
#include "zink_screen.h"
VkInstance
zink_create_instance(struct zink_instance_info *instance_info)
bool
zink_create_instance(struct zink_screen *screen)
{
struct zink_instance_info *instance_info = &screen->instance_info;
/* reserve one slot for MoltenVK */
const char *layers[${len(layers) + 1}] = {0};
uint32_t num_layers = 0;
@@ -242,14 +244,13 @@ zink_create_instance(struct zink_instance_info *instance_info)
ici.ppEnabledLayerNames = layers;
ici.enabledLayerCount = num_layers;
VkInstance instance = VK_NULL_HANDLE;
VkResult err = vkCreateInstance(&ici, NULL, &instance);
VkResult err = vkCreateInstance(&ici, NULL, &screen->instance);
if (err != VK_SUCCESS) {
mesa_loge("ZINK: vkCreateInstance failed");
return VK_NULL_HANDLE;
return false;
}
return instance;
return true;
}
void

View File

@@ -2056,9 +2056,8 @@ zink_internal_create_screen(const struct pipe_screen_config *config)
screen->instance_info.disable_xcb_surface = driQueryOptionb(config->options, "disable_xcb_surface");
}
#endif
screen->instance = zink_create_instance(&screen->instance_info);
if (!screen->instance)
if (!zink_create_instance(screen))
goto fail;
vk_instance_dispatch_table_load(&screen->vk.instance, &vkGetInstanceProcAddr, screen->instance);