boolean stw_init(const struct stw_winsys *stw_winsys) { static struct stw_device stw_dev_storage; struct pipe_screen *screen; debug_printf("%s\n", __FUNCTION__); assert(!stw_dev); stw_tls_init(); stw_dev = &stw_dev_storage; memset(stw_dev, 0, sizeof(*stw_dev)); #ifdef DEBUG stw_dev->memdbg_no = debug_memory_begin(); #endif stw_dev->stw_winsys = stw_winsys; #ifdef WIN32_THREADS _glthread_INIT_MUTEX(OneTimeLock); #endif screen = stw_winsys->create_screen(); if(!screen) goto error1; #ifdef DEBUG stw_dev->screen = trace_screen_create(screen); stw_dev->trace_running = stw_dev->screen != screen ? TRUE : FALSE; #else stw_dev->screen = screen; #endif stw_dev->screen->flush_frontbuffer = &stw_flush_frontbuffer; pipe_mutex_init( stw_dev->ctx_mutex ); pipe_mutex_init( stw_dev->fb_mutex ); stw_dev->ctx_table = handle_table_create(); if (!stw_dev->ctx_table) { goto error1; } stw_pixelformat_init(); return TRUE; error1: stw_dev = NULL; return FALSE; }
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(); debug_printf("%s\n", __FUNCTION__); assert(!stw_dev); stw_tls_init(); stw_dev = &stw_dev_storage; memset(stw_dev, 0, sizeof(*stw_dev)); #ifdef DEBUG stw_dev->memdbg_no = debug_memory_begin(); #endif stw_dev->stw_winsys = stw_winsys; stw_dev->stapi = stw_st_create_api(); stw_dev->smapi = CALLOC_STRUCT(st_manager); 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_levels = screen->get_param(screen, PIPE_CAP_MAX_TEXTURE_2D_LEVELS); stw_dev->max_2d_length = 1 << (stw_dev->max_2d_levels - 1); pipe_mutex_init( stw_dev->ctx_mutex ); pipe_mutex_init( stw_dev->fb_mutex ); stw_dev->ctx_table = handle_table_create(); if (!stw_dev->ctx_table) { goto error1; } stw_pixelformat_init(); return TRUE; error1: FREE(stw_dev->smapi); if (stw_dev->stapi) stw_dev->stapi->destroy(stw_dev->stapi); stw_dev = NULL; return FALSE; }
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(); debug_printf("%s\n", __FUNCTION__); assert(!stw_dev); stw_tls_init(); stw_dev = &stw_dev_storage; memset(stw_dev, 0, sizeof(*stw_dev)); #ifdef DEBUG stw_dev->memdbg_no = debug_memory_begin(); #endif stw_dev->stw_winsys = stw_winsys; stw_dev->stapi = stw_st_create_api(); stw_dev->smapi = CALLOC_STRUCT(st_manager); 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_levels = screen->get_param(screen, PIPE_CAP_MAX_TEXTURE_2D_LEVELS); stw_dev->max_2d_length = 1 << (stw_dev->max_2d_levels - 1); InitializeCriticalSection(&stw_dev->ctx_mutex); InitializeCriticalSection(&stw_dev->fb_mutex); stw_dev->ctx_table = handle_table_create(); if (!stw_dev->ctx_table) { goto error1; } stw_pixelformat_init(); /* env var override for WGL_EXT_swap_control, useful for testing/debugging */ const char *s = os_get_option("WGL_SWAP_INTERVAL"); if (s) { stw_dev->swap_interval = atoi(s); } stw_dev->refresh_rate = get_refresh_rate(); stw_dev->initialized = true; return TRUE; error1: FREE(stw_dev->smapi); if (stw_dev->stapi) stw_dev->stapi->destroy(stw_dev->stapi); stw_dev = NULL; return FALSE; }