2022-02-11 09:07:11 +11:00
|
|
|
/* SPDX-License-Identifier: GPL-2.0-or-later
|
|
|
|
|
* Copyright 2013 Blender Foundation. All rights reserved. */
|
2014-10-07 15:46:19 -05:00
|
|
|
|
2019-02-18 08:08:12 +11:00
|
|
|
/** \file
|
|
|
|
|
* \ingroup gpu
|
2014-10-07 15:46:19 -05:00
|
|
|
*/
|
|
|
|
|
|
2020-03-19 09:33:03 +01:00
|
|
|
#include "GPU_init_exit.h" /* interface */
|
2014-10-07 15:46:19 -05:00
|
|
|
#include "BLI_sys_types.h"
|
2020-03-19 09:33:03 +01:00
|
|
|
#include "GPU_batch.h"
|
2015-07-02 19:30:08 +02:00
|
|
|
|
2014-10-07 15:46:19 -05:00
|
|
|
#include "intern/gpu_codegen.h"
|
2015-02-16 21:19:12 +01:00
|
|
|
#include "intern/gpu_private.h"
|
2022-01-17 14:45:22 +01:00
|
|
|
#include "intern/gpu_shader_create_info_private.hh"
|
|
|
|
|
#include "intern/gpu_shader_dependency_private.h"
|
2014-10-07 15:46:19 -05:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* although the order of initialization and shutdown should not matter
|
|
|
|
|
* (except for the extensions), I chose alphabetical and reverse alphabetical order
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
static bool initialized = false;
|
|
|
|
|
|
|
|
|
|
void GPU_init(void)
|
|
|
|
|
{
|
2015-10-07 00:27:27 +11:00
|
|
|
/* can't avoid calling this multiple times, see wm_window_ghostwindow_add */
|
2019-04-22 09:32:37 +10:00
|
|
|
if (initialized) {
|
2014-10-07 15:46:19 -05:00
|
|
|
return;
|
2019-04-22 09:32:37 +10:00
|
|
|
}
|
2014-10-07 15:46:19 -05:00
|
|
|
|
|
|
|
|
initialized = true;
|
|
|
|
|
|
2022-01-17 14:45:22 +01:00
|
|
|
gpu_shader_dependency_init();
|
|
|
|
|
gpu_shader_create_info_init();
|
|
|
|
|
|
2014-10-07 15:46:19 -05:00
|
|
|
gpu_codegen_init();
|
2015-02-16 21:19:12 +01:00
|
|
|
|
2017-02-08 00:38:07 +01:00
|
|
|
gpu_batch_init();
|
|
|
|
|
|
2020-03-11 14:52:57 +11:00
|
|
|
#ifndef GPU_STANDALONE
|
2019-09-27 22:42:57 +02:00
|
|
|
gpu_pbvh_init();
|
2020-03-11 14:52:57 +11:00
|
|
|
#endif
|
2014-10-07 15:46:19 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void GPU_exit(void)
|
|
|
|
|
{
|
2020-03-11 14:52:57 +11:00
|
|
|
#ifndef GPU_STANDALONE
|
2019-09-27 22:42:57 +02:00
|
|
|
gpu_pbvh_exit();
|
2020-03-11 14:52:57 +11:00
|
|
|
#endif
|
2019-09-27 22:42:57 +02:00
|
|
|
|
2017-02-08 00:38:07 +01:00
|
|
|
gpu_batch_exit();
|
|
|
|
|
|
2014-10-07 15:46:19 -05:00
|
|
|
gpu_codegen_exit();
|
|
|
|
|
|
2022-01-17 14:45:22 +01:00
|
|
|
gpu_shader_dependency_exit();
|
|
|
|
|
gpu_shader_create_info_exit();
|
|
|
|
|
|
2014-10-07 15:46:19 -05:00
|
|
|
initialized = false;
|
|
|
|
|
}
|
2019-01-02 10:01:46 -02:00
|
|
|
|
2020-08-01 13:02:21 +10:00
|
|
|
bool GPU_is_init(void)
|
2019-01-02 10:01:46 -02:00
|
|
|
{
|
|
|
|
|
return initialized;
|
|
|
|
|
}
|