Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added dependencies/angle/Linux64/libEGL.so
Binary file not shown.
Binary file added dependencies/angle/Linux64/libGLESv2.so
Binary file not shown.
Binary file added dependencies/angle/LinuxArm64/libEGL.so
Binary file not shown.
Binary file added dependencies/angle/LinuxArm64/libGLESv2.so
Binary file not shown.
Binary file added dependencies/angle/Mac64/libEGL.dylib
Binary file not shown.
Binary file added dependencies/angle/Mac64/libGLESv2.dylib
Binary file not shown.
Binary file added dependencies/angle/MacArm64/libEGL.dylib
Binary file not shown.
Binary file added dependencies/angle/MacArm64/libGLESv2.dylib
Binary file not shown.
Binary file added dependencies/angle/Windows/d3dcompiler_47.dll
Binary file not shown.
Binary file added dependencies/angle/Windows/libEGL.dll
Binary file not shown.
Binary file added dependencies/angle/Windows/libGLESv2.dll
Binary file not shown.
Binary file added dependencies/angle/Windows64/d3dcompiler_47.dll
Binary file not shown.
Binary file added dependencies/angle/Windows64/libEGL.dll
Binary file not shown.
Binary file added dependencies/angle/Windows64/libGLESv2.dll
Binary file not shown.
9 changes: 7 additions & 2 deletions include.xml
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,7 @@
<define name="lime-native" if="native" />
<define name="lime-openalsoft" if="windows || linux || mac || android || ios || tvos" />
<define name="lime-openal" if="emscripten || lime-openalsoft" />
<define name="lime-opengl" if="desktop" unless="html5" />
<define name="lime-opengles" if="emscripten || mobile" />
<define name="lime-opengles" if="native" />
<define name="lime-vorbis" if="native" />
<define name="lime-webgl" if="html5" />

Expand Down Expand Up @@ -123,6 +122,12 @@
<dependency name="UIKit.framework" />
</section>

<section if="desktop">
<dependency path="dependencies/angle" name="d3dcompiler_47" if="windows" />
<dependency path="dependencies/angle" name="libEGL" />
<dependency path="dependencies/angle" name="libGLESv2" />
</section>

<define name="MACOSX_DEPLOYMENT_TARGET" value="10.9" if="mac" unless="MACOSX_DEPLOYMENT_TARGET" />
<setenv name="MACOSX_DEPLOYMENT_TARGET" value="${MACOSX_DEPLOYMENT_TARGET}" if="mac" />

Expand Down
7 changes: 2 additions & 5 deletions project/Build.xml
Original file line number Diff line number Diff line change
Expand Up @@ -189,8 +189,6 @@

</section>

<compilerflag value="-DLIME_OPENGL_GL" if="windows || mac || linux" />
<compilerflag value="-DLIME_OPENGL_GLES2" if="android || rpi || emscripten || tizen || ios || tvos" />
<compilerflag value="-DLIME_OPENGL" />

<file name="src/graphics/opengl/OpenGLBindings.cpp" />
Expand Down Expand Up @@ -379,7 +377,6 @@
<lib name="kernel32.lib" />
<lib name="ole32.lib" />
<lib name="oleaut32.lib" />
<lib name="opengl32.lib" />
<lib name="rpcrt4.lib" if="LIME_HARFBUZZ" />
<lib name="setupapi.lib" />
<lib name="shell32.lib" />
Expand All @@ -406,7 +403,6 @@
<lib name="-lkernel32" />
<lib name="-lole32" />
<lib name="-loleaut32" />
<lib name="-lopengl32" />
<lib name="-lrpcrt4" if="LIME_HARFBUZZ" />
<lib name="-lsetupapi" />
<lib name="-lshell32" />
Expand Down Expand Up @@ -434,6 +430,8 @@

<section if="linux">

<flag value="-Wl,-rpath,$ORIGIN"/>

<lib name="-lpthread" />
<lib name="-lrt" />

