This PR enables shader validation testing on buildbot for Metal. OpenGL isn't enabled as OpenGL requires an actual driver and GPU attached to the build bot infrastructure. Also the OpenGL backend caches data (glsl_patch) globally and requires a restart in order to create the correct one. Vulkan isn't enabled as it requires some changes: * For windows it requires to install more recent vulkan software versions as part of the buildbot windows configuration * For Linux it requires to start a GHOST System without any X11/Wayland This currently fails on the buildbot. We should check if we can use `GHOST_SystemHeadless` with `GHOST_ContextVK` Each shaders are compiled twice. Once based on the actual features of the installed GPU/backend. And once with all the work-arounds enabled, simulating a platform close to the minimum requirements of Blender. Pull Request: https://projects.blender.org/blender/blender/pulls/116040
59 lines
1.2 KiB
C++
59 lines
1.2 KiB
C++
/* SPDX-FileCopyrightText: 2023 Blender Authors
|
|
*
|
|
* SPDX-License-Identifier: Apache-2.0 */
|
|
|
|
#include "testing/testing.h"
|
|
|
|
#include "CLG_log.h"
|
|
|
|
#include "BLI_math_color.h"
|
|
|
|
#include "GPU_context.h"
|
|
#include "GPU_debug.h"
|
|
#include "GPU_init_exit.h"
|
|
#include "gpu_testing.hh"
|
|
|
|
#include "GHOST_C-api.h"
|
|
|
|
namespace blender::gpu {
|
|
|
|
void GPUTest::SetUp()
|
|
{
|
|
prev_g_debug_ = G.debug;
|
|
G.debug |= g_debug_flags_;
|
|
|
|
CLG_init();
|
|
GPU_backend_type_selection_set(gpu_backend_type);
|
|
GHOST_GPUSettings gpuSettings = {};
|
|
gpuSettings.context_type = draw_context_type;
|
|
gpuSettings.flags = GHOST_gpuDebugContext;
|
|
ghost_system = GHOST_CreateSystem();
|
|
ghost_context = GHOST_CreateGPUContext(ghost_system, gpuSettings);
|
|
GHOST_ActivateGPUContext(ghost_context);
|
|
context = GPU_context_create(nullptr, ghost_context);
|
|
GPU_init();
|
|
|
|
BLI_init_srgb_conversion();
|
|
|
|
GPU_render_begin();
|
|
GPU_context_begin_frame(context);
|
|
GPU_debug_capture_begin();
|
|
}
|
|
|
|
void GPUTest::TearDown()
|
|
{
|
|
GPU_debug_capture_end();
|
|
GPU_context_end_frame(context);
|
|
GPU_render_end();
|
|
|
|
GPU_exit();
|
|
GPU_context_discard(context);
|
|
GHOST_DisposeGPUContext(ghost_system, ghost_context);
|
|
GHOST_DisposeSystem(ghost_system);
|
|
CLG_exit();
|
|
|
|
G.debug = prev_g_debug_;
|
|
}
|
|
|
|
} // namespace blender::gpu
|