mirror of
https://github.com/panda3d/panda3d.git
synced 2025-09-28 07:48:37 -04:00
Add p3headlessgl render plug-in on Linux using EGL as fallback for GLX
Fixes #1086
This commit is contained in:
parent
8bde2f2b1b
commit
94806801e3
2
direct/src/dist/commands.py
vendored
2
direct/src/dist/commands.py
vendored
@ -277,7 +277,7 @@ class build_apps(setuptools.Command):
|
||||
'libpthread.so.*', 'libc.so.*', 'ld-linux-x86-64.so.*',
|
||||
'libgl.so.*', 'libx11.so.*', 'libncursesw.so.*', 'libz.so.*',
|
||||
'librt.so.*', 'libutil.so.*', 'libnsl.so.1', 'libXext.so.6',
|
||||
'libXrender.so.1', 'libICE.so.6', 'libSM.so.6',
|
||||
'libXrender.so.1', 'libICE.so.6', 'libSM.so.6', 'libEGL.so.1',
|
||||
'libgobject-2.0.so.0', 'libgthread-2.0.so.0', 'libglib-2.0.so.0',
|
||||
|
||||
# macOS
|
||||
|
@ -1255,6 +1255,14 @@ if not PkgSkip("EIGEN"):
|
||||
# will turn them into runtime assertions.
|
||||
DefSymbol("ALWAYS", "EIGEN_NO_STATIC_ASSERT")
|
||||
|
||||
if not PkgSkip("EGL"):
|
||||
DefSymbol('EGL', 'HAVE_EGL', '')
|
||||
if PkgSkip("X11"):
|
||||
DefSymbol('EGL', 'EGL_NO_X11', '')
|
||||
|
||||
if not PkgSkip("X11"):
|
||||
DefSymbol('X11', 'USE_X11', '')
|
||||
|
||||
########################################################################
|
||||
##
|
||||
## Give a Status Report on Command-Line Options
|
||||
@ -3243,6 +3251,8 @@ configprc = configprc.replace('\r\n', '\n')
|
||||
|
||||
if (GetTarget() == 'windows'):
|
||||
configprc = configprc.replace("$XDG_CACHE_HOME/panda3d", "$USER_APPDATA/Panda3D-%s" % MAJOR_VERSION)
|
||||
elif not PkgSkip("X11") and not PkgSkip("GL") and not PkgSkip("EGL") and not GetLinkAllStatic():
|
||||
configprc = configprc.replace("#load-display pandadx9", "aux-display p3headlessgl")
|
||||
else:
|
||||
configprc = configprc.replace("aux-display pandadx9", "")
|
||||
|
||||
@ -3591,9 +3601,10 @@ elif GetTarget() == 'darwin':
|
||||
elif GetTarget() == 'android':
|
||||
CopyAllHeaders('panda/src/android')
|
||||
CopyAllHeaders('panda/src/androiddisplay')
|
||||
else:
|
||||
if not PkgSkip('X11'):
|
||||
CopyAllHeaders('panda/src/x11display')
|
||||
CopyAllHeaders('panda/src/glxdisplay')
|
||||
if not PkgSkip('GL'):
|
||||
CopyAllHeaders('panda/src/glxdisplay')
|
||||
CopyAllHeaders('panda/src/egldisplay')
|
||||
CopyAllHeaders('panda/metalibs/pandagl')
|
||||
CopyAllHeaders('panda/metalibs/pandagles')
|
||||
@ -5156,7 +5167,6 @@ if (GetTarget() == 'windows' and PkgSkip("GL")==0 and not RUNTIME):
|
||||
# If we're not compiling with any windowing system at all, but we do have EGL,
|
||||
# we can use that to create a headless libpandagl instead.
|
||||
if not PkgSkip("EGL") and not PkgSkip("GL") and PkgSkip("X11") and GetTarget() not in ('windows', 'darwin') and not RUNTIME:
|
||||
DefSymbol('EGL', 'HAVE_EGL', '')
|
||||
OPTS=['DIR:panda/src/egldisplay', 'DIR:panda/src/glstuff', 'BUILDING:PANDAGL', 'GL', 'EGL']
|
||||
TargetAdd('pandagl_egldisplay_composite1.obj', opts=OPTS, input='p3egldisplay_composite1.cxx')
|
||||
OPTS=['DIR:panda/metalibs/pandagl', 'BUILDING:PANDAGL', 'GL', 'EGL']
|
||||
@ -5168,13 +5178,28 @@ if not PkgSkip("EGL") and not PkgSkip("GL") and PkgSkip("X11") and GetTarget() n
|
||||
TargetAdd('libpandagl.dll', input=COMMON_PANDA_LIBS)
|
||||
TargetAdd('libpandagl.dll', opts=['MODULE', 'GL', 'EGL', 'CGGL'])
|
||||
|
||||
elif not PkgSkip("EGL") and not PkgSkip("GL") and GetTarget() not in ('windows', 'darwin') and not RUNTIME:
|
||||
# As a temporary solution for #1086, build this module, which we can use as a
|
||||
# fallback to OpenGL for headless systems.
|
||||
DefSymbol('EGL', 'HAVE_EGL', '')
|
||||
OPTS=['DIR:panda/src/egldisplay', 'DIR:panda/src/glstuff', 'BUILDING:PANDAGL', 'GL', 'EGL']
|
||||
TargetAdd('p3headlessgl_egldisplay_composite1.obj', opts=OPTS, input='p3egldisplay_composite1.cxx')
|
||||
OPTS=['DIR:panda/metalibs/pandagl', 'BUILDING:PANDAGL', 'GL', 'EGL']
|
||||
TargetAdd('p3headlessgl_pandagl.obj', opts=OPTS, input='pandagl.cxx')
|
||||
TargetAdd('libp3headlessgl.dll', input='p3headlessgl_pandagl.obj')
|
||||
TargetAdd('libp3headlessgl.dll', input='p3glgsg_config_glgsg.obj')
|
||||
TargetAdd('libp3headlessgl.dll', input='p3glgsg_glgsg.obj')
|
||||
TargetAdd('libp3headlessgl.dll', input='p3headlessgl_egldisplay_composite1.obj')
|
||||
TargetAdd('libp3headlessgl.dll', input=COMMON_PANDA_LIBS)
|
||||
TargetAdd('libp3headlessgl.dll', opts=['MODULE', 'GL', 'EGL', 'CGGL'])
|
||||
|
||||
#
|
||||
# DIRECTORY: panda/src/egldisplay/
|
||||
#
|
||||
|
||||
if (PkgSkip("EGL")==0 and PkgSkip("GLES")==0 and not RUNTIME):
|
||||
DefSymbol('GLES', 'OPENGLES_1', '')
|
||||
OPTS=['DIR:panda/src/egldisplay', 'DIR:panda/src/glstuff', 'BUILDING:PANDAGLES', 'GLES', 'EGL']
|
||||
OPTS=['DIR:panda/src/egldisplay', 'DIR:panda/src/glstuff', 'BUILDING:PANDAGLES', 'GLES', 'EGL', 'X11']
|
||||
TargetAdd('pandagles_egldisplay_composite1.obj', opts=OPTS, input='p3egldisplay_composite1.cxx')
|
||||
OPTS=['DIR:panda/metalibs/pandagles', 'BUILDING:PANDAGLES', 'GLES', 'EGL']
|
||||
TargetAdd('pandagles_pandagles.obj', opts=OPTS, input='pandagles.cxx')
|
||||
@ -5193,7 +5218,7 @@ if (PkgSkip("EGL")==0 and PkgSkip("GLES")==0 and not RUNTIME):
|
||||
|
||||
if (PkgSkip("EGL")==0 and PkgSkip("GLES2")==0 and not RUNTIME):
|
||||
DefSymbol('GLES2', 'OPENGLES_2', '')
|
||||
OPTS=['DIR:panda/src/egldisplay', 'DIR:panda/src/glstuff', 'BUILDING:PANDAGLES2', 'GLES2', 'EGL']
|
||||
OPTS=['DIR:panda/src/egldisplay', 'DIR:panda/src/glstuff', 'BUILDING:PANDAGLES2', 'GLES2', 'EGL', 'X11']
|
||||
TargetAdd('pandagles2_egldisplay_composite1.obj', opts=OPTS, input='p3egldisplay_composite1.cxx')
|
||||
OPTS=['DIR:panda/metalibs/pandagles2', 'BUILDING:PANDAGLES2', 'GLES2', 'EGL']
|
||||
TargetAdd('pandagles2_pandagles2.obj', opts=OPTS, input='pandagles2.cxx')
|
||||
|
@ -90,7 +90,7 @@ ABI_TAG = get_abi_tag()
|
||||
EXCLUDE_EXT = [".pyc", ".pyo", ".N", ".prebuilt", ".xcf", ".plist", ".vcproj", ".sln"]
|
||||
|
||||
# Plug-ins to install.
|
||||
PLUGIN_LIBS = ["pandagl", "pandagles", "pandagles2", "pandadx9", "p3tinydisplay", "p3ptloader", "p3assimp", "p3ffmpeg", "p3openal_audio", "p3fmod_audio"]
|
||||
PLUGIN_LIBS = ["pandagl", "pandagles", "pandagles2", "pandadx9", "p3tinydisplay", "p3ptloader", "p3assimp", "p3ffmpeg", "p3openal_audio", "p3fmod_audio", "p3headlessgl"]
|
||||
|
||||
# Libraries included in manylinux ABI that should be ignored. See PEP 513/571/599.
|
||||
MANYLINUX_LIBS = [
|
||||
@ -103,6 +103,7 @@ MANYLINUX_LIBS = [
|
||||
# These are not mentioned in manylinux1 spec but should nonetheless always
|
||||
# be excluded.
|
||||
"linux-vdso.so.1", "linux-gate.so.1", "ld-linux.so.2", "libdrm.so.2",
|
||||
"libEGL.so.1",
|
||||
]
|
||||
|
||||
# Binaries to never scan for dependencies on non-Windows systems.
|
||||
|
@ -26,7 +26,7 @@
|
||||
#include "glxGraphicsPipe.h"
|
||||
#endif
|
||||
|
||||
#if defined(HAVE_EGL) && !defined(HAVE_X11)
|
||||
#ifdef HAVE_EGL
|
||||
#include "config_egldisplay.h"
|
||||
#include "eglGraphicsPipe.h"
|
||||
#endif
|
||||
@ -59,7 +59,7 @@ init_libpandagl() {
|
||||
init_libglxdisplay();
|
||||
#endif
|
||||
|
||||
#if defined(HAVE_EGL) && !defined(HAVE_X11)
|
||||
#ifdef HAVE_EGL
|
||||
init_libegldisplay();
|
||||
#endif
|
||||
}
|
||||
@ -84,9 +84,16 @@ get_pipe_type_pandagl() {
|
||||
return glxGraphicsPipe::get_class_type().get_index();
|
||||
#endif
|
||||
|
||||
#if defined(HAVE_EGL) && !defined(HAVE_X11)
|
||||
#ifdef HAVE_EGL
|
||||
return eglGraphicsPipe::get_class_type().get_index();
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
#if defined(HAVE_EGL) && !defined(USE_X11)
|
||||
int
|
||||
get_pipe_type_p3headlessgl() {
|
||||
return eglGraphicsPipe::get_class_type().get_index();
|
||||
}
|
||||
#endif
|
||||
|
@ -12,4 +12,8 @@
|
||||
EXPCL_PANDAGL void init_libpandagl();
|
||||
extern "C" EXPCL_PANDAGL int get_pipe_type_pandagl();
|
||||
|
||||
#if defined(HAVE_EGL) && !defined(USE_X11)
|
||||
extern "C" EXPCL_PANDAGL int get_pipe_type_p3headlessgl();
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
@ -48,7 +48,7 @@ init_libegldisplay() {
|
||||
|
||||
eglGraphicsBuffer::init_type();
|
||||
eglGraphicsPipe::init_type();
|
||||
#ifdef HAVE_X11
|
||||
#ifdef USE_X11
|
||||
eglGraphicsPixmap::init_type();
|
||||
eglGraphicsWindow::init_type();
|
||||
#endif
|
||||
|
@ -53,7 +53,7 @@ eglGraphicsPipe() {
|
||||
|
||||
//NB. if the X11 display failed to open, _display will be 0, which is a valid
|
||||
// input to eglGetDisplay - it means to open the default display.
|
||||
#ifdef HAVE_X11
|
||||
#ifdef USE_X11
|
||||
_egl_display = eglGetDisplay((NativeDisplayType) _display);
|
||||
#else
|
||||
_egl_display = eglGetDisplay(EGL_DEFAULT_DISPLAY);
|
||||
@ -207,7 +207,7 @@ make_output(const std::string &name,
|
||||
// First thing to try: an eglGraphicsWindow
|
||||
|
||||
if (retry == 0) {
|
||||
#ifdef HAVE_X11
|
||||
#ifdef USE_X11
|
||||
if (!_display) {
|
||||
return nullptr;
|
||||
}
|
||||
@ -290,7 +290,7 @@ make_output(const std::string &name,
|
||||
|
||||
// Fourth thing to try: an eglGraphicsPixmap.
|
||||
if (retry == 3) {
|
||||
#ifdef HAVE_X11
|
||||
#ifdef USE_X11
|
||||
if (!_display) {
|
||||
return nullptr;
|
||||
}
|
||||
|
@ -16,12 +16,14 @@
|
||||
|
||||
#include "pandabase.h"
|
||||
|
||||
#ifdef HAVE_X11
|
||||
#ifdef USE_X11
|
||||
#include "x11GraphicsPipe.h"
|
||||
typedef x11GraphicsPipe BaseGraphicsPipe;
|
||||
#else
|
||||
#include "graphicsPipe.h"
|
||||
typedef GraphicsPipe BaseGraphicsPipe;
|
||||
#undef EGL_NO_X11
|
||||
#define EGL_NO_X11 1
|
||||
#endif
|
||||
|
||||
#ifdef OPENGLES_2
|
||||
|
@ -13,7 +13,7 @@
|
||||
|
||||
#include "eglGraphicsPixmap.h"
|
||||
|
||||
#ifdef HAVE_X11
|
||||
#ifdef USE_X11
|
||||
|
||||
#include "eglGraphicsWindow.h"
|
||||
#include "eglGraphicsStateGuardian.h"
|
||||
@ -245,4 +245,4 @@ open_buffer() {
|
||||
return true;
|
||||
}
|
||||
|
||||
#endif // HAVE_X11
|
||||
#endif // USE_X11
|
||||
|
@ -16,7 +16,7 @@
|
||||
|
||||
#include "pandabase.h"
|
||||
|
||||
#ifdef HAVE_X11
|
||||
#ifdef USE_X11
|
||||
|
||||
#include "eglGraphicsPipe.h"
|
||||
#include "graphicsBuffer.h"
|
||||
@ -69,6 +69,6 @@ private:
|
||||
static TypeHandle _type_handle;
|
||||
};
|
||||
|
||||
#endif // HAVE_X11
|
||||
#endif // USE_X11
|
||||
|
||||
#endif
|
||||
|
@ -187,7 +187,7 @@ choose_pixel_format(const FrameBufferProperties &properties,
|
||||
best_props = fbprops;
|
||||
}
|
||||
}
|
||||
#ifdef HAVE_X11
|
||||
#ifdef USE_X11
|
||||
X11_Display *display = egl_pipe->get_display();
|
||||
if (display) {
|
||||
int screen = egl_pipe->get_screen();
|
||||
@ -233,7 +233,7 @@ choose_pixel_format(const FrameBufferProperties &properties,
|
||||
|
||||
int err = eglGetError();
|
||||
if (_context && err == EGL_SUCCESS) {
|
||||
#ifdef HAVE_X11
|
||||
#ifdef USE_X11
|
||||
if (!display || _visual)
|
||||
#endif
|
||||
{
|
||||
@ -262,7 +262,7 @@ choose_pixel_format(const FrameBufferProperties &properties,
|
||||
<< get_egl_error_string(err) << "\n";
|
||||
_fbconfig = 0;
|
||||
_context = 0;
|
||||
#ifdef HAVE_X11
|
||||
#ifdef USE_X11
|
||||
_visual = 0;
|
||||
#endif
|
||||
}
|
||||
@ -306,7 +306,7 @@ egl_is_at_least_version(int major_version, int minor_version) const {
|
||||
*/
|
||||
void eglGraphicsStateGuardian::
|
||||
gl_flush() const {
|
||||
#ifdef HAVE_X11
|
||||
#ifdef USE_X11
|
||||
// This call requires synchronization with X.
|
||||
LightReMutexHolder holder(eglGraphicsPipe::_x_mutex);
|
||||
#endif
|
||||
@ -318,7 +318,7 @@ gl_flush() const {
|
||||
*/
|
||||
GLenum eglGraphicsStateGuardian::
|
||||
gl_get_error() const {
|
||||
#ifdef HAVE_X11
|
||||
#ifdef USE_X11
|
||||
// This call requires synchronization with X.
|
||||
LightReMutexHolder holder(eglGraphicsPipe::_x_mutex);
|
||||
#endif
|
||||
|
@ -17,7 +17,7 @@
|
||||
#include "pandabase.h"
|
||||
#include "eglGraphicsPipe.h"
|
||||
|
||||
#ifdef HAVE_X11
|
||||
#ifdef USE_X11
|
||||
#include "get_x11.h"
|
||||
#endif
|
||||
|
||||
@ -55,7 +55,7 @@ public:
|
||||
EGLContext _share_context;
|
||||
EGLContext _context;
|
||||
EGLDisplay _egl_display;
|
||||
#ifdef HAVE_X11
|
||||
#ifdef USE_X11
|
||||
XVisualInfo *_visual = nullptr;
|
||||
#endif
|
||||
EGLConfig _fbconfig;
|
||||
|
@ -13,7 +13,7 @@
|
||||
|
||||
#include "eglGraphicsWindow.h"
|
||||
|
||||
#ifdef HAVE_X11
|
||||
#ifdef USE_X11
|
||||
|
||||
#include "eglGraphicsStateGuardian.h"
|
||||
#include "config_egldisplay.h"
|
||||
@ -279,4 +279,4 @@ open_window() {
|
||||
return true;
|
||||
}
|
||||
|
||||
#endif // HAVE_X11
|
||||
#endif // USE_X11
|
||||
|
@ -16,7 +16,7 @@
|
||||
|
||||
#include "pandabase.h"
|
||||
|
||||
#ifdef HAVE_X11
|
||||
#ifdef USE_X11
|
||||
|
||||
#include "eglGraphicsPipe.h"
|
||||
#include "x11GraphicsWindow.h"
|
||||
@ -67,6 +67,6 @@ private:
|
||||
|
||||
#include "eglGraphicsWindow.I"
|
||||
|
||||
#endif // HAVE_X11
|
||||
#endif // USE_X11
|
||||
|
||||
#endif
|
||||
|
Loading…
x
Reference in New Issue
Block a user