Expand Down Expand Up @@ -464,7 +462,6 @@
<vflag name="-framework" value="CoreMedia" />
<vflag name="-framework" value="CoreVideo" />
<vflag name="-framework" value="ForceFeedback" />
<vflag name="-framework" value="OpenGL" />
<vflag name="-framework" value="Foundation" />
<vflag name="-framework" value="GameController" />
<vflag name="-framework" value="IOKit" />
Expand Down
12 changes: 4 additions & 8 deletions project/lib/custom/sdl/include/SDL_build_config.h
Original file line number Diff line number Diff line change
Expand Up @@ -443,10 +443,8 @@
# define SDL_POWER_WINDOWS 1 /**< Windows power management */
# define SDL_SENSOR_WINDOWS 1 /**< Windows sensor support */
# define SDL_VIDEO_DRIVER_WINDOWS 1 /**< Windows video driver */
# define SDL_VIDEO_OPENGL 1 /**< OpenGL support */
# define SDL_VIDEO_OPENGL_EGL 1 /**< EGL (Embedded OpenGL) support */
# define SDL_VIDEO_OPENGL_EGL 1 /**< EGL support */
# define SDL_VIDEO_OPENGL_ES2 1 /**< OpenGL ES 2.0 support */
# define SDL_VIDEO_OPENGL_WGL 1 /**< Windows GL (WGL) support */
/** @} */

#elif defined(SDL_PLATFORM_MACOS)
Expand All @@ -465,8 +463,8 @@
# define SDL_POWER_MACOSX 1 /**< macOS power management */
# define SDL_SENSOR_DUMMY 1 /**< Dummy sensor driver (no native support) */
# define SDL_VIDEO_DRIVER_COCOA 1 /**< Cocoa video driver */
# define SDL_VIDEO_OPENGL 1 /**< OpenGL support */
# define SDL_VIDEO_OPENGL_CGL 1 /**< Core Graphics Layer (CGL) OpenGL support */
# define SDL_VIDEO_OPENGL_EGL 1 /**< EGL support */
# define SDL_VIDEO_OPENGL_ES2 1 /**< OpenGL ES 2.0 support */
/** @} */

#elif defined(SDL_PLATFORM_IOS)
Expand Down Expand Up @@ -516,7 +514,7 @@
# define SDL_SENSOR_ANDROID 1 /**< Android sensor support */
# define SDL_TRAY_DUMMY 1 /**< Dummy system tray driver (not applicable on Android) */
# define SDL_VIDEO_DRIVER_ANDROID 1 /**< Android video driver */
# define SDL_VIDEO_OPENGL_EGL 1 /**< EGL support */
# define SDL_VIDEO_OPENGL_EGL 1 /**< EGL support */
# define SDL_VIDEO_OPENGL_ES2 1 /**< OpenGL ES 2.0 support */
/** @} */

