From 3c58f7e657040ec8aea4518626d5bbb411adfa6f Mon Sep 17 00:00:00 2001 From: v1993 Date: Mon, 10 Apr 2023 03:15:26 +0300 Subject: [PATCH 1/3] Fix multicontext and multithreaded tests --- source/tests/glbinding-test/MultiContext_test.cpp | 13 +++++++++---- source/tests/glbinding-test/MultiThreading_test.cpp | 11 +++++++---- 2 files changed, 16 insertions(+), 8 deletions(-) diff --git a/source/tests/glbinding-test/MultiContext_test.cpp b/source/tests/glbinding-test/MultiContext_test.cpp index fd9faf1ea..4824907a8 100644 --- a/source/tests/glbinding-test/MultiContext_test.cpp +++ b/source/tests/glbinding-test/MultiContext_test.cpp @@ -5,15 +5,16 @@ #include #include -#include -#include #include #include +#include +#include #include using namespace gl; using namespace glbinding; +using namespace aux; class MultiContext_test : public testing::Test { @@ -54,7 +55,9 @@ TEST_F(MultiContext_test, Test) EXPECT_NE(nullptr, window2); glfwMakeContextCurrent(window1); - Binding::initialize(false); + glbinding::initialize(0, [](const char * name) { + return glfwGetProcAddress(name); + }); #ifdef SYSTEM_WINDOWS EXPECT_EQ(Version(3, 2), ContextInfo::version()); @@ -67,7 +70,9 @@ TEST_F(MultiContext_test, Test) #endif glfwMakeContextCurrent(window2); - Binding::initialize(false); + glbinding::initialize(1, [](const char * name) { + return glfwGetProcAddress(name); + }); Binding::releaseCurrentContext(); glfwMakeContextCurrent(window1); diff --git a/source/tests/glbinding-test/MultiThreading_test.cpp b/source/tests/glbinding-test/MultiThreading_test.cpp index a9aaf3679..f0ebdd112 100644 --- a/source/tests/glbinding-test/MultiThreading_test.cpp +++ b/source/tests/glbinding-test/MultiThreading_test.cpp @@ -6,10 +6,9 @@ #include #include -#include -#include #include #include +#include #include @@ -60,7 +59,9 @@ TEST_F(MultiThreading_test, Test) std::thread t1([window1]() { glfwMakeContextCurrent(window1); - Binding::initialize(false); + glbinding::initialize(0, [](const char * name) { + return glfwGetProcAddress(name); + }); std::this_thread::sleep_for(std::chrono::milliseconds(5)); @@ -82,7 +83,9 @@ TEST_F(MultiThreading_test, Test) std::thread t2([window2]() { glfwMakeContextCurrent(window2); - Binding::initialize(false); + glbinding::initialize(1, [](const char * name) { + return glfwGetProcAddress(name); + }); std::this_thread::sleep_for(std::chrono::milliseconds(4)); From 6dea91bbeb3c37228b35f76ac5bc278f7184a156 Mon Sep 17 00:00:00 2001 From: v1993 Date: Mon, 10 Apr 2023 03:17:41 +0300 Subject: [PATCH 2/3] Add fixed tests to test suite --- source/tests/glbinding-test/CMakeLists.txt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/source/tests/glbinding-test/CMakeLists.txt b/source/tests/glbinding-test/CMakeLists.txt index 4ca3cfec2..6d4e1f97a 100644 --- a/source/tests/glbinding-test/CMakeLists.txt +++ b/source/tests/glbinding-test/CMakeLists.txt @@ -32,6 +32,8 @@ set(sources RingBuffer_test.cpp SharedBitfield_test.cpp Boolean_compilation_test.cpp + MultiContext_test.cpp + MultiThreading_test.cpp # regession tests Regression_test_82.cpp From 2bd2a06b09b863656e75407f9f845f5b5e12c050 Mon Sep 17 00:00:00 2001 From: v1993 Date: Mon, 10 Apr 2023 03:23:34 +0300 Subject: [PATCH 3/3] MultiContext test: release correct contexts --- source/tests/glbinding-test/MultiContext_test.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/source/tests/glbinding-test/MultiContext_test.cpp b/source/tests/glbinding-test/MultiContext_test.cpp index 4824907a8..d9d94bbe8 100644 --- a/source/tests/glbinding-test/MultiContext_test.cpp +++ b/source/tests/glbinding-test/MultiContext_test.cpp @@ -74,9 +74,9 @@ TEST_F(MultiContext_test, Test) return glfwGetProcAddress(name); }); - Binding::releaseCurrentContext(); + Binding::releaseContext(1); glfwMakeContextCurrent(window1); - Binding::releaseCurrentContext(); + Binding::releaseContext(2); glfwTerminate(); }