From bc461840fe7462cb6d55cd3f577824de07583e0c Mon Sep 17 00:00:00 2001 From: Daria Volvenkova Date: Mon, 30 Jul 2018 21:10:25 +0300 Subject: [PATCH] Graphic context added. --- android/jni/com/mapswithme/maps/Framework.cpp | 8 +- android/jni/com/mapswithme/maps/Framework.hpp | 2 +- .../mapswithme/opengl/androidoglcontext.cpp | 26 ++-- .../mapswithme/opengl/androidoglcontext.hpp | 20 +-- .../opengl/androidoglcontextfactory.cpp | 26 ++-- .../opengl/androidoglcontextfactory.hpp | 20 +-- drape/CMakeLists.txt | 6 +- drape/drape_global.hpp | 2 +- drape/drape_tests/glfunctions.cpp | 35 +++++ drape/drape_tests/glmock_functions.hpp | 12 ++ drape/graphic_context.hpp | 35 +++++ drape/graphic_context_factory.cpp | 51 +++++++ drape/graphic_context_factory.hpp | 52 +++++++ drape/oglcontext.cpp | 42 ++++++ drape/oglcontext.hpp | 18 +-- drape/oglcontextfactory.cpp | 51 ------- drape/oglcontextfactory.hpp | 52 ------- drape_frontend/backend_renderer.cpp | 14 +- drape_frontend/backend_renderer.hpp | 4 +- drape_frontend/base_renderer.cpp | 12 +- drape_frontend/base_renderer.hpp | 10 +- drape_frontend/drape_engine.cpp | 2 +- drape_frontend/drape_engine.hpp | 8 +- drape_frontend/frontend_renderer.cpp | 74 +++++----- drape_frontend/frontend_renderer.hpp | 4 +- iphone/Maps/Classes/EAGLView.mm | 2 +- iphone/Maps/Classes/iosOGLContext.h | 14 +- iphone/Maps/Classes/iosOGLContext.mm | 22 +-- iphone/Maps/Classes/iosOGLContextFactory.h | 16 +-- iphone/Maps/Classes/iosOGLContextFactory.mm | 18 +-- map/framework.cpp | 4 +- map/framework.hpp | 6 +- qt/drape_surface.cpp | 130 ------------------ qt/drape_surface.hpp | 48 ------- qt/qt_common/qtoglcontext.cpp | 32 ++--- qt/qt_common/qtoglcontext.hpp | 26 ++-- qt/qt_common/qtoglcontextfactory.cpp | 12 +- qt/qt_common/qtoglcontextfactory.hpp | 14 +- xcode/drape/drape.xcodeproj/project.pbxproj | 24 ++-- 39 files changed, 451 insertions(+), 503 deletions(-) create mode 100644 drape/graphic_context.hpp create mode 100644 drape/graphic_context_factory.cpp create mode 100644 drape/graphic_context_factory.hpp create mode 100644 drape/oglcontext.cpp delete mode 100644 drape/oglcontextfactory.cpp delete mode 100644 drape/oglcontextfactory.hpp delete mode 100644 qt/drape_surface.cpp delete mode 100644 qt/drape_surface.hpp diff --git a/android/jni/com/mapswithme/maps/Framework.cpp b/android/jni/com/mapswithme/maps/Framework.cpp index a2c660d9c3..0baf430945 100644 --- a/android/jni/com/mapswithme/maps/Framework.cpp +++ b/android/jni/com/mapswithme/maps/Framework.cpp @@ -198,7 +198,7 @@ void Framework::DetachSurface(bool destroyContext) { LOG(LINFO, ("Detach surface started. destroyContext =", destroyContext)); ASSERT(m_contextFactory != nullptr, ()); - m_contextFactory->setPresentAvailable(false); + m_contextFactory->SetPresentAvailable(false); if (destroyContext) { @@ -230,7 +230,7 @@ bool Framework::AttachSurface(JNIEnv * env, jobject jSurface) ASSERT(!m_guiPositions.empty(), ("GUI elements must be set-up before engine is created")); - m_contextFactory->setPresentAvailable(true); + m_contextFactory->SetPresentAvailable(true); m_work.SetRenderingEnabled(factory); if (m_isContextDestroyed) @@ -252,7 +252,7 @@ void Framework::PauseSurfaceRendering() if (m_contextFactory == nullptr) return; LOG(LINFO, ("Pause surface rendering.")); - m_contextFactory->setPresentAvailable(false); + m_contextFactory->SetPresentAvailable(false); } void Framework::ResumeSurfaceRendering() @@ -262,7 +262,7 @@ void Framework::ResumeSurfaceRendering() LOG(LINFO, ("Resume surface rendering.")); AndroidOGLContextFactory * factory = m_contextFactory->CastFactory(); if (factory->IsValid()) - m_contextFactory->setPresentAvailable(true); + m_contextFactory->SetPresentAvailable(true); } void Framework::SetMapStyle(MapStyle mapStyle) diff --git a/android/jni/com/mapswithme/maps/Framework.hpp b/android/jni/com/mapswithme/maps/Framework.hpp index 6ad976771b..39d82e0c55 100644 --- a/android/jni/com/mapswithme/maps/Framework.hpp +++ b/android/jni/com/mapswithme/maps/Framework.hpp @@ -12,7 +12,7 @@ #include "drape_frontend/gui/skin.hpp" #include "drape/pointers.hpp" -#include "drape/oglcontextfactory.hpp" +#include "drape/graphic_context_factory.hpp" #include "local_ads/event.hpp" diff --git a/android/jni/com/mapswithme/opengl/androidoglcontext.cpp b/android/jni/com/mapswithme/opengl/androidoglcontext.cpp index 913bf1eca2..46ad1af2d5 100644 --- a/android/jni/com/mapswithme/opengl/androidoglcontext.cpp +++ b/android/jni/com/mapswithme/opengl/androidoglcontext.cpp @@ -43,43 +43,43 @@ AndroidOGLContext::~AndroidOGLContext() CHECK_EGL_CALL(); } -void AndroidOGLContext::setDefaultFramebuffer() +void AndroidOGLContext::SetDefaultFramebuffer() { glBindFramebuffer(GL_FRAMEBUFFER, 0); } -void AndroidOGLContext::makeCurrent() +void AndroidOGLContext::MakeCurrent() { ASSERT(m_surface != EGL_NO_SURFACE, ()); if (eglMakeCurrent(m_display, m_surface, m_surface, m_nativeContext) == EGL_FALSE) CHECK_EGL_CALL(); } -void AndroidOGLContext::doneCurrent() +void AndroidOGLContext::DoneCurrent() { - clearCurrent(); + ClearCurrent(); } -void AndroidOGLContext::clearCurrent() +void AndroidOGLContext::ClearCurrent() { if (eglMakeCurrent(m_display, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT) == EGL_FALSE) CHECK_EGL_CALL(); } -void AndroidOGLContext::setRenderingEnabled(bool enabled) +void AndroidOGLContext::SetRenderingEnabled(bool enabled) { if (enabled) - makeCurrent(); + MakeCurrent(); else - clearCurrent(); + ClearCurrent(); } -void AndroidOGLContext::setPresentAvailable(bool available) +void AndroidOGLContext::SetPresentAvailable(bool available) { m_presentAvailable = available; } -bool AndroidOGLContext::validate() +bool AndroidOGLContext::Validate() { if (!m_presentAvailable) return false; @@ -88,7 +88,7 @@ bool AndroidOGLContext::validate() eglGetCurrentContext() != EGL_NO_CONTEXT; } -void AndroidOGLContext::present() +void AndroidOGLContext::Present() { if (!m_presentAvailable) return; @@ -97,13 +97,13 @@ void AndroidOGLContext::present() CHECK_EGL_CALL(); } -void AndroidOGLContext::setSurface(EGLSurface surface) +void AndroidOGLContext::SetSurface(EGLSurface surface) { m_surface = surface; ASSERT(m_surface != EGL_NO_SURFACE, ()); } -void AndroidOGLContext::resetSurface() +void AndroidOGLContext::ResetSurface() { m_surface = EGL_NO_SURFACE; } diff --git a/android/jni/com/mapswithme/opengl/androidoglcontext.hpp b/android/jni/com/mapswithme/opengl/androidoglcontext.hpp index 839030cd39..358c559a46 100644 --- a/android/jni/com/mapswithme/opengl/androidoglcontext.hpp +++ b/android/jni/com/mapswithme/opengl/androidoglcontext.hpp @@ -14,18 +14,18 @@ public: EGLConfig config, AndroidOGLContext * contextToShareWith); ~AndroidOGLContext(); - void makeCurrent() override; - void doneCurrent() override; - void present() override; - void setDefaultFramebuffer() override; - void setRenderingEnabled(bool enabled) override; - void setPresentAvailable(bool available) override; - bool validate() override; + void MakeCurrent() override; + void DoneCurrent() override; + void Present() override; + void SetDefaultFramebuffer() override; + void SetRenderingEnabled(bool enabled) override; + void SetPresentAvailable(bool available) override; + bool Validate() override; - void setSurface(EGLSurface surface); - void resetSurface(); + void SetSurface(EGLSurface surface); + void ResetSurface(); - void clearCurrent(); + void ClearCurrent(); private: // {@ Owned by Context diff --git a/android/jni/com/mapswithme/opengl/androidoglcontextfactory.cpp b/android/jni/com/mapswithme/opengl/androidoglcontextfactory.cpp index ca31e26313..6199131212 100644 --- a/android/jni/com/mapswithme/opengl/androidoglcontextfactory.cpp +++ b/android/jni/com/mapswithme/opengl/androidoglcontextfactory.cpp @@ -117,7 +117,7 @@ AndroidOGLContextFactory::AndroidOGLContextFactory(JNIEnv * env, jobject jsurfac SetSurface(env, jsurface); - if (!createPixelbufferSurface()) + if (!CreatePixelbufferSurface()) { CHECK_EGL(eglTerminate(m_display)); return; @@ -166,7 +166,7 @@ void AndroidOGLContextFactory::SetSurface(JNIEnv * env, jobject jsurface) return; } - if (!createWindowSurface()) + if (!CreateWindowSurface()) { CHECK_EGL(eglTerminate(m_display)); return; @@ -176,7 +176,7 @@ void AndroidOGLContextFactory::SetSurface(JNIEnv * env, jobject jsurface) return; if (m_drawContext != nullptr) - m_drawContext->setSurface(m_windowSurface); + m_drawContext->SetSurface(m_windowSurface); m_windowSurfaceValid = true; } @@ -192,7 +192,7 @@ void AndroidOGLContextFactory::ResetSurface() } if (m_drawContext != nullptr) - m_drawContext->resetSurface(); + m_drawContext->ResetSurface(); if (IsValid()) { @@ -264,7 +264,7 @@ bool AndroidOGLContextFactory::QuerySurfaceSize() return true; } -dp::OGLContext * AndroidOGLContextFactory::getDrawContext() +dp::GraphicContext * AndroidOGLContextFactory::GetDrawContext() { ASSERT(IsValid(), ()); ASSERT(m_windowSurface != EGL_NO_SURFACE, ()); @@ -276,7 +276,7 @@ dp::OGLContext * AndroidOGLContextFactory::getDrawContext() return m_drawContext; } -dp::OGLContext * AndroidOGLContextFactory::getResourcesUploadContext() +dp::GraphicContext * AndroidOGLContextFactory::GetResourcesUploadContext() { ASSERT(IsValid(), ()); ASSERT(m_pixelbufferSurface != EGL_NO_SURFACE, ()); @@ -288,17 +288,17 @@ dp::OGLContext * AndroidOGLContextFactory::getResourcesUploadContext() return m_uploadContext; } -bool AndroidOGLContextFactory::isDrawContextCreated() const +bool AndroidOGLContextFactory::IsDrawContextCreated() const { return m_drawContext != nullptr; } -bool AndroidOGLContextFactory::isUploadContextCreated() const +bool AndroidOGLContextFactory::IsUploadContextCreated() const { return m_uploadContext != nullptr; } -void AndroidOGLContextFactory::waitForInitialization(dp::OGLContext *) +void AndroidOGLContextFactory::WaitForInitialization(dp::GraphicContext *) { std::unique_lock lock(m_initializationMutex); if (m_isInitialized) @@ -316,13 +316,13 @@ void AndroidOGLContextFactory::waitForInitialization(dp::OGLContext *) } } -void AndroidOGLContextFactory::setPresentAvailable(bool available) +void AndroidOGLContextFactory::SetPresentAvailable(bool available) { if (m_drawContext != nullptr) - m_drawContext->setPresentAvailable(available); + m_drawContext->SetPresentAvailable(available); } -bool AndroidOGLContextFactory::createWindowSurface() +bool AndroidOGLContextFactory::CreateWindowSurface() { EGLConfig configs[kMaxConfigCount]; int count = 0; @@ -368,7 +368,7 @@ bool AndroidOGLContextFactory::createWindowSurface() return true; } -bool AndroidOGLContextFactory::createPixelbufferSurface() +bool AndroidOGLContextFactory::CreatePixelbufferSurface() { //ASSERT(m_config != NULL, ()); diff --git a/android/jni/com/mapswithme/opengl/androidoglcontextfactory.hpp b/android/jni/com/mapswithme/opengl/androidoglcontextfactory.hpp index c1370b6dc2..476dd1419c 100644 --- a/android/jni/com/mapswithme/opengl/androidoglcontextfactory.hpp +++ b/android/jni/com/mapswithme/opengl/androidoglcontextfactory.hpp @@ -2,7 +2,7 @@ #include "com/mapswithme/core/jni_helper.hpp" #include "androidoglcontext.hpp" -#include "drape/oglcontextfactory.hpp" +#include "drape/graphic_context_factory.hpp" #include "base/src_point.hpp" @@ -11,7 +11,7 @@ namespace android { -class AndroidOGLContextFactory : public dp::OGLContextFactory +class AndroidOGLContextFactory : public dp::GraphicContextFactory { public: AndroidOGLContextFactory(JNIEnv * env, jobject jsurface); @@ -19,12 +19,12 @@ public: bool IsValid() const; - dp::OGLContext * getDrawContext() override; - dp::OGLContext * getResourcesUploadContext() override; - bool isDrawContextCreated() const override; - bool isUploadContextCreated() const override; - void waitForInitialization(dp::OGLContext * context) override; - void setPresentAvailable(bool available) override; + dp::GraphicContext * GetDrawContext() override; + dp::GraphicContext * GetResourcesUploadContext() override; + bool IsDrawContextCreated() const override; + bool IsUploadContextCreated() const override; + void WaitForInitialization(dp::GraphicContext * context) override; + void SetPresentAvailable(bool available) override; void SetSurface(JNIEnv * env, jobject jsurface); void ResetSurface(); @@ -39,8 +39,8 @@ private: bool QuerySurfaceSize(); private: - bool createWindowSurface(); - bool createPixelbufferSurface(); + bool CreateWindowSurface(); + bool CreatePixelbufferSurface(); AndroidOGLContext * m_drawContext; AndroidOGLContext * m_uploadContext; diff --git a/drape/CMakeLists.txt b/drape/CMakeLists.txt index 016050e599..48fad00676 100644 --- a/drape/CMakeLists.txt +++ b/drape/CMakeLists.txt @@ -63,6 +63,9 @@ set( ${DRAPE_ROOT}/gpu_buffer.hpp ${DRAPE_ROOT}/gpu_program.cpp ${DRAPE_ROOT}/gpu_program.hpp + ${DRAPE_ROOT}/graphic_context.hpp + ${DRAPE_ROOT}/graphic_context_factory.cpp + ${DRAPE_ROOT}/graphic_context_factory.hpp ${DRAPE_ROOT}/hw_texture.cpp ${DRAPE_ROOT}/hw_texture.hpp ${DRAPE_ROOT}/index_buffer.cpp @@ -72,9 +75,8 @@ set( ${DRAPE_ROOT}/index_storage.cpp ${DRAPE_ROOT}/index_storage.hpp ${DRAPE_ROOT}/object_pool.hpp + ${DRAPE_ROOT}/oglcontext.cpp ${DRAPE_ROOT}/oglcontext.hpp - ${DRAPE_ROOT}/oglcontextfactory.cpp - ${DRAPE_ROOT}/oglcontextfactory.hpp ${DRAPE_ROOT}/overlay_handle.cpp ${DRAPE_ROOT}/overlay_handle.hpp ${DRAPE_ROOT}/overlay_tree.cpp diff --git a/drape/drape_global.hpp b/drape/drape_global.hpp index aba0255882..73376750bc 100644 --- a/drape/drape_global.hpp +++ b/drape/drape_global.hpp @@ -1,6 +1,6 @@ #pragma once -#include "color.hpp" +#include "drape/color.hpp" #include "geometry/point2d.hpp" diff --git a/drape/drape_tests/glfunctions.cpp b/drape/drape_tests/glfunctions.cpp index 39cc47d163..eae86206ca 100644 --- a/drape/drape_tests/glfunctions.cpp +++ b/drape/drape_tests/glfunctions.cpp @@ -11,6 +11,11 @@ dp::ApiVersion GLFunctions::CurrentApiVersion = dp::ApiVersion::OpenGLES2; #define MOCK_CALL(f) GLMockFunctions::Instance().f; +void GLFunctions::Init(dp::ApiVersion apiVersion) +{ + MOCK_CALL(Init(apiVersion)); +} + void GLFunctions::glFlush() { } @@ -326,3 +331,33 @@ int32_t GLFunctions::glGetBufferParameter(glConst target, glConst name) { return MOCK_CALL(glGetBufferParameter(target, name)); } + +void GLFunctions::glCullFace(glConst face) +{ + MOCK_CALL(glCullFace(face)); +} + +void GLFunctions::glFrontFace(glConst mode) +{ + MOCK_CALL(glFrontFace(mode)); +} + +void GLFunctions::glDepthMask(bool needWriteToDepthBuffer) +{ + MOCK_CALL(glDepthMask(needWriteToDepthBuffer)); +} + +void GLFunctions::glClear(uint32_t clearBits) +{ + MOCK_CALL(glClear(clearBits)); +} + +void GLFunctions::glClearColor(float r, float g, float b, float a) +{ + MOCK_CALL(glClearColor(r, g, b, a)); +} + +void GLFunctions::glClearDepthValue(double depth) +{ + MOCK_CALL(glClearDepthValue(depth)); +} diff --git a/drape/drape_tests/glmock_functions.hpp b/drape/drape_tests/glmock_functions.hpp index fcb4801dd0..2f5b99f33c 100644 --- a/drape/drape_tests/glmock_functions.hpp +++ b/drape/drape_tests/glmock_functions.hpp @@ -1,5 +1,6 @@ #pragma once +#include "drape/drape_global.hpp" #include "drape/glconstants.hpp" #include "std/string.hpp" @@ -16,6 +17,8 @@ public: static GLMockFunctions & Instance(); static void ValidateAndClear(); + MOCK_METHOD1(Init, void(dp::ApiVersion)); + // VAO MOCK_METHOD0(glGenVertexArray, uint32_t()); MOCK_METHOD1(glBindVertexArray, void(uint32_t vao)); @@ -95,6 +98,15 @@ public: MOCK_METHOD2(glFramebufferTexture2D, void(glConst attachment, glConst texture)); MOCK_METHOD0(glCheckFramebufferStatus, uint32_t()); + MOCK_METHOD1(glCullFace, void(glConst)); + MOCK_METHOD1(glFrontFace, void(glConst)); + + MOCK_METHOD1(glDepthMask, void(bool)); + + MOCK_METHOD1(glClear, void(uint32_t)); + MOCK_METHOD4(glClearColor, void(float, float, float, float)); + MOCK_METHOD1(glClearDepthValue, void(double)); + private: static GLMockFunctions * m_mock; }; diff --git a/drape/graphic_context.hpp b/drape/graphic_context.hpp new file mode 100644 index 0000000000..7f538079cc --- /dev/null +++ b/drape/graphic_context.hpp @@ -0,0 +1,35 @@ +#pragma once + +#include "drape/drape_global.hpp" + +namespace dp +{ +using ContextConst = uint32_t; + +enum ClearBits: ContextConst +{ + ColorBit = 1, + DepthBit = 1 << 1, + StencilBit = 1 << 2 +}; + +class GraphicContext +{ +public: + virtual ~GraphicContext() {} + virtual void Present() = 0; + virtual void MakeCurrent() = 0; + virtual void DoneCurrent() {} + virtual void SetDefaultFramebuffer() = 0; + // w, h - pixel size of render target (logical size * visual scale). + virtual void Resize(int /*w*/, int /*h*/) {} + virtual void SetRenderingEnabled(bool /*enabled*/) {} + virtual void SetPresentAvailable(bool /*available*/) {} + virtual bool Validate() { return true; } + + virtual void SetApiVersion(ApiVersion apiVersion) = 0; + virtual void Init() = 0; + virtual void SetClearColor(float r, float g, float b, float a) = 0; + virtual void Clear(ContextConst clearBits) = 0; +}; +} // namespace dp diff --git a/drape/graphic_context_factory.cpp b/drape/graphic_context_factory.cpp new file mode 100644 index 0000000000..c9e3674c59 --- /dev/null +++ b/drape/graphic_context_factory.cpp @@ -0,0 +1,51 @@ +#include "drape/graphic_context_factory.hpp" + +namespace dp +{ +ThreadSafeFactory::ThreadSafeFactory(GraphicContextFactory * factory, bool enableSharing) + : m_factory(factory) + , m_enableSharing(enableSharing) +{} + +ThreadSafeFactory::~ThreadSafeFactory() +{ + delete m_factory; +} + +GraphicContext * ThreadSafeFactory::GetDrawContext() +{ + return CreateContext([this](){ return m_factory->GetDrawContext(); }, + [this](){ return m_factory->IsUploadContextCreated(); }); +} + +GraphicContext * ThreadSafeFactory::GetResourcesUploadContext() +{ + return CreateContext([this](){ return m_factory->GetResourcesUploadContext(); }, + [this](){ return m_factory->IsDrawContextCreated(); }); +} + +GraphicContext * ThreadSafeFactory::CreateContext(TCreateCtxFn const & createFn, TIsSeparateCreatedFn const checkFn) +{ + threads::ConditionGuard g(m_contidion); + GraphicContext * ctx = createFn(); + if (m_enableSharing) + { + if (!checkFn()) + g.Wait(); + else + g.Signal(); + } + + return ctx; +} + +void ThreadSafeFactory::WaitForInitialization(GraphicContext * context) +{ + m_factory->WaitForInitialization(context); +} + +void ThreadSafeFactory::SetPresentAvailable(bool available) +{ + m_factory->SetPresentAvailable(available); +} +} // namespace dp diff --git a/drape/graphic_context_factory.hpp b/drape/graphic_context_factory.hpp new file mode 100644 index 0000000000..3c20665003 --- /dev/null +++ b/drape/graphic_context_factory.hpp @@ -0,0 +1,52 @@ +#pragma once + +#include "drape/graphic_context.hpp" + +#include "base/condition.hpp" +#include "base/assert.hpp" + +#include "std/function.hpp" + +namespace dp +{ +class GraphicContextFactory +{ +public: + virtual ~GraphicContextFactory() {} + virtual GraphicContext * GetDrawContext() = 0; + virtual GraphicContext * GetResourcesUploadContext() = 0; + virtual bool IsDrawContextCreated() const { return false; } + virtual bool IsUploadContextCreated() const { return false; } + virtual void WaitForInitialization(dp::GraphicContext * context) {} + virtual void SetPresentAvailable(bool available) {} +}; + +class ThreadSafeFactory : public GraphicContextFactory +{ +public: + ThreadSafeFactory(GraphicContextFactory * factory, bool enableSharing = true); + ~ThreadSafeFactory(); + GraphicContext * GetDrawContext() override; + GraphicContext * GetResourcesUploadContext() override; + + template + T * CastFactory() + { + ASSERT(dynamic_cast(m_factory) != nullptr, ()); + return static_cast(m_factory); + } + + void WaitForInitialization(dp::GraphicContext * context) override; + void SetPresentAvailable(bool available) override; + +protected: + typedef function TCreateCtxFn; + typedef function TIsSeparateCreatedFn; + GraphicContext * CreateContext(TCreateCtxFn const & createFn, TIsSeparateCreatedFn const checkFn); + +private: + GraphicContextFactory * m_factory; + threads::Condition m_contidion; + bool m_enableSharing; +}; +} // namespace dp diff --git a/drape/oglcontext.cpp b/drape/oglcontext.cpp new file mode 100644 index 0000000000..eaffb7f0d6 --- /dev/null +++ b/drape/oglcontext.cpp @@ -0,0 +1,42 @@ +#include "drape/oglcontext.hpp" +#include "drape/glfunctions.hpp" + +namespace dp +{ +void OGLContext::SetApiVersion(ApiVersion apiVersion) +{ + GLFunctions::Init(apiVersion); +} + +void OGLContext::Init() +{ + GLFunctions::glPixelStore(gl_const::GLUnpackAlignment, 1); + + GLFunctions::glClearDepthValue(1.0); + GLFunctions::glDepthFunc(gl_const::GLLessOrEqual); + GLFunctions::glDepthMask(true); + + GLFunctions::glFrontFace(gl_const::GLClockwise); + GLFunctions::glCullFace(gl_const::GLBack); + GLFunctions::glEnable(gl_const::GLCullFace); + GLFunctions::glEnable(gl_const::GLScissorTest); +} + +void OGLContext::SetClearColor(float r, float g, float b, float a) +{ + GLFunctions::glClearColor(r, g, b, a); +} + +void OGLContext::Clear(ContextConst clearBits) +{ + glConst glBits = 0; + if (clearBits & ClearBits::ColorBit) + glBits |= gl_const::GLColorBit; + if (clearBits & ClearBits::DepthBit) + glBits |= gl_const::GLDepthBit; + if (clearBits & ClearBits::StencilBit) + glBits |= gl_const::GLStencilBit; + + GLFunctions::glClear(glBits); +} +} // namespace dp diff --git a/drape/oglcontext.hpp b/drape/oglcontext.hpp index baaa5bcc3a..709df24b61 100644 --- a/drape/oglcontext.hpp +++ b/drape/oglcontext.hpp @@ -1,19 +1,15 @@ #pragma once +#include "drape/graphic_context.hpp" + namespace dp { -class OGLContext +class OGLContext: public GraphicContext { public: - virtual ~OGLContext() {} - virtual void present() = 0; - virtual void makeCurrent() = 0; - virtual void doneCurrent() {} - virtual void setDefaultFramebuffer() = 0; - // w, h - pixel size of render target (logical size * visual scale). - virtual void resize(int /*w*/, int /*h*/) {} - virtual void setRenderingEnabled(bool /*enabled*/) {} - virtual void setPresentAvailable(bool /*available*/) {} - virtual bool validate() { return true; } + void SetApiVersion(ApiVersion apiVersion) override; + void Init() override; + void SetClearColor(float r, float g, float b, float a) override; + void Clear(ContextConst clearBits) override; }; } // namespace dp diff --git a/drape/oglcontextfactory.cpp b/drape/oglcontextfactory.cpp deleted file mode 100644 index da61f0f311..0000000000 --- a/drape/oglcontextfactory.cpp +++ /dev/null @@ -1,51 +0,0 @@ -#include "drape/oglcontextfactory.hpp" - -namespace dp -{ -ThreadSafeFactory::ThreadSafeFactory(OGLContextFactory * factory, bool enableSharing) - : m_factory(factory) - , m_enableSharing(enableSharing) -{} - -ThreadSafeFactory::~ThreadSafeFactory() -{ - delete m_factory; -} - -OGLContext * ThreadSafeFactory::getDrawContext() -{ - return CreateContext([this](){ return m_factory->getDrawContext(); }, - [this](){ return m_factory->isUploadContextCreated(); }); -} - -OGLContext *ThreadSafeFactory::getResourcesUploadContext() -{ - return CreateContext([this](){ return m_factory->getResourcesUploadContext(); }, - [this](){ return m_factory->isDrawContextCreated(); }); -} - -OGLContext * ThreadSafeFactory::CreateContext(TCreateCtxFn const & createFn, TIsSeparateCreatedFn const checkFn) -{ - threads::ConditionGuard g(m_contidion); - OGLContext * ctx = createFn(); - if (m_enableSharing) - { - if (!checkFn()) - g.Wait(); - else - g.Signal(); - } - - return ctx; -} - -void ThreadSafeFactory::waitForInitialization(dp::OGLContext * context) -{ - m_factory->waitForInitialization(context); -} - -void ThreadSafeFactory::setPresentAvailable(bool available) -{ - m_factory->setPresentAvailable(available); -} -} // namespace dp diff --git a/drape/oglcontextfactory.hpp b/drape/oglcontextfactory.hpp deleted file mode 100644 index cf0438bbad..0000000000 --- a/drape/oglcontextfactory.hpp +++ /dev/null @@ -1,52 +0,0 @@ -#pragma once - -#include "drape/oglcontext.hpp" - -#include "base/condition.hpp" -#include "base/assert.hpp" - -#include "std/function.hpp" - -namespace dp -{ -class OGLContextFactory -{ -public: - virtual ~OGLContextFactory() {} - virtual OGLContext * getDrawContext() = 0; - virtual OGLContext * getResourcesUploadContext() = 0; - virtual bool isDrawContextCreated() const { return false; } - virtual bool isUploadContextCreated() const { return false; } - virtual void waitForInitialization(dp::OGLContext * context) {} - virtual void setPresentAvailable(bool available) {} -}; - -class ThreadSafeFactory : public OGLContextFactory -{ -public: - ThreadSafeFactory(OGLContextFactory * factory, bool enableSharing = true); - ~ThreadSafeFactory(); - OGLContext * getDrawContext() override; - OGLContext * getResourcesUploadContext() override; - - template - T * CastFactory() - { - ASSERT(dynamic_cast(m_factory) != nullptr, ()); - return static_cast(m_factory); - } - - void waitForInitialization(dp::OGLContext * context) override; - void setPresentAvailable(bool available) override; - -protected: - typedef function TCreateCtxFn; - typedef function TIsSeparateCreatedFn; - OGLContext * CreateContext(TCreateCtxFn const & createFn, TIsSeparateCreatedFn const checkFn); - -private: - OGLContextFactory * m_factory; - threads::Condition m_contidion; - bool m_enableSharing; -}; -} // namespace dp diff --git a/drape_frontend/backend_renderer.cpp b/drape_frontend/backend_renderer.cpp index ac4e252e03..35a480e526 100644 --- a/drape_frontend/backend_renderer.cpp +++ b/drape_frontend/backend_renderer.cpp @@ -577,15 +577,15 @@ void BackendRenderer::ReleaseResources() m_trafficGenerator.reset(); m_texMng->Release(); - m_contextFactory->getResourcesUploadContext()->doneCurrent(); + m_contextFactory->GetResourcesUploadContext()->DoneCurrent(); } void BackendRenderer::OnContextCreate() { LOG(LINFO, ("On context create.")); - dp::OGLContext * context = m_contextFactory->getResourcesUploadContext(); - m_contextFactory->waitForInitialization(context); - context->makeCurrent(); + auto context = m_contextFactory->GetResourcesUploadContext(); + m_contextFactory->WaitForInitialization(context); + context->MakeCurrent(); GLFunctions::Init(m_apiVersion); @@ -603,7 +603,7 @@ void BackendRenderer::OnContextDestroy() m_overlays.clear(); m_trafficGenerator->ClearGLDependentResources(); - m_contextFactory->getResourcesUploadContext()->doneCurrent(); + m_contextFactory->GetResourcesUploadContext()->DoneCurrent(); } BackendRenderer::Routine::Routine(BackendRenderer & renderer) : m_renderer(renderer) {} @@ -612,10 +612,10 @@ void BackendRenderer::Routine::Do() { LOG(LINFO, ("Start routine.")); m_renderer.OnContextCreate(); - dp::OGLContext * context = m_renderer.m_contextFactory->getResourcesUploadContext(); + dp::GraphicContext * context = m_renderer.m_contextFactory->GetResourcesUploadContext(); while (!IsCancelled()) { - if (context->validate()) + if (context->Validate()) m_renderer.ProcessSingleMessage(); m_renderer.CheckRenderingEnabled(); } diff --git a/drape_frontend/backend_renderer.hpp b/drape_frontend/backend_renderer.hpp index 83fd6ce54d..a1cec276e6 100644 --- a/drape_frontend/backend_renderer.hpp +++ b/drape_frontend/backend_renderer.hpp @@ -17,7 +17,7 @@ namespace dp { -class OGLContextFactory; +class GraphicContextFactory; class TextureManager; } // namespace dp @@ -38,7 +38,7 @@ public: struct Params : BaseRenderer::Params { Params(dp::ApiVersion apiVersion, ref_ptr commutator, - ref_ptr factory, ref_ptr texMng, + ref_ptr factory, ref_ptr texMng, MapDataProvider const & model, TUpdateCurrentCountryFn const & updateCurrentCountryFn, ref_ptr requestedTiles, bool allow3dBuildings, bool trafficEnabled, bool simplifiedTrafficColors, TIsUGCFn && isUGCFn) diff --git a/drape_frontend/base_renderer.cpp b/drape_frontend/base_renderer.cpp index b46e1836ea..7a49101c75 100644 --- a/drape_frontend/base_renderer.cpp +++ b/drape_frontend/base_renderer.cpp @@ -40,7 +40,7 @@ void BaseRenderer::StopThread() m_selfThread.Join(); } -void BaseRenderer::SetRenderingEnabled(ref_ptr contextFactory) +void BaseRenderer::SetRenderingEnabled(ref_ptr contextFactory) { if (m_wasContextReset && contextFactory != nullptr) m_contextFactory = contextFactory; @@ -107,7 +107,7 @@ void BaseRenderer::CheckRenderingEnabled() { if (!m_isEnabled) { - dp::OGLContext * context = nullptr; + dp::GraphicContext * context = nullptr; if (m_wasContextReset) { @@ -118,9 +118,9 @@ void BaseRenderer::CheckRenderingEnabled() else { bool const isDrawContext = m_threadName == ThreadsCommutator::RenderThread; - context = isDrawContext ? m_contextFactory->getDrawContext() : - m_contextFactory->getResourcesUploadContext(); - context->setRenderingEnabled(false); + context = isDrawContext ? m_contextFactory->GetDrawContext() : + m_contextFactory->GetResourcesUploadContext(); + context->SetRenderingEnabled(false); } // notify initiator-thread about rendering disabling @@ -145,7 +145,7 @@ void BaseRenderer::CheckRenderingEnabled() } else { - context->setRenderingEnabled(true); + context->SetRenderingEnabled(true); } } // notify initiator-thread about rendering enabling diff --git a/drape_frontend/base_renderer.hpp b/drape_frontend/base_renderer.hpp index b44f8fc277..afcb4ff00b 100644 --- a/drape_frontend/base_renderer.hpp +++ b/drape_frontend/base_renderer.hpp @@ -4,7 +4,7 @@ #include "drape_frontend/threads_commutator.hpp" #include "drape_frontend/tile_utils.hpp" -#include "drape/oglcontextfactory.hpp" +#include "drape/graphic_context_factory.hpp" #include "drape/texture_manager.hpp" #include "base/thread.hpp" @@ -25,7 +25,7 @@ public: { Params(dp::ApiVersion apiVersion, ref_ptr commutator, - ref_ptr factory, + ref_ptr factory, ref_ptr texMng) : m_apiVersion(apiVersion) , m_commutator(commutator) @@ -36,7 +36,7 @@ public: dp::ApiVersion m_apiVersion; ref_ptr m_commutator; - ref_ptr m_oglContextFactory; + ref_ptr m_oglContextFactory; ref_ptr m_texMng; }; @@ -44,7 +44,7 @@ public: bool CanReceiveMessages(); - void SetRenderingEnabled(ref_ptr contextFactory); + void SetRenderingEnabled(ref_ptr contextFactory); void SetRenderingDisabled(bool const destroyContext); bool IsRenderingEnabled() const; @@ -52,7 +52,7 @@ public: protected: dp::ApiVersion m_apiVersion; ref_ptr m_commutator; - ref_ptr m_contextFactory; + ref_ptr m_contextFactory; ref_ptr m_texMng; void StartThread(); diff --git a/drape_frontend/drape_engine.cpp b/drape_frontend/drape_engine.cpp index a271d88e04..83fa37ee39 100644 --- a/drape_frontend/drape_engine.cpp +++ b/drape_frontend/drape_engine.cpp @@ -344,7 +344,7 @@ void DrapeEngine::UpdateUserMarks(UserMarksProvider * provider, bool firstTime) } } -void DrapeEngine::SetRenderingEnabled(ref_ptr contextFactory) +void DrapeEngine::SetRenderingEnabled(ref_ptr contextFactory) { m_backend->SetRenderingEnabled(contextFactory); m_frontend->SetRenderingEnabled(contextFactory); diff --git a/drape_frontend/drape_engine.hpp b/drape_frontend/drape_engine.hpp index 0397b6fd25..a1d1bf7136 100644 --- a/drape_frontend/drape_engine.hpp +++ b/drape_frontend/drape_engine.hpp @@ -37,7 +37,7 @@ namespace dp { class GlyphGenerator; -class OGLContextFactory; +class GraphicContextFactory; } // namespace dp namespace df @@ -51,7 +51,7 @@ public: struct Params { Params(dp::ApiVersion apiVersion, - ref_ptr factory, + ref_ptr factory, dp::Viewport const & viewport, MapDataProvider const & model, Hints const & hints, @@ -93,7 +93,7 @@ public: {} dp::ApiVersion m_apiVersion; - ref_ptr m_factory; + ref_ptr m_factory; dp::Viewport m_viewport; MapDataProvider m_model; Hints m_hints; @@ -141,7 +141,7 @@ public: void UpdateUserMarks(UserMarksProvider * provider, bool firstTime); void InvalidateUserMarks(); - void SetRenderingEnabled(ref_ptr contextFactory = nullptr); + void SetRenderingEnabled(ref_ptr contextFactory = nullptr); void SetRenderingDisabled(bool const destroyContext); void InvalidateRect(m2::RectD const & rect); void UpdateMapStyle(); diff --git a/drape_frontend/frontend_renderer.cpp b/drape_frontend/frontend_renderer.cpp index 9941bdff48..88ac585c75 100755 --- a/drape_frontend/frontend_renderer.cpp +++ b/drape_frontend/frontend_renderer.cpp @@ -1038,7 +1038,7 @@ void FrontendRenderer::OnResize(ScreenBase const & screen) if (viewportChanged || m_needRestoreSize) { - m_contextFactory->getDrawContext()->resize(sx, sy); + m_contextFactory->GetDrawContext()->Resize(sx, sy); m_buildingsFramebuffer->SetSize(sx, sy); m_postprocessRenderer->Resize(sx, sy); m_needRestoreSize = false; @@ -1223,11 +1223,13 @@ void FrontendRenderer::RenderScene(ScreenBase const & modelView, bool activeFram DrapeMeasurer::Instance().BeforeRenderFrame(); #endif + auto context = m_contextFactory->GetDrawContext(); + if (m_postprocessRenderer->BeginFrame(activeFrame)) { m_viewport.Apply(); RefreshBgColor(); - GLFunctions::glClear(gl_const::GLColorBit | gl_const::GLDepthBit | gl_const::GLStencilBit); + context->Clear(dp::ClearBits::ColorBit | dp::ClearBits::DepthBit | dp::ClearBits::StencilBit); Render2dLayer(modelView); RenderUserMarksLayer(modelView, RenderState::UserLineLayer); @@ -1247,7 +1249,7 @@ void FrontendRenderer::RenderScene(ScreenBase const & modelView, bool activeFram RenderRouteLayer(modelView); } - GLFunctions::glClear(gl_const::GLDepthBit); + context->Clear(dp::ClearBits::DepthBit); if (m_selectionShape != nullptr) { @@ -1336,17 +1338,18 @@ void FrontendRenderer::Render3dLayer(ScreenBase const & modelView, bool useFrame if (layer.m_renderGroups.empty()) return; + auto context = m_contextFactory->GetDrawContext(); float const kOpacity = 0.7f; if (useFramebuffer) { ASSERT(m_buildingsFramebuffer->IsSupported(), ()); m_buildingsFramebuffer->Enable(); - GLFunctions::glClearColor(0.0f, 0.0f, 0.0f, 0.0f); - GLFunctions::glClear(gl_const::GLColorBit | gl_const::GLDepthBit); + context->SetClearColor(0.0f, 0.0f, 0.0f, 0.0f); + context->Clear(dp::ClearBits::ColorBit | dp::ClearBits::DepthBit); } else { - GLFunctions::glClear(gl_const::GLDepthBit); + context->Clear(dp::ClearBits::DepthBit); } layer.Sort(make_ref(m_overlayTree)); @@ -1395,7 +1398,7 @@ bool FrontendRenderer::HasRouteData() const void FrontendRenderer::RenderTransitSchemeLayer(ScreenBase const & modelView) { - GLFunctions::glClear(gl_const::GLDepthBit); + m_contextFactory->GetDrawContext()->Clear(dp::ClearBits::DepthBit); if (m_transitSchemeEnabled && m_transitSchemeRenderer->IsSchemeVisible(m_currentZoomLevel)) { RenderTransitBackground(); @@ -1406,7 +1409,7 @@ void FrontendRenderer::RenderTransitSchemeLayer(ScreenBase const & modelView) void FrontendRenderer::RenderTrafficLayer(ScreenBase const & modelView) { - GLFunctions::glClear(gl_const::GLDepthBit); + m_contextFactory->GetDrawContext()->Clear(dp::ClearBits::DepthBit); if (m_trafficRenderer->HasRenderData()) { m_trafficRenderer->RenderTraffic(modelView, m_currentZoomLevel, 1.0f /* opacity */, @@ -1438,7 +1441,7 @@ void FrontendRenderer::RenderRouteLayer(ScreenBase const & modelView) if (HasTransitRouteData()) RenderTransitBackground(); - GLFunctions::glClear(gl_const::GLDepthBit); + m_contextFactory->GetDrawContext()->Clear(dp::ClearBits::DepthBit); m_routeRenderer->RenderRoute(modelView, m_trafficRenderer->HasRenderData(), make_ref(m_gpuProgramManager), m_frameValues); } @@ -1449,7 +1452,7 @@ void FrontendRenderer::RenderUserMarksLayer(ScreenBase const & modelView, Render if (renderGroups.empty()) return; - GLFunctions::glClear(gl_const::GLDepthBit); + m_contextFactory->GetDrawContext()->Clear(dp::ClearBits::DepthBit); for (drape_ptr & group : renderGroups) RenderSingleGroup(modelView, make_ref(group)); @@ -1467,19 +1470,20 @@ void FrontendRenderer::RenderSearchMarksLayer(ScreenBase const & modelView) RenderUserMarksLayer(modelView, RenderState::SearchMarkLayer); } -void FrontendRenderer::RenderEmptyFrame(dp::OGLContext * context) +void FrontendRenderer::RenderEmptyFrame() { - if (!context->validate()) + auto context = m_contextFactory->GetDrawContext(); + if (!context->Validate()) return; - context->setDefaultFramebuffer(); + context->SetDefaultFramebuffer(); auto const c = dp::Extract(drule::rules().GetBgColor(1 /* scale */), 0); - GLFunctions::glClearColor(c.GetRedF(), c.GetGreenF(), c.GetBlueF(), 1.0f); + context->SetClearColor(c.GetRedF(), c.GetGreenF(), c.GetBlueF(), 1.0f); m_viewport.Apply(); - GLFunctions::glClear(gl_const::GLColorBit); + context->Clear(dp::ClearBits::ColorBit); - context->present(); + context->Present(); } void FrontendRenderer::BuildOverlayTree(ScreenBase const & modelView) @@ -1617,7 +1621,7 @@ void FrontendRenderer::RefreshBgColor() scales::GetUpperStyleScale()); auto const color = drule::rules().GetBgColor(scale); auto const c = dp::Extract(color, 0 /*255 - (color >> 24)*/); - GLFunctions::glClearColor(c.GetRedF(), c.GetGreenF(), c.GetBlueF(), 1.0f); + m_contextFactory->GetDrawContext()->SetClearColor(c.GetRedF(), c.GetGreenF(), c.GetBlueF(), 1.0f); } void FrontendRenderer::DisablePerspective() @@ -1929,7 +1933,8 @@ void FrontendRenderer::OnContextDestroy() dp::DebugRectRenderer::Instance().Destroy(); m_gpuProgramManager.reset(); - m_contextFactory->getDrawContext()->doneCurrent(); + + m_contextFactory->GetDrawContext()->DoneCurrent(); m_needRestoreSize = true; m_firstTilesReady = false; @@ -1942,26 +1947,17 @@ void FrontendRenderer::OnContextCreate() { LOG(LINFO, ("On context create.")); - dp::OGLContext * context = m_contextFactory->getDrawContext(); - m_contextFactory->waitForInitialization(context); + auto context = m_contextFactory->GetDrawContext(); + m_contextFactory->WaitForInitialization(context); - context->makeCurrent(); + context->MakeCurrent(); - GLFunctions::Init(m_apiVersion); + context->SetApiVersion(m_apiVersion); // Render empty frame here to avoid black initialization screen. - RenderEmptyFrame(context); + RenderEmptyFrame(); - GLFunctions::glPixelStore(gl_const::GLUnpackAlignment, 1); - - GLFunctions::glClearDepthValue(1.0); - GLFunctions::glDepthFunc(gl_const::GLLessOrEqual); - GLFunctions::glDepthMask(true); - - GLFunctions::glFrontFace(gl_const::GLClockwise); - GLFunctions::glCullFace(gl_const::GLBack); - GLFunctions::glEnable(gl_const::GLCullFace); - GLFunctions::glEnable(gl_const::GLScissorTest); + context->Init(); dp::SupportManager::Instance().Init(); @@ -1989,9 +1985,9 @@ void FrontendRenderer::OnContextCreate() m_postprocessRenderer->Init(m_apiVersion, [context]() { - if (!context->validate()) + if (!context->Validate()) return false; - context->setDefaultFramebuffer(); + context->SetDefaultFramebuffer(); return true; }); #ifndef OMIM_OS_IPHONE_SIMULATOR @@ -2030,7 +2026,7 @@ void FrontendRenderer::Routine::Do() bool forceFullRedrawNextFrame = false; uint32_t constexpr kMaxInactiveFrames = 2; - dp::OGLContext * context = m_renderer.m_contextFactory->getDrawContext(); + auto context = m_renderer.m_contextFactory->GetDrawContext(); auto & scaleFpsHelper = gui::DrapeGui::Instance().GetScaleFpsHelper(); #ifdef DEBUG @@ -2052,7 +2048,7 @@ void FrontendRenderer::Routine::Do() while (!IsCancelled()) { - if (context->validate()) + if (context->Validate()) { timer.Reset(); @@ -2133,7 +2129,7 @@ void FrontendRenderer::Routine::Do() while (availableTime > 0.0); } - context->present(); + context->Present(); // Limit fps in following mode. double constexpr kFrameTime = 1.0 / 30.0; @@ -2177,7 +2173,7 @@ void FrontendRenderer::ReleaseResources() m_transitBackground.reset(); m_gpuProgramManager.reset(); - m_contextFactory->getDrawContext()->doneCurrent(); + m_contextFactory->GetDrawContext()->DoneCurrent(); } void FrontendRenderer::AddUserEvent(drape_ptr && event) diff --git a/drape_frontend/frontend_renderer.hpp b/drape_frontend/frontend_renderer.hpp index 9889bee2e1..95e7e55d78 100755 --- a/drape_frontend/frontend_renderer.hpp +++ b/drape_frontend/frontend_renderer.hpp @@ -78,7 +78,7 @@ public: struct Params : BaseRenderer::Params { Params(dp::ApiVersion apiVersion, ref_ptr commutator, - ref_ptr factory, ref_ptr texMng, + ref_ptr factory, ref_ptr texMng, MyPositionController::Params && myPositionParams, dp::Viewport viewport, TModelViewChanged const & modelViewChangedFn, TTapEventInfoFn const & tapEventFn, TUserPositionChangedFn const & positionChangedFn, ref_ptr requestedTiles, @@ -169,7 +169,7 @@ private: void RenderRouteLayer(ScreenBase const & modelView); void RenderSearchMarksLayer(ScreenBase const & modelView); void RenderTransitBackground(); - void RenderEmptyFrame(dp::OGLContext * context); + void RenderEmptyFrame(); bool HasTransitRouteData() const; bool HasRouteData() const; diff --git a/iphone/Maps/Classes/EAGLView.mm b/iphone/Maps/Classes/EAGLView.mm index 5b6a9aee36..92baa1f951 100644 --- a/iphone/Maps/Classes/EAGLView.mm +++ b/iphone/Maps/Classes/EAGLView.mm @@ -174,7 +174,7 @@ double getExactDPI(double contentScaleFactor) - (void)setPresentAvailable:(BOOL)available { - m_factory->setPresentAvailable(available); + m_factory->SetPresentAvailable(available); } - (MWMMapWidgets *)widgetsManager diff --git a/iphone/Maps/Classes/iosOGLContext.h b/iphone/Maps/Classes/iosOGLContext.h index 79b857f1e0..c7e2abed29 100644 --- a/iphone/Maps/Classes/iosOGLContext.h +++ b/iphone/Maps/Classes/iosOGLContext.h @@ -15,19 +15,19 @@ public: iosOGLContext * contextToShareWith, bool needBuffers = false); ~iosOGLContext(); - void makeCurrent() override; - void present() override; - void setDefaultFramebuffer() override; - void resize(int w, int h) override; - void setPresentAvailable(bool available) override; + void MakeCurrent() override; + void Present() override; + void SetDefaultFramebuffer() override; + void Resize(int w, int h) override; + void SetPresentAvailable(bool available) override; private: dp::ApiVersion m_apiVersion; CAEAGLLayer * m_layer; EAGLContext * m_nativeContext; - void initBuffers(); - void destroyBuffers(); + void InitBuffers(); + void DestroyBuffers(); //{@ Buffers bool m_needBuffers; diff --git a/iphone/Maps/Classes/iosOGLContext.mm b/iphone/Maps/Classes/iosOGLContext.mm index f7e3ee403c..a048e03c6d 100644 --- a/iphone/Maps/Classes/iosOGLContext.mm +++ b/iphone/Maps/Classes/iosOGLContext.mm @@ -35,24 +35,24 @@ iosOGLContext::iosOGLContext(CAEAGLLayer * layer, dp::ApiVersion apiVersion, iosOGLContext::~iosOGLContext() { - destroyBuffers(); + DestroyBuffers(); } -void iosOGLContext::makeCurrent() +void iosOGLContext::MakeCurrent() { ASSERT(m_nativeContext != NULL, ()); [EAGLContext setCurrentContext: m_nativeContext]; if (m_needBuffers && !m_hasBuffers) - initBuffers(); + InitBuffers(); } -void iosOGLContext::setPresentAvailable(bool available) +void iosOGLContext::SetPresentAvailable(bool available) { m_presentAvailable = available; } -void iosOGLContext::present() +void iosOGLContext::Present() { ASSERT(m_nativeContext != NULL, ()); ASSERT(m_renderBufferId, ()); @@ -73,13 +73,13 @@ void iosOGLContext::present() GLCHECK(glDiscardFramebufferEXT(GL_FRAMEBUFFER, 1, discards + 1)); } -void iosOGLContext::setDefaultFramebuffer() +void iosOGLContext::SetDefaultFramebuffer() { ASSERT(m_frameBufferId, ()); glBindFramebuffer(GL_FRAMEBUFFER, m_frameBufferId); } -void iosOGLContext::resize(int w, int h) +void iosOGLContext::Resize(int w, int h) { if (m_needBuffers && m_hasBuffers) { @@ -90,12 +90,12 @@ void iosOGLContext::resize(int w, int h) if (width == w && height == h) return; - destroyBuffers(); - initBuffers(); + DestroyBuffers(); + InitBuffers(); } } -void iosOGLContext::initBuffers() +void iosOGLContext::InitBuffers() { ASSERT(m_needBuffers, ()); @@ -134,7 +134,7 @@ void iosOGLContext::initBuffers() } } -void iosOGLContext::destroyBuffers() +void iosOGLContext::DestroyBuffers() { if (m_needBuffers && m_hasBuffers) { diff --git a/iphone/Maps/Classes/iosOGLContextFactory.h b/iphone/Maps/Classes/iosOGLContextFactory.h index 8f906925cc..015c2f8013 100644 --- a/iphone/Maps/Classes/iosOGLContextFactory.h +++ b/iphone/Maps/Classes/iosOGLContextFactory.h @@ -2,27 +2,27 @@ #import "iosOGLContext.h" -#include "drape/oglcontextfactory.hpp" +#include "drape/graphic_context_factory.hpp" #include "drape/drape_global.hpp" #include "std/condition_variable.hpp" #include "std/mutex.hpp" -class iosOGLContextFactory: public dp::OGLContextFactory +class iosOGLContextFactory: public dp::GraphicContextFactory { public: iosOGLContextFactory(CAEAGLLayer * layer, dp::ApiVersion apiVersion); ~iosOGLContextFactory(); - dp::OGLContext * getDrawContext() override; - dp::OGLContext * getResourcesUploadContext() override; + dp::GraphicContext * GetDrawContext() override; + dp::GraphicContext * GetResourcesUploadContext() override; - bool isDrawContextCreated() const override; - bool isUploadContextCreated() const override; + bool IsDrawContextCreated() const override; + bool IsUploadContextCreated() const override; - void waitForInitialization(dp::OGLContext * context) override; + void WaitForInitialization(dp::GraphicContext * context) override; - void setPresentAvailable(bool available) override; + void SetPresentAvailable(bool available) override; private: CAEAGLLayer * m_layer; diff --git a/iphone/Maps/Classes/iosOGLContextFactory.mm b/iphone/Maps/Classes/iosOGLContextFactory.mm index 8a844e682b..2c226e3dcc 100644 --- a/iphone/Maps/Classes/iosOGLContextFactory.mm +++ b/iphone/Maps/Classes/iosOGLContextFactory.mm @@ -18,37 +18,37 @@ iosOGLContextFactory::~iosOGLContextFactory() delete m_uploadContext; } -dp::OGLContext * iosOGLContextFactory::getDrawContext() +dp::GraphicContext * iosOGLContextFactory::GetDrawContext() { if (m_drawContext == nullptr) m_drawContext = new iosOGLContext(m_layer, m_apiVersion, m_uploadContext, true); return m_drawContext; } -dp::OGLContext * iosOGLContextFactory::getResourcesUploadContext() +dp::GraphicContext * iosOGLContextFactory::GetResourcesUploadContext() { if (m_uploadContext == nullptr) m_uploadContext = new iosOGLContext(m_layer, m_apiVersion, m_drawContext, false); return m_uploadContext; } -bool iosOGLContextFactory::isDrawContextCreated() const +bool iosOGLContextFactory::IsDrawContextCreated() const { return m_drawContext != nullptr; } -bool iosOGLContextFactory::isUploadContextCreated() const +bool iosOGLContextFactory::IsUploadContextCreated() const { return m_uploadContext != nullptr; } -void iosOGLContextFactory::setPresentAvailable(bool available) +void iosOGLContextFactory::SetPresentAvailable(bool available) { lock_guard lock(m_initializationMutex); m_presentAvailable = available; if (m_isInitialized) { - m_drawContext->setPresentAvailable(m_presentAvailable); + m_drawContext->SetPresentAvailable(m_presentAvailable); } else if (m_initializationCounter >= kGLThreadsCount && m_presentAvailable) { @@ -57,7 +57,7 @@ void iosOGLContextFactory::setPresentAvailable(bool available) } } -void iosOGLContextFactory::waitForInitialization(dp::OGLContext * context) +void iosOGLContextFactory::WaitForInitialization(dp::GraphicContext * context) { unique_lock lock(m_initializationMutex); if (!m_isInitialized) @@ -74,6 +74,6 @@ void iosOGLContextFactory::waitForInitialization(dp::OGLContext * context) } } - if (m_drawContext == context) - m_drawContext->setPresentAvailable(m_presentAvailable); + if (static_cast(m_drawContext) == context) + m_drawContext->SetPresentAvailable(m_presentAvailable); } diff --git a/map/framework.cpp b/map/framework.cpp index 092be7937e..de93263fe8 100644 --- a/map/framework.cpp +++ b/map/framework.cpp @@ -1698,7 +1698,7 @@ bool Framework::GetDistanceAndAzimut(m2::PointD const & point, return (d < 25000.0); } -void Framework::CreateDrapeEngine(ref_ptr contextFactory, DrapeCreationParams && params) +void Framework::CreateDrapeEngine(ref_ptr contextFactory, DrapeCreationParams && params) { auto idReadFn = [this](df::MapDataProvider::TReadCallback const & fn, m2::RectD const & r, @@ -1862,7 +1862,7 @@ void Framework::DestroyDrapeEngine() } } -void Framework::SetRenderingEnabled(ref_ptr contextFactory) +void Framework::SetRenderingEnabled(ref_ptr contextFactory) { m_isRenderingEnabled = true; if (m_drapeEngine) diff --git a/map/framework.hpp b/map/framework.hpp index 99d6106fad..d0e1b3b6ef 100644 --- a/map/framework.hpp +++ b/map/framework.hpp @@ -25,7 +25,7 @@ #include "drape_frontend/drape_engine.hpp" #include "drape_frontend/user_event_stream.hpp" -#include "drape/oglcontextfactory.hpp" +#include "drape/graphic_context_factory.hpp" #include "kml/type_utils.hpp" @@ -471,12 +471,12 @@ public: df::Hints m_hints; }; - void CreateDrapeEngine(ref_ptr contextFactory, DrapeCreationParams && params); + void CreateDrapeEngine(ref_ptr contextFactory, DrapeCreationParams && params); ref_ptr GetDrapeEngine(); bool IsDrapeEngineCreated() const { return m_drapeEngine != nullptr; } void DestroyDrapeEngine(); /// Called when graphics engine should be temporarily paused and then resumed. - void SetRenderingEnabled(ref_ptr contextFactory = nullptr); + void SetRenderingEnabled(ref_ptr contextFactory = nullptr); void SetRenderingDisabled(bool destroyContext); void OnRecoverGLContext(int width, int height); diff --git a/qt/drape_surface.cpp b/qt/drape_surface.cpp deleted file mode 100644 index 67236a2447..0000000000 --- a/qt/drape_surface.cpp +++ /dev/null @@ -1,130 +0,0 @@ -#include "qt/drape_surface.hpp" - -#include "drape_frontend/viewport.hpp" - -#include "base/stl_add.hpp" -#include "base/logging.hpp" - -#include "std/bind.hpp" -#include "std/cmath.hpp" - -#include - -namespace qt -{ - -DrapeSurface::DrapeSurface() - : m_dragState(false) - , m_contextFactory(NULL) -{ - setSurfaceType(QSurface::OpenGLSurface); - - QObject::connect(this, SIGNAL(heightChanged(int)), this, SLOT(sizeChanged(int))); - QObject::connect(this, SIGNAL(widthChanged(int)), this, SLOT(sizeChanged(int))); -} - -DrapeSurface::~DrapeSurface() -{ - m_framework.PrepareToShutdown(); - m_contextFactory.Destroy(); -} - -void DrapeSurface::LoadState() -{ - if (!m_framework.LoadState()) - m_framework.ShowAll(); - else - m_framework.Invalidate(); -} - -void DrapeSurface::SaveState() -{ - m_framework.SaveState(); -} - -void DrapeSurface::exposeEvent(QExposeEvent *e) -{ - Q_UNUSED(e); - - if (isExposed()) - { - if (m_contextFactory.IsNull()) - { - dp::ThreadSafeFactory * factory = new dp::ThreadSafeFactory(new QtOGLContextFactory(this)); - m_contextFactory = dp::MasterPointer(factory); - CreateEngine(); - } - } -} - -void DrapeSurface::mousePressEvent(QMouseEvent * e) -{ - QWindow::mousePressEvent(e); - if (!isExposed()) - return; - - if (e->button() == Qt::LeftButton) - { - m2::PointF const p = GetDevicePosition(e->pos()); - DragEvent const event(p.x, p.y); - m_framework.StartDrag(event); - m_dragState = true; - } -} - -void DrapeSurface::mouseMoveEvent(QMouseEvent * e) -{ - QWindow::mouseMoveEvent(e); - if (!isExposed()) - return; - - if (m_dragState) - { - m2::PointF const p = GetDevicePosition(e->pos()); - DragEvent const event(p.x, p.y); - m_framework.DoDrag(event); - } -} - -void DrapeSurface::mouseReleaseEvent(QMouseEvent * e) -{ - QWindow::mouseReleaseEvent(e); - if (!isExposed()) - return; - - if (m_dragState) - { - m2::PointF const p = GetDevicePosition(e->pos()); - DragEvent const event(p.x, p.y); - m_framework.StopDrag(event); - m_dragState = false; - } -} - -void DrapeSurface::wheelEvent(QWheelEvent * e) -{ - if (!m_dragState) - { - m2::PointF const p = GetDevicePosition(e->pos()); - ScaleToPointEvent const event(p.x, p.y, exp(e->delta() / 360.0)); - m_framework.ScaleToPoint(event, false); - } -} - -void DrapeSurface::CreateEngine() -{ - m_framework.CreateDrapeEngine(m_contextFactory.GetRefPointer(), devicePixelRatio(), width(), height()); -} - -void DrapeSurface::sizeChanged(int) -{ - m_framework.OnSize(width(), height()); -} - -m2::PointF DrapeSurface::GetDevicePosition(QPoint const & p) -{ - qreal const ratio = devicePixelRatio(); - return m2::PointF(p.x() * ratio, p.y() * ratio); -} - -} diff --git a/qt/drape_surface.hpp b/qt/drape_surface.hpp deleted file mode 100644 index 0e81a95eba..0000000000 --- a/qt/drape_surface.hpp +++ /dev/null @@ -1,48 +0,0 @@ -#pragma once - -#include "qtoglcontextfactory.hpp" - -#include "map/framework.hpp" -#include "drape_frontend/drape_engine.hpp" - -#include - -namespace qt -{ - -class DrapeSurface : public QWindow -{ - Q_OBJECT - -public: - DrapeSurface(); - ~DrapeSurface(); - - void LoadState(); - void SaveState(); - - Framework & GetFramework() { return m_framework; } - -protected: - void exposeEvent(QExposeEvent * e); - void mousePressEvent(QMouseEvent * e); - void mouseMoveEvent(QMouseEvent * e); - void mouseReleaseEvent(QMouseEvent * e); - void wheelEvent(QWheelEvent * e); - -private: - void CreateEngine(); - - Q_SLOT void sizeChanged(int); - -private: - m2::PointF GetDevicePosition(QPoint const & p); - - bool m_dragState; - -private: - Framework m_framework; - dp::MasterPointer m_contextFactory; -}; - -} // namespace qt diff --git a/qt/qt_common/qtoglcontext.cpp b/qt/qt_common/qtoglcontext.cpp index cfc57799e1..c47f8acd78 100644 --- a/qt/qt_common/qtoglcontext.cpp +++ b/qt/qt_common/qtoglcontext.cpp @@ -23,29 +23,29 @@ QtRenderOGLContext::QtRenderOGLContext(QOpenGLContext * rootContext, QOffscreenS ASSERT(m_ctx->isValid(), ()); } -void QtRenderOGLContext::present() +void QtRenderOGLContext::Present() { if (!m_resizeLock) - lockFrame(); + LockFrame(); m_resizeLock = false; GLFunctions::glFinish(); std::swap(m_frontFrame, m_backFrame); - unlockFrame(); + UnlockFrame(); } -void QtRenderOGLContext::makeCurrent() +void QtRenderOGLContext::MakeCurrent() { VERIFY(m_ctx->makeCurrent(m_surface), ()); } -void QtRenderOGLContext::doneCurrent() +void QtRenderOGLContext::DoneCurrent() { m_ctx->doneCurrent(); } -void QtRenderOGLContext::setDefaultFramebuffer() +void QtRenderOGLContext::SetDefaultFramebuffer() { if (m_backFrame == nullptr) return; @@ -53,9 +53,9 @@ void QtRenderOGLContext::setDefaultFramebuffer() m_backFrame->bind(); } -void QtRenderOGLContext::resize(int w, int h) +void QtRenderOGLContext::Resize(int w, int h) { - lockFrame(); + LockFrame(); m_resizeLock = true; QSize size(my::NextPowOf2(w), my::NextPowOf2(h)); @@ -66,17 +66,17 @@ void QtRenderOGLContext::resize(int w, int h) m_backFrame = my::make_unique(size, QOpenGLFramebufferObject::Depth); } -void QtRenderOGLContext::lockFrame() +void QtRenderOGLContext::LockFrame() { m_lock.lock(); } -QRectF const & QtRenderOGLContext::getTexRect() const +QRectF const & QtRenderOGLContext::GetTexRect() const { return m_texRect; } -GLuint QtRenderOGLContext::getTextureHandle() const +GLuint QtRenderOGLContext::GetTextureHandle() const { if (!m_frontFrame) return 0; @@ -84,7 +84,7 @@ GLuint QtRenderOGLContext::getTextureHandle() const return m_frontFrame->texture(); } -void QtRenderOGLContext::unlockFrame() +void QtRenderOGLContext::UnlockFrame() { m_lock.unlock(); } @@ -99,22 +99,22 @@ QtUploadOGLContext::QtUploadOGLContext(QOpenGLContext * rootContext, QOffscreenS ASSERT(m_ctx->isValid(), ()); } -void QtUploadOGLContext::makeCurrent() +void QtUploadOGLContext::MakeCurrent() { m_ctx->makeCurrent(m_surface); } -void QtUploadOGLContext::doneCurrent() +void QtUploadOGLContext::DoneCurrent() { m_ctx->doneCurrent(); } -void QtUploadOGLContext::present() +void QtUploadOGLContext::Present() { ASSERT(false, ()); } -void QtUploadOGLContext::setDefaultFramebuffer() +void QtUploadOGLContext::SetDefaultFramebuffer() { ASSERT(false, ()); } diff --git a/qt/qt_common/qtoglcontext.hpp b/qt/qt_common/qtoglcontext.hpp index ff409ea0dc..679fad5313 100644 --- a/qt/qt_common/qtoglcontext.hpp +++ b/qt/qt_common/qtoglcontext.hpp @@ -19,16 +19,16 @@ public: QtRenderOGLContext(QOpenGLContext * rootContext, QOffscreenSurface * surface); // dp::OGLContext overrides: - void present() override; - void makeCurrent() override; - void doneCurrent() override; - void setDefaultFramebuffer() override; - void resize(int w, int h) override; + void Present() override; + void MakeCurrent() override; + void DoneCurrent() override; + void SetDefaultFramebuffer() override; + void Resize(int w, int h) override; - void lockFrame(); - GLuint getTextureHandle() const; - QRectF const & getTexRect() const; - void unlockFrame(); + void LockFrame(); + GLuint GetTextureHandle() const; + QRectF const & GetTexRect() const; + void UnlockFrame(); private: QOffscreenSurface * m_surface = nullptr; @@ -48,10 +48,10 @@ public: QtUploadOGLContext(QOpenGLContext * rootContext, QOffscreenSurface * surface); // dp::OGLContext overrides: - void present() override; - void makeCurrent() override; - void doneCurrent() override; - void setDefaultFramebuffer() override; + void Present() override; + void MakeCurrent() override; + void DoneCurrent() override; + void SetDefaultFramebuffer() override; private: QOffscreenSurface * m_surface = nullptr; // non-owning ptr diff --git a/qt/qt_common/qtoglcontextfactory.cpp b/qt/qt_common/qtoglcontextfactory.cpp index cf16bb3850..525ad736e9 100644 --- a/qt/qt_common/qtoglcontextfactory.cpp +++ b/qt/qt_common/qtoglcontextfactory.cpp @@ -32,29 +32,29 @@ bool QtOGLContextFactory::LockFrame() if (m_preparedToShutdown || !m_drawContext) return false; - m_drawContext->lockFrame(); + m_drawContext->LockFrame(); return true; } QRectF const & QtOGLContextFactory::GetTexRect() const { ASSERT(m_drawContext != nullptr, ()); - return m_drawContext->getTexRect(); + return m_drawContext->GetTexRect(); } GLuint QtOGLContextFactory::GetTextureHandle() const { ASSERT(m_drawContext != nullptr, ()); - return m_drawContext->getTextureHandle(); + return m_drawContext->GetTextureHandle(); } void QtOGLContextFactory::UnlockFrame() { ASSERT(m_drawContext != nullptr, ()); - m_drawContext->unlockFrame(); + m_drawContext->UnlockFrame(); } -dp::OGLContext * QtOGLContextFactory::getDrawContext() +dp::GraphicContext * QtOGLContextFactory::GetDrawContext() { if (!m_drawContext) m_drawContext = my::make_unique(m_rootContext, m_drawSurface.get()); @@ -62,7 +62,7 @@ dp::OGLContext * QtOGLContextFactory::getDrawContext() return m_drawContext.get(); } -dp::OGLContext * QtOGLContextFactory::getResourcesUploadContext() +dp::GraphicContext * QtOGLContextFactory::GetResourcesUploadContext() { if (!m_uploadContext) m_uploadContext = my::make_unique(m_rootContext, m_uploadSurface.get()); diff --git a/qt/qt_common/qtoglcontextfactory.hpp b/qt/qt_common/qtoglcontextfactory.hpp index 21c133d229..209d556c33 100644 --- a/qt/qt_common/qtoglcontextfactory.hpp +++ b/qt/qt_common/qtoglcontextfactory.hpp @@ -1,6 +1,6 @@ #pragma once -#include "drape/oglcontextfactory.hpp" +#include "drape/graphic_context_factory.hpp" #include "qt/qt_common/qtoglcontext.hpp" #include @@ -12,7 +12,7 @@ namespace qt { namespace common { -class QtOGLContextFactory : public dp::OGLContextFactory +class QtOGLContextFactory : public dp::GraphicContextFactory { public: QtOGLContextFactory(QOpenGLContext * rootContext); @@ -25,11 +25,11 @@ public: QRectF const & GetTexRect() const; void UnlockFrame(); - // dp::OGLContextFactory overrides: - dp::OGLContext * getDrawContext() override; - dp::OGLContext * getResourcesUploadContext() override; - bool isDrawContextCreated() const override { return m_drawContext != nullptr; } - bool isUploadContextCreated() const override { return m_uploadContext != nullptr; } + // dp::GraphicContextFactory overrides: + dp::GraphicContext * GetDrawContext() override; + dp::GraphicContext * GetResourcesUploadContext() override; + bool IsDrawContextCreated() const override { return m_drawContext != nullptr; } + bool IsUploadContextCreated() const override { return m_uploadContext != nullptr; } private: std::unique_ptr CreateSurface(); diff --git a/xcode/drape/drape.xcodeproj/project.pbxproj b/xcode/drape/drape.xcodeproj/project.pbxproj index 388ce60d83..a3f345478b 100644 --- a/xcode/drape/drape.xcodeproj/project.pbxproj +++ b/xcode/drape/drape.xcodeproj/project.pbxproj @@ -74,8 +74,6 @@ 6729A58F1A69213A007D5872 /* index_buffer.hpp in Headers */ = {isa = PBXBuildFile; fileRef = 6729A52B1A69213A007D5872 /* index_buffer.hpp */; }; 6729A5901A69213A007D5872 /* object_pool.hpp in Headers */ = {isa = PBXBuildFile; fileRef = 6729A52C1A69213A007D5872 /* object_pool.hpp */; }; 6729A5911A69213A007D5872 /* oglcontext.hpp in Headers */ = {isa = PBXBuildFile; fileRef = 6729A52D1A69213A007D5872 /* oglcontext.hpp */; }; - 6729A5921A69213A007D5872 /* oglcontextfactory.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 6729A52E1A69213A007D5872 /* oglcontextfactory.cpp */; }; - 6729A5931A69213A007D5872 /* oglcontextfactory.hpp in Headers */ = {isa = PBXBuildFile; fileRef = 6729A52F1A69213A007D5872 /* oglcontextfactory.hpp */; }; 6729A5941A69213A007D5872 /* overlay_handle.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 6729A5301A69213A007D5872 /* overlay_handle.cpp */; }; 6729A5951A69213A007D5872 /* overlay_handle.hpp in Headers */ = {isa = PBXBuildFile; fileRef = 6729A5311A69213A007D5872 /* overlay_handle.hpp */; }; 6729A5961A69213A007D5872 /* overlay_tree.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 6729A5321A69213A007D5872 /* overlay_tree.cpp */; }; @@ -107,6 +105,10 @@ 675D21991BFB876E00717E4F /* projection.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 675D21971BFB876E00717E4F /* projection.cpp */; }; 675D219A1BFB876E00717E4F /* projection.hpp in Headers */ = {isa = PBXBuildFile; fileRef = 675D21981BFB876E00717E4F /* projection.hpp */; }; BB035F6C1E3A2A5C00519962 /* drape_diagnostics.hpp in Headers */ = {isa = PBXBuildFile; fileRef = BB035F6B1E3A2A5C00519962 /* drape_diagnostics.hpp */; }; + BBB72E902110AF0F00249D4F /* oglcontext.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BBB72E8F2110AF0F00249D4F /* oglcontext.cpp */; }; + BBB72E942110B86000249D4F /* graphic_context_factory.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BBB72E912110B85E00249D4F /* graphic_context_factory.cpp */; }; + BBB72E952110B86000249D4F /* graphic_context_factory.hpp in Headers */ = {isa = PBXBuildFile; fileRef = BBB72E922110B85E00249D4F /* graphic_context_factory.hpp */; }; + BBB72E962110B86000249D4F /* graphic_context.hpp in Headers */ = {isa = PBXBuildFile; fileRef = BBB72E932110B85E00249D4F /* graphic_context.hpp */; }; /* End PBXBuildFile section */ /* Begin PBXFileReference section */ @@ -180,8 +182,6 @@ 6729A52B1A69213A007D5872 /* index_buffer.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = index_buffer.hpp; sourceTree = ""; }; 6729A52C1A69213A007D5872 /* object_pool.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = object_pool.hpp; sourceTree = ""; }; 6729A52D1A69213A007D5872 /* oglcontext.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = oglcontext.hpp; sourceTree = ""; }; - 6729A52E1A69213A007D5872 /* oglcontextfactory.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = oglcontextfactory.cpp; sourceTree = ""; }; - 6729A52F1A69213A007D5872 /* oglcontextfactory.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = oglcontextfactory.hpp; sourceTree = ""; }; 6729A5301A69213A007D5872 /* overlay_handle.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = overlay_handle.cpp; sourceTree = ""; }; 6729A5311A69213A007D5872 /* overlay_handle.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = overlay_handle.hpp; sourceTree = ""; }; 6729A5321A69213A007D5872 /* overlay_tree.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = overlay_tree.cpp; sourceTree = ""; }; @@ -213,6 +213,10 @@ 675D21971BFB876E00717E4F /* projection.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = projection.cpp; sourceTree = ""; }; 675D21981BFB876E00717E4F /* projection.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = projection.hpp; sourceTree = ""; }; BB035F6B1E3A2A5C00519962 /* drape_diagnostics.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = drape_diagnostics.hpp; sourceTree = ""; }; + BBB72E8F2110AF0F00249D4F /* oglcontext.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = oglcontext.cpp; sourceTree = ""; }; + BBB72E912110B85E00249D4F /* graphic_context_factory.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = graphic_context_factory.cpp; sourceTree = ""; }; + BBB72E922110B85E00249D4F /* graphic_context_factory.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = graphic_context_factory.hpp; sourceTree = ""; }; + BBB72E932110B85E00249D4F /* graphic_context.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = graphic_context.hpp; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -298,6 +302,9 @@ 6729A5231A69213A007D5872 /* gpu_buffer.hpp */, 6729A5261A69213A007D5872 /* gpu_program.cpp */, 6729A5271A69213A007D5872 /* gpu_program.hpp */, + BBB72E932110B85E00249D4F /* graphic_context.hpp */, + BBB72E912110B85E00249D4F /* graphic_context_factory.cpp */, + BBB72E922110B85E00249D4F /* graphic_context_factory.hpp */, 6709471B1BDF9A4F005014C0 /* hw_texture_ios.hpp */, 6709471C1BDF9A4F005014C0 /* hw_texture_ios.mm */, 6709471D1BDF9A4F005014C0 /* hw_texture.cpp */, @@ -310,8 +317,7 @@ 670947201BDF9A4F005014C0 /* index_storage.hpp */, 6729A52C1A69213A007D5872 /* object_pool.hpp */, 6729A52D1A69213A007D5872 /* oglcontext.hpp */, - 6729A52E1A69213A007D5872 /* oglcontextfactory.cpp */, - 6729A52F1A69213A007D5872 /* oglcontextfactory.hpp */, + BBB72E8F2110AF0F00249D4F /* oglcontext.cpp */, 6729A5301A69213A007D5872 /* overlay_handle.cpp */, 6729A5311A69213A007D5872 /* overlay_handle.hpp */, 6729A5321A69213A007D5872 /* overlay_tree.cpp */, @@ -377,13 +383,13 @@ 6729A56C1A69213A007D5872 /* binding_info.hpp in Headers */, 3492DA0B1CA2D91C00C1F3B3 /* visual_scale.hpp in Headers */, 6729A5971A69213A007D5872 /* overlay_tree.hpp in Headers */, + BBB72E952110B86000249D4F /* graphic_context_factory.hpp in Headers */, 6729A5751A69213A007D5872 /* drape_global.hpp in Headers */, 347F32FA1C45383E009758CC /* debug_rect_renderer.hpp in Headers */, 6729A5701A69213A007D5872 /* color.hpp in Headers */, 6729A5801A69213A007D5872 /* glsl_func.hpp in Headers */, 6729A5761A69213A007D5872 /* dynamic_texture.hpp in Headers */, 6729A5681A69213A007D5872 /* batcher_helpers.hpp in Headers */, - 6729A5931A69213A007D5872 /* oglcontextfactory.hpp in Headers */, 6729A56A1A69213A007D5872 /* batcher.hpp in Headers */, 675D219A1BFB876E00717E4F /* projection.hpp in Headers */, 670947291BDF9A4F005014C0 /* hw_texture_ios.hpp in Headers */, @@ -394,6 +400,7 @@ 6729A5741A69213A007D5872 /* data_buffer.hpp in Headers */, 6729A58B1A69213A007D5872 /* gpu_program.hpp in Headers */, 6743D3451C3533AE0095054B /* support_manager.hpp in Headers */, + BBB72E962110B86000249D4F /* graphic_context.hpp in Headers */, 6729A5B31A69213A007D5872 /* vertex_decl.hpp in Headers */, 6729A5721A69213A007D5872 /* cpu_buffer.hpp in Headers */, 6729A5AD1A69213A007D5872 /* uniform_value.hpp in Headers */, @@ -490,13 +497,13 @@ 6709472D1BDF9A4F005014C0 /* index_storage.cpp in Sources */, 6729A5861A69213A007D5872 /* gpu_buffer.cpp in Sources */, 6729A59A1A69213A007D5872 /* render_bucket.cpp in Sources */, - 6729A5921A69213A007D5872 /* oglcontextfactory.cpp in Sources */, 6729A58A1A69213A007D5872 /* gpu_program.cpp in Sources */, 6709472A1BDF9A4F005014C0 /* hw_texture_ios.mm in Sources */, 4513BF0D1EC2F0760066565C /* viewport.cpp in Sources */, 6729A57B1A69213A007D5872 /* glextensions_list.cpp in Sources */, 34C624C91DABDB2000510300 /* static_texture.cpp in Sources */, 4513BF0B1EC2F0760066565C /* framebuffer.cpp in Sources */, + BBB72E942110B86000249D4F /* graphic_context_factory.cpp in Sources */, 6729A5981A69213A007D5872 /* pointers.cpp in Sources */, 6729A5A41A69213A007D5872 /* symbols_texture.cpp in Sources */, 675D21991BFB876E00717E4F /* projection.cpp in Sources */, @@ -508,6 +515,7 @@ 6729A5691A69213A007D5872 /* batcher.cpp in Sources */, 670947251BDF9A4F005014C0 /* bidi.cpp in Sources */, 6729A58C1A69213A007D5872 /* index_buffer_mutator.cpp in Sources */, + BBB72E902110AF0F00249D4F /* oglcontext.cpp in Sources */, 6729A57D1A69213A007D5872 /* glfunctions.cpp in Sources */, 6729A5731A69213A007D5872 /* data_buffer.cpp in Sources */, 6709472B1BDF9A4F005014C0 /* hw_texture.cpp in Sources */,