From 8d5ee2348e7693b9770e3f1e5752aef55bc72105 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mart=C3=ADn=20Lucas=20Golini?= Date: Sun, 23 Jun 2019 01:30:36 -0300 Subject: [PATCH] Fixed Window::setGLContextThread, now can only be acquired by one thread at once. --HG-- branch : dev --- bin/assets/layouts/test.xml | 4 +- projects/linux/ee.cflags | 1 + projects/linux/ee.creator.user | 166 +++++++++++++++++++- projects/linux/ee.cxxflags | 1 + src/eepp/window/backend/SDL2/windowsdl2.cpp | 2 + src/eepp/window/backend/SDL2/windowsdl2.hpp | 1 + 6 files changed, 170 insertions(+), 5 deletions(-) create mode 100644 projects/linux/ee.cflags create mode 100644 projects/linux/ee.cxxflags diff --git a/bin/assets/layouts/test.xml b/bin/assets/layouts/test.xml index e8781567f..27d72460a 100644 --- a/bin/assets/layouts/test.xml +++ b/bin/assets/layouts/test.xml @@ -11,9 +11,9 @@ - + Test diff --git a/projects/linux/ee.cflags b/projects/linux/ee.cflags new file mode 100644 index 000000000..68d516530 --- /dev/null +++ b/projects/linux/ee.cflags @@ -0,0 +1 @@ +-std=c17 \ No newline at end of file diff --git a/projects/linux/ee.creator.user b/projects/linux/ee.creator.user index c26863fe9..0bd723e41 100644 --- a/projects/linux/ee.creator.user +++ b/projects/linux/ee.creator.user @@ -1,6 +1,6 @@ - + EnvironmentId @@ -997,6 +997,15 @@ 1 + dwarf + + cpu-cycles + + + 250 + -F + true + 4096 false false 0 @@ -1011,6 +1020,7 @@ 0.01 10 true + kcachegrind 1 25 @@ -1054,6 +1064,15 @@ + dwarf + + cpu-cycles + + + 250 + -F + true + 4096 false false 0 @@ -1068,6 +1087,7 @@ 0.01 10 true + kcachegrind 1 25 @@ -1111,6 +1131,15 @@ + dwarf + + cpu-cycles + + + 250 + -F + true + 4096 false false 0 @@ -1125,6 +1154,7 @@ 0.01 10 true + kcachegrind 1 25 @@ -1168,6 +1198,15 @@ + dwarf + + cpu-cycles + + + 250 + -F + true + 4096 false false 0 @@ -1182,6 +1221,7 @@ 0.01 10 true + kcachegrind 1 25 @@ -1225,6 +1265,15 @@ + dwarf + + cpu-cycles + + + 250 + -F + true + 4096 false false 0 @@ -1239,6 +1288,7 @@ 0.01 10 true + kcachegrind 1 25 @@ -1282,6 +1332,15 @@ + dwarf + + cpu-cycles + + + 250 + -F + true + 4096 false false 0 @@ -1296,6 +1355,7 @@ 0.01 10 true + kcachegrind 1 25 @@ -1339,6 +1399,15 @@ + dwarf + + cpu-cycles + + + 250 + -F + true + 4096 false false 0 @@ -1353,6 +1422,7 @@ 0.01 10 true + kcachegrind 1 25 @@ -1396,6 +1466,15 @@ + dwarf + + cpu-cycles + + + 250 + -F + true + 4096 false false 0 @@ -1410,6 +1489,7 @@ 0.01 10 true + kcachegrind 1 25 @@ -1453,6 +1533,15 @@ + dwarf + + cpu-cycles + + + 250 + -F + true + 4096 false false 0 @@ -1467,6 +1556,7 @@ 0.01 10 true + kcachegrind 1 25 @@ -1510,6 +1600,15 @@ + dwarf + + cpu-cycles + + + 250 + -F + true + 4096 false false 0 @@ -1524,6 +1623,7 @@ 0.01 10 true + kcachegrind 1 25 @@ -1567,6 +1667,15 @@ + dwarf + + cpu-cycles + + + 250 + -F + true + 4096 false false 0 @@ -1581,6 +1690,7 @@ 0.01 10 true + kcachegrind 1 25 @@ -1624,6 +1734,15 @@ + dwarf + + cpu-cycles + + + 250 + -F + true + 4096 false false 0 @@ -1638,6 +1757,7 @@ 0.01 10 true + kcachegrind 1 25 @@ -1681,6 +1801,15 @@ + dwarf + + cpu-cycles + + + 250 + -F + true + 4096 false false 0 @@ -1695,6 +1824,7 @@ 0.01 10 true + kcachegrind 1 25 @@ -1738,6 +1868,15 @@ + dwarf + + cpu-cycles + + + 250 + -F + true + 4096 false false 0 @@ -1752,6 +1891,7 @@ 0.01 10 true + kcachegrind 1 25 @@ -1795,6 +1935,15 @@ + dwarf + + cpu-cycles + + + 250 + -F + true + 4096 false false 0 @@ -1809,6 +1958,7 @@ 0.01 10 true + kcachegrind 1 25 @@ -1852,6 +2002,15 @@ + dwarf + + cpu-cycles + + + 250 + -F + true + 4096 false false 0 @@ -1866,6 +2025,7 @@ 0.01 10 true + kcachegrind 1 25 @@ -1917,10 +2077,10 @@ ProjectExplorer.Project.Updater.FileVersion - 20 + 21 Version - 20 + 21 diff --git a/projects/linux/ee.cxxflags b/projects/linux/ee.cxxflags new file mode 100644 index 000000000..6435dfce2 --- /dev/null +++ b/projects/linux/ee.cxxflags @@ -0,0 +1 @@ +-std=c++17 \ No newline at end of file diff --git a/src/eepp/window/backend/SDL2/windowsdl2.cpp b/src/eepp/window/backend/SDL2/windowsdl2.cpp index f9783a2d2..b20dc7794 100644 --- a/src/eepp/window/backend/SDL2/windowsdl2.cpp +++ b/src/eepp/window/backend/SDL2/windowsdl2.cpp @@ -246,11 +246,13 @@ bool WindowSDL::isThreadedGLContext() { } void WindowSDL::setGLContextThread() { + mGLContextMutex.lock(); SDL_GL_MakeCurrent( mSDLWindow, mGLContextThread ); } void WindowSDL::unsetGLContextThread() { SDL_GL_MakeCurrent( mSDLWindow, NULL ); + mGLContextMutex.unlock(); } int WindowSDL::getCurrentDisplayIndex() { diff --git a/src/eepp/window/backend/SDL2/windowsdl2.hpp b/src/eepp/window/backend/SDL2/windowsdl2.hpp index 15361ea99..a844fa0f1 100644 --- a/src/eepp/window/backend/SDL2/windowsdl2.hpp +++ b/src/eepp/window/backend/SDL2/windowsdl2.hpp @@ -88,6 +88,7 @@ class EE_API WindowSDL : public Window { SDL_Window * mSDLWindow; SDL_GLContext mGLContext; SDL_GLContext mGLContextThread; + Mutex mGLContextMutex; #ifdef EE_USE_WMINFO WMInfo * mWMinfo;