2023-12-18 00:25:33 +01:00
|
|
|
/*************************************************************************/
|
|
|
|
/* frt_load_gles.h */
|
|
|
|
/*************************************************************************/
|
|
|
|
/* This file is part of: */
|
|
|
|
/* PANDEMONIUM ENGINE */
|
|
|
|
/* https://github.com/Relintai/pandemonium_engine */
|
|
|
|
/*************************************************************************/
|
|
|
|
/* Copyright (c) 2022-present Péter Magyar. */
|
|
|
|
/* Copyright (c) 2014-2022 Godot Engine contributors (cf. AUTHORS.md). */
|
|
|
|
/* Copyright (c) 2007-2022 Juan Linietsky, Ariel Manzur. */
|
|
|
|
/* */
|
|
|
|
/* Permission is hereby granted, free of charge, to any person obtaining */
|
|
|
|
/* a copy of this software and associated documentation files (the */
|
|
|
|
/* "Software"), to deal in the Software without restriction, including */
|
|
|
|
/* without limitation the rights to use, copy, modify, merge, publish, */
|
|
|
|
/* distribute, sublicense, and/or sell copies of the Software, and to */
|
|
|
|
/* permit persons to whom the Software is furnished to do so, subject to */
|
|
|
|
/* the following conditions: */
|
|
|
|
/* */
|
|
|
|
/* The above copyright notice and this permission notice shall be */
|
|
|
|
/* included in all copies or substantial portions of the Software. */
|
|
|
|
/* */
|
|
|
|
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
|
|
|
|
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
|
|
|
|
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
|
|
|
|
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
|
|
|
|
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
|
|
|
|
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
|
|
|
|
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
|
|
|
/*************************************************************************/
|
|
|
|
|
2022-03-27 13:36:42 +02:00
|
|
|
// frt_load_gles.h
|
|
|
|
/*
|
|
|
|
* FRT - A Godot platform targeting single board computers
|
|
|
|
* Copyright (c) 2017-2019 Emanuele Fornara
|
|
|
|
*
|
|
|
|
* Permission is hereby granted, free of charge, to any person obtaining
|
|
|
|
* a copy of this software and associated documentation files (the
|
|
|
|
* "Software"), to deal in the Software without restriction, including
|
|
|
|
* without limitation the rights to use, copy, modify, merge, publish,
|
|
|
|
* distribute, sublicense, and/or sell copies of the Software, and to
|
|
|
|
* permit persons to whom the Software is furnished to do so, subject to
|
|
|
|
* the following conditions:
|
|
|
|
*
|
|
|
|
* The above copyright notice and this permission notice shall be
|
|
|
|
* included in all copies or substantial portions of the Software.
|
|
|
|
*
|
|
|
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
|
|
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
|
|
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
|
|
|
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
|
|
|
* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
|
|
|
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
|
|
|
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
|
|
*/
|
|
|
|
|
|
|
|
// on pi, skip EGL/GLESv2 in /opt/vc/lib
|
|
|
|
static const char *lib(const char *s) {
|
|
|
|
#if defined(__arm__) || defined(__aarch64__)
|
|
|
|
static char buf[64]; // large enough
|
|
|
|
strcpy(buf, "/opt/vc/lib/");
|
|
|
|
strcat(buf, s);
|
|
|
|
if (access(buf, R_OK) != 0)
|
|
|
|
return s;
|
|
|
|
#if defined(__arm__)
|
|
|
|
strcpy(buf, "/usr/lib/arm-linux-gnueabihf/");
|
|
|
|
#else
|
|
|
|
strcpy(buf, "/usr/lib/aarch64-linux-gnu/");
|
|
|
|
#endif
|
|
|
|
strcat(buf, s);
|
|
|
|
return buf;
|
|
|
|
#else // !pi
|
|
|
|
return s;
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
|
|
|
#define FRT_DL_SKIP
|
|
|
|
#include "dl/gles2.gen.h"
|
|
|
|
|
2024-07-21 10:10:09 +02:00
|
|
|
#ifndef GLES3_DISABLED
|
|
|
|
#if FRT_GLES_VERSION == 3
|
|
|
|
#include "dl/gles3.gen.h"
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
|
2022-03-27 13:36:42 +02:00
|
|
|
static bool frt_load_gles(int version) {
|
2024-07-21 10:10:09 +02:00
|
|
|
#ifndef GLES3_DISABLED
|
|
|
|
#if FRT_GLES_VERSION == 3
|
|
|
|
if (version == 3)
|
|
|
|
return frt_load_gles3(lib("libGLESv2.so.2"));
|
|
|
|
#endif
|
|
|
|
#endif
|
2022-03-27 13:36:42 +02:00
|
|
|
return frt_load_gles2(lib("libGLESv2.so.2"));
|
|
|
|
}
|