Files
test/source/blender/gpu/tests/gpu_testing.cc
Jeroen Bakker fc46d6408f GPU: Use --debug-gpu-renderdoc For Renderdoc Integration.
The renderdoc integration used to be behind the `--debug-gpu`
command line option. When using `--debug-gpu` outside renderdoc
error messages where displayed that aren't relevant.

This PR adds a specific command line option for the renderdoc
integration. This option will also enable `--debug-gpu`.

Pull Request: https://projects.blender.org/blender/blender/pulls/106541
2023-04-04 12:46:47 +02:00

53 lines
1.1 KiB
C++

/* SPDX-License-Identifier: Apache-2.0 */
#include "testing/testing.h"
#include "CLG_log.h"
#include "GPU_context.h"
#include "GPU_debug.h"
#include "GPU_init_exit.h"
#include "gpu_testing.hh"
#include "GHOST_C-api.h"
#include "BKE_global.h"
namespace blender::gpu {
void GPUTest::SetUp()
{
prev_g_debug_ = G.debug;
G.debug |= G_DEBUG_GPU | G_DEBUG_GPU_RENDERDOC;
CLG_init();
GPU_backend_type_selection_set(gpu_backend_type);
GHOST_GLSettings glSettings = {};
glSettings.context_type = draw_context_type;
glSettings.flags = GHOST_glDebugContext;
ghost_system = GHOST_CreateSystem();
ghost_context = GHOST_CreateOpenGLContext(ghost_system, glSettings);
GHOST_ActivateOpenGLContext(ghost_context);
context = GPU_context_create(nullptr, ghost_context);
GPU_init();
GPU_context_begin_frame(context);
GPU_debug_capture_begin();
}
void GPUTest::TearDown()
{
GPU_debug_capture_end();
GPU_context_end_frame(context);
GPU_exit();
GPU_context_discard(context);
GHOST_DisposeOpenGLContext(ghost_system, ghost_context);
GHOST_DisposeSystem(ghost_system);
CLG_exit();
G.debug = prev_g_debug_;
}
} // namespace blender::gpu