From 99a0864b481eaf3e8c50e6057628779096747333 Mon Sep 17 00:00:00 2001 From: Erik Faye-Lund Date: Sun, 26 May 2019 10:42:51 +0200 Subject: [PATCH] wgl: move screen-init to a helper This will be useful in the next commit. Reviewed-by: Neha Bhende Part-of: --- src/gallium/state_trackers/wgl/stw_device.c | 31 +++++++++++++-------- 1 file changed, 19 insertions(+), 12 deletions(-) diff --git a/src/gallium/state_trackers/wgl/stw_device.c b/src/gallium/state_trackers/wgl/stw_device.c index 7c887194b5c..86906ececc0 100644 --- a/src/gallium/state_trackers/wgl/stw_device.c +++ b/src/gallium/state_trackers/wgl/stw_device.c @@ -80,12 +80,28 @@ get_refresh_rate(void) } } +static bool +init_screen(const struct stw_winsys *stw_winsys) +{ + struct pipe_screen *screen = stw_winsys->create_screen(); + if (!screen) + return false; + + if (stw_winsys->get_adapter_luid) + stw_winsys->get_adapter_luid(screen, &stw_dev->AdapterLuid); + + stw_dev->smapi->screen = screen; + stw_dev->screen = screen; + + stw_dev->max_2d_length = screen->get_param(screen, + PIPE_CAP_MAX_TEXTURE_2D_SIZE); + return true; +} boolean stw_init(const struct stw_winsys *stw_winsys) { static struct stw_device stw_dev_storage; - struct pipe_screen *screen; debug_disable_error_message_boxes(); @@ -107,19 +123,10 @@ stw_init(const struct stw_winsys *stw_winsys) if (!stw_dev->stapi || !stw_dev->smapi) goto error1; - screen = stw_winsys->create_screen(); - if (!screen) - goto error1; - - if (stw_winsys->get_adapter_luid) - stw_winsys->get_adapter_luid(screen, &stw_dev->AdapterLuid); - - stw_dev->smapi->screen = screen; stw_dev->smapi->get_param = stw_get_param; - stw_dev->screen = screen; - stw_dev->max_2d_length = screen->get_param(screen, - PIPE_CAP_MAX_TEXTURE_2D_SIZE); + if (!init_screen(stw_winsys)) + goto error1; InitializeCriticalSection(&stw_dev->ctx_mutex); InitializeCriticalSection(&stw_dev->fb_mutex); -- 2.30.2