Blender V4.3
gpu_testing.cc
Go to the documentation of this file.
1/* SPDX-FileCopyrightText: 2023 Blender Authors
2 *
3 * SPDX-License-Identifier: Apache-2.0 */
4
5#include "testing/testing.h"
6
7#include "CLG_log.h"
8
9#include "BLI_math_color.h"
10
11#include "GPU_context.hh"
12#include "GPU_debug.hh"
13#include "GPU_init_exit.hh"
14#include "gpu_testing.hh"
15
16#include "GHOST_C-api.h"
17
18namespace blender::gpu {
19
21{
22 prev_g_debug_ = G.debug;
23 G.debug |= g_debug_flags_;
24
25 CLG_init();
26 GPU_backend_type_selection_set(gpu_backend_type);
27 GHOST_GPUSettings gpuSettings = {};
28 gpuSettings.context_type = draw_context_type;
29 gpuSettings.flags = GHOST_gpuDebugContext;
30 ghost_system = GHOST_CreateSystem();
31 GPU_backend_ghost_system_set(ghost_system);
32 ghost_context = GHOST_CreateGPUContext(ghost_system, gpuSettings);
33 GHOST_ActivateGPUContext(ghost_context);
34 context = GPU_context_create(nullptr, ghost_context);
35 GPU_init();
36
38
42}
43
45{
47 GPU_context_end_frame(context);
49
50 GPU_exit();
51 GPU_context_discard(context);
52 GHOST_DisposeGPUContext(ghost_system, ghost_context);
53 GHOST_DisposeSystem(ghost_system);
54 CLG_exit();
55
56 G.debug = prev_g_debug_;
57}
58
59} // namespace blender::gpu
void BLI_init_srgb_conversion(void)
void CLG_exit(void)
Definition clog.c:706
void CLG_init(void)
Definition clog.c:699
GHOST C-API function and type declarations.
GHOST_ContextHandle GHOST_CreateGPUContext(GHOST_SystemHandle systemhandle, GHOST_GPUSettings gpuSettings)
GHOST_SystemHandle GHOST_CreateSystem(void)
GHOST_TSuccess GHOST_ActivateGPUContext(GHOST_ContextHandle contexthandle)
GHOST_TSuccess GHOST_DisposeGPUContext(GHOST_SystemHandle systemhandle, GHOST_ContextHandle contexthandle)
GHOST_TSuccess GHOST_DisposeSystem(GHOST_SystemHandle systemhandle)
@ GHOST_gpuDebugContext
Definition GHOST_Types.h:77
void GPU_render_end()
GPUContext * GPU_context_create(void *ghost_window, void *ghost_context)
void GPU_backend_type_selection_set(const eGPUBackendType backend)
void GPU_context_begin_frame(GPUContext *ctx)
void GPU_render_begin()
void GPU_context_discard(GPUContext *)
void GPU_context_end_frame(GPUContext *ctx)
void GPU_backend_ghost_system_set(void *ghost_system_handle)
void GPU_debug_capture_end()
Definition gpu_debug.cc:93
void GPU_debug_capture_begin(const char *title)
Definition gpu_debug.cc:78
void GPU_init()
void GPU_exit()
void TearDown() override
void SetUp() override
#define G(x, y, z)
GHOST_TDrawingContextType context_type