This causes an assert with libepoxy, but was wrong already regardless. Refactor logic to work as follows: * GPU_exit() deletes backend resources * Destroy UI GPU resources with the context active * Call GPU_backend_exit() after deleting the context Ref D15291 Differential Revision: https://developer.blender.org/D15465
38 lines
779 B
C++
38 lines
779 B
C++
/* SPDX-License-Identifier: Apache-2.0 */
|
|
|
|
#include "testing/testing.h"
|
|
|
|
#include "CLG_log.h"
|
|
|
|
#include "GPU_context.h"
|
|
#include "GPU_init_exit.h"
|
|
#include "gpu_testing.hh"
|
|
|
|
#include "GHOST_C-api.h"
|
|
|
|
namespace blender::gpu {
|
|
|
|
void GPUTest::SetUp()
|
|
{
|
|
GHOST_GLSettings glSettings = {0};
|
|
CLG_init();
|
|
ghost_system = GHOST_CreateSystem();
|
|
GPU_backend_init_once();
|
|
ghost_context = GHOST_CreateOpenGLContext(ghost_system, glSettings);
|
|
GHOST_ActivateOpenGLContext(ghost_context);
|
|
context = GPU_context_create(nullptr);
|
|
GPU_init();
|
|
}
|
|
|
|
void GPUTest::TearDown()
|
|
{
|
|
GPU_exit();
|
|
GPU_context_discard(context);
|
|
GHOST_DisposeOpenGLContext(ghost_system, ghost_context);
|
|
GPU_backend_exit();
|
|
GHOST_DisposeSystem(ghost_system);
|
|
CLG_exit();
|
|
}
|
|
|
|
} // namespace blender::gpu
|