Expand Down Expand Up @@ -584,10 +582,8 @@
* @brief OpenGL rendering contexts on Linux.
* @{
*/
# define SDL_VIDEO_OPENGL 1 /**< OpenGL support */
# define SDL_VIDEO_OPENGL_EGL 1 /**< EGL support */
# define SDL_VIDEO_OPENGL_ES2 1 /**< OpenGL ES 2.0 support */
# define SDL_VIDEO_OPENGL_GLX 1 /**< GLX (OpenGL Extension to X) support */
/** @} */

#endif
Expand Down
4 changes: 1 addition & 3 deletions project/lib/glad-files.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,7 @@

<compilerflag value="-I${NATIVE_TOOLKIT_PATH}/glad/include/" />

<file name="${NATIVE_TOOLKIT_PATH}/glad/src/gl.c" if="windows || mac || linux" />

<file name="${NATIVE_TOOLKIT_PATH}/glad/src/gles2.c" if="android || rpi || emscripten || tizen" />
<file name="${NATIVE_TOOLKIT_PATH}/glad/src/gles2.c" />

</files>

Expand Down
2 changes: 1 addition & 1 deletion project/lib/sdl
12 changes: 12 additions & 0 deletions project/src/backend/sdl/SDLApplication.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,18 @@ namespace lime {

SDLApplication::SDLApplication () {

SDL_SetHint (SDL_HINT_OPENGL_ES_DRIVER, "1");

#ifdef HX_WINDOWS
SDL_SetHint (SDL_HINT_VIDEO_WIN_D3DCOMPILER, "d3dcompiler_47.dll");
#endif

SDL_SetHint (SDL_HINT_VIDEO_FORCE_EGL, "1");

#ifndef ANDROID
SDL_SetHint (SDL_HINT_VIDEO_EGL_ALLOW_GETDISPLAY_FALLBACK, "0");
#endif

SDL_SetHint (SDL_HINT_JOYSTICK_HIDAPI, "1");

#ifdef IPHONE
Expand Down
48 changes: 42 additions & 6 deletions project/src/backend/sdl/SDLWindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,35 @@ namespace lime {
SDL_Cursor* SDLCursor::waitCursor = 0;
SDL_Cursor* SDLCursor::waitArrowCursor = 0;


static SDL_EGLAttrib *GetDefaultPlatformBackendAttribCallback (void *userdata)
{

std::vector<SDL_EGLAttrib> attribs;

attribs.push_back (0x3203 /* EGL_PLATFORM_ANGLE_TYPE_ANGLE */);
#if defined (HX_WINDOWS)
attribs.push_back (0x3208 /* EGL_PLATFORM_ANGLE_TYPE_D3D11_ANGLE */);
#elif defined (HX_LINUX)
attribs.push_back (0x3450 /* EGL_PLATFORM_ANGLE_TYPE_VULKAN_ANGLE */);
#elif defined (HX_MACOS)
attribs.push_back (0x3489 /* EGL_PLATFORM_ANGLE_TYPE_METAL_ANGLE */);
#endif
attribs.push_back (0x3038 /* EGL_NONE */);

SDL_EGLAttrib *result = (SDL_EGLAttrib *)SDL_malloc (attribs.size () * sizeof (SDL_EGLAttrib));

if (result) {

std::memcpy (result, attribs.data (), attribs.size () * sizeof(SDL_EGLAttrib));

}

return result;

}


SDLWindow::SDLWindow (Application* application, int width, int height, int flags, const char* title) {

context = 0;
Expand All @@ -48,15 +77,18 @@ namespace lime {
if (flags & WINDOW_FLAG_ALWAYS_ON_TOP) sdlWindowFlags |= SDL_WINDOW_ALWAYS_ON_TOP;
#endif

#ifdef LIME_OPENGL_GLES2
#if defined (HX_WINDOWS) || defined (HX_MACOS) || defined (HX_LINUX)
const char* driver = SDL_GetCurrentVideoDriver ();

if (driver && SDL_strcmp (driver, "wayland") != 0 && SDL_strcmp (driver, "kmsdrm") != 0)
{
SDL_GL_SetAttribute (SDL_GL_EGL_PLATFORM, 0x3202);
}
#endif

SDL_GL_SetAttribute (SDL_GL_CONTEXT_PROFILE_MASK, SDL_GL_CONTEXT_PROFILE_ES);
SDL_GL_SetAttribute (SDL_GL_CONTEXT_MAJOR_VERSION, 3);
SDL_GL_SetAttribute (SDL_GL_CONTEXT_MINOR_VERSION, 0);
#endif

#ifdef LIME_OPENGL_GL
// TODO: Use OpenGL 3.3 Core on Desktop
#endif

if (flags & WINDOW_FLAG_DEPTH_BUFFER) {

Expand Down Expand Up @@ -97,6 +129,10 @@ namespace lime {

}

#if defined (HX_WINDOWS) || defined (HX_MACOS) || defined (HX_LINUX)
SDL_EGL_SetAttributeCallbacks (GetDefaultPlatformBackendAttribCallback, NULL, NULL, NULL);
#endif

sdlWindow = SDL_CreateWindow (title, width, height, sdlWindowFlags);

if (!sdlWindow) {
Expand Down
Loading