mirror of
https://github.com/godotengine/godot.git
synced 2025-10-27 19:54:27 +00:00
[Linux/BSD] Offload RenderingDevice creation test to subprocess.
(cherry picked from commit 6ed12bfc5d)
This commit is contained in:
parent
f045c4c283
commit
14d7775217
11 changed files with 149 additions and 50 deletions
|
|
@ -37,10 +37,12 @@
|
|||
#include "servers/rendering_server.h"
|
||||
|
||||
#ifdef X11_ENABLED
|
||||
#include "x11/detect_prime_x11.h"
|
||||
#include "x11/display_server_x11.h"
|
||||
#endif
|
||||
|
||||
#ifdef WAYLAND_ENABLED
|
||||
#include "wayland/detect_prime_egl.h"
|
||||
#include "wayland/display_server_wayland.h"
|
||||
#endif
|
||||
|
||||
|
|
@ -49,6 +51,22 @@
|
|||
#include "modules/regex/regex.h"
|
||||
#endif
|
||||
|
||||
#if defined(RD_ENABLED)
|
||||
#include "servers/rendering/rendering_device.h"
|
||||
#endif
|
||||
|
||||
#if defined(VULKAN_ENABLED)
|
||||
#ifdef X11_ENABLED
|
||||
#include "x11/rendering_context_driver_vulkan_x11.h"
|
||||
#endif
|
||||
#ifdef WAYLAND_ENABLED
|
||||
#include "wayland/rendering_context_driver_vulkan_wayland.h"
|
||||
#endif
|
||||
#endif
|
||||
#if defined(GLES3_ENABLED)
|
||||
#include "drivers/gles3/rasterizer_gles3.h"
|
||||
#endif
|
||||
|
||||
#include <dlfcn.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
|
@ -1180,6 +1198,73 @@ String OS_LinuxBSD::get_system_ca_certificates() {
|
|||
return f->get_as_text();
|
||||
}
|
||||
|
||||
bool OS_LinuxBSD::_test_create_rendering_device(const String &p_display_driver) const {
|
||||
// Tests Rendering Device creation.
|
||||
|
||||
bool ok = false;
|
||||
#if defined(RD_ENABLED)
|
||||
Error err;
|
||||
RenderingContextDriver *rcd = nullptr;
|
||||
|
||||
#if defined(VULKAN_ENABLED)
|
||||
#ifdef X11_ENABLED
|
||||
if (p_display_driver == "x11" || p_display_driver.is_empty()) {
|
||||
rcd = memnew(RenderingContextDriverVulkanX11);
|
||||
}
|
||||
#endif
|
||||
#ifdef WAYLAND_ENABLED
|
||||
if (p_display_driver == "wayland") {
|
||||
rcd = memnew(RenderingContextDriverVulkanWayland);
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
if (rcd != nullptr) {
|
||||
err = rcd->initialize();
|
||||
if (err == OK) {
|
||||
RenderingDevice *rd = memnew(RenderingDevice);
|
||||
err = rd->initialize(rcd);
|
||||
memdelete(rd);
|
||||
rd = nullptr;
|
||||
if (err == OK) {
|
||||
ok = true;
|
||||
}
|
||||
}
|
||||
memdelete(rcd);
|
||||
rcd = nullptr;
|
||||
}
|
||||
#endif
|
||||
return ok;
|
||||
}
|
||||
|
||||
bool OS_LinuxBSD::_test_create_rendering_device_and_gl(const String &p_display_driver) const {
|
||||
// Tests OpenGL context and Rendering Device simultaneous creation. This function is expected to crash on some drivers.
|
||||
|
||||
#ifdef GLES3_ENABLED
|
||||
#ifdef X11_ENABLED
|
||||
if (p_display_driver == "x11" || p_display_driver.is_empty()) {
|
||||
#ifdef SOWRAP_ENABLED
|
||||
if (initialize_xlib(0) != 0) {
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
DetectPrimeX11::create_context();
|
||||
}
|
||||
#endif
|
||||
#ifdef WAYLAND_ENABLED
|
||||
if (p_display_driver == "wayland") {
|
||||
#ifdef SOWRAP_ENABLED
|
||||
if (initialize_wayland_egl(0) != 0) {
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
DetectPrimeEGL::create_context(EGL_PLATFORM_WAYLAND_KHR);
|
||||
}
|
||||
#endif
|
||||
RasterizerGLES3::make_current(true);
|
||||
#endif
|
||||
return _test_create_rendering_device(p_display_driver);
|
||||
}
|
||||
|
||||
OS_LinuxBSD::OS_LinuxBSD() {
|
||||
main_loop = nullptr;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue