Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mapsme/omim.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaria Volvenkova <d.volvenkova@corp.mail.ru>2017-05-16 14:42:32 +0300
committerGitHub <noreply@github.com>2017-05-16 14:42:32 +0300
commitd2f79bd2c7004af2d1459e8d5b7748763f241a54 (patch)
tree64300bccb750e59f7c3a05800eafcd5c3b3f89cb
parentaa6703383e8d4c2ff8445e8b3c27728846cdab4b (diff)
parent086d6f9cf247cea07cff6bc33d5567dc7c64806b (diff)
Merge pull request #6040 from rokuz/es3-supportbeta-810
Added OpenGL ES3 support
-rw-r--r--android/jni/Android.mk2
-rw-r--r--android/jni/com/mapswithme/maps/Framework.cpp2
-rw-r--r--android/jni/com/mapswithme/opengl/android_gl_utils.cpp5
-rw-r--r--android/jni/com/mapswithme/opengl/android_gl_utils.hpp13
-rw-r--r--android/jni/com/mapswithme/opengl/androidoglcontext.cpp15
-rw-r--r--android/jni/com/mapswithme/opengl/androidoglcontext.hpp7
-rw-r--r--android/jni/com/mapswithme/opengl/androidoglcontextfactory.cpp55
-rw-r--r--android/jni/com/mapswithme/opengl/androidoglcontextfactory.hpp5
-rw-r--r--android/jni/com/mapswithme/opengl/gl3stub.c342
-rw-r--r--android/jni/com/mapswithme/opengl/gl3stub.h492
-rw-r--r--base/newtype.hpp2
-rw-r--r--base/src_point.cpp9
-rw-r--r--base/src_point.hpp81
-rw-r--r--drape/CMakeLists.txt4
-rw-r--r--drape/data_buffer.cpp28
-rw-r--r--drape/data_buffer.hpp17
-rw-r--r--drape/data_buffer_impl.hpp103
-rw-r--r--drape/drape_common.pri4
-rw-r--r--drape/drape_global.hpp9
-rw-r--r--drape/drape_tests/font_texture_tests.cpp109
-rw-r--r--drape/drape_tests/glfunctions.cpp4
-rw-r--r--drape/drape_tests/memory_comparer.hpp35
-rw-r--r--drape/framebuffer.cpp (renamed from drape_frontend/framebuffer.cpp)41
-rw-r--r--drape/framebuffer.hpp (renamed from drape_frontend/framebuffer.hpp)10
-rw-r--r--drape/glIncludes.hpp7
-rw-r--r--drape/glconstants.cpp9
-rw-r--r--drape/glconstants.hpp1
-rw-r--r--drape/glextensions_list.cpp158
-rw-r--r--drape/glextensions_list.hpp28
-rw-r--r--drape/glfunctions.cpp693
-rw-r--r--drape/glfunctions.hpp72
-rw-r--r--drape/gpu_buffer.cpp81
-rw-r--r--drape/gpu_buffer.hpp14
-rw-r--r--drape/gpu_program_manager.cpp3
-rw-r--r--drape/hw_texture.cpp56
-rw-r--r--drape/hw_texture_ios.mm1
-rw-r--r--drape/support_manager.cpp2
-rw-r--r--drape/texture.cpp35
-rw-r--r--drape/texture.hpp10
-rw-r--r--drape/vertex_array_buffer.cpp135
-rw-r--r--drape/vertex_array_buffer.hpp46
-rw-r--r--drape/viewport.cpp25
-rw-r--r--drape/viewport.hpp31
-rw-r--r--drape_frontend/CMakeLists.txt4
-rw-r--r--drape_frontend/backend_renderer.cpp2
-rw-r--r--drape_frontend/backend_renderer.hpp22
-rw-r--r--drape_frontend/base_renderer.cpp3
-rw-r--r--drape_frontend/base_renderer.hpp8
-rw-r--r--drape_frontend/batch_merge_helper.cpp2
-rw-r--r--drape_frontend/drape_engine.cpp6
-rw-r--r--drape_frontend/drape_engine.hpp21
-rwxr-xr-xdrape_frontend/drape_frontend.pro4
-rw-r--r--drape_frontend/drape_frontend_tests/compile_shaders_test.cpp29
-rwxr-xr-xdrape_frontend/frontend_renderer.cpp23
-rwxr-xr-xdrape_frontend/frontend_renderer.hpp21
-rw-r--r--drape_frontend/message_subclasses.hpp2
-rw-r--r--drape_frontend/shaders/dashed_line.fsh.glsl8
-rwxr-xr-xdrape_frontend/shaders/text.fsh.glsl4
-rwxr-xr-xdrape_frontend/shaders/text_fixed.fsh.glsl6
-rw-r--r--drape_frontend/viewport.cpp46
-rw-r--r--drape_frontend/viewport.hpp37
-rw-r--r--iphone/Maps/Classes/EAGLView.h10
-rw-r--r--iphone/Maps/Classes/EAGLView.mm16
-rw-r--r--iphone/Maps/Classes/iosOGLContext.h14
-rw-r--r--iphone/Maps/Classes/iosOGLContext.mm28
-rw-r--r--iphone/Maps/Classes/iosOGLContextFactory.h4
-rw-r--r--iphone/Maps/Classes/iosOGLContextFactory.mm7
-rw-r--r--map/framework.cpp20
-rw-r--r--map/framework.hpp1
-rw-r--r--qt/qt_common/map_widget.cpp1
-rw-r--r--testing/testing.hpp2
-rw-r--r--xcode/drape/drape.xcodeproj/project.pbxproj16
-rw-r--r--xcode/drape_frontend/drape_frontend.xcodeproj/project.pbxproj16
73 files changed, 1945 insertions, 1239 deletions
diff --git a/android/jni/Android.mk b/android/jni/Android.mk
index 05400dda81..a1421e2c63 100644
--- a/android/jni/Android.mk
+++ b/android/jni/Android.mk
@@ -70,6 +70,7 @@ LOCAL_HEADER_FILES := \
com/mapswithme/opengl/android_gl_utils.hpp \
com/mapswithme/opengl/androidoglcontext.hpp \
com/mapswithme/opengl/androidoglcontextfactory.hpp \
+ com/mapswithme/opengl/gl3stub.h \
com/mapswithme/platform/Platform.hpp \
LOCAL_SRC_FILES := \
@@ -102,6 +103,7 @@ LOCAL_SRC_FILES := \
com/mapswithme/opengl/android_gl_utils.cpp \
com/mapswithme/opengl/androidoglcontext.cpp \
com/mapswithme/opengl/androidoglcontextfactory.cpp \
+ com/mapswithme/opengl/gl3stub.c \
com/mapswithme/platform/HttpThread.cpp \
com/mapswithme/platform/SocketImpl.cpp \
com/mapswithme/platform/Language.cpp \
diff --git a/android/jni/com/mapswithme/maps/Framework.cpp b/android/jni/com/mapswithme/maps/Framework.cpp
index 81a80b99d7..daac8aa140 100644
--- a/android/jni/com/mapswithme/maps/Framework.cpp
+++ b/android/jni/com/mapswithme/maps/Framework.cpp
@@ -143,6 +143,8 @@ bool Framework::CreateDrapeEngine(JNIEnv * env, jobject jSurface, int densityDpi
}
::Framework::DrapeCreationParams p;
+ p.m_apiVersion = factory->IsSupportedOpenGLES3() ? dp::ApiVersion::OpenGLES3 :
+ dp::ApiVersion::OpenGLES2;
p.m_surfaceWidth = factory->GetWidth();
p.m_surfaceHeight = factory->GetHeight();
p.m_visualScale = dp::VisualScale(densityDpi);
diff --git a/android/jni/com/mapswithme/opengl/android_gl_utils.cpp b/android/jni/com/mapswithme/opengl/android_gl_utils.cpp
index 50b57f041b..13fed787bc 100644
--- a/android/jni/com/mapswithme/opengl/android_gl_utils.cpp
+++ b/android/jni/com/mapswithme/opengl/android_gl_utils.cpp
@@ -1,7 +1,8 @@
#include "android_gl_utils.hpp"
-#include "../../../../../base/logging.hpp"
-#include "../../../../../base/string_utils.hpp"
+#include "base/logging.hpp"
+#include "base/src_point.hpp"
+#include "base/string_utils.hpp"
namespace android
{
diff --git a/android/jni/com/mapswithme/opengl/android_gl_utils.hpp b/android/jni/com/mapswithme/opengl/android_gl_utils.hpp
index 1e9d4a1a5b..e79067800e 100644
--- a/android/jni/com/mapswithme/opengl/android_gl_utils.hpp
+++ b/android/jni/com/mapswithme/opengl/android_gl_utils.hpp
@@ -1,9 +1,11 @@
#pragma once
-#include "../../../../../base/src_point.hpp"
+#include "drape/glIncludes.hpp"
-#include <EGL/egl.h>
-#include <GLES2/gl2.h>
+namespace my
+{
+class SrcPoint;
+}
namespace android
{
@@ -23,8 +25,7 @@ private:
void CheckEGL(my::SrcPoint const & src);
-#define CHECK_EGL(x) do { (x); CheckEGL(SRC());} while(false);
-#define CHECK_EGL_CALL() do { CheckEGL(SRC());} while (false);
-
} // namespace android
+#define CHECK_EGL(x) do { (x); android::CheckEGL(SRC());} while(false);
+#define CHECK_EGL_CALL() do { android::CheckEGL(SRC());} while (false);
diff --git a/android/jni/com/mapswithme/opengl/androidoglcontext.cpp b/android/jni/com/mapswithme/opengl/androidoglcontext.cpp
index 040f7a73c1..09fd588b81 100644
--- a/android/jni/com/mapswithme/opengl/androidoglcontext.cpp
+++ b/android/jni/com/mapswithme/opengl/androidoglcontext.cpp
@@ -1,21 +1,28 @@
#include "androidoglcontext.hpp"
#include "android_gl_utils.hpp"
+
#include "base/assert.hpp"
#include "base/logging.hpp"
+#include "base/src_point.hpp"
namespace android
{
-static EGLint * getContextAttributesList()
+static EGLint * getContextAttributesList(bool supportedES3)
{
static EGLint contextAttrList[] = {
EGL_CONTEXT_CLIENT_VERSION, 2,
EGL_NONE
};
- return contextAttrList;
+ static EGLint contextAttrListES3[] = {
+ EGL_CONTEXT_CLIENT_VERSION, 3,
+ EGL_NONE
+ };
+ return supportedES3 ? contextAttrListES3 : contextAttrList;
}
-AndroidOGLContext::AndroidOGLContext(EGLDisplay display, EGLSurface surface, EGLConfig config, AndroidOGLContext * contextToShareWith)
+AndroidOGLContext::AndroidOGLContext(bool supportedES3, EGLDisplay display, EGLSurface surface,
+ EGLConfig config, AndroidOGLContext * contextToShareWith)
: m_nativeContext(EGL_NO_CONTEXT)
, m_surface(surface)
, m_display(display)
@@ -24,7 +31,7 @@ AndroidOGLContext::AndroidOGLContext(EGLDisplay display, EGLSurface surface, EGL
ASSERT(m_display != EGL_NO_DISPLAY, ());
EGLContext sharedContext = (contextToShareWith == NULL) ? EGL_NO_CONTEXT : contextToShareWith->m_nativeContext;
- m_nativeContext = eglCreateContext(m_display, config, sharedContext, getContextAttributesList());
+ m_nativeContext = eglCreateContext(m_display, config, sharedContext, getContextAttributesList(supportedES3));
CHECK(m_nativeContext != EGL_NO_CONTEXT, ());
}
diff --git a/android/jni/com/mapswithme/opengl/androidoglcontext.hpp b/android/jni/com/mapswithme/opengl/androidoglcontext.hpp
index 424aac5ff3..5c0bed7765 100644
--- a/android/jni/com/mapswithme/opengl/androidoglcontext.hpp
+++ b/android/jni/com/mapswithme/opengl/androidoglcontext.hpp
@@ -1,17 +1,16 @@
#pragma once
+#include "drape/glIncludes.hpp"
#include "drape/oglcontext.hpp"
-#include <EGL/egl.h>
-#include <GLES2/gl2.h>
-
namespace android
{
class AndroidOGLContext : public dp::OGLContext
{
public:
- AndroidOGLContext(EGLDisplay display, EGLSurface surface, EGLConfig config, AndroidOGLContext * contextToShareWith);
+ AndroidOGLContext(bool supportedES3, EGLDisplay display, EGLSurface surface,
+ EGLConfig config, AndroidOGLContext * contextToShareWith);
~AndroidOGLContext();
void makeCurrent() override;
diff --git a/android/jni/com/mapswithme/opengl/androidoglcontextfactory.cpp b/android/jni/com/mapswithme/opengl/androidoglcontextfactory.cpp
index 011f5c53e6..38db410219 100644
--- a/android/jni/com/mapswithme/opengl/androidoglcontextfactory.cpp
+++ b/android/jni/com/mapswithme/opengl/androidoglcontextfactory.cpp
@@ -3,6 +3,7 @@
#include "base/assert.hpp"
#include "base/logging.hpp"
+#include "base/src_point.hpp"
#include <algorithm>
@@ -10,10 +11,13 @@
#include <android/native_window.h>
#include <android/native_window_jni.h>
+#define EGL_OPENGL_ES3_BIT 0x00000040
+
namespace android
{
-
-static EGLint * getConfigAttributesListRGB8()
+namespace
+{
+static EGLint * getConfigAttributesListRGB8(bool supportedES3)
{
static EGLint attr_list[] = {
EGL_RED_SIZE, 8,
@@ -26,11 +30,26 @@ static EGLint * getConfigAttributesListRGB8()
EGL_SURFACE_TYPE, EGL_PBUFFER_BIT | EGL_WINDOW_BIT,
EGL_NONE
};
- return attr_list;
+ static EGLint attr_list_es3[] = {
+ EGL_RED_SIZE, 8,
+ EGL_GREEN_SIZE, 8,
+ EGL_BLUE_SIZE, 8,
+ EGL_ALPHA_SIZE, 0,
+ EGL_STENCIL_SIZE, 0,
+ EGL_DEPTH_SIZE, 16,
+ EGL_RENDERABLE_TYPE, EGL_OPENGL_ES3_BIT,
+ EGL_SURFACE_TYPE, EGL_PBUFFER_BIT | EGL_WINDOW_BIT,
+ EGL_NONE
+ };
+ return supportedES3 ? attr_list_es3 : attr_list;
}
+int const kMaxConfigCount = 40;
+
static EGLint * getConfigAttributesListR5G6B5()
{
+ // We do not support OpenGL ES3 for R5G6B5, because some Android devices
+ // are not able to create OpenGL context in such mode.
static EGLint attr_list[] = {
EGL_RED_SIZE, 5,
EGL_GREEN_SIZE, 6,
@@ -44,6 +63,15 @@ static EGLint * getConfigAttributesListR5G6B5()
return attr_list;
}
+bool IsSupportedRGB8(EGLDisplay display, bool es3)
+{
+ EGLConfig configs[kMaxConfigCount];
+ int count = 0;
+ return eglChooseConfig(display, getConfigAttributesListRGB8(es3), configs,
+ kMaxConfigCount, &count) == EGL_TRUE;
+}
+} // namespace
+
AndroidOGLContextFactory::AndroidOGLContextFactory(JNIEnv * env, jobject jsurface)
: m_drawContext(NULL)
, m_uploadContext(NULL)
@@ -55,6 +83,7 @@ AndroidOGLContextFactory::AndroidOGLContextFactory(JNIEnv * env, jobject jsurfac
, m_surfaceWidth(0)
, m_surfaceHeight(0)
, m_windowSurfaceValid(false)
+ , m_supportedES3(false)
{
m_display = eglGetDisplay(EGL_DEFAULT_DISPLAY);
if (m_display == EGL_NO_DISPLAY)
@@ -70,6 +99,8 @@ AndroidOGLContextFactory::AndroidOGLContextFactory(JNIEnv * env, jobject jsurfac
return;
}
+ m_supportedES3 = gl3stubInit() && IsSupportedRGB8(m_display, true /* es3 */);
+
SetSurface(env, jsurface);
if (!createPixelbufferSurface())
@@ -202,7 +233,10 @@ dp::OGLContext * AndroidOGLContextFactory::getDrawContext()
ASSERT(IsValid(), ());
ASSERT(m_windowSurface != EGL_NO_SURFACE, ());
if (m_drawContext == nullptr)
- m_drawContext = new AndroidOGLContext(m_display, m_windowSurface, m_config, m_uploadContext);
+ {
+ m_drawContext = new AndroidOGLContext(m_supportedES3, m_display, m_windowSurface,
+ m_config, m_uploadContext);
+ }
return m_drawContext;
}
@@ -211,7 +245,10 @@ dp::OGLContext * AndroidOGLContextFactory::getResourcesUploadContext()
ASSERT(IsValid(), ());
ASSERT(m_pixelbufferSurface != EGL_NO_SURFACE, ());
if (m_uploadContext == nullptr)
- m_uploadContext = new AndroidOGLContext(m_display, m_pixelbufferSurface, m_config, m_drawContext);
+ {
+ m_uploadContext = new AndroidOGLContext(m_supportedES3, m_display, m_pixelbufferSurface,
+ m_config, m_drawContext);
+ }
return m_uploadContext;
}
@@ -227,12 +264,14 @@ bool AndroidOGLContextFactory::isUploadContextCreated() const
bool AndroidOGLContextFactory::createWindowSurface()
{
- int const kMaxConfigCount = 40;
EGLConfig configs[kMaxConfigCount];
int count = 0;
- if (eglChooseConfig(m_display, getConfigAttributesListRGB8(), configs, kMaxConfigCount, &count) != EGL_TRUE)
+ if (eglChooseConfig(m_display, getConfigAttributesListRGB8(m_supportedES3), configs,
+ kMaxConfigCount, &count) != EGL_TRUE)
{
- VERIFY(eglChooseConfig(m_display, getConfigAttributesListR5G6B5(), configs, kMaxConfigCount, &count) == EGL_TRUE, ());
+ ASSERT(!m_supportedES3, ());
+ VERIFY(eglChooseConfig(m_display, getConfigAttributesListR5G6B5(), configs,
+ kMaxConfigCount, &count) == EGL_TRUE, ());
LOG(LDEBUG, ("Backbuffer format: R5G6B5"));
}
else
diff --git a/android/jni/com/mapswithme/opengl/androidoglcontextfactory.hpp b/android/jni/com/mapswithme/opengl/androidoglcontextfactory.hpp
index a8fb32bd96..43209d1fad 100644
--- a/android/jni/com/mapswithme/opengl/androidoglcontextfactory.hpp
+++ b/android/jni/com/mapswithme/opengl/androidoglcontextfactory.hpp
@@ -4,6 +4,8 @@
#include "androidoglcontext.hpp"
#include "drape/oglcontextfactory.hpp"
+#include "base/src_point.hpp"
+
namespace android
{
@@ -27,6 +29,8 @@ public:
int GetHeight() const;
void UpdateSurfaceSize();
+ bool IsSupportedOpenGLES3() const { return m_supportedES3; }
+
private:
bool QuerySurfaceSize();
@@ -48,6 +52,7 @@ private:
int m_surfaceHeight;
bool m_windowSurfaceValid;
+ bool m_supportedES3;
};
} // namespace android
diff --git a/android/jni/com/mapswithme/opengl/gl3stub.c b/android/jni/com/mapswithme/opengl/gl3stub.c
new file mode 100644
index 0000000000..19b78e7b67
--- /dev/null
+++ b/android/jni/com/mapswithme/opengl/gl3stub.c
@@ -0,0 +1,342 @@
+/*
+ * Copyright 2013 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "gl3stub.h"
+
+GLboolean gl3stubInit() {
+ #define FIND_PROC(s) s = (void*)eglGetProcAddress(#s)
+ FIND_PROC(glReadBuffer);
+ FIND_PROC(glDrawRangeElements);
+ FIND_PROC(glTexImage3D);
+ FIND_PROC(glTexSubImage3D);
+ FIND_PROC(glCopyTexSubImage3D);
+ FIND_PROC(glCompressedTexImage3D);
+ FIND_PROC(glCompressedTexSubImage3D);
+ FIND_PROC(glGenQueries);
+ FIND_PROC(glDeleteQueries);
+ FIND_PROC(glIsQuery);
+ FIND_PROC(glBeginQuery);
+ FIND_PROC(glEndQuery);
+ FIND_PROC(glGetQueryiv);
+ FIND_PROC(glGetQueryObjectuiv);
+ FIND_PROC(glUnmapBuffer);
+ FIND_PROC(glGetBufferPointerv);
+ FIND_PROC(glDrawBuffers);
+ FIND_PROC(glUniformMatrix2x3fv);
+ FIND_PROC(glUniformMatrix3x2fv);
+ FIND_PROC(glUniformMatrix2x4fv);
+ FIND_PROC(glUniformMatrix4x2fv);
+ FIND_PROC(glUniformMatrix3x4fv);
+ FIND_PROC(glUniformMatrix4x3fv);
+ FIND_PROC(glBlitFramebuffer);
+ FIND_PROC(glRenderbufferStorageMultisample);
+ FIND_PROC(glFramebufferTextureLayer);
+ FIND_PROC(glMapBufferRange);
+ FIND_PROC(glFlushMappedBufferRange);
+ FIND_PROC(glBindVertexArray);
+ FIND_PROC(glDeleteVertexArrays);
+ FIND_PROC(glGenVertexArrays);
+ FIND_PROC(glIsVertexArray);
+ FIND_PROC(glGetIntegeri_v);
+ FIND_PROC(glBeginTransformFeedback);
+ FIND_PROC(glEndTransformFeedback);
+ FIND_PROC(glBindBufferRange);
+ FIND_PROC(glBindBufferBase);
+ FIND_PROC(glTransformFeedbackVaryings);
+ FIND_PROC(glGetTransformFeedbackVarying);
+ FIND_PROC(glVertexAttribIPointer);
+ FIND_PROC(glGetVertexAttribIiv);
+ FIND_PROC(glGetVertexAttribIuiv);
+ FIND_PROC(glVertexAttribI4i);
+ FIND_PROC(glVertexAttribI4ui);
+ FIND_PROC(glVertexAttribI4iv);
+ FIND_PROC(glVertexAttribI4uiv);
+ FIND_PROC(glGetUniformuiv);
+ FIND_PROC(glGetFragDataLocation);
+ FIND_PROC(glUniform1ui);
+ FIND_PROC(glUniform2ui);
+ FIND_PROC(glUniform3ui);
+ FIND_PROC(glUniform4ui);
+ FIND_PROC(glUniform1uiv);
+ FIND_PROC(glUniform2uiv);
+ FIND_PROC(glUniform3uiv);
+ FIND_PROC(glUniform4uiv);
+ FIND_PROC(glClearBufferiv);
+ FIND_PROC(glClearBufferuiv);
+ FIND_PROC(glClearBufferfv);
+ FIND_PROC(glClearBufferfi);
+ FIND_PROC(glGetStringi);
+ FIND_PROC(glCopyBufferSubData);
+ FIND_PROC(glGetUniformIndices);
+ FIND_PROC(glGetActiveUniformsiv);
+ FIND_PROC(glGetUniformBlockIndex);
+ FIND_PROC(glGetActiveUniformBlockiv);
+ FIND_PROC(glGetActiveUniformBlockName);
+ FIND_PROC(glUniformBlockBinding);
+ FIND_PROC(glDrawArraysInstanced);
+ FIND_PROC(glDrawElementsInstanced);
+ FIND_PROC(glFenceSync);
+ FIND_PROC(glIsSync);
+ FIND_PROC(glDeleteSync);
+ FIND_PROC(glClientWaitSync);
+ FIND_PROC(glWaitSync);
+ FIND_PROC(glGetInteger64v);
+ FIND_PROC(glGetSynciv);
+ FIND_PROC(glGetInteger64i_v);
+ FIND_PROC(glGetBufferParameteri64v);
+ FIND_PROC(glGenSamplers);
+ FIND_PROC(glDeleteSamplers);
+ FIND_PROC(glIsSampler);
+ FIND_PROC(glBindSampler);
+ FIND_PROC(glSamplerParameteri);
+ FIND_PROC(glSamplerParameteriv);
+ FIND_PROC(glSamplerParameterf);
+ FIND_PROC(glSamplerParameterfv);
+ FIND_PROC(glGetSamplerParameteriv);
+ FIND_PROC(glGetSamplerParameterfv);
+ FIND_PROC(glVertexAttribDivisor);
+ FIND_PROC(glBindTransformFeedback);
+ FIND_PROC(glDeleteTransformFeedbacks);
+ FIND_PROC(glGenTransformFeedbacks);
+ FIND_PROC(glIsTransformFeedback);
+ FIND_PROC(glPauseTransformFeedback);
+ FIND_PROC(glResumeTransformFeedback);
+ FIND_PROC(glGetProgramBinary);
+ FIND_PROC(glProgramBinary);
+ FIND_PROC(glProgramParameteri);
+ FIND_PROC(glInvalidateFramebuffer);
+ FIND_PROC(glInvalidateSubFramebuffer);
+ FIND_PROC(glTexStorage2D);
+ FIND_PROC(glTexStorage3D);
+ FIND_PROC(glGetInternalformativ);
+ #undef FIND_PROC
+
+ if (!glReadBuffer ||
+ !glDrawRangeElements ||
+ !glTexImage3D ||
+ !glTexSubImage3D ||
+ !glCopyTexSubImage3D ||
+ !glCompressedTexImage3D ||
+ !glCompressedTexSubImage3D ||
+ !glGenQueries ||
+ !glDeleteQueries ||
+ !glIsQuery ||
+ !glBeginQuery ||
+ !glEndQuery ||
+ !glGetQueryiv ||
+ !glGetQueryObjectuiv ||
+ !glUnmapBuffer ||
+ !glGetBufferPointerv ||
+ !glDrawBuffers ||
+ !glUniformMatrix2x3fv ||
+ !glUniformMatrix3x2fv ||
+ !glUniformMatrix2x4fv ||
+ !glUniformMatrix4x2fv ||
+ !glUniformMatrix3x4fv ||
+ !glUniformMatrix4x3fv ||
+ !glBlitFramebuffer ||
+ !glRenderbufferStorageMultisample ||
+ !glFramebufferTextureLayer ||
+ !glMapBufferRange ||
+ !glFlushMappedBufferRange ||
+ !glBindVertexArray ||
+ !glDeleteVertexArrays ||
+ !glGenVertexArrays ||
+ !glIsVertexArray ||
+ !glGetIntegeri_v ||
+ !glBeginTransformFeedback ||
+ !glEndTransformFeedback ||
+ !glBindBufferRange ||
+ !glBindBufferBase ||
+ !glTransformFeedbackVaryings ||
+ !glGetTransformFeedbackVarying ||
+ !glVertexAttribIPointer ||
+ !glGetVertexAttribIiv ||
+ !glGetVertexAttribIuiv ||
+ !glVertexAttribI4i ||
+ !glVertexAttribI4ui ||
+ !glVertexAttribI4iv ||
+ !glVertexAttribI4uiv ||
+ !glGetUniformuiv ||
+ !glGetFragDataLocation ||
+ !glUniform1ui ||
+ !glUniform2ui ||
+ !glUniform3ui ||
+ !glUniform4ui ||
+ !glUniform1uiv ||
+ !glUniform2uiv ||
+ !glUniform3uiv ||
+ !glUniform4uiv ||
+ !glClearBufferiv ||
+ !glClearBufferuiv ||
+ !glClearBufferfv ||
+ !glClearBufferfi ||
+ !glGetStringi ||
+ !glCopyBufferSubData ||
+ !glGetUniformIndices ||
+ !glGetActiveUniformsiv ||
+ !glGetUniformBlockIndex ||
+ !glGetActiveUniformBlockiv ||
+ !glGetActiveUniformBlockName ||
+ !glUniformBlockBinding ||
+ !glDrawArraysInstanced ||
+ !glDrawElementsInstanced ||
+ !glFenceSync ||
+ !glIsSync ||
+ !glDeleteSync ||
+ !glClientWaitSync ||
+ !glWaitSync ||
+ !glGetInteger64v ||
+ !glGetSynciv ||
+ !glGetInteger64i_v ||
+ !glGetBufferParameteri64v ||
+ !glGenSamplers ||
+ !glDeleteSamplers ||
+ !glIsSampler ||
+ !glBindSampler ||
+ !glSamplerParameteri ||
+ !glSamplerParameteriv ||
+ !glSamplerParameterf ||
+ !glSamplerParameterfv ||
+ !glGetSamplerParameteriv ||
+ !glGetSamplerParameterfv ||
+ !glVertexAttribDivisor ||
+ !glBindTransformFeedback ||
+ !glDeleteTransformFeedbacks ||
+ !glGenTransformFeedbacks ||
+ !glIsTransformFeedback ||
+ !glPauseTransformFeedback ||
+ !glResumeTransformFeedback ||
+ !glGetProgramBinary ||
+ !glProgramBinary ||
+ !glProgramParameteri ||
+ !glInvalidateFramebuffer ||
+ !glInvalidateSubFramebuffer ||
+ !glTexStorage2D ||
+ !glTexStorage3D ||
+ !glGetInternalformativ)
+ {
+ return GL_FALSE;
+ }
+
+ return GL_TRUE;
+}
+
+/* Function pointer definitions */
+GL_APICALL void (* GL_APIENTRY glReadBuffer) (GLenum mode);
+GL_APICALL void (* GL_APIENTRY glDrawRangeElements) (GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const GLvoid* indices);
+GL_APICALL void (* GL_APIENTRY glTexImage3D) (GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const GLvoid* pixels);
+GL_APICALL void (* GL_APIENTRY glTexSubImage3D) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const GLvoid* pixels);
+GL_APICALL void (* GL_APIENTRY glCopyTexSubImage3D) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height);
+GL_APICALL void (* GL_APIENTRY glCompressedTexImage3D) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const GLvoid* data);
+GL_APICALL void (* GL_APIENTRY glCompressedTexSubImage3D) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const GLvoid* data);
+GL_APICALL void (* GL_APIENTRY glGenQueries) (GLsizei n, GLuint* ids);
+GL_APICALL void (* GL_APIENTRY glDeleteQueries) (GLsizei n, const GLuint* ids);
+GL_APICALL GLboolean (* GL_APIENTRY glIsQuery) (GLuint id);
+GL_APICALL void (* GL_APIENTRY glBeginQuery) (GLenum target, GLuint id);
+GL_APICALL void (* GL_APIENTRY glEndQuery) (GLenum target);
+GL_APICALL void (* GL_APIENTRY glGetQueryiv) (GLenum target, GLenum pname, GLint* params);
+GL_APICALL void (* GL_APIENTRY glGetQueryObjectuiv) (GLuint id, GLenum pname, GLuint* params);
+GL_APICALL GLboolean (* GL_APIENTRY glUnmapBuffer) (GLenum target);
+GL_APICALL void (* GL_APIENTRY glGetBufferPointerv) (GLenum target, GLenum pname, GLvoid** params);
+GL_APICALL void (* GL_APIENTRY glDrawBuffers) (GLsizei n, const GLenum* bufs);
+GL_APICALL void (* GL_APIENTRY glUniformMatrix2x3fv) (GLint location, GLsizei count, GLboolean transpose, const GLfloat* value);
+GL_APICALL void (* GL_APIENTRY glUniformMatrix3x2fv) (GLint location, GLsizei count, GLboolean transpose, const GLfloat* value);
+GL_APICALL void (* GL_APIENTRY glUniformMatrix2x4fv) (GLint location, GLsizei count, GLboolean transpose, const GLfloat* value);
+GL_APICALL void (* GL_APIENTRY glUniformMatrix4x2fv) (GLint location, GLsizei count, GLboolean transpose, const GLfloat* value);
+GL_APICALL void (* GL_APIENTRY glUniformMatrix3x4fv) (GLint location, GLsizei count, GLboolean transpose, const GLfloat* value);
+GL_APICALL void (* GL_APIENTRY glUniformMatrix4x3fv) (GLint location, GLsizei count, GLboolean transpose, const GLfloat* value);
+GL_APICALL void (* GL_APIENTRY glBlitFramebuffer) (GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter);
+GL_APICALL void (* GL_APIENTRY glRenderbufferStorageMultisample) (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height);
+GL_APICALL void (* GL_APIENTRY glFramebufferTextureLayer) (GLenum target, GLenum attachment, GLuint texture, GLint level, GLint layer);
+GL_APICALL GLvoid* (* GL_APIENTRY glMapBufferRange) (GLenum target, GLintptr offset, GLsizeiptr length, GLbitfield access);
+GL_APICALL void (* GL_APIENTRY glFlushMappedBufferRange) (GLenum target, GLintptr offset, GLsizeiptr length);
+GL_APICALL void (* GL_APIENTRY glBindVertexArray) (GLuint array);
+GL_APICALL void (* GL_APIENTRY glDeleteVertexArrays) (GLsizei n, const GLuint* arrays);
+GL_APICALL void (* GL_APIENTRY glGenVertexArrays) (GLsizei n, GLuint* arrays);
+GL_APICALL GLboolean (* GL_APIENTRY glIsVertexArray) (GLuint array);
+GL_APICALL void (* GL_APIENTRY glGetIntegeri_v) (GLenum target, GLuint index, GLint* data);
+GL_APICALL void (* GL_APIENTRY glBeginTransformFeedback) (GLenum primitiveMode);
+GL_APICALL void (* GL_APIENTRY glEndTransformFeedback) (void);
+GL_APICALL void (* GL_APIENTRY glBindBufferRange) (GLenum target, GLuint index, GLuint buffer, GLintptr offset, GLsizeiptr size);
+GL_APICALL void (* GL_APIENTRY glBindBufferBase) (GLenum target, GLuint index, GLuint buffer);
+GL_APICALL void (* GL_APIENTRY glTransformFeedbackVaryings) (GLuint program, GLsizei count, const GLchar* const* varyings, GLenum bufferMode);
+GL_APICALL void (* GL_APIENTRY glGetTransformFeedbackVarying) (GLuint program, GLuint index, GLsizei bufSize, GLsizei* length, GLsizei* size, GLenum* type, GLchar* name);
+GL_APICALL void (* GL_APIENTRY glVertexAttribIPointer) (GLuint index, GLint size, GLenum type, GLsizei stride, const GLvoid* pointer);
+GL_APICALL void (* GL_APIENTRY glGetVertexAttribIiv) (GLuint index, GLenum pname, GLint* params);
+GL_APICALL void (* GL_APIENTRY glGetVertexAttribIuiv) (GLuint index, GLenum pname, GLuint* params);
+GL_APICALL void (* GL_APIENTRY glVertexAttribI4i) (GLuint index, GLint x, GLint y, GLint z, GLint w);
+GL_APICALL void (* GL_APIENTRY glVertexAttribI4ui) (GLuint index, GLuint x, GLuint y, GLuint z, GLuint w);
+GL_APICALL void (* GL_APIENTRY glVertexAttribI4iv) (GLuint index, const GLint* v);
+GL_APICALL void (* GL_APIENTRY glVertexAttribI4uiv) (GLuint index, const GLuint* v);
+GL_APICALL void (* GL_APIENTRY glGetUniformuiv) (GLuint program, GLint location, GLuint* params);
+GL_APICALL GLint (* GL_APIENTRY glGetFragDataLocation) (GLuint program, const GLchar *name);
+GL_APICALL void (* GL_APIENTRY glUniform1ui) (GLint location, GLuint v0);
+GL_APICALL void (* GL_APIENTRY glUniform2ui) (GLint location, GLuint v0, GLuint v1);
+GL_APICALL void (* GL_APIENTRY glUniform3ui) (GLint location, GLuint v0, GLuint v1, GLuint v2);
+GL_APICALL void (* GL_APIENTRY glUniform4ui) (GLint location, GLuint v0, GLuint v1, GLuint v2, GLuint v3);
+GL_APICALL void (* GL_APIENTRY glUniform1uiv) (GLint location, GLsizei count, const GLuint* value);
+GL_APICALL void (* GL_APIENTRY glUniform2uiv) (GLint location, GLsizei count, const GLuint* value);
+GL_APICALL void (* GL_APIENTRY glUniform3uiv) (GLint location, GLsizei count, const GLuint* value);
+GL_APICALL void (* GL_APIENTRY glUniform4uiv) (GLint location, GLsizei count, const GLuint* value);
+GL_APICALL void (* GL_APIENTRY glClearBufferiv) (GLenum buffer, GLint drawbuffer, const GLint* value);
+GL_APICALL void (* GL_APIENTRY glClearBufferuiv) (GLenum buffer, GLint drawbuffer, const GLuint* value);
+GL_APICALL void (* GL_APIENTRY glClearBufferfv) (GLenum buffer, GLint drawbuffer, const GLfloat* value);
+GL_APICALL void (* GL_APIENTRY glClearBufferfi) (GLenum buffer, GLint drawbuffer, GLfloat depth, GLint stencil);
+GL_APICALL const GLubyte* (* GL_APIENTRY glGetStringi) (GLenum name, GLuint index);
+GL_APICALL void (* GL_APIENTRY glCopyBufferSubData) (GLenum readTarget, GLenum writeTarget, GLintptr readOffset, GLintptr writeOffset, GLsizeiptr size);
+GL_APICALL void (* GL_APIENTRY glGetUniformIndices) (GLuint program, GLsizei uniformCount, const GLchar* const* uniformNames, GLuint* uniformIndices);
+GL_APICALL void (* GL_APIENTRY glGetActiveUniformsiv) (GLuint program, GLsizei uniformCount, const GLuint* uniformIndices, GLenum pname, GLint* params);
+GL_APICALL GLuint (* GL_APIENTRY glGetUniformBlockIndex) (GLuint program, const GLchar* uniformBlockName);
+GL_APICALL void (* GL_APIENTRY glGetActiveUniformBlockiv) (GLuint program, GLuint uniformBlockIndex, GLenum pname, GLint* params);
+GL_APICALL void (* GL_APIENTRY glGetActiveUniformBlockName) (GLuint program, GLuint uniformBlockIndex, GLsizei bufSize, GLsizei* length, GLchar* uniformBlockName);
+GL_APICALL void (* GL_APIENTRY glUniformBlockBinding) (GLuint program, GLuint uniformBlockIndex, GLuint uniformBlockBinding);
+GL_APICALL void (* GL_APIENTRY glDrawArraysInstanced) (GLenum mode, GLint first, GLsizei count, GLsizei instanceCount);
+GL_APICALL void (* GL_APIENTRY glDrawElementsInstanced) (GLenum mode, GLsizei count, GLenum type, const GLvoid* indices, GLsizei instanceCount);
+GL_APICALL GLsync (* GL_APIENTRY glFenceSync) (GLenum condition, GLbitfield flags);
+GL_APICALL GLboolean (* GL_APIENTRY glIsSync) (GLsync sync);
+GL_APICALL void (* GL_APIENTRY glDeleteSync) (GLsync sync);
+GL_APICALL GLenum (* GL_APIENTRY glClientWaitSync) (GLsync sync, GLbitfield flags, GLuint64 timeout);
+GL_APICALL void (* GL_APIENTRY glWaitSync) (GLsync sync, GLbitfield flags, GLuint64 timeout);
+GL_APICALL void (* GL_APIENTRY glGetInteger64v) (GLenum pname, GLint64* params);
+GL_APICALL void (* GL_APIENTRY glGetSynciv) (GLsync sync, GLenum pname, GLsizei bufSize, GLsizei* length, GLint* values);
+GL_APICALL void (* GL_APIENTRY glGetInteger64i_v) (GLenum target, GLuint index, GLint64* data);
+GL_APICALL void (* GL_APIENTRY glGetBufferParameteri64v) (GLenum target, GLenum pname, GLint64* params);
+GL_APICALL void (* GL_APIENTRY glGenSamplers) (GLsizei count, GLuint* samplers);
+GL_APICALL void (* GL_APIENTRY glDeleteSamplers) (GLsizei count, const GLuint* samplers);
+GL_APICALL GLboolean (* GL_APIENTRY glIsSampler) (GLuint sampler);
+GL_APICALL void (* GL_APIENTRY glBindSampler) (GLuint unit, GLuint sampler);
+GL_APICALL void (* GL_APIENTRY glSamplerParameteri) (GLuint sampler, GLenum pname, GLint param);
+GL_APICALL void (* GL_APIENTRY glSamplerParameteriv) (GLuint sampler, GLenum pname, const GLint* param);
+GL_APICALL void (* GL_APIENTRY glSamplerParameterf) (GLuint sampler, GLenum pname, GLfloat param);
+GL_APICALL void (* GL_APIENTRY glSamplerParameterfv) (GLuint sampler, GLenum pname, const GLfloat* param);
+GL_APICALL void (* GL_APIENTRY glGetSamplerParameteriv) (GLuint sampler, GLenum pname, GLint* params);
+GL_APICALL void (* GL_APIENTRY glGetSamplerParameterfv) (GLuint sampler, GLenum pname, GLfloat* params);
+GL_APICALL void (* GL_APIENTRY glVertexAttribDivisor) (GLuint index, GLuint divisor);
+GL_APICALL void (* GL_APIENTRY glBindTransformFeedback) (GLenum target, GLuint id);
+GL_APICALL void (* GL_APIENTRY glDeleteTransformFeedbacks) (GLsizei n, const GLuint* ids);
+GL_APICALL void (* GL_APIENTRY glGenTransformFeedbacks) (GLsizei n, GLuint* ids);
+GL_APICALL GLboolean (* GL_APIENTRY glIsTransformFeedback) (GLuint id);
+GL_APICALL void (* GL_APIENTRY glPauseTransformFeedback) (void);
+GL_APICALL void (* GL_APIENTRY glResumeTransformFeedback) (void);
+GL_APICALL void (* GL_APIENTRY glGetProgramBinary) (GLuint program, GLsizei bufSize, GLsizei* length, GLenum* binaryFormat, GLvoid* binary);
+GL_APICALL void (* GL_APIENTRY glProgramBinary) (GLuint program, GLenum binaryFormat, const GLvoid* binary, GLsizei length);
+GL_APICALL void (* GL_APIENTRY glProgramParameteri) (GLuint program, GLenum pname, GLint value);
+GL_APICALL void (* GL_APIENTRY glInvalidateFramebuffer) (GLenum target, GLsizei numAttachments, const GLenum* attachments);
+GL_APICALL void (* GL_APIENTRY glInvalidateSubFramebuffer) (GLenum target, GLsizei numAttachments, const GLenum* attachments, GLint x, GLint y, GLsizei width, GLsizei height);
+GL_APICALL void (* GL_APIENTRY glTexStorage2D) (GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height);
+GL_APICALL void (* GL_APIENTRY glTexStorage3D) (GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth);
+GL_APICALL void (* GL_APIENTRY glGetInternalformativ) (GLenum target, GLenum internalformat, GLenum pname, GLsizei bufSize, GLint* params);
diff --git a/android/jni/com/mapswithme/opengl/gl3stub.h b/android/jni/com/mapswithme/opengl/gl3stub.h
new file mode 100644
index 0000000000..aab6120e3f
--- /dev/null
+++ b/android/jni/com/mapswithme/opengl/gl3stub.h
@@ -0,0 +1,492 @@
+#ifndef __gl3_h_
+#define __gl3_h_
+
+/*
+ * stub gl3.h for dynamic loading, based on:
+ * gl3.h last updated on $Date: 2013-02-12 14:37:24 -0800 (Tue, 12 Feb 2013) $
+ *
+ * Changes:
+ * - Added #include <GLES2/gl2.h>
+ * - Removed duplicate OpenGL ES 2.0 declarations
+ * - Converted OpenGL ES 3.0 function prototypes to function pointer
+ * declarations
+ * - Added gl3stubInit() declaration
+ */
+
+#include <EGL/egl.h>
+#include <GLES2/gl2.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*
+** Copyright (c) 2007-2013 The Khronos Group Inc.
+**
+** Permission is hereby granted, free of charge, to any person obtaining a
+** copy of this software and/or associated documentation files (the
+** "Materials"), to deal in the Materials without restriction, including
+** without limitation the rights to use, copy, modify, merge, publish,
+** distribute, sublicense, and/or sell copies of the Materials, and to
+** permit persons to whom the Materials are 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 Materials.
+**
+** THE MATERIALS ARE 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
+** MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
+*/
+
+/* Call this function before calling any OpenGL ES 3.0 functions. It will
+ * return GL_TRUE if the OpenGL ES 3.0 was successfully initialized, GL_FALSE
+ * otherwise. */
+GLboolean gl3stubInit();
+
+/*-------------------------------------------------------------------------
+ * Data type definitions
+ *-----------------------------------------------------------------------*/
+
+/* OpenGL ES 3.0 */
+
+typedef unsigned short GLhalf;
+typedef khronos_int64_t GLint64;
+typedef khronos_uint64_t GLuint64;
+typedef struct __GLsync *GLsync;
+
+/*-------------------------------------------------------------------------
+ * Token definitions
+ *-----------------------------------------------------------------------*/
+
+/* OpenGL ES core versions */
+#define GL_ES_VERSION_3_0 1
+
+/* OpenGL ES 3.0 */
+
+#define GL_READ_BUFFER 0x0C02
+#define GL_UNPACK_ROW_LENGTH 0x0CF2
+#define GL_UNPACK_SKIP_ROWS 0x0CF3
+#define GL_UNPACK_SKIP_PIXELS 0x0CF4
+#define GL_PACK_ROW_LENGTH 0x0D02
+#define GL_PACK_SKIP_ROWS 0x0D03
+#define GL_PACK_SKIP_PIXELS 0x0D04
+#define GL_COLOR 0x1800
+#define GL_DEPTH 0x1801
+#define GL_STENCIL 0x1802
+#define GL_RED 0x1903
+#define GL_RGB8 0x8051
+#define GL_RGBA8 0x8058
+#define GL_RGB10_A2 0x8059
+#define GL_TEXTURE_BINDING_3D 0x806A
+#define GL_UNPACK_SKIP_IMAGES 0x806D
+#define GL_UNPACK_IMAGE_HEIGHT 0x806E
+#define GL_TEXTURE_3D 0x806F
+#define GL_TEXTURE_WRAP_R 0x8072
+#define GL_MAX_3D_TEXTURE_SIZE 0x8073
+#define GL_UNSIGNED_INT_2_10_10_10_REV 0x8368
+#define GL_MAX_ELEMENTS_VERTICES 0x80E8
+#define GL_MAX_ELEMENTS_INDICES 0x80E9
+#define GL_TEXTURE_MIN_LOD 0x813A
+#define GL_TEXTURE_MAX_LOD 0x813B
+#define GL_TEXTURE_BASE_LEVEL 0x813C
+#define GL_TEXTURE_MAX_LEVEL 0x813D
+#define GL_MIN 0x8007
+#define GL_MAX 0x8008
+#define GL_DEPTH_COMPONENT24 0x81A6
+#define GL_MAX_TEXTURE_LOD_BIAS 0x84FD
+#define GL_TEXTURE_COMPARE_MODE 0x884C
+#define GL_TEXTURE_COMPARE_FUNC 0x884D
+#define GL_CURRENT_QUERY 0x8865
+#define GL_QUERY_RESULT 0x8866
+#define GL_QUERY_RESULT_AVAILABLE 0x8867
+#define GL_BUFFER_MAPPED 0x88BC
+#define GL_BUFFER_MAP_POINTER 0x88BD
+#define GL_STREAM_READ 0x88E1
+#define GL_STREAM_COPY 0x88E2
+#define GL_STATIC_READ 0x88E5
+#define GL_STATIC_COPY 0x88E6
+#define GL_DYNAMIC_READ 0x88E9
+#define GL_DYNAMIC_COPY 0x88EA
+#define GL_MAX_DRAW_BUFFERS 0x8824
+#define GL_DRAW_BUFFER0 0x8825
+#define GL_DRAW_BUFFER1 0x8826
+#define GL_DRAW_BUFFER2 0x8827
+#define GL_DRAW_BUFFER3 0x8828
+#define GL_DRAW_BUFFER4 0x8829
+#define GL_DRAW_BUFFER5 0x882A
+#define GL_DRAW_BUFFER6 0x882B
+#define GL_DRAW_BUFFER7 0x882C
+#define GL_DRAW_BUFFER8 0x882D
+#define GL_DRAW_BUFFER9 0x882E
+#define GL_DRAW_BUFFER10 0x882F
+#define GL_DRAW_BUFFER11 0x8830
+#define GL_DRAW_BUFFER12 0x8831
+#define GL_DRAW_BUFFER13 0x8832
+#define GL_DRAW_BUFFER14 0x8833
+#define GL_DRAW_BUFFER15 0x8834
+#define GL_MAX_FRAGMENT_UNIFORM_COMPONENTS 0x8B49
+#define GL_MAX_VERTEX_UNIFORM_COMPONENTS 0x8B4A
+#define GL_SAMPLER_3D 0x8B5F
+#define GL_SAMPLER_2D_SHADOW 0x8B62
+#define GL_FRAGMENT_SHADER_DERIVATIVE_HINT 0x8B8B
+#define GL_PIXEL_PACK_BUFFER 0x88EB
+#define GL_PIXEL_UNPACK_BUFFER 0x88EC
+#define GL_PIXEL_PACK_BUFFER_BINDING 0x88ED
+#define GL_PIXEL_UNPACK_BUFFER_BINDING 0x88EF
+#define GL_FLOAT_MAT2x3 0x8B65
+#define GL_FLOAT_MAT2x4 0x8B66
+#define GL_FLOAT_MAT3x2 0x8B67
+#define GL_FLOAT_MAT3x4 0x8B68
+#define GL_FLOAT_MAT4x2 0x8B69
+#define GL_FLOAT_MAT4x3 0x8B6A
+#define GL_SRGB 0x8C40
+#define GL_SRGB8 0x8C41
+#define GL_SRGB8_ALPHA8 0x8C43
+#define GL_COMPARE_REF_TO_TEXTURE 0x884E
+#define GL_MAJOR_VERSION 0x821B
+#define GL_MINOR_VERSION 0x821C
+#define GL_NUM_EXTENSIONS 0x821D
+#define GL_RGBA32F 0x8814
+#define GL_RGB32F 0x8815
+#define GL_RGBA16F 0x881A
+#define GL_RGB16F 0x881B
+#define GL_VERTEX_ATTRIB_ARRAY_INTEGER 0x88FD
+#define GL_MAX_ARRAY_TEXTURE_LAYERS 0x88FF
+#define GL_MIN_PROGRAM_TEXEL_OFFSET 0x8904
+#define GL_MAX_PROGRAM_TEXEL_OFFSET 0x8905
+#define GL_MAX_VARYING_COMPONENTS 0x8B4B
+#define GL_TEXTURE_2D_ARRAY 0x8C1A
+#define GL_TEXTURE_BINDING_2D_ARRAY 0x8C1D
+#define GL_R11F_G11F_B10F 0x8C3A
+#define GL_UNSIGNED_INT_10F_11F_11F_REV 0x8C3B
+#define GL_RGB9_E5 0x8C3D
+#define GL_UNSIGNED_INT_5_9_9_9_REV 0x8C3E
+#define GL_TRANSFORM_FEEDBACK_VARYING_MAX_LENGTH 0x8C76
+#define GL_TRANSFORM_FEEDBACK_BUFFER_MODE 0x8C7F
+#define GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_COMPONENTS 0x8C80
+#define GL_TRANSFORM_FEEDBACK_VARYINGS 0x8C83
+#define GL_TRANSFORM_FEEDBACK_BUFFER_START 0x8C84
+#define GL_TRANSFORM_FEEDBACK_BUFFER_SIZE 0x8C85
+#define GL_TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN 0x8C88
+#define GL_RASTERIZER_DISCARD 0x8C89
+#define GL_MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS 0x8C8A
+#define GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS 0x8C8B
+#define GL_INTERLEAVED_ATTRIBS 0x8C8C
+#define GL_SEPARATE_ATTRIBS 0x8C8D
+#define GL_TRANSFORM_FEEDBACK_BUFFER 0x8C8E
+#define GL_TRANSFORM_FEEDBACK_BUFFER_BINDING 0x8C8F
+#define GL_RGBA32UI 0x8D70
+#define GL_RGB32UI 0x8D71
+#define GL_RGBA16UI 0x8D76
+#define GL_RGB16UI 0x8D77
+#define GL_RGBA8UI 0x8D7C
+#define GL_RGB8UI 0x8D7D
+#define GL_RGBA32I 0x8D82
+#define GL_RGB32I 0x8D83
+#define GL_RGBA16I 0x8D88
+#define GL_RGB16I 0x8D89
+#define GL_RGBA8I 0x8D8E
+#define GL_RGB8I 0x8D8F
+#define GL_RED_INTEGER 0x8D94
+#define GL_RGB_INTEGER 0x8D98
+#define GL_RGBA_INTEGER 0x8D99
+#define GL_SAMPLER_2D_ARRAY 0x8DC1
+#define GL_SAMPLER_2D_ARRAY_SHADOW 0x8DC4
+#define GL_SAMPLER_CUBE_SHADOW 0x8DC5
+#define GL_UNSIGNED_INT_VEC2 0x8DC6
+#define GL_UNSIGNED_INT_VEC3 0x8DC7
+#define GL_UNSIGNED_INT_VEC4 0x8DC8
+#define GL_INT_SAMPLER_2D 0x8DCA
+#define GL_INT_SAMPLER_3D 0x8DCB
+#define GL_INT_SAMPLER_CUBE 0x8DCC
+#define GL_INT_SAMPLER_2D_ARRAY 0x8DCF
+#define GL_UNSIGNED_INT_SAMPLER_2D 0x8DD2
+#define GL_UNSIGNED_INT_SAMPLER_3D 0x8DD3
+#define GL_UNSIGNED_INT_SAMPLER_CUBE 0x8DD4
+#define GL_UNSIGNED_INT_SAMPLER_2D_ARRAY 0x8DD7
+#define GL_BUFFER_ACCESS_FLAGS 0x911F
+#define GL_BUFFER_MAP_LENGTH 0x9120
+#define GL_BUFFER_MAP_OFFSET 0x9121
+#define GL_DEPTH_COMPONENT32F 0x8CAC
+#define GL_DEPTH32F_STENCIL8 0x8CAD
+#define GL_FLOAT_32_UNSIGNED_INT_24_8_REV 0x8DAD
+#define GL_FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING 0x8210
+#define GL_FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE 0x8211
+#define GL_FRAMEBUFFER_ATTACHMENT_RED_SIZE 0x8212
+#define GL_FRAMEBUFFER_ATTACHMENT_GREEN_SIZE 0x8213
+#define GL_FRAMEBUFFER_ATTACHMENT_BLUE_SIZE 0x8214
+#define GL_FRAMEBUFFER_ATTACHMENT_ALPHA_SIZE 0x8215
+#define GL_FRAMEBUFFER_ATTACHMENT_DEPTH_SIZE 0x8216
+#define GL_FRAMEBUFFER_ATTACHMENT_STENCIL_SIZE 0x8217
+#define GL_FRAMEBUFFER_DEFAULT 0x8218
+#define GL_FRAMEBUFFER_UNDEFINED 0x8219
+#define GL_DEPTH_STENCIL_ATTACHMENT 0x821A
+#define GL_DEPTH_STENCIL 0x84F9
+#define GL_UNSIGNED_INT_24_8 0x84FA
+#define GL_DEPTH24_STENCIL8 0x88F0
+#define GL_UNSIGNED_NORMALIZED 0x8C17
+#define GL_DRAW_FRAMEBUFFER_BINDING GL_FRAMEBUFFER_BINDING
+#define GL_READ_FRAMEBUFFER 0x8CA8
+#define GL_DRAW_FRAMEBUFFER 0x8CA9
+#define GL_READ_FRAMEBUFFER_BINDING 0x8CAA
+#define GL_RENDERBUFFER_SAMPLES 0x8CAB
+#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER 0x8CD4
+#define GL_MAX_COLOR_ATTACHMENTS 0x8CDF
+#define GL_COLOR_ATTACHMENT1 0x8CE1
+#define GL_COLOR_ATTACHMENT2 0x8CE2
+#define GL_COLOR_ATTACHMENT3 0x8CE3
+#define GL_COLOR_ATTACHMENT4 0x8CE4
+#define GL_COLOR_ATTACHMENT5 0x8CE5
+#define GL_COLOR_ATTACHMENT6 0x8CE6
+#define GL_COLOR_ATTACHMENT7 0x8CE7
+#define GL_COLOR_ATTACHMENT8 0x8CE8
+#define GL_COLOR_ATTACHMENT9 0x8CE9
+#define GL_COLOR_ATTACHMENT10 0x8CEA
+#define GL_COLOR_ATTACHMENT11 0x8CEB
+#define GL_COLOR_ATTACHMENT12 0x8CEC
+#define GL_COLOR_ATTACHMENT13 0x8CED
+#define GL_COLOR_ATTACHMENT14 0x8CEE
+#define GL_COLOR_ATTACHMENT15 0x8CEF
+#define GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE 0x8D56
+#define GL_MAX_SAMPLES 0x8D57
+#define GL_HALF_FLOAT 0x140B
+#define GL_MAP_READ_BIT 0x0001
+#define GL_MAP_WRITE_BIT 0x0002
+#define GL_MAP_INVALIDATE_RANGE_BIT 0x0004
+#define GL_MAP_INVALIDATE_BUFFER_BIT 0x0008
+#define GL_MAP_FLUSH_EXPLICIT_BIT 0x0010
+#define GL_MAP_UNSYNCHRONIZED_BIT 0x0020
+#define GL_RG 0x8227
+#define GL_RG_INTEGER 0x8228
+#define GL_R8 0x8229
+#define GL_RG8 0x822B
+#define GL_R16F 0x822D
+#define GL_R32F 0x822E
+#define GL_RG16F 0x822F
+#define GL_RG32F 0x8230
+#define GL_R8I 0x8231
+#define GL_R8UI 0x8232
+#define GL_R16I 0x8233
+#define GL_R16UI 0x8234
+#define GL_R32I 0x8235
+#define GL_R32UI 0x8236
+#define GL_RG8I 0x8237
+#define GL_RG8UI 0x8238
+#define GL_RG16I 0x8239
+#define GL_RG16UI 0x823A
+#define GL_RG32I 0x823B
+#define GL_RG32UI 0x823C
+#define GL_VERTEX_ARRAY_BINDING 0x85B5
+#define GL_R8_SNORM 0x8F94
+#define GL_RG8_SNORM 0x8F95
+#define GL_RGB8_SNORM 0x8F96
+#define GL_RGBA8_SNORM 0x8F97
+#define GL_SIGNED_NORMALIZED 0x8F9C
+#define GL_PRIMITIVE_RESTART_FIXED_INDEX 0x8D69
+#define GL_COPY_READ_BUFFER 0x8F36
+#define GL_COPY_WRITE_BUFFER 0x8F37
+#define GL_COPY_READ_BUFFER_BINDING GL_COPY_READ_BUFFER
+#define GL_COPY_WRITE_BUFFER_BINDING GL_COPY_WRITE_BUFFER
+#define GL_UNIFORM_BUFFER 0x8A11
+#define GL_UNIFORM_BUFFER_BINDING 0x8A28
+#define GL_UNIFORM_BUFFER_START 0x8A29
+#define GL_UNIFORM_BUFFER_SIZE 0x8A2A
+#define GL_MAX_VERTEX_UNIFORM_BLOCKS 0x8A2B
+#define GL_MAX_FRAGMENT_UNIFORM_BLOCKS 0x8A2D
+#define GL_MAX_COMBINED_UNIFORM_BLOCKS 0x8A2E
+#define GL_MAX_UNIFORM_BUFFER_BINDINGS 0x8A2F
+#define GL_MAX_UNIFORM_BLOCK_SIZE 0x8A30
+#define GL_MAX_COMBINED_VERTEX_UNIFORM_COMPONENTS 0x8A31
+#define GL_MAX_COMBINED_FRAGMENT_UNIFORM_COMPONENTS 0x8A33
+#define GL_UNIFORM_BUFFER_OFFSET_ALIGNMENT 0x8A34
+#define GL_ACTIVE_UNIFORM_BLOCK_MAX_NAME_LENGTH 0x8A35
+#define GL_ACTIVE_UNIFORM_BLOCKS 0x8A36
+#define GL_UNIFORM_TYPE 0x8A37
+#define GL_UNIFORM_SIZE 0x8A38
+#define GL_UNIFORM_NAME_LENGTH 0x8A39
+#define GL_UNIFORM_BLOCK_INDEX 0x8A3A
+#define GL_UNIFORM_OFFSET 0x8A3B
+#define GL_UNIFORM_ARRAY_STRIDE 0x8A3C
+#define GL_UNIFORM_MATRIX_STRIDE 0x8A3D
+#define GL_UNIFORM_IS_ROW_MAJOR 0x8A3E
+#define GL_UNIFORM_BLOCK_BINDING 0x8A3F
+#define GL_UNIFORM_BLOCK_DATA_SIZE 0x8A40
+#define GL_UNIFORM_BLOCK_NAME_LENGTH 0x8A41
+#define GL_UNIFORM_BLOCK_ACTIVE_UNIFORMS 0x8A42
+#define GL_UNIFORM_BLOCK_ACTIVE_UNIFORM_INDICES 0x8A43
+#define GL_UNIFORM_BLOCK_REFERENCED_BY_VERTEX_SHADER 0x8A44
+#define GL_UNIFORM_BLOCK_REFERENCED_BY_FRAGMENT_SHADER 0x8A46
+#define GL_INVALID_INDEX 0xFFFFFFFFu
+#define GL_MAX_VERTEX_OUTPUT_COMPONENTS 0x9122
+#define GL_MAX_FRAGMENT_INPUT_COMPONENTS 0x9125
+#define GL_MAX_SERVER_WAIT_TIMEOUT 0x9111
+#define GL_OBJECT_TYPE 0x9112
+#define GL_SYNC_CONDITION 0x9113
+#define GL_SYNC_STATUS 0x9114
+#define GL_SYNC_FLAGS 0x9115
+#define GL_SYNC_FENCE 0x9116
+#define GL_SYNC_GPU_COMMANDS_COMPLETE 0x9117
+#define GL_UNSIGNALED 0x9118
+#define GL_SIGNALED 0x9119
+#define GL_ALREADY_SIGNALED 0x911A
+#define GL_TIMEOUT_EXPIRED 0x911B
+#define GL_CONDITION_SATISFIED 0x911C
+#define GL_WAIT_FAILED 0x911D
+#define GL_SYNC_FLUSH_COMMANDS_BIT 0x00000001
+#define GL_TIMEOUT_IGNORED 0xFFFFFFFFFFFFFFFFull
+#define GL_VERTEX_ATTRIB_ARRAY_DIVISOR 0x88FE
+#define GL_ANY_SAMPLES_PASSED 0x8C2F
+#define GL_ANY_SAMPLES_PASSED_CONSERVATIVE 0x8D6A
+#define GL_SAMPLER_BINDING 0x8919
+#define GL_RGB10_A2UI 0x906F
+#define GL_TEXTURE_SWIZZLE_R 0x8E42
+#define GL_TEXTURE_SWIZZLE_G 0x8E43
+#define GL_TEXTURE_SWIZZLE_B 0x8E44
+#define GL_TEXTURE_SWIZZLE_A 0x8E45
+#define GL_GREEN 0x1904
+#define GL_BLUE 0x1905
+#define GL_INT_2_10_10_10_REV 0x8D9F
+#define GL_TRANSFORM_FEEDBACK 0x8E22
+#define GL_TRANSFORM_FEEDBACK_PAUSED 0x8E23
+#define GL_TRANSFORM_FEEDBACK_ACTIVE 0x8E24
+#define GL_TRANSFORM_FEEDBACK_BINDING 0x8E25
+#define GL_PROGRAM_BINARY_RETRIEVABLE_HINT 0x8257
+#define GL_PROGRAM_BINARY_LENGTH 0x8741
+#define GL_NUM_PROGRAM_BINARY_FORMATS 0x87FE
+#define GL_PROGRAM_BINARY_FORMATS 0x87FF
+#define GL_COMPRESSED_R11_EAC 0x9270
+#define GL_COMPRESSED_SIGNED_R11_EAC 0x9271
+#define GL_COMPRESSED_RG11_EAC 0x9272
+#define GL_COMPRESSED_SIGNED_RG11_EAC 0x9273
+#define GL_COMPRESSED_RGB8_ETC2 0x9274
+#define GL_COMPRESSED_SRGB8_ETC2 0x9275
+#define GL_COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2 0x9276
+#define GL_COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2 0x9277
+#define GL_COMPRESSED_RGBA8_ETC2_EAC 0x9278
+#define GL_COMPRESSED_SRGB8_ALPHA8_ETC2_EAC 0x9279
+#define GL_TEXTURE_IMMUTABLE_FORMAT 0x912F
+#define GL_MAX_ELEMENT_INDEX 0x8D6B
+#define GL_NUM_SAMPLE_COUNTS 0x9380
+#define GL_TEXTURE_IMMUTABLE_LEVELS 0x82DF
+
+/*-------------------------------------------------------------------------
+ * Entrypoint definitions
+ *-----------------------------------------------------------------------*/
+
+/* OpenGL ES 3.0 */
+
+extern GL_APICALL void (* GL_APIENTRY glReadBuffer) (GLenum mode);
+extern GL_APICALL void (* GL_APIENTRY glDrawRangeElements) (GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const GLvoid* indices);
+extern GL_APICALL void (* GL_APIENTRY glTexImage3D) (GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const GLvoid* pixels);
+extern GL_APICALL void (* GL_APIENTRY glTexSubImage3D) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const GLvoid* pixels);
+extern GL_APICALL void (* GL_APIENTRY glCopyTexSubImage3D) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height);
+extern GL_APICALL void (* GL_APIENTRY glCompressedTexImage3D) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const GLvoid* data);
+extern GL_APICALL void (* GL_APIENTRY glCompressedTexSubImage3D) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const GLvoid* data);
+extern GL_APICALL void (* GL_APIENTRY glGenQueries) (GLsizei n, GLuint* ids);
+extern GL_APICALL void (* GL_APIENTRY glDeleteQueries) (GLsizei n, const GLuint* ids);
+extern GL_APICALL GLboolean (* GL_APIENTRY glIsQuery) (GLuint id);
+extern GL_APICALL void (* GL_APIENTRY glBeginQuery) (GLenum target, GLuint id);
+extern GL_APICALL void (* GL_APIENTRY glEndQuery) (GLenum target);
+extern GL_APICALL void (* GL_APIENTRY glGetQueryiv) (GLenum target, GLenum pname, GLint* params);
+extern GL_APICALL void (* GL_APIENTRY glGetQueryObjectuiv) (GLuint id, GLenum pname, GLuint* params);
+extern GL_APICALL GLboolean (* GL_APIENTRY glUnmapBuffer) (GLenum target);
+extern GL_APICALL void (* GL_APIENTRY glGetBufferPointerv) (GLenum target, GLenum pname, GLvoid** params);
+extern GL_APICALL void (* GL_APIENTRY glDrawBuffers) (GLsizei n, const GLenum* bufs);
+extern GL_APICALL void (* GL_APIENTRY glUniformMatrix2x3fv) (GLint location, GLsizei count, GLboolean transpose, const GLfloat* value);
+extern GL_APICALL void (* GL_APIENTRY glUniformMatrix3x2fv) (GLint location, GLsizei count, GLboolean transpose, const GLfloat* value);
+extern GL_APICALL void (* GL_APIENTRY glUniformMatrix2x4fv) (GLint location, GLsizei count, GLboolean transpose, const GLfloat* value);
+extern GL_APICALL void (* GL_APIENTRY glUniformMatrix4x2fv) (GLint location, GLsizei count, GLboolean transpose, const GLfloat* value);
+extern GL_APICALL void (* GL_APIENTRY glUniformMatrix3x4fv) (GLint location, GLsizei count, GLboolean transpose, const GLfloat* value);
+extern GL_APICALL void (* GL_APIENTRY glUniformMatrix4x3fv) (GLint location, GLsizei count, GLboolean transpose, const GLfloat* value);
+extern GL_APICALL void (* GL_APIENTRY glBlitFramebuffer) (GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter);
+extern GL_APICALL void (* GL_APIENTRY glRenderbufferStorageMultisample) (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height);
+extern GL_APICALL void (* GL_APIENTRY glFramebufferTextureLayer) (GLenum target, GLenum attachment, GLuint texture, GLint level, GLint layer);
+extern GL_APICALL GLvoid* (* GL_APIENTRY glMapBufferRange) (GLenum target, GLintptr offset, GLsizeiptr length, GLbitfield access);
+extern GL_APICALL void (* GL_APIENTRY glFlushMappedBufferRange) (GLenum target, GLintptr offset, GLsizeiptr length);
+extern GL_APICALL void (* GL_APIENTRY glBindVertexArray) (GLuint array);
+extern GL_APICALL void (* GL_APIENTRY glDeleteVertexArrays) (GLsizei n, const GLuint* arrays);
+extern GL_APICALL void (* GL_APIENTRY glGenVertexArrays) (GLsizei n, GLuint* arrays);
+extern GL_APICALL GLboolean (* GL_APIENTRY glIsVertexArray) (GLuint array);
+extern GL_APICALL void (* GL_APIENTRY glGetIntegeri_v) (GLenum target, GLuint index, GLint* data);
+extern GL_APICALL void (* GL_APIENTRY glBeginTransformFeedback) (GLenum primitiveMode);
+extern GL_APICALL void (* GL_APIENTRY glEndTransformFeedback) (void);
+extern GL_APICALL void (* GL_APIENTRY glBindBufferRange) (GLenum target, GLuint index, GLuint buffer, GLintptr offset, GLsizeiptr size);
+extern GL_APICALL void (* GL_APIENTRY glBindBufferBase) (GLenum target, GLuint index, GLuint buffer);
+extern GL_APICALL void (* GL_APIENTRY glTransformFeedbackVaryings) (GLuint program, GLsizei count, const GLchar* const* varyings, GLenum bufferMode);
+extern GL_APICALL void (* GL_APIENTRY glGetTransformFeedbackVarying) (GLuint program, GLuint index, GLsizei bufSize, GLsizei* length, GLsizei* size, GLenum* type, GLchar* name);
+extern GL_APICALL void (* GL_APIENTRY glVertexAttribIPointer) (GLuint index, GLint size, GLenum type, GLsizei stride, const GLvoid* pointer);
+extern GL_APICALL void (* GL_APIENTRY glGetVertexAttribIiv) (GLuint index, GLenum pname, GLint* params);
+extern GL_APICALL void (* GL_APIENTRY glGetVertexAttribIuiv) (GLuint index, GLenum pname, GLuint* params);
+extern GL_APICALL void (* GL_APIENTRY glVertexAttribI4i) (GLuint index, GLint x, GLint y, GLint z, GLint w);
+extern GL_APICALL void (* GL_APIENTRY glVertexAttribI4ui) (GLuint index, GLuint x, GLuint y, GLuint z, GLuint w);
+extern GL_APICALL void (* GL_APIENTRY glVertexAttribI4iv) (GLuint index, const GLint* v);
+extern GL_APICALL void (* GL_APIENTRY glVertexAttribI4uiv) (GLuint index, const GLuint* v);
+extern GL_APICALL void (* GL_APIENTRY glGetUniformuiv) (GLuint program, GLint location, GLuint* params);
+extern GL_APICALL GLint (* GL_APIENTRY glGetFragDataLocation) (GLuint program, const GLchar *name);
+extern GL_APICALL void (* GL_APIENTRY glUniform1ui) (GLint location, GLuint v0);
+extern GL_APICALL void (* GL_APIENTRY glUniform2ui) (GLint location, GLuint v0, GLuint v1);
+extern GL_APICALL void (* GL_APIENTRY glUniform3ui) (GLint location, GLuint v0, GLuint v1, GLuint v2);
+extern GL_APICALL void (* GL_APIENTRY glUniform4ui) (GLint location, GLuint v0, GLuint v1, GLuint v2, GLuint v3);
+extern GL_APICALL void (* GL_APIENTRY glUniform1uiv) (GLint location, GLsizei count, const GLuint* value);
+extern GL_APICALL void (* GL_APIENTRY glUniform2uiv) (GLint location, GLsizei count, const GLuint* value);
+extern GL_APICALL void (* GL_APIENTRY glUniform3uiv) (GLint location, GLsizei count, const GLuint* value);
+extern GL_APICALL void (* GL_APIENTRY glUniform4uiv) (GLint location, GLsizei count, const GLuint* value);
+extern GL_APICALL void (* GL_APIENTRY glClearBufferiv) (GLenum buffer, GLint drawbuffer, const GLint* value);
+extern GL_APICALL void (* GL_APIENTRY glClearBufferuiv) (GLenum buffer, GLint drawbuffer, const GLuint* value);
+extern GL_APICALL void (* GL_APIENTRY glClearBufferfv) (GLenum buffer, GLint drawbuffer, const GLfloat* value);
+extern GL_APICALL void (* GL_APIENTRY glClearBufferfi) (GLenum buffer, GLint drawbuffer, GLfloat depth, GLint stencil);
+extern GL_APICALL const GLubyte* (* GL_APIENTRY glGetStringi) (GLenum name, GLuint index);
+extern GL_APICALL void (* GL_APIENTRY glCopyBufferSubData) (GLenum readTarget, GLenum writeTarget, GLintptr readOffset, GLintptr writeOffset, GLsizeiptr size);
+extern GL_APICALL void (* GL_APIENTRY glGetUniformIndices) (GLuint program, GLsizei uniformCount, const GLchar* const* uniformNames, GLuint* uniformIndices);
+extern GL_APICALL void (* GL_APIENTRY glGetActiveUniformsiv) (GLuint program, GLsizei uniformCount, const GLuint* uniformIndices, GLenum pname, GLint* params);
+extern GL_APICALL GLuint (* GL_APIENTRY glGetUniformBlockIndex) (GLuint program, const GLchar* uniformBlockName);
+extern GL_APICALL void (* GL_APIENTRY glGetActiveUniformBlockiv) (GLuint program, GLuint uniformBlockIndex, GLenum pname, GLint* params);
+extern GL_APICALL void (* GL_APIENTRY glGetActiveUniformBlockName) (GLuint program, GLuint uniformBlockIndex, GLsizei bufSize, GLsizei* length, GLchar* uniformBlockName);
+extern GL_APICALL void (* GL_APIENTRY glUniformBlockBinding) (GLuint program, GLuint uniformBlockIndex, GLuint uniformBlockBinding);
+extern GL_APICALL void (* GL_APIENTRY glDrawArraysInstanced) (GLenum mode, GLint first, GLsizei count, GLsizei instanceCount);
+extern GL_APICALL void (* GL_APIENTRY glDrawElementsInstanced) (GLenum mode, GLsizei count, GLenum type, const GLvoid* indices, GLsizei instanceCount);
+extern GL_APICALL GLsync (* GL_APIENTRY glFenceSync) (GLenum condition, GLbitfield flags);
+extern GL_APICALL GLboolean (* GL_APIENTRY glIsSync) (GLsync sync);
+extern GL_APICALL void (* GL_APIENTRY glDeleteSync) (GLsync sync);
+extern GL_APICALL GLenum (* GL_APIENTRY glClientWaitSync) (GLsync sync, GLbitfield flags, GLuint64 timeout);
+extern GL_APICALL void (* GL_APIENTRY glWaitSync) (GLsync sync, GLbitfield flags, GLuint64 timeout);
+extern GL_APICALL void (* GL_APIENTRY glGetInteger64v) (GLenum pname, GLint64* params);
+extern GL_APICALL void (* GL_APIENTRY glGetSynciv) (GLsync sync, GLenum pname, GLsizei bufSize, GLsizei* length, GLint* values);
+extern GL_APICALL void (* GL_APIENTRY glGetInteger64i_v) (GLenum target, GLuint index, GLint64* data);
+extern GL_APICALL void (* GL_APIENTRY glGetBufferParameteri64v) (GLenum target, GLenum pname, GLint64* params);
+extern GL_APICALL void (* GL_APIENTRY glGenSamplers) (GLsizei count, GLuint* samplers);
+extern GL_APICALL void (* GL_APIENTRY glDeleteSamplers) (GLsizei count, const GLuint* samplers);
+extern GL_APICALL GLboolean (* GL_APIENTRY glIsSampler) (GLuint sampler);
+extern GL_APICALL void (* GL_APIENTRY glBindSampler) (GLuint unit, GLuint sampler);
+extern GL_APICALL void (* GL_APIENTRY glSamplerParameteri) (GLuint sampler, GLenum pname, GLint param);
+extern GL_APICALL void (* GL_APIENTRY glSamplerParameteriv) (GLuint sampler, GLenum pname, const GLint* param);
+extern GL_APICALL void (* GL_APIENTRY glSamplerParameterf) (GLuint sampler, GLenum pname, GLfloat param);
+extern GL_APICALL void (* GL_APIENTRY glSamplerParameterfv) (GLuint sampler, GLenum pname, const GLfloat* param);
+extern GL_APICALL void (* GL_APIENTRY glGetSamplerParameteriv) (GLuint sampler, GLenum pname, GLint* params);
+extern GL_APICALL void (* GL_APIENTRY glGetSamplerParameterfv) (GLuint sampler, GLenum pname, GLfloat* params);
+extern GL_APICALL void (* GL_APIENTRY glVertexAttribDivisor) (GLuint index, GLuint divisor);
+extern GL_APICALL void (* GL_APIENTRY glBindTransformFeedback) (GLenum target, GLuint id);
+extern GL_APICALL void (* GL_APIENTRY glDeleteTransformFeedbacks) (GLsizei n, const GLuint* ids);
+extern GL_APICALL void (* GL_APIENTRY glGenTransformFeedbacks) (GLsizei n, GLuint* ids);
+extern GL_APICALL GLboolean (* GL_APIENTRY glIsTransformFeedback) (GLuint id);
+extern GL_APICALL void (* GL_APIENTRY glPauseTransformFeedback) (void);
+extern GL_APICALL void (* GL_APIENTRY glResumeTransformFeedback) (void);
+extern GL_APICALL void (* GL_APIENTRY glGetProgramBinary) (GLuint program, GLsizei bufSize, GLsizei* length, GLenum* binaryFormat, GLvoid* binary);
+extern GL_APICALL void (* GL_APIENTRY glProgramBinary) (GLuint program, GLenum binaryFormat, const GLvoid* binary, GLsizei length);
+extern GL_APICALL void (* GL_APIENTRY glProgramParameteri) (GLuint program, GLenum pname, GLint value);
+extern GL_APICALL void (* GL_APIENTRY glInvalidateFramebuffer) (GLenum target, GLsizei numAttachments, const GLenum* attachments);
+extern GL_APICALL void (* GL_APIENTRY glInvalidateSubFramebuffer) (GLenum target, GLsizei numAttachments, const GLenum* attachments, GLint x, GLint y, GLsizei width, GLsizei height);
+extern GL_APICALL void (* GL_APIENTRY glTexStorage2D) (GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height);
+extern GL_APICALL void (* GL_APIENTRY glTexStorage3D) (GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth);
+extern GL_APICALL void (* GL_APIENTRY glGetInternalformativ) (GLenum target, GLenum internalformat, GLenum pname, GLsizei bufSize, GLint* params);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/base/newtype.hpp b/base/newtype.hpp
index f9306c3ae7..f17194e779 100644
--- a/base/newtype.hpp
+++ b/base/newtype.hpp
@@ -146,7 +146,7 @@ namespace newtype_default_output
template <typename Type, typename Tag>
string SimpleDebugPrint(NewType<Type, Tag> const & nt)
{
- return DebugPrint(nt.Get());
+ return ::DebugPrint(nt.Get());
}
} // namespace newtype_default_output
} // namespace my
diff --git a/base/src_point.cpp b/base/src_point.cpp
index 663054f229..4230eed080 100644
--- a/base/src_point.cpp
+++ b/base/src_point.cpp
@@ -3,14 +3,12 @@
#include <algorithm>
#include <sstream>
-
namespace my
{
-
void SrcPoint::TruncateFileName()
{
size_t const maxLen = 10000;
- char const * p[] = { m_fileName, m_fileName };
+ char const * p[] = {m_fileName, m_fileName};
for (size_t i = 0; i < maxLen && m_fileName[i]; ++i)
{
if (m_fileName[i] == '\\' || m_fileName[i] == '/')
@@ -22,9 +20,7 @@ void SrcPoint::TruncateFileName()
m_fileName = p[1];
}
-} // namespace my
-
-std::string DebugPrint(my::SrcPoint const & srcPoint)
+std::string DebugPrint(SrcPoint const & srcPoint)
{
std::ostringstream out;
if (srcPoint.Line() > 0)
@@ -32,3 +28,4 @@ std::string DebugPrint(my::SrcPoint const & srcPoint)
<< srcPoint.Postfix() << " ";
return out.str();
}
+} // namespace my
diff --git a/base/src_point.hpp b/base/src_point.hpp
index 2d46d0af56..4e990cfd73 100644
--- a/base/src_point.hpp
+++ b/base/src_point.hpp
@@ -2,65 +2,44 @@
#include <string>
-
#ifndef SRC_LOGGING
- #define SRC_LOGGING 1
+#define SRC_LOGGING 1
#endif
#if SRC_LOGGING
- #ifndef __OBJC__
- #define SRC() my::SrcPoint(__FILE__, __LINE__, __FUNCTION__, "()")
- #else
- #define SRC() my::SrcPoint(__FILE__, __LINE__, __FUNCTION__)
- #endif
+#ifndef __OBJC__
+#define SRC() my::SrcPoint(__FILE__, __LINE__, __FUNCTION__, "()")
+#else
+#define SRC() my::SrcPoint(__FILE__, __LINE__, __FUNCTION__)
+#endif
#else
- #define SRC() my::SrcPoint()
+#define SRC() my::SrcPoint()
#endif
namespace my
{
- class SrcPoint
+class SrcPoint
+{
+public:
+ SrcPoint() : m_fileName(""), m_line(-1), m_function(""), m_postfix("") { TruncateFileName(); }
+ SrcPoint(char const * fileName, int line, char const * function, char const * postfix = "")
+ : m_fileName(fileName), m_line(line), m_function(function), m_postfix(postfix)
{
- public:
- SrcPoint() : m_fileName(""), m_line(-1), m_function(""), m_postfix("")
- {
- TruncateFileName();
- }
-
- SrcPoint(char const * fileName, int line, char const * function, char const * postfix = "")
- : m_fileName(fileName), m_line(line), m_function(function), m_postfix(postfix)
- {
- TruncateFileName();
- }
-
- inline char const * FileName() const
- {
- return m_fileName;
- }
-
- inline int Line() const
- {
- return m_line;
- }
-
- inline char const * Function() const
- {
- return m_function;
- }
-
- inline char const * Postfix() const
- {
- return m_postfix;
- }
-
- private:
- void TruncateFileName();
-
- char const * m_fileName;
- int m_line;
- char const * m_function;
- char const * m_postfix;
- };
+ TruncateFileName();
+ }
+
+ inline char const * FileName() const { return m_fileName; }
+ inline int Line() const { return m_line; }
+ inline char const * Function() const { return m_function; }
+ inline char const * Postfix() const { return m_postfix; }
+private:
+ void TruncateFileName();
+
+ char const * m_fileName;
+ int m_line;
+ char const * m_function;
+ char const * m_postfix;
+};
+
+std::string DebugPrint(SrcPoint const & srcPoint);
}
-
-std::string DebugPrint(my::SrcPoint const & srcPoint);
diff --git a/drape/CMakeLists.txt b/drape/CMakeLists.txt
index bfff605500..4355682b36 100644
--- a/drape/CMakeLists.txt
+++ b/drape/CMakeLists.txt
@@ -42,6 +42,8 @@ set(
${DRAPE_ROOT}/dynamic_texture.hpp
${DRAPE_ROOT}/font_texture.cpp
${DRAPE_ROOT}/font_texture.hpp
+ ${DRAPE_ROOT}/framebuffer.cpp
+ ${DRAPE_ROOT}/framebuffer.hpp
${DRAPE_ROOT}/glconstants.cpp
${DRAPE_ROOT}/glconstants.hpp
${DRAPE_ROOT}/glextensions_list.cpp
@@ -111,6 +113,8 @@ set(
${DRAPE_ROOT}/utils/vertex_decl.hpp
${DRAPE_ROOT}/vertex_array_buffer.cpp
${DRAPE_ROOT}/vertex_array_buffer.hpp
+ ${DRAPE_ROOT}/viewport.cpp
+ ${DRAPE_ROOT}/viewport.hpp
${DRAPE_ROOT}/visual_scale.hpp
)
diff --git a/drape/data_buffer.cpp b/drape/data_buffer.cpp
index fccc4fa7f9..672741fa9d 100644
--- a/drape/data_buffer.cpp
+++ b/drape/data_buffer.cpp
@@ -3,7 +3,6 @@
namespace dp
{
-
DataBuffer::DataBuffer(uint8_t elementSize, uint32_t capacity)
: m_impl(make_unique_dp<CpuBufferImpl>(elementSize, capacity))
{
@@ -17,30 +16,31 @@ ref_ptr<DataBufferBase> DataBuffer::GetBuffer() const
void DataBuffer::MoveToGPU(GPUBuffer::Target target)
{
- // if currentSize is 0 buffer hasn't been filled on preparation stage, let it be filled further
+ // If currentSize is 0 buffer hasn't been filled on preparation stage, let it be filled further.
uint32_t const currentSize = m_impl->GetCurrentSize();
if (currentSize != 0)
- m_impl = make_unique_dp<GpuBufferImpl>(target, m_impl->Data(),m_impl->GetElementSize(), currentSize);
+ {
+ m_impl = make_unique_dp<GpuBufferImpl>(target, m_impl->Data(), m_impl->GetElementSize(),
+ currentSize);
+ }
else
- m_impl = make_unique_dp<GpuBufferImpl>(target, nullptr, m_impl->GetElementSize(), m_impl->GetAvailableSize());
+ {
+ m_impl = make_unique_dp<GpuBufferImpl>(target, nullptr, m_impl->GetElementSize(),
+ m_impl->GetAvailableSize());
+ }
}
-
-DataBufferMapper::DataBufferMapper(ref_ptr<DataBuffer> buffer)
+DataBufferMapper::DataBufferMapper(ref_ptr<DataBuffer> buffer, uint32_t elementOffset,
+ uint32_t elementCount)
: m_buffer(buffer)
{
m_buffer->GetBuffer()->Bind();
- m_ptr = m_buffer->GetBuffer()->Map();
-}
-
-DataBufferMapper::~DataBufferMapper()
-{
- m_buffer->GetBuffer()->Unmap();
+ m_ptr = m_buffer->GetBuffer()->Map(elementOffset, elementCount);
}
+DataBufferMapper::~DataBufferMapper() { m_buffer->GetBuffer()->Unmap(); }
void DataBufferMapper::UpdateData(void const * data, uint32_t elementOffset, uint32_t elementCount)
{
m_buffer->GetBuffer()->UpdateData(m_ptr, data, elementOffset, elementCount);
}
-
-}
+} // namespace dp
diff --git a/drape/data_buffer.hpp b/drape/data_buffer.hpp
index 0c82228449..15871a0326 100644
--- a/drape/data_buffer.hpp
+++ b/drape/data_buffer.hpp
@@ -1,16 +1,14 @@
#pragma once
-#include "drape/pointers.hpp"
#include "drape/gpu_buffer.hpp"
+#include "drape/pointers.hpp"
namespace dp
{
-
class DataBufferBase
{
public:
virtual ~DataBufferBase() {}
-
virtual uint32_t GetCapacity() const = 0;
virtual uint32_t GetCurrentSize() const = 0;
virtual uint32_t GetAvailableSize() const = 0;
@@ -19,14 +17,14 @@ public:
virtual void const * Data() const = 0;
virtual void UploadData(void const * data, uint32_t elementCount) = 0;
- virtual void UpdateData(void * destPtr, void const * srcPtr, uint32_t elementOffset, uint32_t elementCount) = 0;
+ virtual void UpdateData(void * destPtr, void const * srcPtr, uint32_t elementOffset,
+ uint32_t elementCount) = 0;
virtual void Bind() = 0;
- virtual void * Map() = 0;
+ virtual void * Map(uint32_t elementOffset, uint32_t elementCount) = 0;
virtual void Unmap() = 0;
};
-
class DataBuffer
{
public:
@@ -39,11 +37,10 @@ private:
drape_ptr<DataBufferBase> m_impl;
};
-
class DataBufferMapper
{
public:
- DataBufferMapper(ref_ptr<DataBuffer> buffer);
+ DataBufferMapper(ref_ptr<DataBuffer> buffer, uint32_t elementOffset, uint32_t elementCount);
~DataBufferMapper();
void UpdateData(void const * data, uint32_t elementOffset, uint32_t elementCount);
@@ -52,6 +49,4 @@ private:
ref_ptr<DataBuffer> m_buffer;
void * m_ptr;
};
-
-} // namespace dp
-
+} // namespace dp
diff --git a/drape/data_buffer_impl.hpp b/drape/data_buffer_impl.hpp
index 562e9a0913..1d46204a55 100644
--- a/drape/data_buffer_impl.hpp
+++ b/drape/data_buffer_impl.hpp
@@ -1,65 +1,40 @@
#pragma once
-#include "data_buffer.hpp"
-#include "cpu_buffer.hpp"
-#include "gpu_buffer.hpp"
+#include "drape/cpu_buffer.hpp"
+#include "drape/data_buffer.hpp"
+#include "drape/gpu_buffer.hpp"
+
#include "std/utility.hpp"
namespace dp
{
-
-/// generic implementation of data buffer
+// Generic implementation of data buffer.
template <typename TBuffer>
class DataBufferImpl : public DataBufferBase
{
public:
- template<typename... Args> DataBufferImpl(Args&&... params)
- : m_buffer(make_unique_dp<TBuffer>(forward<Args>(params)...))
- {
- }
-
- uint32_t GetCapacity() const override
- {
- return m_buffer->GetCapacity();
- }
-
- uint32_t GetCurrentSize() const override
- {
- return m_buffer->GetCurrentSize();
- }
-
- uint32_t GetAvailableSize() const override
- {
- return m_buffer->GetAvailableSize();
- }
-
- uint8_t GetElementSize() const override
- {
- return m_buffer->GetElementSize();
- }
-
- void Seek(uint32_t elementNumber) override
- {
- m_buffer->Seek(elementNumber);
- }
+ template <typename... Args>
+ DataBufferImpl(Args &&... params) : m_buffer(make_unique_dp<TBuffer>(forward<Args>(params)...))
+ {}
+ uint32_t GetCapacity() const override { return m_buffer->GetCapacity(); }
+ uint32_t GetCurrentSize() const override { return m_buffer->GetCurrentSize(); }
+ uint32_t GetAvailableSize() const override { return m_buffer->GetAvailableSize(); }
+ uint8_t GetElementSize() const override { return m_buffer->GetElementSize(); }
+ void Seek(uint32_t elementNumber) override { m_buffer->Seek(elementNumber); }
protected:
drape_ptr<TBuffer> m_buffer;
};
-/// CPU implementation of data buffer
+// CPU implementation of data buffer.
class CpuBufferImpl : public DataBufferImpl<CPUBuffer>
{
public:
- template<typename... Args> CpuBufferImpl(Args&&... params)
- : DataBufferImpl(forward<Args>(params)...)
+ template <typename... Args>
+ CpuBufferImpl(Args &&... params) : DataBufferImpl(forward<Args>(params)...)
{}
- void const * Data() const override
- {
- return m_buffer->Data();
- }
-
+ void const * Data() const override { return m_buffer->Data(); }
void UploadData(void const * data, uint32_t elementCount) override
{
m_buffer->UploadData(data, elementCount);
@@ -67,34 +42,28 @@ public:
m_buffer->Seek(newOffset);
}
- void UpdateData(void * destPtr, void const * srcPtr, uint32_t elementOffset, uint32_t elementCount) override
+ void UpdateData(void * destPtr, void const * srcPtr, uint32_t elementOffset,
+ uint32_t elementCount) override
{
ASSERT(false, ("Data updating is unavailable for CPU buffer"));
}
- void Bind() override
- {
- ASSERT(false, ("Binding is unavailable for CPU buffer"));
- }
-
- void * Map() override
+ void Bind() override { ASSERT(false, ("Binding is unavailable for CPU buffer")); }
+ void * Map(uint32_t elementOffset, uint32_t elementCount) override
{
ASSERT(false, ("Mapping is unavailable for CPU buffer"));
return nullptr;
}
- void Unmap() override
- {
- ASSERT(false, ("Unmapping is unavailable for CPU buffer"));
- }
+ void Unmap() override { ASSERT(false, ("Unmapping is unavailable for CPU buffer")); }
};
-/// GPU implementation of data buffer
+// GPU implementation of data buffer.
class GpuBufferImpl : public DataBufferImpl<GPUBuffer>
{
public:
- template<typename... Args> GpuBufferImpl(Args&&... params)
- : DataBufferImpl(forward<Args>(params)...)
+ template <typename... Args>
+ GpuBufferImpl(Args &&... params) : DataBufferImpl(forward<Args>(params)...)
{}
void const * Data() const override
@@ -108,25 +77,17 @@ public:
m_buffer->UploadData(data, elementCount);
}
- void UpdateData(void * destPtr, void const * srcPtr, uint32_t elementOffset, uint32_t elementCount) override
+ void UpdateData(void * destPtr, void const * srcPtr, uint32_t elementOffset,
+ uint32_t elementCount) override
{
m_buffer->UpdateData(destPtr, srcPtr, elementOffset, elementCount);
}
- void Bind() override
- {
- m_buffer->Bind();
- }
-
- void * Map() override
+ void Bind() override { m_buffer->Bind(); }
+ void * Map(uint32_t elementOffset, uint32_t elementCount) override
{
- return m_buffer->Map();
- }
-
- void Unmap() override
- {
- return m_buffer->Unmap();
+ return m_buffer->Map(elementOffset, elementCount);
}
+ void Unmap() override { return m_buffer->Unmap(); }
};
-
-} // namespace dp
+} // namespace dp
diff --git a/drape/drape_common.pri b/drape/drape_common.pri
index fa68b27b05..2511103f47 100644
--- a/drape/drape_common.pri
+++ b/drape/drape_common.pri
@@ -13,6 +13,7 @@ SOURCES += \
$$DRAPE_DIR/data_buffer.cpp \
$$DRAPE_DIR/debug_rect_renderer.cpp \
$$DRAPE_DIR/font_texture.cpp \
+ $$DRAPE_DIR/framebuffer.cpp \
$$DRAPE_DIR/glconstants.cpp \
$$DRAPE_DIR/glextensions_list.cpp \
$$DRAPE_DIR/glstate.cpp \
@@ -44,6 +45,7 @@ SOURCES += \
$$DRAPE_DIR/utils/projection.cpp \
$$DRAPE_DIR/utils/vertex_decl.cpp \
$$DRAPE_DIR/vertex_array_buffer.cpp \
+ $$DRAPE_DIR/viewport.cpp \
HEADERS += \
$$DRAPE_DIR/attribute_buffer_mutator.hpp \
@@ -63,6 +65,7 @@ HEADERS += \
$$DRAPE_DIR/drape_global.hpp \
$$DRAPE_DIR/dynamic_texture.hpp \
$$DRAPE_DIR/font_texture.hpp \
+ $$DRAPE_DIR/framebuffer.hpp \
$$DRAPE_DIR/glconstants.hpp \
$$DRAPE_DIR/glextensions_list.hpp \
$$DRAPE_DIR/glfunctions.hpp \
@@ -101,6 +104,7 @@ HEADERS += \
$$DRAPE_DIR/utils/projection.hpp \
$$DRAPE_DIR/utils/vertex_decl.hpp \
$$DRAPE_DIR/vertex_array_buffer.hpp \
+ $$DRAPE_DIR/viewport.hpp \
$$DRAPE_DIR/visual_scale.hpp \
iphone*{
diff --git a/drape/drape_global.hpp b/drape/drape_global.hpp
index d445f72633..d3933057d0 100644
--- a/drape/drape_global.hpp
+++ b/drape/drape_global.hpp
@@ -72,4 +72,13 @@ struct FontDecl
float m_size = 0;
bool m_isSdf = true;
};
+
+inline std::string DebugPrint(dp::ApiVersion apiVersion)
+{
+ if (apiVersion == dp::OpenGLES2)
+ return "OpenGLES2";
+ else if (apiVersion == dp::OpenGLES3)
+ return "OpenGLES3";
+ return "Unknown";
+}
} // namespace dp
diff --git a/drape/drape_tests/font_texture_tests.cpp b/drape/drape_tests/font_texture_tests.cpp
index b6b7882fd2..f4eab31fd1 100644
--- a/drape/drape_tests/font_texture_tests.cpp
+++ b/drape/drape_tests/font_texture_tests.cpp
@@ -1,6 +1,6 @@
-#include "testing/testing.hpp"
-#include "drape/drape_tests/img.hpp"
#include "drape/drape_tests/dummy_texture.hpp"
+#include "drape/drape_tests/img.hpp"
+#include "testing/testing.hpp"
#include "drape/font_texture.hpp"
#include "drape/glyph_manager.hpp"
@@ -10,8 +10,8 @@
#include "std/bind.hpp"
-#include <QtGui/QPainter>
#include <QtCore/QPoint>
+#include <QtGui/QPainter>
#include "drape/drape_tests/glmock_functions.hpp"
@@ -26,59 +26,52 @@ using namespace dp;
namespace
{
- class UploadedRender
+class UploadedRender
+{
+public:
+ UploadedRender(QPoint const & pen) : m_pen(pen) {}
+ void glMemoryToQImage(int x, int y, int w, int h, glConst f, glConst t, void const * memory)
+ {
+ TEST(f == gl_const::GLAlpha || f == gl_const::GLAlpha8 || f == gl_const::GLRed, ());
+ TEST(t == gl_const::GLUnsignedByteType, ());
+
+ uint8_t const * image = reinterpret_cast<uint8_t const *>(memory);
+
+ QPoint p(m_pen);
+ p.rx() += x;
+ m_images.push_back(qMakePair(p, CreateImage(w, h, image)));
+ m_pen.ry() += h;
+ }
+
+ void Render(QPaintDevice * device)
{
- public:
- UploadedRender(QPoint const & pen)
- : m_pen(pen)
- {
- }
-
- void glMemoryToQImage(int x, int y, int w, int h, glConst f, glConst t, void const * memory)
- {
- TEST(f == gl_const::GLAlpha || f == gl_const::GLAlpha8, ());
- TEST(t == gl_const::GLUnsignedByteType, ());
-
- uint8_t const * image = reinterpret_cast<uint8_t const *>(memory);
-
- QPoint p(m_pen);
- p.rx() += x;
- m_images.push_back(qMakePair(p, CreateImage(w, h, image)));
- m_pen.ry() += h;
- }
-
- void Render(QPaintDevice * device)
- {
- QPainter p(device);
- for (auto d : m_images)
- p.drawImage(d.first, d.second);
- }
-
- private:
- QPoint m_pen;
- QVector<QPair<QPoint, QImage> > m_images;
- };
-
- class DummyGlyphIndex : public GlyphIndex
+ QPainter p(device);
+ for (auto d : m_images)
+ p.drawImage(d.first, d.second);
+ }
+
+private:
+ QPoint m_pen;
+ QVector<QPair<QPoint, QImage>> m_images;
+};
+
+class DummyGlyphIndex : public GlyphIndex
+{
+ typedef GlyphIndex TBase;
+
+public:
+ DummyGlyphIndex(m2::PointU size, ref_ptr<GlyphManager> mng) : TBase(size, mng) {}
+ ref_ptr<Texture::ResourceInfo> MapResource(GlyphKey const & key)
{
- typedef GlyphIndex TBase;
- public:
- DummyGlyphIndex(m2::PointU size, ref_ptr<GlyphManager> mng)
- : TBase(size, mng)
- {
- }
-
- ref_ptr<Texture::ResourceInfo> MapResource(GlyphKey const & key)
- {
- bool dummy = false;
- return TBase::MapResource(key, dummy);
- }
- };
-}
+ bool dummy = false;
+ return TBase::MapResource(key, dummy);
+ }
+};
+} // namespace
UNIT_TEST(UploadingGlyphs)
{
- // This unit test creates window so can't be run in GUI-less Linux machine.
+// This unit test creates window so can't be run in GUI-less Linux machine.
#ifndef OMIM_OS_LINUX
EXPECTGL(glHasExtension(_)).Times(AnyNumber());
EXPECTGL(glBindTexture(_)).Times(AnyNumber());
@@ -96,11 +89,12 @@ UNIT_TEST(UploadingGlyphs)
GlyphManager mng(args);
DummyGlyphIndex index(m2::PointU(128, 128), make_ref(&mng));
- size_t count = 1; // invalid symbol glyph has mapped internally.
+ size_t count = 1; // invalid symbol glyph has mapped internally.
count += (index.MapResource(GlyphKey(0x58, GlyphManager::kDynamicGlyphSize)) != nullptr) ? 1 : 0;
count += (index.MapResource(GlyphKey(0x59, GlyphManager::kDynamicGlyphSize)) != nullptr) ? 1 : 0;
count += (index.MapResource(GlyphKey(0x61, GlyphManager::kDynamicGlyphSize)) != nullptr) ? 1 : 0;
- while (index.GetPendingNodesCount() < count);
+ while (index.GetPendingNodesCount() < count)
+ ;
Texture::Params p;
p.m_allocator = GetDefaultAllocator();
@@ -109,7 +103,8 @@ UNIT_TEST(UploadingGlyphs)
DummyTexture tex;
tex.Create(p);
- EXPECTGL(glTexSubImage2D(_, _, _, _, _, _, _)).WillRepeatedly(Invoke(&r, &UploadedRender::glMemoryToQImage));
+ EXPECTGL(glTexSubImage2D(_, _, _, _, _, _, _))
+ .WillRepeatedly(Invoke(&r, &UploadedRender::glMemoryToQImage));
index.UploadResources(make_ref(&tex));
count = 0;
@@ -119,9 +114,11 @@ UNIT_TEST(UploadingGlyphs)
count += (index.MapResource(GlyphKey(0x65, GlyphManager::kDynamicGlyphSize)) != nullptr) ? 1 : 0;
count += (index.MapResource(GlyphKey(0x400, GlyphManager::kDynamicGlyphSize)) != nullptr) ? 1 : 0;
count += (index.MapResource(GlyphKey(0x401, GlyphManager::kDynamicGlyphSize)) != nullptr) ? 1 : 0;
- while (index.GetPendingNodesCount() < count);
+ while (index.GetPendingNodesCount() < count)
+ ;
- EXPECTGL(glTexSubImage2D(_, _, _, _, _, _, _)).WillRepeatedly(Invoke(&r, &UploadedRender::glMemoryToQImage));
+ EXPECTGL(glTexSubImage2D(_, _, _, _, _, _, _))
+ .WillRepeatedly(Invoke(&r, &UploadedRender::glMemoryToQImage));
index.UploadResources(make_ref(&tex));
RunTestLoop("UploadingGlyphs", bind(&UploadedRender::Render, &r, _1));
diff --git a/drape/drape_tests/glfunctions.cpp b/drape/drape_tests/glfunctions.cpp
index ad78bd869b..7cc5909d3b 100644
--- a/drape/drape_tests/glfunctions.cpp
+++ b/drape/drape_tests/glfunctions.cpp
@@ -7,6 +7,8 @@
using namespace emul;
+dp::ApiVersion GLFunctions::CurrentApiVersion = dp::ApiVersion::OpenGLES2;
+
#define MOCK_CALL(f) GLMockFunctions::Instance().f;
void GLFunctions::glFlush()
@@ -270,6 +272,8 @@ void GLFunctions::glUniformValueiv(int8_t location, int32_t * v, uint32_t size)
void * GLFunctions::glMapBuffer(glConst, glConst) { return 0; }
+void * GLFunctions::glMapBufferRange(glConst, uint32_t, uint32_t, glConst) { return 0; }
+
void GLFunctions::glUnmapBuffer(glConst target) {}
void GLFunctions::glDrawElements(glConst primitive, uint32_t sizeOfIndex,
diff --git a/drape/drape_tests/memory_comparer.hpp b/drape/drape_tests/memory_comparer.hpp
index d7cdd0e003..eb6a3fbdeb 100644
--- a/drape/drape_tests/memory_comparer.hpp
+++ b/drape/drape_tests/memory_comparer.hpp
@@ -1,46 +1,36 @@
#pragma once
-#include "testing/testing.hpp"
-#include "drape/glconstants.hpp"
#include "base/logging.hpp"
+#include "drape/glconstants.hpp"
+#include "testing/testing.hpp"
-#include "std/cstring.hpp"
+#include <cstring>
namespace dp
{
-
struct MemoryComparer
{
void * m_mem;
int m_size;
- MemoryComparer(void * memory, int size)
- : m_mem(memory)
- , m_size(size)
- {
- }
-
+ MemoryComparer(void * memory, int size) : m_mem(memory), m_size(size) {}
void cmpSubBuffer(glConst /*type*/, uint32_t size, void const * data, uint32_t /*offset*/) const
{
TEST_EQUAL(size, m_size, ());
TEST_EQUAL(memcmp(m_mem, data, size), 0, ());
}
- void cmpSubImage(uint32_t /*x*/, uint32_t /*y*/, uint32_t width, uint32_t height,
- glConst layout, glConst pixelFormat, void const * data) const
+ void cmpSubImage(uint32_t /*x*/, uint32_t /*y*/, uint32_t width, uint32_t height, glConst layout,
+ glConst pixelFormat, void const * data) const
{
uint32_t channelCount = 0;
- if (layout == gl_const::GLRGBA ||
- layout == gl_const::GLRGBA8 ||
- layout == gl_const::GLRGBA4)
+ if (layout == gl_const::GLRGBA || layout == gl_const::GLRGBA8 || layout == gl_const::GLRGBA4)
channelCount = 4;
else if (layout == gl_const::GLRGB)
channelCount = 3;
- else if (layout == gl_const::GLAlpha ||
- layout == gl_const::GLAlpha8 ||
- layout == gl_const::GLLuminance ||
- layout == gl_const::GLLuminance8 ||
- layout == gl_const::GLAlphaLuminance)
+ else if (layout == gl_const::GLAlpha || layout == gl_const::GLAlpha8 ||
+ layout == gl_const::GLLuminance || layout == gl_const::GLLuminance8 ||
+ layout == gl_const::GLAlphaLuminance || layout == gl_const::GLRed)
{
channelCount = 1;
}
@@ -55,9 +45,6 @@ struct MemoryComparer
for (int i = 0; i < m_size; ++i)
TEST_EQUAL(member[i], input[i], (i));
-
- //TEST_EQUAL(memcmp(m_mem, data, m_size), 0, ());
}
};
-
-}
+} // namespace dp
diff --git a/drape_frontend/framebuffer.cpp b/drape/framebuffer.cpp
index 964bc643ea..73d79173f5 100644
--- a/drape_frontend/framebuffer.cpp
+++ b/drape/framebuffer.cpp
@@ -1,4 +1,4 @@
-#include "framebuffer.hpp"
+#include "drape/framebuffer.hpp"
#include "drape/glfunctions.hpp"
#include "drape/oglcontext.hpp"
@@ -7,16 +7,9 @@
#include "base/logging.hpp"
#include "base/string_utils.hpp"
-#include "math.h"
-
-namespace df
-{
-
-Framebuffer::~Framebuffer()
+namespace dp
{
- Destroy();
-}
-
+Framebuffer::~Framebuffer() { Destroy(); }
void Framebuffer::Destroy()
{
if (m_colorTextureId != 0)
@@ -24,11 +17,13 @@ void Framebuffer::Destroy()
GLFunctions::glDeleteTexture(m_colorTextureId);
m_colorTextureId = 0;
}
+
if (m_depthTextureId != 0)
{
GLFunctions::glDeleteTexture(m_depthTextureId);
m_depthTextureId = 0;
}
+
if (m_framebufferId != 0)
{
GLFunctions::glDeleteFramebuffer(&m_framebufferId);
@@ -36,11 +31,7 @@ void Framebuffer::Destroy()
}
}
-void Framebuffer::SetDefaultContext(dp::OGLContext * context)
-{
- m_defaultContext = context;
-}
-
+void Framebuffer::SetDefaultContext(dp::OGLContext * context) { m_defaultContext = context; }
void Framebuffer::SetSize(uint32_t width, uint32_t height)
{
ASSERT(m_defaultContext, ());
@@ -58,7 +49,8 @@ void Framebuffer::SetSize(uint32_t width, uint32_t height)
m_colorTextureId = GLFunctions::glGenTexture();
GLFunctions::glBindTexture(m_colorTextureId);
- GLFunctions::glTexImage2D(m_width, m_height, gl_const::GLRGBA, gl_const::GLUnsignedByteType, NULL);
+ GLFunctions::glTexImage2D(m_width, m_height, gl_const::GLRGBA, gl_const::GLUnsignedByteType,
+ nullptr);
GLFunctions::glTexParameter(gl_const::GLMagFilter, gl_const::GLLinear);
GLFunctions::glTexParameter(gl_const::GLMinFilter, gl_const::GLLinear);
GLFunctions::glTexParameter(gl_const::GLWrapT, gl_const::GLClampToEdge);
@@ -66,7 +58,15 @@ void Framebuffer::SetSize(uint32_t width, uint32_t height)
m_depthTextureId = GLFunctions::glGenTexture();
GLFunctions::glBindTexture(m_depthTextureId);
- GLFunctions::glTexImage2D(m_width, m_height, gl_const::GLDepthComponent, gl_const::GLUnsignedIntType, NULL);
+ GLFunctions::glTexImage2D(m_width, m_height, gl_const::GLDepthComponent,
+ gl_const::GLUnsignedIntType, nullptr);
+ if (GLFunctions::CurrentApiVersion == dp::ApiVersion::OpenGLES3)
+ {
+ GLFunctions::glTexParameter(gl_const::GLMagFilter, gl_const::GLNearest);
+ GLFunctions::glTexParameter(gl_const::GLMinFilter, gl_const::GLNearest);
+ GLFunctions::glTexParameter(gl_const::GLWrapT, gl_const::GLClampToEdge);
+ GLFunctions::glTexParameter(gl_const::GLWrapS, gl_const::GLClampToEdge);
+ }
GLFunctions::glBindTexture(0);
@@ -101,8 +101,5 @@ void Framebuffer::Disable()
m_defaultContext->setDefaultFramebuffer();
}
-uint32_t Framebuffer::GetTextureId() const
-{
- return m_colorTextureId;
-}
-} // namespace df
+uint32_t Framebuffer::GetTextureId() const { return m_colorTextureId; }
+} // namespace dp
diff --git a/drape_frontend/framebuffer.hpp b/drape/framebuffer.hpp
index 5c16c9341b..39de064799 100644
--- a/drape_frontend/framebuffer.hpp
+++ b/drape/framebuffer.hpp
@@ -1,14 +1,10 @@
#pragma once
-#include "stdint.h"
+#include <cstdint>
namespace dp
{
class OGLContext;
-}
-
-namespace df
-{
class Framebuffer
{
@@ -24,7 +20,6 @@ public:
uint32_t GetTextureId() const;
bool IsSupported() const { return m_isSupported; }
-
private:
void Destroy();
@@ -39,5 +34,4 @@ private:
bool m_isSupported = true;
};
-
-} // namespace df
+} // namespace dp
diff --git a/drape/glIncludes.hpp b/drape/glIncludes.hpp
index 5f87f1670e..b47df3e85a 100644
--- a/drape/glIncludes.hpp
+++ b/drape/glIncludes.hpp
@@ -3,9 +3,8 @@
#include "std/target_os.hpp"
#if defined(OMIM_OS_IPHONE)
- #define USE_OPENGLES20_IF_AVAILABLE 1
- #include <OpenGLES/ES2/gl.h>
#include <OpenGLES/ES2/glext.h>
+ #include <OpenGLES/ES3/gl.h>
#elif defined(OMIM_OS_MAC)
#include <OpenGL/gl.h>
#include <OpenGL/glext.h>
@@ -15,10 +14,10 @@
#include <GL/gl.h>
#include "3party/GL/glext.h"
#elif defined(OMIM_OS_ANDROID)
- #include <EGL/egl.h>
- #include <GLES2/gl2.h>
#define GL_GLEXT_PROTOTYPES
#include <GLES2/gl2ext.h>
+ #include "android/jni/com/mapswithme/opengl/gl3stub.h"
+ #include <EGL/egl.h>
#else
#define GL_GLEXT_PROTOTYPES
#include <GL/gl.h>
diff --git a/drape/glconstants.cpp b/drape/glconstants.cpp
index e934c7be71..0c3c0f5724 100644
--- a/drape/glconstants.cpp
+++ b/drape/glconstants.cpp
@@ -25,6 +25,14 @@
#define GL_LUMINANCE8_ALPHA4_OES 0x8043
#endif
+#if !defined(GL_LUMINANCE)
+ #define GL_LUMINANCE 0x1909
+#endif
+
+#if !defined(GL_LUMINANCE_ALPHA)
+ #define GL_LUMINANCE_ALPHA 0x190A
+#endif
+
#if defined(GL_WRITE_ONLY)
#define WRITE_ONLY_DEF GL_WRITE_ONLY
#elif defined(GL_WRITE_ONLY_OES)
@@ -125,6 +133,7 @@ const glConst GLAlpha8 = GL_ALPHA8_OES;
const glConst GLLuminance8 = GL_LUMINANCE8_OES;
const glConst GLAlphaLuminance8 = GL_LUMINANCE8_ALPHA8_OES;
const glConst GLAlphaLuminance4 = GL_LUMINANCE8_ALPHA4_OES;
+const glConst GLRed = GL_RED;
const glConst GL8BitOnChannel = GL_UNSIGNED_BYTE;
const glConst GL4BitOnChannel = GL_UNSIGNED_SHORT_4_4_4_4;
diff --git a/drape/glconstants.hpp b/drape/glconstants.hpp
index 1dccc60bb8..c67c181fa9 100644
--- a/drape/glconstants.hpp
+++ b/drape/glconstants.hpp
@@ -62,6 +62,7 @@ extern const glConst GLAlpha8;
extern const glConst GLLuminance8;
extern const glConst GLAlphaLuminance8;
extern const glConst GLAlphaLuminance4;
+extern const glConst GLRed;
/// Pixel type for texture upload
extern const glConst GL8BitOnChannel;
diff --git a/drape/glextensions_list.cpp b/drape/glextensions_list.cpp
index b9647ebefd..69647f4fa5 100644
--- a/drape/glextensions_list.cpp
+++ b/drape/glextensions_list.cpp
@@ -3,121 +3,87 @@
#include "base/assert.hpp"
-#include "std/string.hpp"
+#include "std/target_os.hpp"
namespace dp
{
-
-#ifdef DEBUG
- #include "std/map.hpp"
-
- class GLExtensionsList::Impl
+GLExtensionsList::GLExtensionsList(dp::ApiVersion apiVersion)
+{
+#if defined(OMIM_OS_MOBILE)
+ CheckExtension(TextureNPOT, "GL_OES_texture_npot");
+ if (apiVersion == dp::ApiVersion::OpenGLES2)
{
- public:
- void CheckExtension(GLExtensionsList::ExtensionName const & enumName, const string & extName)
- {
#ifdef OMIM_OS_ANDROID
- if (enumName == GLExtensionsList::VertexArrayObject)
- m_supportedMap[enumName] = false;
- else
-#endif
- m_supportedMap[enumName] = GLFunctions::glHasExtension(extName);
- }
-
- void SetExtension(GLExtensionsList::ExtensionName const & enumName, bool isSupported)
- {
- m_supportedMap[enumName] = isSupported;
- }
-
- bool IsSupported(GLExtensionsList::ExtensionName const & enumName) const
- {
- map<GLExtensionsList::ExtensionName, bool>::const_iterator it = m_supportedMap.find(enumName);
- if (it != m_supportedMap.end())
- return it->second;
-
- ASSERT(false, ("Not all used extensions is checked"));
- return false;
- }
-
- private:
- map<GLExtensionsList::ExtensionName, bool> m_supportedMap;
- };
+ SetExtension(VertexArrayObject, false);
#else
- #include "std/set.hpp"
-
- class GLExtensionsList::Impl
- {
- public:
- void CheckExtension(GLExtensionsList::ExtensionName const & enumName, const string & extName)
- {
-#ifdef OMIM_OS_ANDROID
- if (enumName == GLExtensionsList::VertexArrayObject)
- return;
-#endif
- if (GLFunctions::glHasExtension(extName))
- m_supported.insert(enumName);
- }
-
- void SetExtension(GLExtensionsList::ExtensionName const & enumName, bool isSupported)
- {
- if (isSupported)
- m_supported.insert(enumName);
- }
-
- bool IsSupported(GLExtensionsList::ExtensionName const & enumName) const
- {
- if (m_supported.find(enumName) != m_supported.end())
- return true;
-
- return false;
- }
-
- private:
- set<GLExtensionsList::ExtensionName> m_supported;
- };
+ CheckExtension(VertexArrayObject, "GL_OES_vertex_array_object");
#endif
-
-GLExtensionsList::GLExtensionsList()
- : m_impl(new Impl())
-{
-#if defined(OMIM_OS_MOBILE)
- m_impl->CheckExtension(VertexArrayObject, "GL_OES_vertex_array_object");
- m_impl->CheckExtension(RequiredInternalFormat, "GL_OES_required_internalformat");
- m_impl->CheckExtension(TextureNPOT, "GL_OES_texture_npot");
- m_impl->CheckExtension(MapBuffer, "GL_OES_mapbuffer");
- m_impl->CheckExtension(UintIndices, "GL_OES_element_index_uint");
- m_impl->CheckExtension(MapBufferRange, "GL_EXT_map_buffer_range");
+ CheckExtension(MapBuffer, "GL_OES_mapbuffer");
+ CheckExtension(UintIndices, "GL_OES_element_index_uint");
+ CheckExtension(MapBufferRange, "GL_EXT_map_buffer_range");
+ }
+ else
+ {
+ SetExtension(VertexArrayObject, true);
+ SetExtension(MapBuffer, true);
+ SetExtension(MapBufferRange, true);
+ SetExtension(UintIndices, true);
+ }
#elif defined(OMIM_OS_WINDOWS)
m_impl->CheckExtension(TextureNPOT, "GL_ARB_texture_non_power_of_two");
- m_impl->SetExtension(VertexArrayObject, false);
- m_impl->SetExtension(RequiredInternalFormat, false);
- m_impl->SetExtension(MapBuffer, true);
- m_impl->SetExtension(MapBufferRange, false);
- m_impl->SetExtension(UintIndices, true);
+ SetExtension(MapBuffer, true);
+ SetExtension(UintIndices, true);
+ if (apiVersion == dp::ApiVersion::OpenGLES2)
+ {
+ SetExtension(VertexArrayObject, false);
+ SetExtension(MapBufferRange, false);
+ }
+ else
+ {
+ SetExtension(VertexArrayObject, true);
+ SetExtension(MapBufferRange, true);
+ }
#else
- m_impl->CheckExtension(VertexArrayObject, "GL_APPLE_vertex_array_object");
- m_impl->CheckExtension(TextureNPOT, "GL_ARB_texture_non_power_of_two");
- m_impl->SetExtension(RequiredInternalFormat, false);
- m_impl->SetExtension(MapBuffer, true);
- m_impl->SetExtension(MapBufferRange, false);
- m_impl->SetExtension(UintIndices, true);
+ CheckExtension(TextureNPOT, "GL_ARB_texture_non_power_of_two");
+ SetExtension(MapBuffer, true);
+ SetExtension(UintIndices, true);
+ if (apiVersion == dp::ApiVersion::OpenGLES2)
+ {
+ CheckExtension(VertexArrayObject, "GL_APPLE_vertex_array_object");
+ SetExtension(MapBufferRange, false);
+ }
+ else
+ {
+ SetExtension(VertexArrayObject, true);
+ SetExtension(MapBufferRange, true);
+ }
#endif
}
-GLExtensionsList::~GLExtensionsList()
+// static
+GLExtensionsList & GLExtensionsList::Instance()
{
- delete m_impl;
+ static GLExtensionsList extList(GLFunctions::CurrentApiVersion);
+ return extList;
}
-GLExtensionsList & GLExtensionsList::Instance()
+bool GLExtensionsList::IsSupported(ExtensionName extName) const
{
- static GLExtensionsList extList;
- return extList;
+ auto const it = m_supportedMap.find(extName);
+ if (it != m_supportedMap.end())
+ return it->second;
+
+ ASSERT(false, ("Not all used extensions are checked"));
+ return false;
}
-bool GLExtensionsList::IsSupported(ExtensionName const & extName) const
+void GLExtensionsList::CheckExtension(ExtensionName enumName, std::string const & extName)
{
- return m_impl->IsSupported(extName);
+ m_supportedMap[enumName] = GLFunctions::glHasExtension(extName);
}
-} // namespace dp
+void GLExtensionsList::SetExtension(ExtensionName enumName, bool isSupported)
+{
+ m_supportedMap[enumName] = isSupported;
+}
+} // namespace dp
diff --git a/drape/glextensions_list.hpp b/drape/glextensions_list.hpp
index d5ffc143ed..507c10ec52 100644
--- a/drape/glextensions_list.hpp
+++ b/drape/glextensions_list.hpp
@@ -1,33 +1,37 @@
#pragma once
-#include "std/noncopyable.hpp"
+#include "drape/drape_global.hpp"
+
+#include "base/macros.hpp"
+
+#include <map>
+#include <string>
namespace dp
{
-
-class GLExtensionsList : private noncopyable
+class GLExtensionsList
{
public:
enum ExtensionName
{
VertexArrayObject,
TextureNPOT,
- RequiredInternalFormat,
MapBuffer,
UintIndices,
MapBufferRange
};
static GLExtensionsList & Instance();
- bool IsSupported(ExtensionName const & extName) const;
-private:
- GLExtensionsList();
- ~GLExtensionsList();
+ bool IsSupported(ExtensionName extName) const;
private:
- class Impl;
- Impl * m_impl;
-};
+ GLExtensionsList(dp::ApiVersion apiVersion);
+ void CheckExtension(ExtensionName enumName, std::string const & extName);
+ void SetExtension(ExtensionName enumName, bool isSupported);
+
+ std::map<ExtensionName, bool> m_supportedMap;
-} // namespace dp
+ DISALLOW_COPY_AND_MOVE(GLExtensionsList);
+};
+} // namespace dp
diff --git a/drape/glfunctions.cpp b/drape/glfunctions.cpp
index 15887ac76b..0a272d6056 100644
--- a/drape/glfunctions.cpp
+++ b/drape/glfunctions.cpp
@@ -8,13 +8,10 @@
#include "base/mutex.hpp"
#include "base/string_utils.hpp"
-#ifdef DEBUG
-#include "base/thread.hpp"
-#endif
-
-#include "std/algorithm.hpp"
-#include "std/map.hpp"
-#include "std/utility.hpp"
+#include <algorithm>
+#include <map>
+#include <mutex>
+#include <utility>
#if defined(OMIM_OS_WINDOWS)
#define DP_APIENTRY __stdcall
@@ -22,87 +19,103 @@
#define DP_APIENTRY
#endif
+// static
+dp::ApiVersion GLFunctions::CurrentApiVersion = dp::ApiVersion::OpenGLES2;
+
namespace
{
#ifdef DEBUG
- typedef pair<threads::ThreadID, glConst> TKey;
- typedef pair<TKey, uint32_t> TNode;
- typedef map<TKey, uint32_t> TBoundMap;
- TBoundMap g_boundBuffers;
- threads::Mutex g_mutex;
+using NodeKey = std::pair<std::thread::id, glConst>;
+using Node = std::pair<NodeKey, uint32_t>;
+using BoundMap = std::map<NodeKey, uint32_t>;
+BoundMap g_boundBuffers;
+std::mutex g_boundBuffersMutex;
#endif
-inline GLboolean convert(bool v)
-{
- return (v == true) ? GL_TRUE : GL_FALSE;
-}
-
-typedef void (DP_APIENTRY *TglClearColorFn)(GLfloat r, GLfloat g, GLfloat b, GLfloat a);
-typedef void (DP_APIENTRY *TglClearFn)(GLbitfield mask);
-typedef void (DP_APIENTRY *TglViewportFn)(GLint x, GLint y, GLsizei w, GLsizei h);
-typedef void (DP_APIENTRY *TglScissorFn)(GLint x, GLint y, GLsizei w, GLsizei h);
-typedef void (DP_APIENTRY *TglFlushFn)();
-
-typedef void (DP_APIENTRY *TglActiveTextureFn)(GLenum texture);
-typedef void (DP_APIENTRY *TglBlendEquationFn)(GLenum mode);
-
-typedef void (DP_APIENTRY *TglGenVertexArraysFn)(GLsizei n, GLuint * ids);
-typedef void (DP_APIENTRY *TglBindVertexArrayFn)(GLuint id);
-typedef void (DP_APIENTRY *TglDeleteVertexArrayFn)(GLsizei n, GLuint const * ids);
-
-typedef void (DP_APIENTRY *TglGetBufferParameterFn)(GLenum target, GLenum value, GLint * data);
-typedef void (DP_APIENTRY *TglGenBuffersFn)(GLsizei n, GLuint * buffers);
-typedef void (DP_APIENTRY *TglBindBufferFn)(GLenum target, GLuint buffer);
-typedef void (DP_APIENTRY *TglDeleteBuffersFn)(GLsizei n, GLuint const * buffers);
-typedef void (DP_APIENTRY *TglBufferDataFn)(GLenum target, GLsizeiptr size, GLvoid const * data, GLenum usage);
-typedef void (DP_APIENTRY *TglBufferSubDataFn)(GLenum target, GLintptr offset, GLsizeiptr size, GLvoid const * data);
-typedef void * (DP_APIENTRY *TglMapBufferFn)(GLenum target, GLenum access);
-typedef GLboolean(DP_APIENTRY *TglUnmapBufferFn)(GLenum target);
-typedef void * (DP_APIENTRY *TglMapBufferRangeFn)(GLenum target, GLintptr offset, GLsizeiptr length, GLbitfield access);
-typedef void (DP_APIENTRY *TglFlushMappedBufferRangeFn)(GLenum target, GLintptr offset, GLsizeiptr length);
-
-typedef GLuint(DP_APIENTRY *TglCreateShaderFn)(GLenum type);
-typedef void (DP_APIENTRY *TglShaderSourceFn)(GLuint shaderID, GLsizei count, GLchar const ** string, GLint const * length);
-typedef void (DP_APIENTRY *TglCompileShaderFn)(GLuint shaderID);
-typedef void (DP_APIENTRY *TglDeleteShaderFn)(GLuint shaderID);
-typedef void (DP_APIENTRY *TglGetShaderivFn)(GLuint shaderID, GLenum name, GLint * p);
-typedef void (DP_APIENTRY *TglGetShaderInfoLogFn)(GLuint shaderID, GLsizei maxLength, GLsizei * length, GLchar * infoLog);
-
-typedef GLuint(DP_APIENTRY *TglCreateProgramFn)();
-typedef void (DP_APIENTRY *TglAttachShaderFn)(GLuint programID, GLuint shaderID);
-typedef void (DP_APIENTRY *TglDetachShaderFn)(GLuint programID, GLuint shaderID);
-typedef void (DP_APIENTRY *TglLinkProgramFn)(GLuint programID);
-typedef void (DP_APIENTRY *TglDeleteProgramFn)(GLuint programID);
-typedef void (DP_APIENTRY *TglGetProgramivFn)(GLuint programID, GLenum name, GLint * p);
-typedef void (DP_APIENTRY *TglGetProgramInfoLogFn)(GLuint programID, GLsizei maxLength, GLsizei * length, GLchar * infoLog);
-
-typedef void (DP_APIENTRY *TglUseProgramFn)(GLuint programID);
-typedef GLint (DP_APIENTRY *TglGetAttribLocationFn)(GLuint program, GLchar const * name);
-typedef void (DP_APIENTRY *TglBindAttribLocationFn)(GLuint program, GLuint index, GLchar const * name);
-
-typedef void (DP_APIENTRY *TglEnableVertexAttributeFn)(GLuint location);
-typedef void (DP_APIENTRY *TglVertexAttributePointerFn)(GLuint index, GLint count, GLenum type, GLboolean normalize,
- GLsizei stride, GLvoid const * p);
-typedef GLint(DP_APIENTRY *TglGetUniformLocationFn)(GLuint programID, GLchar const * name);
-typedef void (DP_APIENTRY *TglGetActiveUniformFn)(GLuint programID, GLuint uniformIndex, GLsizei bufSize, GLsizei * length,
- GLint * size, GLenum * type, GLchar * name);
-typedef void (DP_APIENTRY *TglUniform1iFn)(GLint location, GLint value);
-typedef void (DP_APIENTRY *TglUniform2iFn)(GLint location, GLint v1, GLint v2);
-typedef void (DP_APIENTRY *TglUniform3iFn)(GLint location, GLint v1, GLint v2, GLint v3);
-typedef void (DP_APIENTRY *TglUniform4iFn)(GLint location, GLint v1, GLint v2, GLint v3, GLint v4);
-typedef void (DP_APIENTRY *TglUniform1ivFn)(GLint location, GLsizei count, GLint const * value);
-typedef void (DP_APIENTRY *TglUniform1fFn)(GLint location, GLfloat value);
-typedef void (DP_APIENTRY *TglUniform2fFn)(GLint location, GLfloat v1, GLfloat v2);
-typedef void (DP_APIENTRY *TglUniform3fFn)(GLint location, GLfloat v1, GLfloat v2, GLfloat v3);
-typedef void (DP_APIENTRY *TglUniform4fFn)(GLint location, GLfloat v1, GLfloat v2, GLfloat v3, GLfloat v4);
-typedef void (DP_APIENTRY *TglUniform1fvFn)(GLint location, GLsizei count, GLfloat const * value);
-typedef void (DP_APIENTRY *TglUniformMatrix4fvFn)(GLint location, GLsizei count, GLboolean transpose, GLfloat const * value);
-
-typedef void (DP_APIENTRY *TglGenFramebuffersFn)(GLsizei n, GLuint * framebuffers);
-typedef void (DP_APIENTRY *TglDeleteFramebuffersFn)(GLsizei n, GLuint const * framebuffers);
-typedef void (DP_APIENTRY *TglBindFramebufferFn)(GLenum target, GLuint id);
-typedef void (DP_APIENTRY *TglFramebufferTexture2DFn)(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level);
-typedef GLenum(DP_APIENTRY *TglCheckFramebufferStatusFn)(GLenum target);
+inline GLboolean convert(bool v) { return static_cast<GLboolean>(v ? GL_TRUE : GL_FALSE); }
+
+typedef void(DP_APIENTRY * TglClearColorFn)(GLfloat r, GLfloat g, GLfloat b, GLfloat a);
+typedef void(DP_APIENTRY * TglClearFn)(GLbitfield mask);
+typedef void(DP_APIENTRY * TglViewportFn)(GLint x, GLint y, GLsizei w, GLsizei h);
+typedef void(DP_APIENTRY * TglScissorFn)(GLint x, GLint y, GLsizei w, GLsizei h);
+typedef void(DP_APIENTRY * TglFlushFn)();
+
+typedef void(DP_APIENTRY * TglActiveTextureFn)(GLenum texture);
+typedef void(DP_APIENTRY * TglBlendEquationFn)(GLenum mode);
+
+typedef void(DP_APIENTRY * TglGenVertexArraysFn)(GLsizei n, GLuint * ids);
+typedef void(DP_APIENTRY * TglBindVertexArrayFn)(GLuint id);
+typedef void(DP_APIENTRY * TglDeleteVertexArrayFn)(GLsizei n, GLuint const * ids);
+
+typedef void(DP_APIENTRY * TglGetBufferParameterFn)(GLenum target, GLenum value, GLint * data);
+typedef void(DP_APIENTRY * TglGenBuffersFn)(GLsizei n, GLuint * buffers);
+typedef void(DP_APIENTRY * TglBindBufferFn)(GLenum target, GLuint buffer);
+typedef void(DP_APIENTRY * TglDeleteBuffersFn)(GLsizei n, GLuint const * buffers);
+typedef void(DP_APIENTRY * TglBufferDataFn)(GLenum target, GLsizeiptr size, GLvoid const * data,
+ GLenum usage);
+typedef void(DP_APIENTRY * TglBufferSubDataFn)(GLenum target, GLintptr offset, GLsizeiptr size,
+ GLvoid const * data);
+typedef void *(DP_APIENTRY * TglMapBufferFn)(GLenum target, GLenum access);
+typedef GLboolean(DP_APIENTRY * TglUnmapBufferFn)(GLenum target);
+typedef void *(DP_APIENTRY * TglMapBufferRangeFn)(GLenum target, GLintptr offset, GLsizeiptr length,
+ GLbitfield access);
+typedef void(DP_APIENTRY * TglFlushMappedBufferRangeFn)(GLenum target, GLintptr offset,
+ GLsizeiptr length);
+
+typedef GLuint(DP_APIENTRY * TglCreateShaderFn)(GLenum type);
+typedef void(DP_APIENTRY * TglShaderSourceFn)(GLuint shaderID, GLsizei count,
+ GLchar const ** string, GLint const * length);
+typedef void(DP_APIENTRY * TglCompileShaderFn)(GLuint shaderID);
+typedef void(DP_APIENTRY * TglDeleteShaderFn)(GLuint shaderID);
+typedef void(DP_APIENTRY * TglGetShaderivFn)(GLuint shaderID, GLenum name, GLint * p);
+typedef void(DP_APIENTRY * TglGetShaderInfoLogFn)(GLuint shaderID, GLsizei maxLength,
+ GLsizei * length, GLchar * infoLog);
+
+typedef GLuint(DP_APIENTRY * TglCreateProgramFn)();
+typedef void(DP_APIENTRY * TglAttachShaderFn)(GLuint programID, GLuint shaderID);
+typedef void(DP_APIENTRY * TglDetachShaderFn)(GLuint programID, GLuint shaderID);
+typedef void(DP_APIENTRY * TglLinkProgramFn)(GLuint programID);
+typedef void(DP_APIENTRY * TglDeleteProgramFn)(GLuint programID);
+typedef void(DP_APIENTRY * TglGetProgramivFn)(GLuint programID, GLenum name, GLint * p);
+typedef void(DP_APIENTRY * TglGetProgramInfoLogFn)(GLuint programID, GLsizei maxLength,
+ GLsizei * length, GLchar * infoLog);
+
+typedef void(DP_APIENTRY * TglUseProgramFn)(GLuint programID);
+typedef GLint(DP_APIENTRY * TglGetAttribLocationFn)(GLuint program, GLchar const * name);
+typedef void(DP_APIENTRY * TglBindAttribLocationFn)(GLuint program, GLuint index,
+ GLchar const * name);
+
+typedef void(DP_APIENTRY * TglEnableVertexAttributeFn)(GLuint location);
+typedef void(DP_APIENTRY * TglVertexAttributePointerFn)(GLuint index, GLint count, GLenum type,
+ GLboolean normalize, GLsizei stride,
+ GLvoid const * p);
+typedef GLint(DP_APIENTRY * TglGetUniformLocationFn)(GLuint programID, GLchar const * name);
+typedef void(DP_APIENTRY * TglGetActiveUniformFn)(GLuint programID, GLuint uniformIndex,
+ GLsizei bufSize, GLsizei * length, GLint * size,
+ GLenum * type, GLchar * name);
+typedef void(DP_APIENTRY * TglUniform1iFn)(GLint location, GLint value);
+typedef void(DP_APIENTRY * TglUniform2iFn)(GLint location, GLint v1, GLint v2);
+typedef void(DP_APIENTRY * TglUniform3iFn)(GLint location, GLint v1, GLint v2, GLint v3);
+typedef void(DP_APIENTRY * TglUniform4iFn)(GLint location, GLint v1, GLint v2, GLint v3, GLint v4);
+typedef void(DP_APIENTRY * TglUniform1ivFn)(GLint location, GLsizei count, GLint const * value);
+typedef void(DP_APIENTRY * TglUniform1fFn)(GLint location, GLfloat value);
+typedef void(DP_APIENTRY * TglUniform2fFn)(GLint location, GLfloat v1, GLfloat v2);
+typedef void(DP_APIENTRY * TglUniform3fFn)(GLint location, GLfloat v1, GLfloat v2, GLfloat v3);
+typedef void(DP_APIENTRY * TglUniform4fFn)(GLint location, GLfloat v1, GLfloat v2, GLfloat v3,
+ GLfloat v4);
+typedef void(DP_APIENTRY * TglUniform1fvFn)(GLint location, GLsizei count, GLfloat const * value);
+typedef void(DP_APIENTRY * TglUniformMatrix4fvFn)(GLint location, GLsizei count,
+ GLboolean transpose, GLfloat const * value);
+
+typedef void(DP_APIENTRY * TglGenFramebuffersFn)(GLsizei n, GLuint * framebuffers);
+typedef void(DP_APIENTRY * TglDeleteFramebuffersFn)(GLsizei n, GLuint const * framebuffers);
+typedef void(DP_APIENTRY * TglBindFramebufferFn)(GLenum target, GLuint id);
+typedef void(DP_APIENTRY * TglFramebufferTexture2DFn)(GLenum target, GLenum attachment,
+ GLenum textarget, GLuint texture,
+ GLint level);
+typedef GLenum(DP_APIENTRY * TglCheckFramebufferStatusFn)(GLenum target);
+
+typedef GLubyte const * (DP_APIENTRY * TglGetStringiFn) (GLenum name, GLuint index);
TglClearColorFn glClearColorFn = nullptr;
TglClearFn glClearFn = nullptr;
@@ -173,184 +186,19 @@ TglBindFramebufferFn glBindFramebufferFn = nullptr;
TglFramebufferTexture2DFn glFramebufferTexture2DFn = nullptr;
TglCheckFramebufferStatusFn glCheckFramebufferStatusFn = nullptr;
-int const GLCompileStatus = GL_COMPILE_STATUS;
-int const GLLinkStatus = GL_LINK_STATUS;
-
-threads::Mutex s_mutex;
-bool s_inited = false;
-
-class GLFunctionsCache
-{
-public:
- GLFunctionsCache() = default;
-
- void SetThread(thread::id const & threadId)
- {
- m_threadId = threadId;
-
- m_glBindTextureCache = CachedParam<uint32_t>();
- m_glActiveTextureCache = CachedParam<glConst>();
- m_glUseProgramCache = CachedParam<uint32_t>();
- m_glLineWidthCache = CachedParam<uint32_t>();
- m_glStateCache.clear();
- m_uniformsCache.clear();
- }
-
- void glBindTexture(uint32_t textureID)
- {
- if (!IsCachedThread() || m_glBindTextureCache.Assign(textureID))
- GLCHECK(::glBindTexture(GL_TEXTURE_2D, textureID));
- }
-
- void glActiveTexture(glConst texBlock)
- {
- if (!IsCachedThread() || m_glActiveTextureCache.Assign(texBlock))
- {
- ASSERT(glActiveTextureFn != nullptr, ());
- GLCHECK(glActiveTextureFn(texBlock));
- }
- }
+TglGetStringiFn glGetStringiFn = nullptr;
- void glUseProgram(uint32_t programID)
- {
- if (!IsCachedThread() || m_glUseProgramCache.Assign(programID))
- {
- ASSERT(glUseProgramFn != nullptr, ());
- GLCHECK(glUseProgramFn(programID));
- }
- }
-
- void glEnable(glConst mode)
- {
- if (!IsCachedThread() || m_glStateCache[mode].Assign(true))
- GLCHECK(::glEnable(mode));
- }
-
- void glDisable(glConst mode)
- {
- if (!IsCachedThread() || m_glStateCache[mode].Assign(false))
- GLCHECK(::glDisable(mode));
- }
-
- void glUniformValuei(int8_t location, int32_t v)
- {
- if (!IsCachedThread() || GetCacheForCurrentProgram().Assign(location, v))
- {
- ASSERT(glUniform1iFn != nullptr, ());
- ASSERT(location != -1, ());
- GLCHECK(glUniform1iFn(location, v));
- }
- }
-
- void glUniformValuef(int8_t location, float v)
- {
- if (!IsCachedThread() || GetCacheForCurrentProgram().Assign(location, v))
- {
- ASSERT(glUniform1fFn != nullptr, ());
- ASSERT(location != -1, ());
- GLCHECK(glUniform1fFn(location, v));
- }
- }
-
- void glLineWidth(uint32_t value)
- {
- if (!IsCachedThread() || m_glLineWidthCache.Assign(value))
- {
- GLCHECK(::glLineWidth(static_cast<float>(value)));
- }
- }
-
-private:
-
- template<typename TValue>
- struct CachedParam
- {
- TValue m_value;
- bool m_inited;
-
- CachedParam()
- : m_value(TValue())
- , m_inited(false)
- {
- }
-
- explicit CachedParam(TValue const & value)
- : m_value(value)
- , m_inited(true)
- {
- }
-
- bool Assign(TValue const & newValue)
- {
- if (m_inited && newValue == m_value)
- return false;
-
- m_value = newValue;
- m_inited = true;
- return true;
- }
-
- bool operator!=(TValue const & value) const
- {
- return m_value != value;
- }
-
- CachedParam & operator=(TValue const & param)
- {
- m_value = param;
- m_inited = true;
- return *this;
- }
- };
-
- template<typename TValue> using UniformCache = map<int8_t, CachedParam<TValue>>;
- using StateParams = map<glConst, CachedParam<bool>>;
-
- struct UniformsCache
- {
- UniformCache<int32_t> m_glUniform1iCache;
- UniformCache<float> m_glUniform1fCache;
-
- bool Assign(int8_t location, int32_t value) { return Assign(location, value, m_glUniform1iCache); }
- bool Assign(int8_t location, float value) { return Assign(location, value, m_glUniform1fCache); }
-
- template<typename TValue>
- bool Assign(int8_t location, TValue const & value, UniformCache<TValue> & cache)
- {
- return cache[location].Assign(value);
- }
- };
-
- GLFunctionsCache::UniformsCache & GetCacheForCurrentProgram()
- {
- ASSERT(m_glUseProgramCache.m_inited, ());
- return m_uniformsCache[m_glUseProgramCache.m_value];
- }
-
- bool IsCachedThread() const
- {
- return this_thread::get_id() == m_threadId;
- }
-
- CachedParam<uint32_t> m_glBindTextureCache;
- CachedParam<glConst> m_glActiveTextureCache;
- CachedParam<uint32_t> m_glUseProgramCache;
- StateParams m_glStateCache;
- CachedParam<uint32_t> m_glLineWidthCache;
-
- map<uint32_t, UniformsCache> m_uniformsCache;
-
- thread::id m_threadId;
-};
-
-GLFunctionsCache s_cache;
+#if !defined(GL_NUM_EXTENSIONS)
+ #define GL_NUM_EXTENSIONS 0x821D
+#endif
-} // namespace
+std::mutex s_mutex;
+bool s_inited = false;
+} // namespace
#ifdef OMIM_OS_WINDOWS
-
template <typename TFunc>
-TFunc LoadExtension(string const & ext)
+TFunc LoadExtension(std::string const & ext)
{
TFunc func = reinterpret_cast<TFunc>(wglGetProcAddress(ext.c_str()));
if (func == nullptr)
@@ -361,21 +209,21 @@ TFunc LoadExtension(string const & ext)
return func;
}
-
- #define LOAD_GL_FUNC(type, func) LoadExtension<type>(#func);
+#define LOAD_GL_FUNC(type, func) LoadExtension<type>(#func);
#else
- #define LOAD_GL_FUNC(type, func) &::func
+#define LOAD_GL_FUNC(type, func) static_cast<type>(&::func)
#endif
-
-void GLFunctions::Init()
+void GLFunctions::Init(dp::ApiVersion apiVersion)
{
- threads::MutexGuard g(s_mutex);
+ std::lock_guard<std::mutex> lock(s_mutex);
if (s_inited)
return;
+ CurrentApiVersion = apiVersion;
s_inited = true;
- /// VAO
+
+/// VAO
#if defined(OMIM_OS_MAC)
glGenVertexArraysFn = &glGenVertexArraysAPPLE;
glBindVertexArrayFn = &glBindVertexArrayAPPLE;
@@ -386,24 +234,59 @@ void GLFunctions::Init()
glGenVertexArraysFn = &::glGenVertexArrays;
glBindVertexArrayFn = &::glBindVertexArray;
glDeleteVertexArrayFn = &::glDeleteVertexArrays;
- glMapBufferFn = &::glMapBuffer; // I don't know correct name for linux!
- glUnmapBufferFn = &::glUnmapBuffer; // I don't know correct name for linux!
+ glMapBufferFn = &::glMapBuffer;
+ glUnmapBufferFn = &::glUnmapBuffer;
#elif defined(OMIM_OS_ANDROID)
- glGenVertexArraysFn = (TglGenVertexArraysFn)eglGetProcAddress("glGenVertexArraysOES");
- glBindVertexArrayFn = (TglBindVertexArrayFn)eglGetProcAddress("glBindVertexArrayOES");
- glDeleteVertexArrayFn = (TglDeleteVertexArrayFn)eglGetProcAddress("glDeleteVertexArraysOES");
- glMapBufferFn = &::glMapBufferOES;
- glUnmapBufferFn = &::glUnmapBufferOES;
- glMapBufferRangeFn = (TglMapBufferRangeFn)eglGetProcAddress("glMapBufferRangeEXT");
- glFlushMappedBufferRangeFn = (TglFlushMappedBufferRangeFn)eglGetProcAddress("glFlushMappedBufferRangeEXT");
+ if (CurrentApiVersion == dp::ApiVersion::OpenGLES2)
+ {
+ glGenVertexArraysFn = (TglGenVertexArraysFn)eglGetProcAddress("glGenVertexArraysOES");
+ glBindVertexArrayFn = (TglBindVertexArrayFn)eglGetProcAddress("glBindVertexArrayOES");
+ glDeleteVertexArrayFn = (TglDeleteVertexArrayFn)eglGetProcAddress("glDeleteVertexArraysOES");
+ glMapBufferFn = &::glMapBufferOES;
+ glUnmapBufferFn = &::glUnmapBufferOES;
+ glMapBufferRangeFn = (TglMapBufferRangeFn)eglGetProcAddress("glMapBufferRangeEXT");
+ glFlushMappedBufferRangeFn =
+ (TglFlushMappedBufferRangeFn)eglGetProcAddress("glFlushMappedBufferRangeEXT");
+ }
+ else if (CurrentApiVersion == dp::ApiVersion::OpenGLES3)
+ {
+ glGenVertexArraysFn = ::glGenVertexArrays;
+ glBindVertexArrayFn = ::glBindVertexArray;
+ glDeleteVertexArrayFn = ::glDeleteVertexArrays;
+ glUnmapBufferFn = ::glUnmapBuffer;
+ glMapBufferRangeFn = ::glMapBufferRange;
+ glFlushMappedBufferRangeFn = ::glFlushMappedBufferRange;
+ glGetStringiFn = ::glGetStringi;
+ }
+ else
+ {
+ ASSERT(false, ("Unknown Graphics API"));
+ }
#elif defined(OMIM_OS_MOBILE)
- glGenVertexArraysFn = &glGenVertexArraysOES;
- glBindVertexArrayFn = &glBindVertexArrayOES;
- glDeleteVertexArrayFn = &glDeleteVertexArraysOES;
- glMapBufferFn = &::glMapBufferOES;
- glUnmapBufferFn = &::glUnmapBufferOES;
- glMapBufferRangeFn = &::glMapBufferRangeEXT;
- glFlushMappedBufferRangeFn = &::glFlushMappedBufferRangeEXT;
+ if (CurrentApiVersion == dp::ApiVersion::OpenGLES2)
+ {
+ glGenVertexArraysFn = &glGenVertexArraysOES;
+ glBindVertexArrayFn = &glBindVertexArrayOES;
+ glDeleteVertexArrayFn = &glDeleteVertexArraysOES;
+ glMapBufferFn = &::glMapBufferOES;
+ glUnmapBufferFn = &::glUnmapBufferOES;
+ glMapBufferRangeFn = &::glMapBufferRangeEXT;
+ glFlushMappedBufferRangeFn = &::glFlushMappedBufferRangeEXT;
+ }
+ else if (CurrentApiVersion == dp::ApiVersion::OpenGLES3)
+ {
+ glGenVertexArraysFn = &::glGenVertexArrays;
+ glBindVertexArrayFn = &::glBindVertexArray;
+ glDeleteVertexArrayFn = &::glDeleteVertexArrays;
+ glUnmapBufferFn = &::glUnmapBuffer;
+ glMapBufferRangeFn = &::glMapBufferRange;
+ glFlushMappedBufferRangeFn = &::glFlushMappedBufferRange;
+ glGetStringiFn = &::glGetStringi;
+ }
+ else
+ {
+ ASSERT(false, ("Unknown Graphics API"));
+ }
#elif defined(OMIM_OS_WINDOWS)
if (dp::GLExtensionsList::Instance().IsSupported(dp::GLExtensionsList::VertexArrayObject))
{
@@ -411,16 +294,15 @@ void GLFunctions::Init()
glBindVertexArrayFn = LOAD_GL_FUNC(TglBindVertexArrayFn, glBindVertexArray);
glDeleteVertexArrayFn = LOAD_GL_FUNC(TglDeleteVertexArrayFn, glDeleteVertexArrays);
}
-
glMapBufferFn = LOAD_GL_FUNC(TglMapBufferFn, glMapBuffer);
glUnmapBufferFn = LOAD_GL_FUNC(TglUnmapBufferFn, glUnmapBuffer);
#endif
- glClearColorFn = &::glClearColor;
- glClearFn = &::glClear;
- glViewportFn = &::glViewport;
- glScissorFn = &::glScissor;
- glFlushFn = &::glFlush;
+ glClearColorFn = LOAD_GL_FUNC(TglClearColorFn, glClearColor);
+ glClearFn = LOAD_GL_FUNC(TglClearFn, glClear);
+ glViewportFn = LOAD_GL_FUNC(TglViewportFn, glViewport);
+ glScissorFn = LOAD_GL_FUNC(TglScissorFn, glScissor);
+ glFlushFn = LOAD_GL_FUNC(TglFlushFn, glFlush);
glActiveTextureFn = LOAD_GL_FUNC(TglActiveTextureFn, glActiveTexture);
glBlendEquationFn = LOAD_GL_FUNC(TglBlendEquationFn, glBlendEquation);
@@ -438,7 +320,8 @@ void GLFunctions::Init()
#ifdef OMIM_OS_WINDOWS
glShaderSourceFn = LOAD_GL_FUNC(TglShaderSourceFn, glShaderSource);
#else
- typedef void (DP_APIENTRY *glShaderSource_Type)(GLuint shaderID, GLsizei count, GLchar const ** string, GLint const * length);
+ typedef void(DP_APIENTRY * glShaderSource_Type)(GLuint shaderID, GLsizei count,
+ GLchar const ** string, GLint const * length);
glShaderSourceFn = reinterpret_cast<glShaderSource_Type>(&::glShaderSource);
#endif
glCompileShaderFn = LOAD_GL_FUNC(TglCompileShaderFn, glCompileShader);
@@ -485,29 +368,39 @@ void GLFunctions::Init()
glCheckFramebufferStatusFn = LOAD_GL_FUNC(TglCheckFramebufferStatusFn, glCheckFramebufferStatus);
}
-void GLFunctions::AttachCache(thread::id const & threadId)
-{
- s_cache.SetThread(threadId);
-}
-
-bool GLFunctions::glHasExtension(string const & name)
+bool GLFunctions::glHasExtension(std::string const & name)
{
- char const * extensions = reinterpret_cast<char const * >(::glGetString(GL_EXTENSIONS));
- GLCHECKCALL();
- if (extensions == nullptr)
- return false;
-
- char const * extName = name.c_str();
- char const * ptr = nullptr;
- while ((ptr = strstr(extensions, extName)) != nullptr)
+ if (CurrentApiVersion == dp::ApiVersion::OpenGLES2)
{
- char const * end = ptr + strlen(extName);
- if (isspace(*end) || *end == '\0')
+ char const * extensions = reinterpret_cast<char const *>(::glGetString(GL_EXTENSIONS));
+ GLCHECKCALL();
+ if (extensions == nullptr)
+ return false;
+
+ char const * extName = name.c_str();
+ char const * ptr = nullptr;
+ while ((ptr = strstr(extensions, extName)) != nullptr)
+ {
+ char const * end = ptr + strlen(extName);
+ if (isspace(*end) || *end == '\0')
return true;
- extensions = end;
+ extensions = end;
+ }
+ }
+ else if (CurrentApiVersion == dp::ApiVersion::OpenGLES3)
+ {
+ ASSERT(glGetStringiFn != nullptr, ());
+ GLint n = 0;
+ glGetIntegerv(GL_NUM_EXTENSIONS, &n);
+ for (GLint i = 0; i < n; i++)
+ {
+ std::string const extension =
+ std::string(reinterpret_cast<char const *>(glGetStringiFn(GL_EXTENSIONS, i)));
+ if (extension == name)
+ return true;
+ }
}
-
return false;
}
@@ -547,21 +440,9 @@ void GLFunctions::glFlush()
GLCHECK(glFlushFn());
}
-void GLFunctions::glFinish()
-{
- GLCHECK(::glFinish());
-}
-
-void GLFunctions::glFrontFace(glConst mode)
-{
- GLCHECK(::glFrontFace(mode));
-}
-
-void GLFunctions::glCullFace(glConst face)
-{
- GLCHECK(::glCullFace(face));
-}
-
+void GLFunctions::glFinish() { GLCHECK(::glFinish()); }
+void GLFunctions::glFrontFace(glConst mode) { GLCHECK(::glFrontFace(mode)); }
+void GLFunctions::glCullFace(glConst face) { GLCHECK(::glCullFace(face)); }
void GLFunctions::glPixelStore(glConst name, uint32_t value)
{
GLCHECK(::glPixelStorei(name, value));
@@ -574,21 +455,21 @@ int32_t GLFunctions::glGetInteger(glConst pname)
return (int32_t)value;
}
-string GLFunctions::glGetString(glConst pname)
+std::string GLFunctions::glGetString(glConst pname)
{
- char const * str = reinterpret_cast<char const * >(::glGetString(pname));
+ char const * str = reinterpret_cast<char const *>(::glGetString(pname));
GLCHECKCALL();
if (str == nullptr)
return "";
- return string(str);
+ return std::string(str);
}
int32_t GLFunctions::glGetMaxLineWidth()
{
GLint range[2];
GLCHECK(::glGetIntegerv(GL_ALIASED_LINE_WIDTH_RANGE, range));
- return max(range[0], range[1]);
+ return std::max(range[0], range[1]);
}
int32_t GLFunctions::glGetBufferParameter(glConst target, glConst name)
@@ -601,12 +482,12 @@ int32_t GLFunctions::glGetBufferParameter(glConst target, glConst name)
void GLFunctions::glEnable(glConst mode)
{
- s_cache.glEnable(mode);
+ GLCHECK(::glEnable(mode));
}
void GLFunctions::glDisable(glConst mode)
{
- s_cache.glDisable(mode);
+ GLCHECK(::glDisable(mode));
}
void GLFunctions::glClearDepthValue(double depth)
@@ -623,11 +504,7 @@ void GLFunctions::glDepthMask(bool needWriteToDepthBuffer)
GLCHECK(::glDepthMask(convert(needWriteToDepthBuffer)));
}
-void GLFunctions::glDepthFunc(glConst depthFunc)
-{
- GLCHECK(::glDepthFunc(depthFunc));
-}
-
+void GLFunctions::glDepthFunc(glConst depthFunc) { GLCHECK(::glDepthFunc(depthFunc)); }
void GLFunctions::glBlendEquation(glConst function)
{
ASSERT(glBlendEquationFn != nullptr, ());
@@ -671,8 +548,8 @@ void GLFunctions::glBindBuffer(uint32_t vbo, uint32_t target)
{
ASSERT(glBindBufferFn != nullptr, ());
#ifdef DEBUG
- threads::MutexGuard guard(g_mutex);
- g_boundBuffers[make_pair(threads::GetCurrentThreadID(), target)] = vbo;
+ std::lock_guard<std::mutex> guard(g_boundBuffersMutex);
+ g_boundBuffers[std::make_pair(std::this_thread::get_id(), target)] = vbo;
#endif
GLCHECK(glBindBufferFn(target, vbo));
}
@@ -681,11 +558,9 @@ void GLFunctions::glDeleteBuffer(uint32_t vbo)
{
ASSERT(glDeleteBuffersFn != nullptr, ());
#ifdef DEBUG
- threads::MutexGuard guard(g_mutex);
- for (TNode const & n : g_boundBuffers)
- {
+ std::lock_guard<std::mutex> guard(g_boundBuffersMutex);
+ for (auto const & n : g_boundBuffers)
ASSERT(n.second != vbo, ());
- }
#endif
GLCHECK(glDeleteBuffersFn(1, &vbo));
}
@@ -717,7 +592,8 @@ void GLFunctions::glUnmapBuffer(glConst target)
GLCHECKCALL();
}
-void * GLFunctions::glMapBufferRange(glConst target, uint32_t offset, uint32_t length, glConst access)
+void * GLFunctions::glMapBufferRange(glConst target, uint32_t offset, uint32_t length,
+ glConst access)
{
ASSERT(glMapBufferRangeFn != nullptr, ());
void * result = glMapBufferRangeFn(target, offset, length, access);
@@ -739,24 +615,29 @@ uint32_t GLFunctions::glCreateShader(glConst type)
return result;
}
-void GLFunctions::glShaderSource(uint32_t shaderID, string const & src, string const & defines)
+void GLFunctions::glShaderSource(uint32_t shaderID, std::string const & src, std::string const & defines)
{
ASSERT(glShaderSourceFn != nullptr, ());
- GLchar const * source[2] =
+
+ std::string fullSrc;
+ if (src.find("#version") != std::string::npos)
{
- defines.c_str(),
- src.c_str()
- };
-
- GLint lengths[2] =
+ auto pos = src.find('\n');
+ ASSERT_NOT_EQUAL(pos, std::string::npos, ());
+ fullSrc = src;
+ fullSrc.insert(pos + 1, defines);
+ }
+ else
{
- static_cast<GLint>(defines.size()),
- static_cast<GLint>(src.size())
- };
- GLCHECK(glShaderSourceFn(shaderID, 2, source, lengths));
+ fullSrc = defines + src;
+ }
+
+ GLchar const * source[1] = {fullSrc.c_str()};
+ GLint lengths[1] = {static_cast<GLint>(fullSrc.size())};
+ GLCHECK(glShaderSourceFn(shaderID, 1, source, lengths));
}
-bool GLFunctions::glCompileShader(uint32_t shaderID, string &errorLog)
+bool GLFunctions::glCompileShader(uint32_t shaderID, std::string & errorLog)
{
ASSERT(glCompileShaderFn != nullptr, ());
ASSERT(glGetShaderivFn != nullptr, ());
@@ -764,14 +645,14 @@ bool GLFunctions::glCompileShader(uint32_t shaderID, string &errorLog)
GLCHECK(glCompileShaderFn(shaderID));
GLint result = GL_FALSE;
- GLCHECK(glGetShaderivFn(shaderID, GLCompileStatus, &result));
+ GLCHECK(glGetShaderivFn(shaderID, GL_COMPILE_STATUS, &result));
if (result == GL_TRUE)
return true;
GLchar buf[1024];
GLint length = 0;
GLCHECK(glGetShaderInfoLogFn(shaderID, 1024, &length, buf));
- errorLog = string(buf, length);
+ errorLog = std::string(buf, static_cast<size_t>(length));
return false;
}
@@ -801,7 +682,7 @@ void GLFunctions::glDetachShader(uint32_t programID, uint32_t shaderID)
GLCHECK(glDetachShaderFn(programID, shaderID));
}
-bool GLFunctions::glLinkProgram(uint32_t programID, string & errorLog)
+bool GLFunctions::glLinkProgram(uint32_t programID, std::string & errorLog)
{
ASSERT(glLinkProgramFn != nullptr, ());
ASSERT(glGetProgramivFn != nullptr, ());
@@ -809,7 +690,7 @@ bool GLFunctions::glLinkProgram(uint32_t programID, string & errorLog)
GLCHECK(glLinkProgramFn(programID));
GLint result = GL_FALSE;
- GLCHECK(glGetProgramivFn(programID, GLLinkStatus, &result));
+ GLCHECK(glGetProgramivFn(programID, GL_LINK_STATUS, &result));
if (result == GL_TRUE)
return true;
@@ -817,7 +698,7 @@ bool GLFunctions::glLinkProgram(uint32_t programID, string & errorLog)
GLchar buf[1024];
GLint length = 0;
GLCHECK(glGetProgramInfoLogFn(programID, 1024, &length, buf));
- errorLog = string(buf, length);
+ errorLog = std::string(buf, static_cast<size_t>(length));
return false;
}
@@ -829,19 +710,20 @@ void GLFunctions::glDeleteProgram(uint32_t programID)
void GLFunctions::glUseProgram(uint32_t programID)
{
- s_cache.glUseProgram(programID);
+ ASSERT(glUseProgramFn != nullptr, ());
+ GLCHECK(glUseProgramFn(programID));
}
-int8_t GLFunctions::glGetAttribLocation(uint32_t programID, string const & name)
+int8_t GLFunctions::glGetAttribLocation(uint32_t programID, std::string const & name)
{
ASSERT(glGetAttribLocationFn != nullptr, ());
int result = glGetAttribLocationFn(programID, name.c_str());
GLCHECKCALL();
ASSERT(result != -1, ());
- return result;
+ return static_cast<int8_t>(result);
}
-void GLFunctions::glBindAttribLocation(uint32_t programID, uint8_t index, string const & name)
+void GLFunctions::glBindAttribLocation(uint32_t programID, uint8_t index, std::string const & name)
{
ASSERT(glBindAttribLocationFn != nullptr, ());
GLCHECK(glBindAttribLocationFn(programID, index, name.c_str()));
@@ -853,43 +735,38 @@ void GLFunctions::glEnableVertexAttribute(int attributeLocation)
GLCHECK(glEnableVertexAttributeFn(attributeLocation));
}
-void GLFunctions::glVertexAttributePointer(int attrLocation,
- uint32_t count,
- glConst type,
- bool needNormalize,
- uint32_t stride,
- uint32_t offset)
+void GLFunctions::glVertexAttributePointer(int attrLocation, uint32_t count, glConst type,
+ bool needNormalize, uint32_t stride, uint32_t offset)
{
ASSERT(glVertexAttributePointerFn != nullptr, ());
- GLCHECK(glVertexAttributePointerFn(attrLocation,
- count,
- type,
- convert(needNormalize),
- stride,
+ GLCHECK(glVertexAttributePointerFn(attrLocation, count, type, convert(needNormalize), stride,
reinterpret_cast<void *>(offset)));
}
void GLFunctions::glGetActiveUniform(uint32_t programID, uint32_t uniformIndex,
- int32_t * uniformSize, glConst * type, string & name)
+ int32_t * uniformSize, glConst * type, std::string & name)
{
ASSERT(glGetActiveUniformFn != nullptr, ());
GLchar buff[256];
- GLCHECK(glGetActiveUniformFn(programID, uniformIndex, ARRAY_SIZE(buff), nullptr, uniformSize, type, buff));
+ GLCHECK(glGetActiveUniformFn(programID, uniformIndex, ARRAY_SIZE(buff), nullptr, uniformSize,
+ type, buff));
name = buff;
}
-int8_t GLFunctions::glGetUniformLocation(uint32_t programID, string const & name)
+int8_t GLFunctions::glGetUniformLocation(uint32_t programID, std::string const & name)
{
ASSERT(glGetUniformLocationFn != nullptr, ());
int result = glGetUniformLocationFn(programID, name.c_str());
GLCHECKCALL();
ASSERT(result != -1, ());
- return result;
+ return static_cast<int8_t>(result);
}
void GLFunctions::glUniformValuei(int8_t location, int32_t v)
{
- s_cache.glUniformValuei(location, v);
+ ASSERT(glUniform1iFn != nullptr, ());
+ ASSERT(location != -1, ());
+ GLCHECK(glUniform1iFn(location, v));
}
void GLFunctions::glUniformValuei(int8_t location, int32_t v1, int32_t v2)
@@ -922,7 +799,9 @@ void GLFunctions::glUniformValueiv(int8_t location, int32_t * v, uint32_t size)
void GLFunctions::glUniformValuef(int8_t location, float v)
{
- s_cache.glUniformValuef(location, v);
+ ASSERT(glUniform1fFn != nullptr, ());
+ ASSERT(location != -1, ());
+ GLCHECK(glUniform1fFn(location, v));
}
void GLFunctions::glUniformValuef(int8_t location, float v1, float v2)
@@ -953,7 +832,7 @@ void GLFunctions::glUniformValuefv(int8_t location, float * v, uint32_t size)
GLCHECK(glUniform1fvFn(location, size, v));
}
-void GLFunctions::glUniformMatrix4x4Value(int8_t location, float const * values)
+void GLFunctions::glUniformMatrix4x4Value(int8_t location, float const * values)
{
ASSERT(glUniformMatrix4fvFn != nullptr, ());
ASSERT(location != -1, ());
@@ -964,7 +843,8 @@ uint32_t GLFunctions::glGetCurrentProgram()
{
GLint programIndex = 0;
GLCHECK(glGetIntegerv(GL_CURRENT_PROGRAM, &programIndex));
- return programIndex;
+ ASSERT_GREATER_OR_EQUAL(programIndex, 0, ());
+ return static_cast<uint32_t>(programIndex);
}
int32_t GLFunctions::glGetProgramiv(uint32_t program, glConst paramName)
@@ -977,7 +857,8 @@ int32_t GLFunctions::glGetProgramiv(uint32_t program, glConst paramName)
void GLFunctions::glActiveTexture(glConst texBlock)
{
- s_cache.glActiveTexture(texBlock);
+ ASSERT(glActiveTextureFn != nullptr, ());
+ GLCHECK(glActiveTextureFn(texBlock));
}
uint32_t GLFunctions::glGenTexture()
@@ -994,15 +875,39 @@ void GLFunctions::glDeleteTexture(uint32_t id)
void GLFunctions::glBindTexture(uint32_t textureID)
{
- s_cache.glBindTexture(textureID);
+ GLCHECK(::glBindTexture(GL_TEXTURE_2D, textureID));
}
-void GLFunctions::glTexImage2D(int width, int height, glConst layout, glConst pixelType, void const * data)
+void GLFunctions::glTexImage2D(int width, int height, glConst layout, glConst pixelType,
+ void const * data)
{
- GLCHECK(::glTexImage2D(GL_TEXTURE_2D, 0, layout, width, height, 0, layout, pixelType, data));
+ // In OpenGL ES3:
+ // - we can't create unsized GL_RED texture, so we use GL_R8;
+ // - we can't create unsized GL_DEPTH_COMPONENT texture, so we use GL_DEPTH_COMPONENT16
+ // or GL_DEPTH_COMPONENT24 or GL_DEPTH_COMPONENT32F.
+ glConst internalFormat = layout;
+ if (CurrentApiVersion == dp::ApiVersion::OpenGLES3)
+ {
+ if (layout == gl_const::GLRed)
+ {
+ internalFormat = GL_R8;
+ }
+ else if (layout == gl_const::GLDepthComponent)
+ {
+ internalFormat = GL_DEPTH_COMPONENT16;
+ if (pixelType == gl_const::GLUnsignedIntType)
+ internalFormat = GL_DEPTH_COMPONENT24;
+ else if (pixelType == gl_const::GLFloatType)
+ internalFormat = GL_DEPTH_COMPONENT32F;
+ }
+ }
+
+ GLCHECK(
+ ::glTexImage2D(GL_TEXTURE_2D, 0, internalFormat, width, height, 0, layout, pixelType, data));
}
-void GLFunctions::glTexSubImage2D(int x, int y, int width, int height, glConst layout, glConst pixelType, void const * data)
+void GLFunctions::glTexSubImage2D(int x, int y, int width, int height, glConst layout,
+ glConst pixelType, void const * data)
{
GLCHECK(::glTexSubImage2D(GL_TEXTURE_2D, 0, x, y, width, height, layout, pixelType, data));
}
@@ -1012,9 +917,11 @@ void GLFunctions::glTexParameter(glConst param, glConst value)
GLCHECK(::glTexParameteri(GL_TEXTURE_2D, param, value));
}
-void GLFunctions::glDrawElements(glConst primitive, uint32_t sizeOfIndex, uint32_t indexCount, uint32_t startIndex)
+void GLFunctions::glDrawElements(glConst primitive, uint32_t sizeOfIndex, uint32_t indexCount,
+ uint32_t startIndex)
{
- GLCHECK(::glDrawElements(primitive, indexCount, sizeOfIndex == sizeof(uint32_t) ? GL_UNSIGNED_INT : GL_UNSIGNED_SHORT,
+ GLCHECK(::glDrawElements(primitive, indexCount,
+ sizeOfIndex == sizeof(uint32_t) ? GL_UNSIGNED_INT : GL_UNSIGNED_SHORT,
reinterpret_cast<GLvoid *>(startIndex * sizeOfIndex)));
}
@@ -1057,25 +964,23 @@ uint32_t GLFunctions::glCheckFramebufferStatus()
void GLFunctions::glLineWidth(uint32_t value)
{
- s_cache.glLineWidth(value);
+ GLCHECK(::glLineWidth(static_cast<float>(value)));
}
namespace
{
-
-string GetGLError(GLenum error)
+std::string GetGLError(GLenum error)
{
switch (error)
{
- case GL_INVALID_ENUM: return "GL_INVALID_ENUM";
- case GL_INVALID_VALUE: return "GL_INVALID_VALUE";
- case GL_INVALID_OPERATION: return "GL_INVALID_OPERATION";
- case GL_OUT_OF_MEMORY: return "GL_OUT_OF_MEMORY";
- default: return strings::to_string(error);
+ case GL_INVALID_ENUM: return "GL_INVALID_ENUM";
+ case GL_INVALID_VALUE: return "GL_INVALID_VALUE";
+ case GL_INVALID_OPERATION: return "GL_INVALID_OPERATION";
+ case GL_OUT_OF_MEMORY: return "GL_OUT_OF_MEMORY";
+ default: return strings::to_string(error);
}
}
-
-} // namespace
+} // namespace
void CheckGLError(my::SrcPoint const & srcPoint)
{
diff --git a/drape/glfunctions.hpp b/drape/glfunctions.hpp
index dab34efe89..4c3e87c4d5 100644
--- a/drape/glfunctions.hpp
+++ b/drape/glfunctions.hpp
@@ -1,25 +1,23 @@
#pragma once
+#include "drape/drape_global.hpp"
#include "drape/glconstants.hpp"
#include "base/src_point.hpp"
-#include "std/string.hpp"
-#include "std/thread.hpp"
+#include <string>
+#include <thread>
class GLFunctions
{
friend class GLFunctionsCache;
public:
- static void Init();
+ static dp::ApiVersion CurrentApiVersion;
- /// Attaches cache of gl-functions to specified thread. The only cache
- /// is available, so invoking of this method on other thread leads to
- /// disabling of current cache and enabling another
- static void AttachCache(thread::id const & threadId);
+ static void Init(dp::ApiVersion apiVersion);
- static bool glHasExtension(string const & name);
+ static bool glHasExtension(std::string const & name);
static void glClearColor(float r, float g, float b, float a);
static void glClear();
static void glClearDepth();
@@ -38,7 +36,7 @@ public:
/// name = { gl_const::GLBufferSize, gl_const::GLBufferUsage }
static int32_t glGetBufferParameter(glConst target, glConst name);
- static string glGetString(glConst pname);
+ static std::string glGetString(glConst pname);
static int32_t glGetMaxLineWidth();
@@ -74,41 +72,40 @@ public:
/// Shaders support
static uint32_t glCreateShader(glConst type);
- static void glShaderSource(uint32_t shaderID, string const & src, string const & defines);
- static bool glCompileShader(uint32_t shaderID, string & errorLog);
+ static void glShaderSource(uint32_t shaderID, std::string const & src,
+ std::string const & defines);
+ static bool glCompileShader(uint32_t shaderID, std::string & errorLog);
static void glDeleteShader(uint32_t shaderID);
static uint32_t glCreateProgram();
static void glAttachShader(uint32_t programID, uint32_t shaderID);
static void glDetachShader(uint32_t programID, uint32_t shaderID);
- static bool glLinkProgram(uint32_t programID, string & errorLog);
+ static bool glLinkProgram(uint32_t programID, std::string & errorLog);
static void glDeleteProgram(uint32_t programID);
static void glUseProgram(uint32_t programID);
- static int8_t glGetAttribLocation(uint32_t programID, string const & name);
- static void glBindAttribLocation(uint32_t programID, uint8_t index, string const & name);
+ static int8_t glGetAttribLocation(uint32_t programID, std::string const & name);
+ static void glBindAttribLocation(uint32_t programID, uint8_t index, std::string const & name);
/// enable vertex attribute binding. To get attributeLocation need to call glGetAttributeLocation
static void glEnableVertexAttribute(int32_t attributeLocation);
/// Configure vertex attribute binding.
/// attrLocation - attribute location in shader program
/// count - specify number of components with "type" for generic attribute
- /// needNormalize - if "true" then OGL will map integer value on [-1 : 1] for signed of on [0 : 1] for unsigned
+ /// needNormalize - if "true" then OGL will map integer value on [-1 : 1] for signed of on [0 : 1]
+ /// for unsigned
/// if "false" it will direct convert to float type
/// if "type" == GLFloat this parameter have no sense
/// stride - how much bytes need to seek from current attribute value to get the second value
- /// offset - how much bytes need to seek from begin of currenct buffer to get first attribute value
- static void glVertexAttributePointer(int32_t attrLocation,
- uint32_t count,
- glConst type,
- bool needNormalize,
- uint32_t stride,
- uint32_t offset);
-
- static void glGetActiveUniform(uint32_t programID, uint32_t uniformIndex,
- int32_t * uniformSize, glConst * type, string & name);
-
- static int8_t glGetUniformLocation(uint32_t programID, string const & name);
+ /// offset - how much bytes need to seek from begin of currenct buffer to get first attribute
+ /// value
+ static void glVertexAttributePointer(int32_t attrLocation, uint32_t count, glConst type,
+ bool needNormalize, uint32_t stride, uint32_t offset);
+
+ static void glGetActiveUniform(uint32_t programID, uint32_t uniformIndex, int32_t * uniformSize,
+ glConst * type, std::string & name);
+
+ static int8_t glGetUniformLocation(uint32_t programID, std::string const & name);
static void glUniformValuei(int8_t location, int32_t v);
static void glUniformValuei(int8_t location, int32_t v1, int32_t v2);
static void glUniformValuei(int8_t location, int32_t v1, int32_t v2, int32_t v3);
@@ -121,7 +118,7 @@ public:
static void glUniformValuef(int8_t location, float v1, float v2, float v3, float v4);
static void glUniformValuefv(int8_t location, float * v, uint32_t size);
- static void glUniformMatrix4x4Value(int8_t location, float const *values);
+ static void glUniformMatrix4x4Value(int8_t location, float const * values);
static uint32_t glGetCurrentProgram();
@@ -132,12 +129,15 @@ public:
static uint32_t glGenTexture();
static void glDeleteTexture(uint32_t id);
static void glBindTexture(uint32_t textureID);
- static void glTexImage2D(int width, int height, glConst layout, glConst pixelType, void const * data);
- static void glTexSubImage2D(int x, int y, int width, int height, glConst layout, glConst pixelType, void const * data);
+ static void glTexImage2D(int width, int height, glConst layout, glConst pixelType,
+ void const * data);
+ static void glTexSubImage2D(int x, int y, int width, int height, glConst layout,
+ glConst pixelType, void const * data);
static void glTexParameter(glConst param, glConst value);
// Draw support
- static void glDrawElements(glConst primitive, uint32_t sizeOfIndex, uint32_t indexCount, uint32_t startIndex = 0);
+ static void glDrawElements(glConst primitive, uint32_t sizeOfIndex, uint32_t indexCount,
+ uint32_t startIndex = 0);
static void glDrawArrays(glConst mode, int32_t first, uint32_t count);
// FBO support
@@ -148,12 +148,12 @@ public:
static uint32_t glCheckFramebufferStatus();
};
-void CheckGLError(my::SrcPoint const &src);
+void CheckGLError(my::SrcPoint const & src);
#ifdef DEBUG
- #define GLCHECK(x) do { (x); CheckGLError(SRC()); } while (false)
- #define GLCHECKCALL() do { CheckGLError(SRC()); } while (false)
+#define GLCHECK(x) do { (x); CheckGLError(SRC()); } while (false)
+#define GLCHECKCALL() do { CheckGLError(SRC()); } while (false)
#else
- #define GLCHECK(x) (x)
- #define GLCHECKCALL()
+#define GLCHECK(x) (x)
+#define GLCHECKCALL()
#endif
diff --git a/drape/gpu_buffer.cpp b/drape/gpu_buffer.cpp
index 5d91dc06f2..12afc9109c 100644
--- a/drape/gpu_buffer.cpp
+++ b/drape/gpu_buffer.cpp
@@ -1,24 +1,23 @@
#include "drape/gpu_buffer.hpp"
-#include "drape/glfunctions.hpp"
#include "drape/glextensions_list.hpp"
+#include "drape/glfunctions.hpp"
#include "drape/utils/gpu_mem_tracker.hpp"
#include "base/assert.hpp"
-#include "std/cstring.hpp"
+#include <cstring>
//#define CHECK_VBO_BOUNDS
namespace dp
{
-
namespace
{
- bool IsMapBufferSupported()
- {
- static bool const isSupported = GLExtensionsList::Instance().IsSupported(GLExtensionsList::MapBuffer);
- return isSupported;
- }
+bool IsMapBufferSupported()
+{
+ static bool const isSupported =
+ GLExtensionsList::Instance().IsSupported(GLExtensionsList::MapBuffer);
+ return isSupported;
}
glConst glTarget(GPUBuffer::Target t)
@@ -28,10 +27,12 @@ glConst glTarget(GPUBuffer::Target t)
return gl_const::GLElementArrayBuffer;
}
+} // namespace
GPUBuffer::GPUBuffer(Target t, void const * data, uint8_t elementSize, uint32_t capacity)
: TBase(elementSize, capacity)
, m_t(t)
+ , m_mappingOffset(0)
#ifdef DEBUG
, m_isMapped(false)
#endif
@@ -51,20 +52,22 @@ GPUBuffer::~GPUBuffer()
void GPUBuffer::UploadData(void const * data, uint32_t elementCount)
{
- ASSERT(m_isMapped == false, ());
+ ASSERT(!m_isMapped, ());
uint32_t currentSize = GetCurrentSize();
uint8_t elementSize = GetElementSize();
- ASSERT(GetCapacity() >= elementCount + currentSize, ("Not enough memory to upload ", elementCount, " elements"));
+ ASSERT(GetCapacity() >= elementCount + currentSize,
+ ("Not enough memory to upload ", elementCount, " elements"));
Bind();
#if defined(CHECK_VBO_BOUNDS)
int32_t size = GLFunctions::glGetBufferParameter(glTarget(m_t), gl_const::GLBufferSize);
ASSERT_EQUAL(GetCapacity() * elementSize, size, ());
- ASSERT_LESS_OR_EQUAL((elementCount + currentSize) * elementSize, size,());
+ ASSERT_LESS_OR_EQUAL((elementCount + currentSize) * elementSize, size, ());
#endif
- GLFunctions::glBufferSubData(glTarget(m_t), elementCount * elementSize, data, currentSize * elementSize);
+ GLFunctions::glBufferSubData(glTarget(m_t), elementCount * elementSize, data,
+ currentSize * elementSize);
TBase::UploadData(elementCount);
#if defined(TRACK_GPU_MEM)
@@ -72,46 +75,55 @@ void GPUBuffer::UploadData(void const * data, uint32_t elementCount)
#endif
}
-void GPUBuffer::Bind()
-{
- GLFunctions::glBindBuffer(m_bufferID, glTarget(m_t));
-}
-
-void * GPUBuffer::Map()
+void GPUBuffer::Bind() { GLFunctions::glBindBuffer(m_bufferID, glTarget(m_t)); }
+void * GPUBuffer::Map(uint32_t elementOffset, uint32_t elementCount)
{
#ifdef DEBUG
- ASSERT(m_isMapped == false, ());
+ ASSERT(!m_isMapped, ());
m_isMapped = true;
#endif
- if (IsMapBufferSupported())
- return GLFunctions::glMapBuffer(glTarget(m_t));
-
- return NULL;
+ if (GLFunctions::CurrentApiVersion == dp::ApiVersion::OpenGLES2)
+ {
+ m_mappingOffset = elementOffset;
+ return IsMapBufferSupported() ? GLFunctions::glMapBuffer(glTarget(m_t)) : nullptr;
+ }
+ else if (GLFunctions::CurrentApiVersion == dp::ApiVersion::OpenGLES3)
+ {
+ ASSERT(IsMapBufferSupported(), ());
+ m_mappingOffset = 0;
+ uint32_t const elementSize = GetElementSize();
+ uint32_t const byteOffset = elementOffset * elementSize;
+ uint32_t const byteCount = elementCount * elementSize;
+ return GLFunctions::glMapBufferRange(glTarget(m_t), byteOffset, byteCount,
+ gl_const::GLWriteBufferBit);
+ }
+ return nullptr;
}
-void GPUBuffer::UpdateData(void * gpuPtr, void const * data, uint32_t elementOffset, uint32_t elementCount)
+void GPUBuffer::UpdateData(void * gpuPtr, void const * data, uint32_t elementOffset,
+ uint32_t elementCount)
{
uint32_t const elementSize = GetElementSize();
- uint32_t const byteOffset = elementOffset * elementSize;
+ uint32_t const byteOffset = (elementOffset + m_mappingOffset) * elementSize;
uint32_t const byteCount = elementCount * elementSize;
uint32_t const byteCapacity = GetCapacity() * elementSize;
- ASSERT(m_isMapped == true, ());
+ ASSERT(m_isMapped, ());
#if defined(CHECK_VBO_BOUNDS)
int32_t size = GLFunctions::glGetBufferParameter(glTarget(m_t), gl_const::GLBufferSize);
ASSERT_EQUAL(size, byteCapacity, ());
- ASSERT_LESS(byteOffset + byteCount, size, ());
+ ASSERT_LESS_OR_EQUAL(byteOffset + byteCount, size, ());
#endif
if (IsMapBufferSupported())
{
- ASSERT(gpuPtr != NULL, ());
+ ASSERT(gpuPtr != nullptr, ());
memcpy((uint8_t *)gpuPtr + byteOffset, data, byteCount);
}
else
{
- ASSERT(gpuPtr == NULL, ());
+ ASSERT(gpuPtr == nullptr, ());
if (byteOffset == 0 && byteCount == byteCapacity)
GLFunctions::glBufferData(glTarget(m_t), byteCount, data, gl_const::GLStaticDraw);
else
@@ -122,9 +134,10 @@ void GPUBuffer::UpdateData(void * gpuPtr, void const * data, uint32_t elementOff
void GPUBuffer::Unmap()
{
#ifdef DEBUG
- ASSERT(m_isMapped == true, ());
+ ASSERT(m_isMapped, ());
m_isMapped = false;
#endif
+ m_mappingOffset = 0;
if (IsMapBufferSupported())
GLFunctions::glUnmapBuffer(glTarget(m_t));
}
@@ -133,9 +146,10 @@ void GPUBuffer::Resize(void const * data, uint32_t elementCount)
{
TBase::Resize(elementCount);
Bind();
- GLFunctions::glBufferData(glTarget(m_t), GetCapacity() * GetElementSize(), data, gl_const::GLDynamicDraw);
+ GLFunctions::glBufferData(glTarget(m_t), GetCapacity() * GetElementSize(), data,
+ gl_const::GLDynamicDraw);
- // if we have set up data already (in glBufferData), we have to call SetDataSize
+ // If we have set up data already (in glBufferData), we have to call SetDataSize.
if (data != nullptr)
SetDataSize(elementCount);
@@ -147,5 +161,4 @@ void GPUBuffer::Resize(void const * data, uint32_t elementCount)
dp::GPUMemTracker::Inst().SetUsed("VBO", m_bufferID, GetCurrentSize() * GetElementSize());
#endif
}
-
-} // namespace dp
+} // namespace dp
diff --git a/drape/gpu_buffer.hpp b/drape/gpu_buffer.hpp
index ec65cd47d7..b04ef21ff8 100644
--- a/drape/gpu_buffer.hpp
+++ b/drape/gpu_buffer.hpp
@@ -1,14 +1,14 @@
#pragma once
-#include "drape/pointers.hpp"
#include "drape/buffer_base.hpp"
+#include "drape/pointers.hpp"
namespace dp
{
-
class GPUBuffer : public BufferBase
{
- typedef BufferBase TBase;
+ using TBase = BufferBase;
+
public:
enum Target
{
@@ -23,22 +23,22 @@ public:
void UploadData(void const * data, uint32_t elementCount);
void Bind();
- void * Map();
+ void * Map(uint32_t elementOffset, uint32_t elementCount);
void UpdateData(void * gpuPtr, void const * data, uint32_t elementOffset, uint32_t elementCount);
void Unmap();
protected:
- /// discard old data
+ // Discard old data.
void Resize(void const * data, uint32_t elementCount);
private:
friend class GPUBufferMapper;
Target m_t;
uint32_t m_bufferID;
+ uint32_t m_mappingOffset;
#ifdef DEBUG
bool m_isMapped;
#endif
};
-
-} // namespace dp
+} // namespace dp
diff --git a/drape/gpu_program_manager.cpp b/drape/gpu_program_manager.cpp
index 5b9df04b81..6ddb7e193c 100644
--- a/drape/gpu_program_manager.cpp
+++ b/drape/gpu_program_manager.cpp
@@ -30,6 +30,9 @@ void GpuProgramManager::Init(drape_ptr<gpu::GpuProgramGetter> && programGetter)
if (SupportManager::Instance().IsSamsungGoogleNexus())
m_globalDefines.append("#define SAMSUNG_GOOGLE_NEXUS\n");
+
+ if (GLFunctions::CurrentApiVersion == dp::ApiVersion::OpenGLES3)
+ m_globalDefines.append("#define GLES3\n");
}
ref_ptr<GpuProgram> GpuProgramManager::GetProgram(int index)
diff --git a/drape/hw_texture.cpp b/drape/hw_texture.cpp
index 547a82c6c0..06a6c580b7 100644
--- a/drape/hw_texture.cpp
+++ b/drape/hw_texture.cpp
@@ -1,7 +1,7 @@
#include "hw_texture.hpp"
-#include "glfunctions.hpp"
#include "glextensions_list.hpp"
+#include "glfunctions.hpp"
#include "platform/platform.hpp"
@@ -15,21 +15,12 @@
namespace dp
{
-
HWTexture::HWTexture()
- : m_width(0)
- , m_height(0)
- , m_format(UNSPECIFIED)
- , m_textureID(-1)
- , m_filter(gl_const::GLLinear)
-{
-}
-
-void HWTexture::Create(Params const & params)
+ : m_width(0), m_height(0), m_format(UNSPECIFIED), m_textureID(-1), m_filter(gl_const::GLLinear)
{
- Create(params, nullptr);
}
+void HWTexture::Create(Params const & params) { Create(params, nullptr); }
void HWTexture::Create(Params const & params, ref_ptr<void> /*data*/)
{
m_width = params.m_width;
@@ -47,7 +38,7 @@ void HWTexture::Create(Params const & params, ref_ptr<void> /*data*/)
if (pixelType == gl_const::GL4BitOnChannel)
channelBitSize = 4;
- if (layout == gl_const::GLAlpha)
+ if (layout == gl_const::GLAlpha || layout == gl_const::GLRed)
channelCount = 1;
uint32_t bitCount = channelBitSize * channelCount * m_width * m_height;
@@ -57,11 +48,7 @@ void HWTexture::Create(Params const & params, ref_ptr<void> /*data*/)
#endif
}
-TextureFormat HWTexture::GetFormat() const
-{
- return m_format;
-}
-
+TextureFormat HWTexture::GetFormat() const { return m_format; }
uint32_t HWTexture::GetWidth() const
{
ASSERT_ID;
@@ -95,19 +82,20 @@ void HWTexture::UnpackFormat(TextureFormat format, glConst & layout, glConst & p
pixelType = gl_const::GL8BitOnChannel;
break;
case ALPHA:
- layout = gl_const::GLAlpha;
+ // On OpenGL ES3 GLAlpha is not supported, we use GLRed instead.
+ layout = GLFunctions::CurrentApiVersion == dp::ApiVersion::OpenGLES2 ? gl_const::GLAlpha
+ : gl_const::GLRed;
pixelType = gl_const::GL8BitOnChannel;
break;
- default:
- ASSERT(false, ());
- break;
+ default: ASSERT(false, ()); break;
}
}
void HWTexture::Bind() const
{
ASSERT_ID;
- GLFunctions::glBindTexture(GetID());
+ if (m_textureID != -1)
+ GLFunctions::glBindTexture(static_cast<uint32_t>(GetID()));
}
void HWTexture::SetFilter(glConst filter)
@@ -120,15 +108,11 @@ void HWTexture::SetFilter(glConst filter)
}
}
-int32_t HWTexture::GetID() const
-{
- return m_textureID;
-}
-
+int32_t HWTexture::GetID() const { return m_textureID; }
OpenGLHWTexture::~OpenGLHWTexture()
{
if (m_textureID != -1)
- GLFunctions::glDeleteTexture(m_textureID);
+ GLFunctions::glDeleteTexture(static_cast<uint32_t>(m_textureID));
}
void OpenGLHWTexture::Create(Params const & params, ref_ptr<void> data)
@@ -158,7 +142,8 @@ void OpenGLHWTexture::Create(Params const & params, ref_ptr<void> data)
GLFunctions::glBindTexture(0);
}
-void OpenGLHWTexture::UploadData(uint32_t x, uint32_t y, uint32_t width, uint32_t height, ref_ptr<void> data)
+void OpenGLHWTexture::UploadData(uint32_t x, uint32_t y, uint32_t width, uint32_t height,
+ ref_ptr<void> data)
{
ASSERT_ID;
glConst layout;
@@ -175,9 +160,11 @@ drape_ptr<HWTexture> OpenGLHWTextureAllocator::CreateTexture()
drape_ptr<HWTextureAllocator> CreateAllocator()
{
- if (!Platform::IsCustomTextureAllocatorSupported())
- return make_unique_dp<OpenGLHWTextureAllocator>();;
-
+ if (GLFunctions::CurrentApiVersion == dp::ApiVersion::OpenGLES3 ||
+ !Platform::IsCustomTextureAllocatorSupported())
+ {
+ return make_unique_dp<OpenGLHWTextureAllocator>();
+ }
#if defined(OMIM_OS_IPHONE) && !defined(OMIM_OS_IPHONE_SIMULATOR)
return make_unique_dp<HWTextureAllocatorApple>();
#else
@@ -190,5 +177,4 @@ ref_ptr<HWTextureAllocator> GetDefaultAllocator()
static OpenGLHWTextureAllocator s_allocator;
return make_ref<HWTextureAllocator>(&s_allocator);
}
-
-}
+} // namespace dp
diff --git a/drape/hw_texture_ios.mm b/drape/hw_texture_ios.mm
index 538d24af05..87951b8a7a 100644
--- a/drape/hw_texture_ios.mm
+++ b/drape/hw_texture_ios.mm
@@ -3,6 +3,7 @@
#include "base/logging.hpp"
#include "drape/glfunctions.hpp"
+#include "drape/glIncludes.hpp"
#import <QuartzCore/CAEAGLLayer.h>
diff --git a/drape/support_manager.cpp b/drape/support_manager.cpp
index 10a0ecccc8..6a68449086 100644
--- a/drape/support_manager.cpp
+++ b/drape/support_manager.cpp
@@ -15,7 +15,7 @@ void SupportManager::Init()
{
string const renderer = GLFunctions::glGetString(gl_const::GLRenderer);
string const version = GLFunctions::glGetString(gl_const::GLVersion);
- LOG(LINFO, ("Renderer =", renderer, "Version =", version));
+ LOG(LINFO, ("Renderer =", renderer, "Api =", GLFunctions::CurrentApiVersion, "Driver version =", version));
// On Android the engine may be recreated. Here we guarantee that GPU info is sent once per session.
static bool gpuInfoSent = false;
diff --git a/drape/texture.cpp b/drape/texture.cpp
index c198dc2722..e764f5e17b 100644
--- a/drape/texture.cpp
+++ b/drape/texture.cpp
@@ -1,7 +1,7 @@
#include "drape/texture.hpp"
-#include "drape/glfunctions.hpp"
#include "drape/glextensions_list.hpp"
+#include "drape/glfunctions.hpp"
#include "drape/utils/gpu_mem_tracker.hpp"
#include "base/math.hpp"
@@ -10,25 +10,13 @@
namespace dp
{
+Texture::ResourceInfo::ResourceInfo(m2::RectF const & texRect) : m_texRect(texRect) {}
-Texture::ResourceInfo::ResourceInfo(m2::RectF const & texRect)
- : m_texRect(texRect) {}
+m2::RectF const & Texture::ResourceInfo::GetTexRect() const { return m_texRect; }
-m2::RectF const & Texture::ResourceInfo::GetTexRect() const
-{
- return m_texRect;
-}
+Texture::Texture() {}
-//////////////////////////////////////////////////////////////////
-
-Texture::Texture()
-{
-}
-
-Texture::~Texture()
-{
- Destroy();
-}
+Texture::~Texture() { Destroy(); }
void Texture::Create(Params const & params)
{
@@ -42,7 +30,8 @@ void Texture::Create(Params const & params, ref_ptr<void> data)
m_hwTexture->Create(params, data);
}
-void Texture::UploadData(uint32_t x, uint32_t y, uint32_t width, uint32_t height, ref_ptr<void> data)
+void Texture::UploadData(uint32_t x, uint32_t y, uint32_t width, uint32_t height,
+ ref_ptr<void> data)
{
ASSERT(m_hwTexture != nullptr, ());
m_hwTexture->UploadData(x, y, width, height, data);
@@ -98,13 +87,10 @@ void Texture::SetFilter(glConst filter)
uint32_t Texture::GetMaxTextureSize()
{
- return GLFunctions::glGetInteger(gl_const::GLMaxTextureSize);
+ return static_cast<uint32_t>(GLFunctions::glGetInteger(gl_const::GLMaxTextureSize));
}
-void Texture::Destroy()
-{
- m_hwTexture.reset();
-}
+void Texture::Destroy() { m_hwTexture.reset(); }
bool Texture::AllocateTexture(ref_ptr<HWTextureAllocator> allocator)
{
@@ -116,5 +102,4 @@ bool Texture::AllocateTexture(ref_ptr<HWTextureAllocator> allocator)
return false;
}
-
-} // namespace dp
+} // namespace dp
diff --git a/drape/texture.hpp b/drape/texture.hpp
index 12237e9622..b795855793 100644
--- a/drape/texture.hpp
+++ b/drape/texture.hpp
@@ -1,9 +1,9 @@
#pragma once
-#include "drape/pointers.hpp"
-#include "drape/glconstants.hpp"
#include "drape/drape_global.hpp"
+#include "drape/glconstants.hpp"
#include "drape/hw_texture.hpp"
+#include "drape/pointers.hpp"
#include "geometry/rect2d.hpp"
@@ -12,7 +12,6 @@
namespace dp
{
-
class Texture
{
public:
@@ -37,7 +36,6 @@ public:
public:
ResourceInfo(m2::RectF const & texRect);
virtual ~ResourceInfo() {}
-
virtual ResourceType GetType() const = 0;
m2::RectF const & GetTexRect() const;
@@ -52,7 +50,6 @@ public:
virtual void UpdateState() {}
virtual bool HasAsyncRoutines() const { return false; }
virtual bool HasEnoughSpace(uint32_t /*newKeysCount*/) const { return true; }
-
using Params = HWTexture::Params;
void Create(Params const & params);
@@ -81,5 +78,4 @@ protected:
private:
drape_ptr<HWTexture> m_hwTexture;
};
-
-} // namespace dp
+} // namespace dp
diff --git a/drape/vertex_array_buffer.cpp b/drape/vertex_array_buffer.cpp
index b812881732..9da306ec15 100644
--- a/drape/vertex_array_buffer.cpp
+++ b/drape/vertex_array_buffer.cpp
@@ -1,14 +1,35 @@
#include "drape/vertex_array_buffer.hpp"
-#include "drape/glfunctions.hpp"
+
#include "drape/glextensions_list.hpp"
+#include "drape/glfunctions.hpp"
#include "drape/index_storage.hpp"
#include "drape/support_manager.hpp"
-#include "base/stl_add.hpp"
#include "base/assert.hpp"
+#include "base/logging.hpp"
namespace dp
{
+namespace
+{
+std::pair<uint32_t, uint32_t> CalculateMappingPart(std::vector<dp::MutateNode> const & nodes)
+{
+ uint32_t minOffset = std::numeric_limits<uint32_t>::max();
+ uint32_t maxOffset = std::numeric_limits<uint32_t>::min();
+ for (size_t i = 0; i < nodes.size(); ++i)
+ {
+ MutateNode const & node = nodes[i];
+ ASSERT_GREATER(node.m_region.m_count, 0, ());
+ if (node.m_region.m_offset < minOffset)
+ minOffset = node.m_region.m_offset;
+ uint32_t const endOffset = node.m_region.m_offset + node.m_region.m_count;
+ if (endOffset > maxOffset)
+ maxOffset = endOffset;
+ }
+ ASSERT_LESS(minOffset, maxOffset, ());
+ return std::make_pair(minOffset, maxOffset - minOffset);
+};
+} // namespace
VertexArrayBuffer::VertexArrayBuffer(uint32_t indexBufferSize, uint32_t dataBufferSize)
: m_VAO(0)
@@ -33,10 +54,10 @@ VertexArrayBuffer::~VertexArrayBuffer()
if (m_VAO != 0)
{
- /// Build called only when VertexArrayBuffer fulled and transfer to FrontendRenderer
- /// but if user move screen before all geometry readed from MWM we delete VertexArrayBuffer on BackendRenderer
- /// in this case m_VAO will be equal a 0
- /// also m_VAO == 0 will be on device that not support OES_vertex_array_object extension
+ // Build is called only when VertexArrayBuffer is full and transferred to FrontendRenderer.
+ // If user move screen before all geometry read from MWM we delete VertexArrayBuffer on
+ // BackendRenderer. In this case m_VAO will be equal 0 also m_VAO == 0 is on devices
+ // that do not support OES_vertex_array_object extension.
GLFunctions::glDeleteVertexArray(m_VAO);
}
}
@@ -52,10 +73,10 @@ void VertexArrayBuffer::PreflushImpl()
ASSERT(!m_isPreflushed, ());
// Buffers are ready, so moving them from CPU to GPU.
- for(auto & buffer : m_staticBuffers)
+ for (auto & buffer : m_staticBuffers)
buffer.second->MoveToGPU(GPUBuffer::ElementBuffer);
- for(auto & buffer : m_dynamicBuffers)
+ for (auto & buffer : m_dynamicBuffers)
buffer.second->MoveToGPU(GPUBuffer::ElementBuffer);
ASSERT(m_indexBuffer != nullptr, ());
@@ -77,16 +98,16 @@ void VertexArrayBuffer::RenderRange(bool drawAsLine, IndicesRange const & range)
if (!(m_staticBuffers.empty() && m_dynamicBuffers.empty()) && GetIndexCount() > 0)
{
ASSERT(m_program != nullptr, ("Somebody not call Build. It's very bad. Very very bad"));
- /// if OES_vertex_array_object is supported than all bindings already saved in VAO
- /// and we need only bind VAO.
+ // If OES_vertex_array_object is supported than all bindings have already saved in VAO
+ // and we need only bind VAO.
if (!Bind())
BindStaticBuffers();
BindDynamicBuffers();
GetIndexBuffer()->Bind();
GLFunctions::glDrawElements(drawAsLine ? gl_const::GLLines : gl_const::GLTriangles,
- dp::IndexStorage::SizeOfIndex(),
- range.m_idxCount, range.m_idxStart);
+ dp::IndexStorage::SizeOfIndex(), range.m_idxCount,
+ range.m_idxStart);
Unbind();
}
@@ -98,10 +119,10 @@ void VertexArrayBuffer::Build(ref_ptr<GpuProgram> program)
PreflushImpl();
if (m_VAO != 0 && m_program == program)
- return;
+ return;
m_program = program;
- /// if OES_vertex_array_object not supported, than buffers will be bind on each Render call
+ // If OES_vertex_array_object not supported, than buffers will be bound on each render call.
if (!GLExtensionsList::Instance().IsSupported(GLExtensionsList::VertexArrayObject))
return;
@@ -116,7 +137,8 @@ void VertexArrayBuffer::Build(ref_ptr<GpuProgram> program)
Unbind();
}
-void VertexArrayBuffer::UploadData(BindingInfo const & bindingInfo, void const * data, uint32_t count)
+void VertexArrayBuffer::UploadData(BindingInfo const & bindingInfo, void const * data,
+ uint32_t count)
{
ref_ptr<DataBuffer> buffer;
if (!bindingInfo.IsDynamic())
@@ -144,35 +166,38 @@ ref_ptr<DataBuffer> VertexArrayBuffer::GetOrCreateStaticBuffer(BindingInfo const
return GetOrCreateBuffer(bindingInfo, false);
}
-ref_ptr<DataBuffer> VertexArrayBuffer::GetBuffer(BindingInfo const & bindingInfo, bool isDynamic) const
+ref_ptr<DataBuffer> VertexArrayBuffer::GetBuffer(BindingInfo const & bindingInfo,
+ bool isDynamic) const
{
- TBuffersMap const * buffers = nullptr;
+ BuffersMap const * buffers = nullptr;
if (isDynamic)
buffers = &m_dynamicBuffers;
else
buffers = &m_staticBuffers;
- TBuffersMap::const_iterator it = buffers->find(bindingInfo);
+ auto it = buffers->find(bindingInfo);
if (it == buffers->end())
return nullptr;
return make_ref(it->second);
}
-ref_ptr<DataBuffer> VertexArrayBuffer::GetOrCreateBuffer(BindingInfo const & bindingInfo, bool isDynamic)
+ref_ptr<DataBuffer> VertexArrayBuffer::GetOrCreateBuffer(BindingInfo const & bindingInfo,
+ bool isDynamic)
{
- TBuffersMap * buffers = nullptr;
+ BuffersMap * buffers = nullptr;
if (isDynamic)
buffers = &m_dynamicBuffers;
else
buffers = &m_staticBuffers;
- TBuffersMap::iterator it = buffers->find(bindingInfo);
+ auto it = buffers->find(bindingInfo);
if (it == buffers->end())
{
- drape_ptr<DataBuffer> dataBuffer = make_unique_dp<DataBuffer>(bindingInfo.GetElementSize(), m_dataBufferSize);
+ drape_ptr<DataBuffer> dataBuffer =
+ make_unique_dp<DataBuffer>(bindingInfo.GetElementSize(), m_dataBufferSize);
ref_ptr<DataBuffer> result = make_ref(dataBuffer);
- (*buffers).insert(make_pair(bindingInfo, move(dataBuffer)));
+ (*buffers).insert(std::make_pair(bindingInfo, move(dataBuffer)));
return result;
}
@@ -190,8 +215,8 @@ uint32_t VertexArrayBuffer::GetAvailableVertexCount() const
return m_dataBufferSize;
#ifdef DEBUG
- TBuffersMap::const_iterator it = m_staticBuffers.begin();
- uint32_t prev = it->second->GetBuffer()->GetAvailableSize();
+ auto it = m_staticBuffers.begin();
+ uint32_t const prev = it->second->GetBuffer()->GetAvailableSize();
for (; it != m_staticBuffers.end(); ++it)
ASSERT_EQUAL(prev, it->second->GetBuffer()->GetAvailableSize(), ());
#endif
@@ -205,8 +230,8 @@ uint32_t VertexArrayBuffer::GetStartIndexValue() const
return 0;
#ifdef DEBUG
- TBuffersMap::const_iterator it = m_staticBuffers.begin();
- uint32_t prev = it->second->GetBuffer()->GetCurrentSize();
+ auto it = m_staticBuffers.begin();
+ uint32_t const prev = it->second->GetBuffer()->GetCurrentSize();
for (; it != m_staticBuffers.end(); ++it)
ASSERT(prev == it->second->GetBuffer()->GetCurrentSize(), ());
#endif
@@ -219,11 +244,7 @@ uint32_t VertexArrayBuffer::GetDynamicBufferOffset(BindingInfo const & bindingIn
return GetOrCreateDynamicBuffer(bindingInfo)->GetBuffer()->GetCurrentSize();
}
-uint32_t VertexArrayBuffer::GetIndexCount() const
-{
- return GetIndexBuffer()->GetCurrentSize();
-}
-
+uint32_t VertexArrayBuffer::GetIndexCount() const { return GetIndexBuffer()->GetCurrentSize(); }
void VertexArrayBuffer::UploadIndexes(void const * data, uint32_t count)
{
ASSERT_LESS_OR_EQUAL(count, GetIndexBuffer()->GetAvailableSize(), ());
@@ -233,8 +254,8 @@ void VertexArrayBuffer::UploadIndexes(void const * data, uint32_t count)
void VertexArrayBuffer::ApplyMutation(ref_ptr<IndexBufferMutator> indexMutator,
ref_ptr<AttributeBufferMutator> attrMutator)
{
- /// We need to bind current VAO before calling glBindBuffer if OES_vertex_array_object is supported.
- /// Otherwise we risk affecting a previously binded VAO.
+ // We need to bind current VAO before calling glBindBuffer if OES_vertex_array_object is
+ // supported. Otherwise we risk affecting a previously bound VAO.
Bind();
if (indexMutator != nullptr)
@@ -254,21 +275,24 @@ void VertexArrayBuffer::ApplyMutation(ref_ptr<IndexBufferMutator> indexMutator,
return;
}
- typedef AttributeBufferMutator::TMutateData TMutateData;
- typedef AttributeBufferMutator::TMutateNodes TMutateNodes;
- TMutateData const & data = attrMutator->GetMutateData();
- for (TMutateData::const_iterator it = data.begin(); it != data.end(); ++it)
+ auto const & data = attrMutator->GetMutateData();
+ for (auto it = data.begin(); it != data.end(); ++it)
{
+ auto const & nodes = it->second;
+ if (nodes.empty())
+ continue;
+
+ auto const offsets = CalculateMappingPart(nodes);
+
ref_ptr<DataBuffer> buffer = GetDynamicBuffer(it->first);
ASSERT(buffer != nullptr, ());
- DataBufferMapper mapper(buffer);
- TMutateNodes const & nodes = it->second;
-
+ DataBufferMapper mapper(buffer, offsets.first, offsets.second);
for (size_t i = 0; i < nodes.size(); ++i)
{
MutateNode const & node = nodes[i];
ASSERT_GREATER(node.m_region.m_count, 0, ());
- mapper.UpdateData(node.m_data.get(), node.m_region.m_offset, node.m_region.m_count);
+ mapper.UpdateData(node.m_data.get(), node.m_region.m_offset - offsets.first,
+ node.m_region.m_count);
}
}
@@ -292,20 +316,11 @@ void VertexArrayBuffer::Unbind() const
GLFunctions::glBindVertexArray(0);
}
-void VertexArrayBuffer::BindStaticBuffers() const
-{
- BindBuffers(m_staticBuffers);
-}
-
-void VertexArrayBuffer::BindDynamicBuffers() const
+void VertexArrayBuffer::BindStaticBuffers() const { BindBuffers(m_staticBuffers); }
+void VertexArrayBuffer::BindDynamicBuffers() const { BindBuffers(m_dynamicBuffers); }
+void VertexArrayBuffer::BindBuffers(BuffersMap const & buffers) const
{
- BindBuffers(m_dynamicBuffers);
-}
-
-void VertexArrayBuffer::BindBuffers(TBuffersMap const & buffers) const
-{
- TBuffersMap::const_iterator it = buffers.begin();
- for (; it != buffers.end(); ++it)
+ for (auto it = buffers.begin(); it != buffers.end(); ++it)
{
BindingInfo const & binding = it->first;
ref_ptr<DataBuffer> buffer = make_ref(it->second);
@@ -317,11 +332,8 @@ void VertexArrayBuffer::BindBuffers(TBuffersMap const & buffers) const
int8_t attributeLocation = m_program->GetAttributeLocation(decl.m_attributeName);
assert(attributeLocation != -1);
GLFunctions::glEnableVertexAttribute(attributeLocation);
- GLFunctions::glVertexAttributePointer(attributeLocation,
- decl.m_componentCount,
- decl.m_componentType,
- false,
- decl.m_stride,
+ GLFunctions::glVertexAttributePointer(attributeLocation, decl.m_componentCount,
+ decl.m_componentType, false, decl.m_stride,
decl.m_offset);
}
}
@@ -332,5 +344,4 @@ ref_ptr<DataBufferBase> VertexArrayBuffer::GetIndexBuffer() const
ASSERT(m_indexBuffer != nullptr, ());
return m_indexBuffer->GetBuffer();
}
-
-} // namespace dp
+} // namespace dp
diff --git a/drape/vertex_array_buffer.hpp b/drape/vertex_array_buffer.hpp
index baab293954..49fc1c67e2 100644
--- a/drape/vertex_array_buffer.hpp
+++ b/drape/vertex_array_buffer.hpp
@@ -1,14 +1,14 @@
#pragma once
-#include "drape/index_buffer_mutator.hpp"
#include "drape/attribute_buffer_mutator.hpp"
-#include "drape/pointers.hpp"
-#include "drape/index_buffer.hpp"
-#include "drape/data_buffer.hpp"
#include "drape/binding_info.hpp"
+#include "drape/data_buffer.hpp"
#include "drape/gpu_program.hpp"
+#include "drape/index_buffer.hpp"
+#include "drape/index_buffer_mutator.hpp"
+#include "drape/pointers.hpp"
-#include "std/map.hpp"
+#include <map>
namespace df
{
@@ -17,42 +17,34 @@ class BatchMergeHelper;
namespace dp
{
-
struct IndicesRange
{
uint32_t m_idxStart;
uint32_t m_idxCount;
- IndicesRange()
- : m_idxStart(0), m_idxCount(0)
- {}
-
- IndicesRange(uint32_t idxStart, uint32_t idxCount)
- : m_idxStart(idxStart), m_idxCount(idxCount)
- {}
-
+ IndicesRange() : m_idxStart(0), m_idxCount(0) {}
+ IndicesRange(uint32_t idxStart, uint32_t idxCount) : m_idxStart(idxStart), m_idxCount(idxCount) {}
bool IsValid() const { return m_idxCount != 0; }
};
class VertexArrayBuffer
{
- typedef map<BindingInfo, drape_ptr<DataBuffer> > TBuffersMap;
+ using BuffersMap = std::map<BindingInfo, drape_ptr<DataBuffer>>;
friend class df::BatchMergeHelper;
+
public:
VertexArrayBuffer(uint32_t indexBufferSize, uint32_t dataBufferSize);
~VertexArrayBuffer();
- /// This method must be call on reading thread, before VAO will be transfer on render thread
+ // This method must be call on reading thread, before VAO will be transfered on render thread.
void Preflush();
- ///{@
- /// On devices where implemented OES_vertex_array_object extensions we use it for build VertexArrayBuffer
- /// OES_vertex_array_object create OpenGL resource that belong only one GL context (which was created by)
- /// by this reason Build/Bind and Render must be called only on Frontendrendere thread
+ // OES_vertex_array_object create OpenGL resource that belong only one GL context (which was
+ // created by). By this reason Build/Bind and Render must be called only on FrontendRenderer
+ // thread.
void Render(bool drawAsLine);
void RenderRange(bool drawAsLine, IndicesRange const & range);
void Build(ref_ptr<GpuProgram> program);
- ///@}
uint32_t GetAvailableVertexCount() const;
uint32_t GetAvailableIndexCount() const;
@@ -68,7 +60,6 @@ public:
void ResetChangingTracking() { m_isChanged = false; }
bool IsChanged() const { return m_isChanged; }
-
private:
ref_ptr<DataBuffer> GetOrCreateStaticBuffer(BindingInfo const & bindingInfo);
ref_ptr<DataBuffer> GetOrCreateDynamicBuffer(BindingInfo const & bindingInfo);
@@ -80,17 +71,17 @@ private:
void Unbind() const;
void BindStaticBuffers() const;
void BindDynamicBuffers() const;
- void BindBuffers(TBuffersMap const & buffers) const;
+ void BindBuffers(BuffersMap const & buffers) const;
ref_ptr<DataBufferBase> GetIndexBuffer() const;
void PreflushImpl();
private:
- /// m_VAO - VertexArrayObject name/identificator
+ // m_VAO - VertexArrayObject name/identifier.
int m_VAO;
- TBuffersMap m_staticBuffers;
- TBuffersMap m_dynamicBuffers;
+ BuffersMap m_staticBuffers;
+ BuffersMap m_dynamicBuffers;
drape_ptr<IndexBuffer> m_indexBuffer;
uint32_t m_dataBufferSize;
@@ -101,5 +92,4 @@ private:
bool m_moveToGpuOnBuild;
bool m_isChanged;
};
-
-} // namespace dp
+} // namespace dp
diff --git a/drape/viewport.cpp b/drape/viewport.cpp
new file mode 100644
index 0000000000..f36b1b6cc1
--- /dev/null
+++ b/drape/viewport.cpp
@@ -0,0 +1,25 @@
+#include "drape/viewport.hpp"
+#include "drape/glfunctions.hpp"
+
+namespace dp
+{
+Viewport::Viewport(uint32_t x0, uint32_t y0, uint32_t w, uint32_t h) : m_zero(x0, y0), m_size(w, h)
+{
+}
+
+void Viewport::SetViewport(uint32_t x0, uint32_t y0, uint32_t w, uint32_t h)
+{
+ m_zero = m2::PointU(x0, y0);
+ m_size = m2::PointU(w, h);
+}
+
+uint32_t Viewport::GetX0() const { return m_zero.x; }
+uint32_t Viewport::GetY0() const { return m_zero.y; }
+uint32_t Viewport::GetWidth() const { return m_size.x; }
+uint32_t Viewport::GetHeight() const { return m_size.y; }
+void Viewport::Apply() const
+{
+ GLCHECK(GLFunctions::glViewport(GetX0(), GetY0(), GetWidth(), GetHeight()));
+ GLCHECK(GLFunctions::glScissor(GetX0(), GetY0(), GetWidth(), GetHeight()));
+}
+} // namespace dp
diff --git a/drape/viewport.hpp b/drape/viewport.hpp
new file mode 100644
index 0000000000..65dcffffa3
--- /dev/null
+++ b/drape/viewport.hpp
@@ -0,0 +1,31 @@
+#pragma once
+
+#include "geometry/point2d.hpp"
+
+namespace dp
+{
+// Pixel ratio independent viewport implementation.
+// pixelRatio is ratio between physical pixels and device-independent pixels for the window.
+class Viewport
+{
+public:
+ // x0, y0, w, h is device-independent pixels
+ Viewport(uint32_t x0, uint32_t y0, uint32_t w, uint32_t h);
+
+ // On iOS we must multiply this on scaleFactor.
+ // On Android we get true size from surface.
+ void SetViewport(uint32_t x0, uint32_t y0, uint32_t w, uint32_t h);
+
+ uint32_t GetX0() const;
+ uint32_t GetY0() const;
+ uint32_t GetWidth() const;
+ uint32_t GetHeight() const;
+
+ // Apply viewport to graphics pipeline with convert start point and size to physical pixels.
+ void Apply() const;
+
+private:
+ m2::PointU m_zero;
+ m2::PointU m_size;
+};
+} // namespace dp
diff --git a/drape_frontend/CMakeLists.txt b/drape_frontend/CMakeLists.txt
index 804987429d..3a130ac449 100644
--- a/drape_frontend/CMakeLists.txt
+++ b/drape_frontend/CMakeLists.txt
@@ -84,8 +84,6 @@ set(
drape_measurer.hpp
engine_context.cpp
engine_context.hpp
- framebuffer.cpp
- framebuffer.hpp
frontend_renderer.cpp
frontend_renderer.hpp
gps_track_point.hpp
@@ -204,8 +202,6 @@ set(
user_mark_shapes.hpp
user_marks_provider.cpp
user_marks_provider.hpp
- viewport.cpp
- viewport.hpp
visual_params.cpp
visual_params.hpp
watch/area_info.hpp
diff --git a/drape_frontend/backend_renderer.cpp b/drape_frontend/backend_renderer.cpp
index 3b637db0c0..0f6d844711 100644
--- a/drape_frontend/backend_renderer.cpp
+++ b/drape_frontend/backend_renderer.cpp
@@ -482,7 +482,7 @@ void BackendRenderer::OnContextCreate()
m_contextFactory->waitForInitialization();
m_contextFactory->getResourcesUploadContext()->makeCurrent();
- GLFunctions::Init();
+ GLFunctions::Init(m_apiVersion);
InitGLDependentResource();
}
diff --git a/drape_frontend/backend_renderer.hpp b/drape_frontend/backend_renderer.hpp
index 6365c263eb..0c38709b11 100644
--- a/drape_frontend/backend_renderer.hpp
+++ b/drape_frontend/backend_renderer.hpp
@@ -9,21 +9,18 @@
#include "drape_frontend/overlay_batcher.hpp"
#include "drape_frontend/requested_tiles.hpp"
#include "drape_frontend/traffic_generator.hpp"
-#include "drape_frontend/viewport.hpp"
#include "drape/pointers.hpp"
+#include "drape/viewport.hpp"
namespace dp
{
-
class OGLContextFactory;
class TextureManager;
-
-}
+} // namespace dp
namespace df
{
-
class Message;
class ReadManager;
class RouteBuilder;
@@ -35,19 +32,20 @@ public:
struct Params : BaseRenderer::Params
{
- Params(ref_ptr<ThreadsCommutator> commutator, ref_ptr<dp::OGLContextFactory> factory,
- ref_ptr<dp::TextureManager> texMng, MapDataProvider const & model,
- TUpdateCurrentCountryFn const & updateCurrentCountryFn,
- ref_ptr<RequestedTiles> requestedTiles, bool allow3dBuildings,
- bool trafficEnabled, bool simplifiedTrafficColors)
- : BaseRenderer::Params(commutator, factory, texMng)
+ Params(dp::ApiVersion apiVersion, ref_ptr<ThreadsCommutator> commutator,
+ ref_ptr<dp::OGLContextFactory> factory, ref_ptr<dp::TextureManager> texMng,
+ MapDataProvider const & model, TUpdateCurrentCountryFn const & updateCurrentCountryFn,
+ ref_ptr<RequestedTiles> requestedTiles, bool allow3dBuildings, bool trafficEnabled,
+ bool simplifiedTrafficColors)
+ : BaseRenderer::Params(apiVersion, commutator, factory, texMng)
, m_model(model)
, m_updateCurrentCountryFn(updateCurrentCountryFn)
, m_requestedTiles(requestedTiles)
, m_allow3dBuildings(allow3dBuildings)
, m_trafficEnabled(trafficEnabled)
, m_simplifiedTrafficColors(simplifiedTrafficColors)
- {}
+ {
+ }
MapDataProvider const & m_model;
TUpdateCurrentCountryFn m_updateCurrentCountryFn;
diff --git a/drape_frontend/base_renderer.cpp b/drape_frontend/base_renderer.cpp
index 265d28ed96..efad1f78e1 100644
--- a/drape_frontend/base_renderer.cpp
+++ b/drape_frontend/base_renderer.cpp
@@ -7,7 +7,8 @@ namespace df
{
BaseRenderer::BaseRenderer(ThreadsCommutator::ThreadName name, Params const & params)
- : m_commutator(params.m_commutator)
+ : m_apiVersion(params.m_apiVersion)
+ , m_commutator(params.m_commutator)
, m_contextFactory(params.m_oglContextFactory)
, m_texMng(params.m_texMng)
, m_threadName(name)
diff --git a/drape_frontend/base_renderer.hpp b/drape_frontend/base_renderer.hpp
index 6171f4929a..52d79a1041 100644
--- a/drape_frontend/base_renderer.hpp
+++ b/drape_frontend/base_renderer.hpp
@@ -22,15 +22,18 @@ class BaseRenderer : public MessageAcceptor
public:
struct Params
{
- Params(ref_ptr<ThreadsCommutator> commutator,
+ Params(dp::ApiVersion apiVersion,
+ ref_ptr<ThreadsCommutator> commutator,
ref_ptr<dp::OGLContextFactory> factory,
ref_ptr<dp::TextureManager> texMng)
- : m_commutator(commutator)
+ : m_apiVersion(apiVersion)
+ , m_commutator(commutator)
, m_oglContextFactory(factory)
, m_texMng(texMng)
{
}
+ dp::ApiVersion m_apiVersion;
ref_ptr<ThreadsCommutator> m_commutator;
ref_ptr<dp::OGLContextFactory> m_oglContextFactory;
ref_ptr<dp::TextureManager> m_texMng;
@@ -46,6 +49,7 @@ public:
bool IsRenderingEnabled() const;
protected:
+ dp::ApiVersion m_apiVersion;
ref_ptr<ThreadsCommutator> m_commutator;
ref_ptr<dp::OGLContextFactory> m_contextFactory;
ref_ptr<dp::TextureManager> m_texMng;
diff --git a/drape_frontend/batch_merge_helper.cpp b/drape_frontend/batch_merge_helper.cpp
index b2ac464fd3..db0fd86a90 100644
--- a/drape_frontend/batch_merge_helper.cpp
+++ b/drape_frontend/batch_merge_helper.cpp
@@ -105,7 +105,7 @@ void BatchMergeHelper::MergeBatches(vector<drape_ptr<RenderGroup>> & batches,
buffer = bucket->GetBuffer();
};
- auto copyVertecesFn = [](TBuffer::TBuffersMap::value_type const & vboNode,
+ auto copyVertecesFn = [](TBuffer::BuffersMap::value_type const & vboNode,
vector<uint8_t> & rawDataBuffer,
ref_ptr<TBuffer> newBuffer)
{
diff --git a/drape_frontend/drape_engine.cpp b/drape_frontend/drape_engine.cpp
index e0b5c9f6a2..115e0fade9 100644
--- a/drape_frontend/drape_engine.cpp
+++ b/drape_frontend/drape_engine.cpp
@@ -51,7 +51,8 @@ DrapeEngine::DrapeEngine(Params && params)
params.m_isAutozoomEnabled,
bind(&DrapeEngine::MyPositionModeChanged, this, _1, _2));
- FrontendRenderer::Params frParams(make_ref(m_threadCommutator),
+ FrontendRenderer::Params frParams(params.m_apiVersion,
+ make_ref(m_threadCommutator),
params.m_factory,
make_ref(m_textureManager),
move(mpParams),
@@ -67,7 +68,8 @@ DrapeEngine::DrapeEngine(Params && params)
m_frontend = make_unique_dp<FrontendRenderer>(move(frParams));
- BackendRenderer::Params brParams(frParams.m_commutator,
+ BackendRenderer::Params brParams(params.m_apiVersion,
+ frParams.m_commutator,
frParams.m_oglContextFactory,
frParams.m_texMng,
params.m_model,
diff --git a/drape_frontend/drape_engine.hpp b/drape_frontend/drape_engine.hpp
index 50510f95cf..64e9b5924e 100644
--- a/drape_frontend/drape_engine.hpp
+++ b/drape_frontend/drape_engine.hpp
@@ -13,6 +13,7 @@
#include "drape/pointers.hpp"
#include "drape/texture_manager.hpp"
+#include "drape/viewport.hpp"
#include "traffic/traffic_info.hpp"
@@ -27,23 +28,25 @@
#include "std/map.hpp"
#include "std/mutex.hpp"
-namespace dp { class OGLContextFactory; }
+namespace dp
+{
+class OGLContextFactory;
+} // namespace dp
namespace df
{
-
class UserMarksProvider;
class MapDataProvider;
-class Viewport;
class DrapeEngine
{
public:
struct Params
{
- Params(ref_ptr<dp::OGLContextFactory> factory,
+ Params(dp::ApiVersion apiVersion,
+ ref_ptr<dp::OGLContextFactory> factory,
ref_ptr<StringsBundle> stringBundle,
- Viewport const & viewport,
+ dp::Viewport const & viewport,
MapDataProvider const & model,
Hints const & hints,
double vs,
@@ -60,7 +63,8 @@ public:
bool isAutozoomEnabled,
bool simplifiedTrafficColors,
OverlaysShowStatsCallback && overlaysShowStatsCallback)
- : m_factory(factory)
+ : m_apiVersion(apiVersion)
+ , m_factory(factory)
, m_stringsBundle(stringBundle)
, m_viewport(viewport)
, m_model(model)
@@ -81,9 +85,10 @@ public:
, m_overlaysShowStatsCallback(move(overlaysShowStatsCallback))
{}
+ dp::ApiVersion m_apiVersion;
ref_ptr<dp::OGLContextFactory> m_factory;
ref_ptr<StringsBundle> m_stringsBundle;
- Viewport m_viewport;
+ dp::Viewport m_viewport;
MapDataProvider m_model;
Hints m_hints;
double m_vs;
@@ -216,7 +221,7 @@ private:
drape_ptr<RequestedTiles> m_requestedTiles;
location::TMyPositionModeChanged m_myPositionModeChanged;
- Viewport m_viewport;
+ dp::Viewport m_viewport;
TModelViewListenerFn m_modelViewChanged;
TUserPositionChangedFn m_userPositionChanged;
diff --git a/drape_frontend/drape_frontend.pro b/drape_frontend/drape_frontend.pro
index 8d61648760..15e0f007bc 100755
--- a/drape_frontend/drape_frontend.pro
+++ b/drape_frontend/drape_frontend.pro
@@ -55,7 +55,6 @@ SOURCES += \
drape_engine.cpp \
drape_measurer.cpp \
engine_context.cpp \
- framebuffer.cpp \
frontend_renderer.cpp \
gps_track_renderer.cpp \
gps_track_shape.cpp \
@@ -100,7 +99,6 @@ SOURCES += \
user_event_stream.cpp \
user_mark_shapes.cpp \
user_marks_provider.cpp \
- viewport.cpp \
visual_params.cpp \
kinetic_scroller.cpp \
watch/cpu_drawer.cpp \
@@ -160,7 +158,6 @@ HEADERS += \
drape_hints.hpp \
drape_measurer.hpp \
engine_context.hpp \
- framebuffer.hpp \
frontend_renderer.hpp \
gps_track_point.hpp \
gps_track_renderer.hpp \
@@ -211,7 +208,6 @@ HEADERS += \
user_event_stream.hpp \
user_mark_shapes.hpp \
user_marks_provider.hpp \
- viewport.hpp \
visual_params.hpp \
kinetic_scroller.hpp \
watch/cpu_drawer.hpp \
diff --git a/drape_frontend/drape_frontend_tests/compile_shaders_test.cpp b/drape_frontend/drape_frontend_tests/compile_shaders_test.cpp
index fd0a246338..31e5fa637d 100644
--- a/drape_frontend/drape_frontend_tests/compile_shaders_test.cpp
+++ b/drape_frontend/drape_frontend_tests/compile_shaders_test.cpp
@@ -27,14 +27,6 @@ std::string const kCompilerOpenGLES3 = "GLSLESCompiler_Series6.mac";
std::string const kCompilerMaliOpenGLES3 = kMaliCompilerOpenGLES3Dir + "/malisc";
std::string DebugPrint(QString const & s) { return s.toStdString(); }
-std::string DebugPrint(dp::ApiVersion apiVersion)
-{
- if (apiVersion == dp::OpenGLES2)
- return "OpenGLES2";
- else if (apiVersion == dp::OpenGLES3)
- return "OpenGLES3";
- return "Unknown";
-}
namespace
{
@@ -139,7 +131,7 @@ UNIT_TEST(CompileShaders_Test)
args << fileName << fileName + ".bin" << shaderType;
};
- string defines = "";
+ std::string const defines = compiler.m_apiVersion == dp::ApiVersion::OpenGLES3 ? "#define GLES3\n" : "";
TestShaders(compiler.m_apiVersion, defines, gpu::GetVertexShaders(compiler.m_apiVersion),
compilerPath, [](QProcess const &) {}, argsPrepareFn, successChecker, ss);
shaderType = "-f";
@@ -148,27 +140,27 @@ UNIT_TEST(CompileShaders_Test)
TEST_EQUAL(errorLog.isEmpty(), true, ("PVR without defines :", errorLog));
- defines = "#define ENABLE_VTF\n";
+ std::string const defines2 = defines + "#define ENABLE_VTF\n";
errorLog.clear();
shaderType = "-v";
- TestShaders(compiler.m_apiVersion, defines, gpu::GetVertexShaders(compiler.m_apiVersion),
+ TestShaders(compiler.m_apiVersion, defines2, gpu::GetVertexShaders(compiler.m_apiVersion),
compilerPath, [](QProcess const &) {}, argsPrepareFn, successChecker, ss);
shaderType = "-f";
- TestShaders(compiler.m_apiVersion, defines, gpu::GetFragmentShaders(compiler.m_apiVersion),
+ TestShaders(compiler.m_apiVersion, defines2, gpu::GetFragmentShaders(compiler.m_apiVersion),
compilerPath, [](QProcess const &) {}, argsPrepareFn, successChecker, ss);
- TEST_EQUAL(errorLog.isEmpty(), true, ("PVR with defines : ", defines, "\n", errorLog));
+ TEST_EQUAL(errorLog.isEmpty(), true, ("PVR with defines : ", defines2, "\n", errorLog));
- defines = "#define SAMSUNG_GOOGLE_NEXUS\n";
+ std::string const defines3 = defines + "#define SAMSUNG_GOOGLE_NEXUS\n";
errorLog.clear();
shaderType = "-v";
- TestShaders(compiler.m_apiVersion, defines, gpu::GetVertexShaders(compiler.m_apiVersion),
+ TestShaders(compiler.m_apiVersion, defines3, gpu::GetVertexShaders(compiler.m_apiVersion),
compilerPath, [](QProcess const &) {}, argsPrepareFn, successChecker, ss);
shaderType = "-f";
- TestShaders(compiler.m_apiVersion, defines, gpu::GetFragmentShaders(compiler.m_apiVersion),
+ TestShaders(compiler.m_apiVersion, defines3, gpu::GetFragmentShaders(compiler.m_apiVersion),
compilerPath, [](QProcess const &) {}, argsPrepareFn, successChecker, ss);
- TEST_EQUAL(errorLog.isEmpty(), true, ("PVR with defines : ", defines, "\n", errorLog));
+ TEST_EQUAL(errorLog.isEmpty(), true, ("PVR with defines : ", defines3, "\n", errorLog));
}
}
@@ -262,7 +254,8 @@ UNIT_TEST(MALI_CompileShaders_Test)
<< "-r" << version.second << "-c" << version.first << "-d" << set.m_driverName
<< fileName;
};
- std::string defines = "";
+ std::string const defines =
+ compiler.m_apiVersion == dp::ApiVersion::OpenGLES3 ? "#define GLES3\n" : "";
QString const compilerPath = QString::fromStdString(compiler.m_compilerPath);
TestShaders(compiler.m_apiVersion, defines, gpu::GetVertexShaders(compiler.m_apiVersion),
compilerPath, procPrepare, argForming, successChecker, ss);
diff --git a/drape_frontend/frontend_renderer.cpp b/drape_frontend/frontend_renderer.cpp
index f5afbf207c..4ae75f8c39 100755
--- a/drape_frontend/frontend_renderer.cpp
+++ b/drape_frontend/frontend_renderer.cpp
@@ -3,7 +3,6 @@
#include "drape_frontend/animation_system.hpp"
#include "drape_frontend/batch_merge_helper.hpp"
#include "drape_frontend/drape_measurer.hpp"
-#include "drape_frontend/framebuffer.hpp"
#include "drape_frontend/gui/drape_gui.hpp"
#include "drape_frontend/gui/ruler_helper.hpp"
#include "drape_frontend/message_subclasses.hpp"
@@ -15,8 +14,8 @@
#include "drape_frontend/visual_params.hpp"
#include "drape/debug_rect_renderer.hpp"
+#include "drape/framebuffer.hpp"
#include "drape/support_manager.hpp"
-
#include "drape/utils/glyph_usage_tracker.hpp"
#include "drape/utils/gpu_mem_tracker.hpp"
#include "drape/utils/projection.hpp"
@@ -39,12 +38,11 @@
namespace df
{
-
namespace
{
-constexpr float kIsometryAngle = math::pi * 76.0f / 180.0f;
-const double VSyncInterval = 0.06;
-//const double VSyncInterval = 0.014;
+float constexpr kIsometryAngle = static_cast<float>(math::pi) * 76.0f / 180.0f;
+double const kVSyncInterval = 0.06;
+//double const kVSyncInterval = 0.014;
struct MergedGroupKey
{
@@ -118,7 +116,7 @@ FrontendRenderer::FrontendRenderer(Params && params)
, m_gpuProgramManager(new dp::GpuProgramManager())
, m_routeRenderer(new RouteRenderer())
, m_trafficRenderer(new TrafficRenderer())
- , m_framebuffer(new Framebuffer())
+ , m_framebuffer(new dp::Framebuffer())
, m_screenQuadRenderer(new ScreenQuadRenderer())
, m_gpsTrackRenderer(
new GpsTrackRenderer(bind(&FrontendRenderer::PrepareGpsTrackPoints, this, _1)))
@@ -1677,8 +1675,7 @@ void FrontendRenderer::OnContextCreate()
dp::OGLContext * context = m_contextFactory->getDrawContext();
context->makeCurrent();
- GLFunctions::Init();
- GLFunctions::AttachCache(this_thread::get_id());
+ GLFunctions::Init(m_apiVersion);
GLFunctions::glPixelStore(gl_const::GLUnpackAlignment, 1);
@@ -1694,7 +1691,7 @@ void FrontendRenderer::OnContextCreate()
dp::SupportManager::Instance().Init();
m_gpuProgramManager = make_unique_dp<dp::GpuProgramManager>();
- m_gpuProgramManager->Init(make_unique_dp<gpu::ShaderMapper>(dp::ApiVersion::OpenGLES2));
+ m_gpuProgramManager->Init(make_unique_dp<gpu::ShaderMapper>(m_apiVersion));
dp::BlendingParams blendingParams;
blendingParams.Apply();
@@ -1704,7 +1701,7 @@ void FrontendRenderer::OnContextCreate()
#endif
// resources recovering
- m_framebuffer.reset(new Framebuffer());
+ m_framebuffer.reset(new dp::Framebuffer());
m_framebuffer->SetDefaultContext(context);
m_screenQuadRenderer.reset(new ScreenQuadRenderer());
@@ -1777,14 +1774,14 @@ void FrontendRenderer::Routine::Do()
}
else
{
- double availableTime = VSyncInterval - timer.ElapsedSeconds();
+ double availableTime = kVSyncInterval - timer.ElapsedSeconds();
do
{
if (!m_renderer.ProcessSingleMessage(false /* waitForMessage */))
break;
activityTimer.Reset();
- availableTime = VSyncInterval - timer.ElapsedSeconds();
+ availableTime = kVSyncInterval - timer.ElapsedSeconds();
}
while (availableTime > 0);
}
diff --git a/drape_frontend/frontend_renderer.hpp b/drape_frontend/frontend_renderer.hpp
index ab55c2c4cd..3fa2cebb33 100755
--- a/drape_frontend/frontend_renderer.hpp
+++ b/drape_frontend/frontend_renderer.hpp
@@ -38,13 +38,13 @@
namespace dp
{
- class RenderBucket;
- class OverlayTree;
-}
+class Framebuffer;
+class OverlayTree;
+class RenderBucket;
+} // namespace dp
namespace df
{
-class Framebuffer;
class ScenarioManager;
class ScreenQuadRenderer;
class SelectionShape;
@@ -69,11 +69,12 @@ public:
struct Params : BaseRenderer::Params
{
- Params(ref_ptr<ThreadsCommutator> commutator,
+ Params(dp::ApiVersion apiVersion,
+ ref_ptr<ThreadsCommutator> commutator,
ref_ptr<dp::OGLContextFactory> factory,
ref_ptr<dp::TextureManager> texMng,
MyPositionController::Params && myPositionParams,
- Viewport viewport,
+ dp::Viewport viewport,
TModelViewChanged const & modelViewChangedFn,
TTapEventInfoFn const & tapEventFn,
TUserPositionChangedFn const & positionChangedFn,
@@ -82,7 +83,7 @@ public:
bool allow3dBuildings,
bool trafficEnabled,
bool blockTapEvents)
- : BaseRenderer::Params(commutator, factory, texMng)
+ : BaseRenderer::Params(apiVersion, commutator, factory, texMng)
, m_myPositionParams(move(myPositionParams))
, m_viewport(viewport)
, m_modelViewChangedFn(modelViewChangedFn)
@@ -96,7 +97,7 @@ public:
{}
MyPositionController::Params m_myPositionParams;
- Viewport m_viewport;
+ dp::Viewport m_viewport;
TModelViewChanged m_modelViewChangedFn;
TTapEventInfoFn m_tapEventFn;
TUserPositionChangedFn m_positionChangedFn;
@@ -267,7 +268,7 @@ private:
drape_ptr<SelectionShape> m_selectionShape;
drape_ptr<RouteRenderer> m_routeRenderer;
drape_ptr<TrafficRenderer> m_trafficRenderer;
- drape_ptr<Framebuffer> m_framebuffer;
+ drape_ptr<dp::Framebuffer> m_framebuffer;
drape_ptr<ScreenQuadRenderer> m_screenQuadRenderer;
drape_ptr<GpsTrackRenderer> m_gpsTrackRenderer;
drape_ptr<DrapeApiRenderer> m_drapeApiRenderer;
@@ -284,7 +285,7 @@ private:
bool m_choosePositionMode;
- Viewport m_viewport;
+ dp::Viewport m_viewport;
UserEventStream m_userEventStream;
TModelViewChanged m_modelViewChangedFn;
TTapEventInfoFn m_tapEventInfoFn;
diff --git a/drape_frontend/message_subclasses.hpp b/drape_frontend/message_subclasses.hpp
index ec2388fb1e..17b9ea5c3d 100644
--- a/drape_frontend/message_subclasses.hpp
+++ b/drape_frontend/message_subclasses.hpp
@@ -18,7 +18,6 @@
#include "drape_frontend/traffic_generator.hpp"
#include "drape_frontend/user_marks_provider.hpp"
#include "drape_frontend/user_mark_shapes.hpp"
-#include "drape_frontend/viewport.hpp"
#include "geometry/polyline2d.hpp"
#include "geometry/rect2d.hpp"
@@ -28,6 +27,7 @@
#include "drape/glstate.hpp"
#include "drape/pointers.hpp"
#include "drape/render_bucket.hpp"
+#include "drape/viewport.hpp"
#include "platform/location.hpp"
diff --git a/drape_frontend/shaders/dashed_line.fsh.glsl b/drape_frontend/shaders/dashed_line.fsh.glsl
index c787cebf8d..742ef26de4 100644
--- a/drape_frontend/shaders/dashed_line.fsh.glsl
+++ b/drape_frontend/shaders/dashed_line.fsh.glsl
@@ -11,8 +11,12 @@ const float aaPixelsCount = 2.5;
void main()
{
vec4 color = texture2D(u_colorTex, v_colorTexCoord);
- vec4 mask = texture2D(u_maskTex, v_maskTexCoord);
- color.a = color.a * mask.a * u_opacity;
+#ifdef GLES3
+ float mask = texture2D(u_maskTex, v_maskTexCoord).r;
+#else
+ float mask = texture2D(u_maskTex, v_maskTexCoord).a;
+#endif
+ color.a = color.a * mask * u_opacity;
float currentW = abs(v_halfLength.x);
float diff = v_halfLength.y - currentW;
diff --git a/drape_frontend/shaders/text.fsh.glsl b/drape_frontend/shaders/text.fsh.glsl
index ca47366d34..edb8220c6f 100755
--- a/drape_frontend/shaders/text.fsh.glsl
+++ b/drape_frontend/shaders/text.fsh.glsl
@@ -18,7 +18,11 @@ void main()
#else
lowp vec4 glyphColor = texture2D(u_colorTex, v_colorTexCoord);
#endif
+#ifdef GLES3
+ float dist = texture2D(u_maskTex, v_maskTexCoord).r;
+#else
float dist = texture2D(u_maskTex, v_maskTexCoord).a;
+#endif
float alpha = smoothstep(u_contrastGamma.x - u_contrastGamma.y, u_contrastGamma.x + u_contrastGamma.y, dist) * u_opacity;
glyphColor.a *= alpha;
gl_FragColor = glyphColor;
diff --git a/drape_frontend/shaders/text_fixed.fsh.glsl b/drape_frontend/shaders/text_fixed.fsh.glsl
index 7931b21546..1fe61a0eeb 100755
--- a/drape_frontend/shaders/text_fixed.fsh.glsl
+++ b/drape_frontend/shaders/text_fixed.fsh.glsl
@@ -11,14 +11,18 @@ uniform sampler2D u_maskTex;
uniform float u_opacity;
uniform vec2 u_contrastGamma;
-void main (void)
+void main()
{
#ifdef ENABLE_VTF
lowp vec4 glyphColor = v_color;
#else
lowp vec4 glyphColor = texture2D(u_colorTex, v_colorTexCoord);
#endif
+#ifdef GLES3
+ float alpha = texture2D(u_maskTex, v_maskTexCoord).r;
+#else
float alpha = texture2D(u_maskTex, v_maskTexCoord).a;
+#endif
glyphColor.a *= u_opacity * alpha;
gl_FragColor = glyphColor;
}
diff --git a/drape_frontend/viewport.cpp b/drape_frontend/viewport.cpp
deleted file mode 100644
index c0ff7e7c10..0000000000
--- a/drape_frontend/viewport.cpp
+++ /dev/null
@@ -1,46 +0,0 @@
-#include "drape_frontend/viewport.hpp"
-#include "drape/glfunctions.hpp"
-
-namespace df
-{
-
-Viewport::Viewport(uint32_t x0, uint32_t y0,
- uint32_t w, uint32_t h)
- : m_zero(x0, y0)
- , m_size(w, h)
-{
-}
-
-void Viewport::SetViewport(uint32_t x0, uint32_t y0, uint32_t w, uint32_t h)
-{
- m_zero = m2::PointU(x0 ,y0);
- m_size = m2::PointU(w, h);
-}
-
-uint32_t Viewport::GetX0() const
-{
- return m_zero.x;
-}
-
-uint32_t Viewport::GetY0() const
-{
- return m_zero.y;
-}
-
-uint32_t Viewport::GetWidth() const
-{
- return m_size.x;
-}
-
-uint32_t Viewport::GetHeight() const
-{
- return m_size.y;
-}
-
-void Viewport::Apply() const
-{
- GLCHECK(GLFunctions::glViewport(GetX0(), GetY0(), GetWidth(), GetHeight()));
- GLCHECK(GLFunctions::glScissor(GetX0(), GetY0(), GetWidth(), GetHeight()));
-}
-
-} // namespace df
diff --git a/drape_frontend/viewport.hpp b/drape_frontend/viewport.hpp
deleted file mode 100644
index d867b8157c..0000000000
--- a/drape_frontend/viewport.hpp
+++ /dev/null
@@ -1,37 +0,0 @@
-#pragma once
-
-#include "geometry/point2d.hpp"
-
-namespace df
-{
-
-// Pixel ratio independent viewport implementation
-// pixelRatio is ratio between physical pixels and device-independent
-// pixels for the window. On retina displays pixelRation equal 2.0, In common equal 1.0
-class Viewport
-{
-public:
- // x0, y0, w, h is device-independent pixels
- Viewport(uint32_t x0, uint32_t y0,
- uint32_t w, uint32_t h);
-
- ///@{ in surface pixels
- /// on iOS we must mul this on scaleFactor
- /// on android we get true size from surface
- void SetViewport(uint32_t x0, uint32_t y0, uint32_t w, uint32_t h);
-
- uint32_t GetX0() const;
- uint32_t GetY0() const;
- uint32_t GetWidth() const;
- uint32_t GetHeight() const;
- ///@}
- // Apply viewport to graphics pipeline
- // with convert start poin and size to physical pixels
- void Apply() const;
-
-private:
- m2::PointU m_zero;
- m2::PointU m_size;
-};
-
-} // namespace df
diff --git a/iphone/Maps/Classes/EAGLView.h b/iphone/Maps/Classes/EAGLView.h
index 94eaf07698..6387091a5c 100644
--- a/iphone/Maps/Classes/EAGLView.h
+++ b/iphone/Maps/Classes/EAGLView.h
@@ -1,8 +1,11 @@
#import "MWMMapWidgets.h"
-#include "../../std/shared_ptr.hpp"
-#include "../../indexer/map_style.hpp"
-#include "../../drape/pointers.hpp"
+#include "drape/pointers.hpp"
+#include "drape/drape_global.hpp"
+
+#include "indexer/map_style.hpp"
+
+#include "std/shared_ptr.hpp"
namespace dp
{
@@ -14,6 +17,7 @@ namespace dp
// Note that setting the view non-opaque will only work if the EAGL surface has an alpha channel.
@interface EAGLView : UIView
{
+ dp::ApiVersion m_apiVersion;
drape_ptr<dp::ThreadSafeFactory> m_factory;
// Do not call onSize from layoutSubViews when real size wasn't changed.
// It's possible when we add/remove subviews (bookmark balloons) and it hangs the map without this check
diff --git a/iphone/Maps/Classes/EAGLView.mm b/iphone/Maps/Classes/EAGLView.mm
index 0a498b13b6..beac617528 100644
--- a/iphone/Maps/Classes/EAGLView.mm
+++ b/iphone/Maps/Classes/EAGLView.mm
@@ -59,9 +59,22 @@ double getExactDPI(double contentScaleFactor)
return self;
}
+- (dp::ApiVersion)getSupportedApiVersion
+{
+ dp::ApiVersion apiVersion = dp::ApiVersion::OpenGLES2;
+ EAGLContext * tempContext = [[EAGLContext alloc] initWithAPI:kEAGLRenderingAPIOpenGLES3];
+ if (tempContext != nil)
+ {
+ tempContext = nil;
+ apiVersion = dp::ApiVersion::OpenGLES3;
+ }
+ return apiVersion;
+}
+
- (void)initialize
{
lastViewSize = CGRectZero;
+ m_apiVersion = [self getSupportedApiVersion];
// Setup Layer Properties
CAEAGLLayer * eaglLayer = (CAEAGLLayer *)self.layer;
@@ -73,7 +86,7 @@ double getExactDPI(double contentScaleFactor)
// Correct retina display support in opengl renderbuffer
self.contentScaleFactor = [[UIScreen mainScreen] nativeScale];
- m_factory = make_unique_dp<dp::ThreadSafeFactory>(new iosOGLContextFactory(eaglLayer));
+ m_factory = make_unique_dp<dp::ThreadSafeFactory>(new iosOGLContextFactory(eaglLayer, m_apiVersion));
}
- (void)createDrapeEngineWithWidth:(int)width height:(int)height
@@ -81,6 +94,7 @@ double getExactDPI(double contentScaleFactor)
LOG(LINFO, ("EAGLView createDrapeEngine Started"));
Framework::DrapeCreationParams p;
+ p.m_apiVersion = m_apiVersion;
p.m_surfaceWidth = width;
p.m_surfaceHeight = height;
p.m_visualScale = dp::VisualScale(getExactDPI(self.contentScaleFactor));
diff --git a/iphone/Maps/Classes/iosOGLContext.h b/iphone/Maps/Classes/iosOGLContext.h
index a6e64e8f16..408e041dcf 100644
--- a/iphone/Maps/Classes/iosOGLContext.h
+++ b/iphone/Maps/Classes/iosOGLContext.h
@@ -1,17 +1,18 @@
#pragma once
-#import "drape/oglcontext.hpp"
+#include "drape/drape_global.hpp"
+#include "drape/oglcontext.hpp"
+#include "drape/glIncludes.hpp"
#import <QuartzCore/CAEAGLLayer.h>
-#import <OpenGLES/ES2/gl.h>
-#import <OpenGLES/ES2/glext.h>
-#include "std/atomic.hpp"
+#include <atomic>
class iosOGLContext : public dp::OGLContext
{
public:
- iosOGLContext(CAEAGLLayer * layer, iosOGLContext * contextToShareWith, bool needBuffers = false);
+ iosOGLContext(CAEAGLLayer * layer, dp::ApiVersion apiVersion,
+ iosOGLContext * contextToShareWith, bool needBuffers = false);
~iosOGLContext();
virtual void makeCurrent();
@@ -22,6 +23,7 @@ public:
void setPresentAvailable(bool available);
private:
+ dp::ApiVersion m_apiVersion;
CAEAGLLayer * m_layer;
EAGLContext * m_nativeContext;
@@ -37,5 +39,5 @@ private:
GLuint m_frameBufferId;
//@} buffers
- atomic<bool> m_presentAvailable;
+ std::atomic<bool> m_presentAvailable;
};
diff --git a/iphone/Maps/Classes/iosOGLContext.mm b/iphone/Maps/Classes/iosOGLContext.mm
index 74e81a5cd3..f7e3ee403c 100644
--- a/iphone/Maps/Classes/iosOGLContext.mm
+++ b/iphone/Maps/Classes/iosOGLContext.mm
@@ -4,8 +4,10 @@
#import "drape/glfunctions.hpp"
-iosOGLContext::iosOGLContext(CAEAGLLayer * layer, iosOGLContext * contextToShareWith, bool needBuffers)
- : m_layer(layer)
+iosOGLContext::iosOGLContext(CAEAGLLayer * layer, dp::ApiVersion apiVersion,
+ iosOGLContext * contextToShareWith, bool needBuffers)
+ : m_apiVersion(apiVersion)
+ , m_layer(layer)
, m_nativeContext(NULL)
, m_needBuffers(needBuffers)
, m_hasBuffers(false)
@@ -14,13 +16,21 @@ iosOGLContext::iosOGLContext(CAEAGLLayer * layer, iosOGLContext * contextToShare
, m_frameBufferId(0)
, m_presentAvailable(true)
{
+ EAGLRenderingAPI api;
+ if (m_apiVersion == dp::ApiVersion::OpenGLES3)
+ api = kEAGLRenderingAPIOpenGLES3;
+ else
+ api = kEAGLRenderingAPIOpenGLES2;
+
if (contextToShareWith != NULL)
{
- m_nativeContext = [[EAGLContext alloc] initWithAPI:kEAGLRenderingAPIOpenGLES2
+ m_nativeContext = [[EAGLContext alloc] initWithAPI:api
sharegroup: contextToShareWith->m_nativeContext.sharegroup];
}
else
- m_nativeContext = [[EAGLContext alloc] initWithAPI:kEAGLRenderingAPIOpenGLES2];
+ {
+ m_nativeContext = [[EAGLContext alloc] initWithAPI:api];
+ }
}
iosOGLContext::~iosOGLContext()
@@ -47,14 +57,20 @@ void iosOGLContext::present()
ASSERT(m_nativeContext != NULL, ());
ASSERT(m_renderBufferId, ());
GLenum const discards[] = { GL_DEPTH_ATTACHMENT, GL_COLOR_ATTACHMENT0 };
- GLCHECK(glDiscardFramebufferEXT(GL_FRAMEBUFFER, 1, discards));
+ if (m_apiVersion == dp::ApiVersion::OpenGLES3)
+ GLCHECK(glInvalidateFramebuffer(GL_FRAMEBUFFER, 1, discards));
+ else
+ GLCHECK(glDiscardFramebufferEXT(GL_FRAMEBUFFER, 1, discards));
glBindRenderbuffer(GL_RENDERBUFFER, m_renderBufferId);
if (m_presentAvailable)
[m_nativeContext presentRenderbuffer: GL_RENDERBUFFER];
- GLCHECK(glDiscardFramebufferEXT(GL_FRAMEBUFFER, 1, discards + 1));
+ if (m_apiVersion == dp::ApiVersion::OpenGLES3)
+ GLCHECK(glInvalidateFramebuffer(GL_FRAMEBUFFER, 1, discards + 1));
+ else
+ GLCHECK(glDiscardFramebufferEXT(GL_FRAMEBUFFER, 1, discards + 1));
}
void iosOGLContext::setDefaultFramebuffer()
diff --git a/iphone/Maps/Classes/iosOGLContextFactory.h b/iphone/Maps/Classes/iosOGLContextFactory.h
index 385eb63a25..8c0346d856 100644
--- a/iphone/Maps/Classes/iosOGLContextFactory.h
+++ b/iphone/Maps/Classes/iosOGLContextFactory.h
@@ -3,6 +3,7 @@
#import "iosOGLContext.h"
#include "drape/oglcontextfactory.hpp"
+#include "drape/drape_global.hpp"
#include "std/condition_variable.hpp"
#include "std/mutex.hpp"
@@ -10,7 +11,7 @@
class iosOGLContextFactory: public dp::OGLContextFactory
{
public:
- iosOGLContextFactory(CAEAGLLayer * layer);
+ iosOGLContextFactory(CAEAGLLayer * layer, dp::ApiVersion apiVersion);
~iosOGLContextFactory();
dp::OGLContext * getDrawContext() override;
@@ -25,6 +26,7 @@ public:
private:
CAEAGLLayer * m_layer;
+ dp::ApiVersion m_apiVersion;
iosOGLContext * m_drawContext;
iosOGLContext * m_uploadContext;
diff --git a/iphone/Maps/Classes/iosOGLContextFactory.mm b/iphone/Maps/Classes/iosOGLContextFactory.mm
index 23f8cb4a2a..69d0bf8e26 100644
--- a/iphone/Maps/Classes/iosOGLContextFactory.mm
+++ b/iphone/Maps/Classes/iosOGLContextFactory.mm
@@ -1,7 +1,8 @@
#import "iosOGLContextFactory.h"
-iosOGLContextFactory::iosOGLContextFactory(CAEAGLLayer * layer)
+iosOGLContextFactory::iosOGLContextFactory(CAEAGLLayer * layer, dp::ApiVersion apiVersion)
: m_layer(layer)
+ , m_apiVersion(apiVersion)
, m_drawContext(nullptr)
, m_uploadContext(nullptr)
, m_isInitialized(false)
@@ -16,14 +17,14 @@ iosOGLContextFactory::~iosOGLContextFactory()
dp::OGLContext * iosOGLContextFactory::getDrawContext()
{
if (m_drawContext == nullptr)
- m_drawContext = new iosOGLContext(m_layer, m_uploadContext, true);
+ m_drawContext = new iosOGLContext(m_layer, m_apiVersion, m_uploadContext, true);
return m_drawContext;
}
dp::OGLContext * iosOGLContextFactory::getResourcesUploadContext()
{
if (m_uploadContext == nullptr)
- m_uploadContext = new iosOGLContext(m_layer, m_drawContext, false);
+ m_uploadContext = new iosOGLContext(m_layer, m_apiVersion, m_drawContext, false);
return m_uploadContext;
}
diff --git a/map/framework.cpp b/map/framework.cpp
index 98b2ee1fe1..fbb7455a62 100644
--- a/map/framework.cpp
+++ b/map/framework.cpp
@@ -1854,16 +1854,16 @@ void Framework::CreateDrapeEngine(ref_ptr<dp::OGLContextFactory> contextFactory,
double const fontsScaleFactor = LoadLargeFontsSize() ? kLargeFontsScaleFactor : 1.0;
- df::DrapeEngine::Params p(contextFactory,
- make_ref(&m_stringsBundle),
- df::Viewport(0, 0, params.m_surfaceWidth, params.m_surfaceHeight),
- df::MapDataProvider(idReadFn, featureReadFn, isCountryLoadedByNameFn, updateCurrentCountryFn),
- params.m_hints, params.m_visualScale, fontsScaleFactor, move(params.m_widgetsInitInfo),
- make_pair(params.m_initialMyPositionState, params.m_hasMyPositionState),
- move(myPositionModeChangedFn), allow3dBuildings, trafficEnabled, params.m_isChoosePositionMode,
- params.m_isChoosePositionMode, GetSelectedFeatureTriangles(),
- m_routingSession.IsActive() && m_routingSession.IsFollowing(), isAutozoomEnabled,
- simplifiedTrafficColors, move(overlaysShowStatsFn));
+ df::DrapeEngine::Params p(
+ params.m_apiVersion, contextFactory, make_ref(&m_stringsBundle),
+ dp::Viewport(0, 0, params.m_surfaceWidth, params.m_surfaceHeight),
+ df::MapDataProvider(idReadFn, featureReadFn, isCountryLoadedByNameFn, updateCurrentCountryFn),
+ params.m_hints, params.m_visualScale, fontsScaleFactor, move(params.m_widgetsInitInfo),
+ make_pair(params.m_initialMyPositionState, params.m_hasMyPositionState),
+ move(myPositionModeChangedFn), allow3dBuildings, trafficEnabled,
+ params.m_isChoosePositionMode, params.m_isChoosePositionMode, GetSelectedFeatureTriangles(),
+ m_routingSession.IsActive() && m_routingSession.IsFollowing(), isAutozoomEnabled,
+ simplifiedTrafficColors, move(overlaysShowStatsFn));
m_drapeEngine = make_unique_dp<df::DrapeEngine>(move(p));
m_drapeEngine->SetModelViewListener([this](ScreenBase const & screen)
diff --git a/map/framework.hpp b/map/framework.hpp
index 18534cb12c..5fd6cf0623 100644
--- a/map/framework.hpp
+++ b/map/framework.hpp
@@ -462,6 +462,7 @@ private:
public:
struct DrapeCreationParams
{
+ dp::ApiVersion m_apiVersion = dp::ApiVersion::OpenGLES2;
float m_visualScale = 1.0f;
int m_surfaceWidth = 0;
int m_surfaceHeight = 0;
diff --git a/qt/qt_common/map_widget.cpp b/qt/qt_common/map_widget.cpp
index 1adb8fd186..8d7243bf27 100644
--- a/qt/qt_common/map_widget.cpp
+++ b/qt/qt_common/map_widget.cpp
@@ -92,6 +92,7 @@ void MapWidget::BindSlider(ScaleSlider & slider)
void MapWidget::CreateEngine()
{
Framework::DrapeCreationParams p;
+ p.m_apiVersion = dp::ApiVersion::OpenGLES2;
p.m_surfaceWidth = m_ratio * width();
p.m_surfaceHeight = m_ratio * height();
p.m_visualScale = m_ratio;
diff --git a/testing/testing.hpp b/testing/testing.hpp
index c8110f15d0..4b0c872752 100644
--- a/testing/testing.hpp
+++ b/testing/testing.hpp
@@ -35,7 +35,7 @@ namespace my
inline void OnTestFailed(SrcPoint const & srcPoint, string const & msg)
{
LOG(LINFO, ("FAILED"));
- LOG(LINFO, (DebugPrint(srcPoint.FileName()) + ":" + DebugPrint(srcPoint.Line()), msg));
+ LOG(LINFO, (::DebugPrint(srcPoint.FileName()) + ":" + ::DebugPrint(srcPoint.Line()), msg));
MYTHROW(TestFailureException, (srcPoint.FileName(), srcPoint.Line(), msg));
}
}
diff --git a/xcode/drape/drape.xcodeproj/project.pbxproj b/xcode/drape/drape.xcodeproj/project.pbxproj
index c845bcd9f5..b2e7894931 100644
--- a/xcode/drape/drape.xcodeproj/project.pbxproj
+++ b/xcode/drape/drape.xcodeproj/project.pbxproj
@@ -12,6 +12,10 @@
3492DA0B1CA2D91C00C1F3B3 /* visual_scale.hpp in Headers */ = {isa = PBXBuildFile; fileRef = 3492DA0A1CA2D91C00C1F3B3 /* visual_scale.hpp */; };
34C624C91DABDB2000510300 /* static_texture.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 34C624C71DABDB2000510300 /* static_texture.cpp */; };
34C624CA1DABDB2000510300 /* static_texture.hpp in Headers */ = {isa = PBXBuildFile; fileRef = 34C624C81DABDB2000510300 /* static_texture.hpp */; };
+ 4513BF0B1EC2F0760066565C /* framebuffer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4513BF071EC2F0760066565C /* framebuffer.cpp */; };
+ 4513BF0C1EC2F0760066565C /* framebuffer.hpp in Headers */ = {isa = PBXBuildFile; fileRef = 4513BF081EC2F0760066565C /* framebuffer.hpp */; };
+ 4513BF0D1EC2F0760066565C /* viewport.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4513BF091EC2F0760066565C /* viewport.cpp */; };
+ 4513BF0E1EC2F0760066565C /* viewport.hpp in Headers */ = {isa = PBXBuildFile; fileRef = 4513BF0A1EC2F0760066565C /* viewport.hpp */; };
45201E951CE605B1008A4842 /* constants.hpp in Headers */ = {isa = PBXBuildFile; fileRef = 45201E941CE605B1008A4842 /* constants.hpp */; };
45FA6D141EB3690B00AE67BD /* gpu_program_info.hpp in Headers */ = {isa = PBXBuildFile; fileRef = 45FA6D131EB3690B00AE67BD /* gpu_program_info.hpp */; };
670947231BDF9A4F005014C0 /* data_buffer_impl.hpp in Headers */ = {isa = PBXBuildFile; fileRef = 670947151BDF9A4F005014C0 /* data_buffer_impl.hpp */; };
@@ -115,6 +119,10 @@
34AF87CA1DBE4F4900E5E7DC /* common-release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = "common-release.xcconfig"; path = "../common-release.xcconfig"; sourceTree = "<group>"; };
34C624C71DABDB2000510300 /* static_texture.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = static_texture.cpp; sourceTree = "<group>"; };
34C624C81DABDB2000510300 /* static_texture.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = static_texture.hpp; sourceTree = "<group>"; };
+ 4513BF071EC2F0760066565C /* framebuffer.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = framebuffer.cpp; sourceTree = "<group>"; };
+ 4513BF081EC2F0760066565C /* framebuffer.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = framebuffer.hpp; sourceTree = "<group>"; };
+ 4513BF091EC2F0760066565C /* viewport.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = viewport.cpp; sourceTree = "<group>"; };
+ 4513BF0A1EC2F0760066565C /* viewport.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = viewport.hpp; sourceTree = "<group>"; };
45201E941CE605B1008A4842 /* constants.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = constants.hpp; sourceTree = "<group>"; };
45FA6D131EB3690B00AE67BD /* gpu_program_info.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = gpu_program_info.hpp; sourceTree = "<group>"; };
670947151BDF9A4F005014C0 /* data_buffer_impl.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = data_buffer_impl.hpp; sourceTree = "<group>"; };
@@ -243,6 +251,10 @@
6729A4F31A691F6A007D5872 /* drape */ = {
isa = PBXGroup;
children = (
+ 4513BF071EC2F0760066565C /* framebuffer.cpp */,
+ 4513BF081EC2F0760066565C /* framebuffer.hpp */,
+ 4513BF091EC2F0760066565C /* viewport.cpp */,
+ 4513BF0A1EC2F0760066565C /* viewport.hpp */,
45FA6D131EB3690B00AE67BD /* gpu_program_info.hpp */,
34C624C71DABDB2000510300 /* static_texture.cpp */,
34C624C81DABDB2000510300 /* static_texture.hpp */,
@@ -403,6 +415,7 @@
6729A5901A69213A007D5872 /* object_pool.hpp in Headers */,
670947261BDF9A4F005014C0 /* bidi.hpp in Headers */,
6729A5A11A69213A007D5872 /* shader.hpp in Headers */,
+ 4513BF0C1EC2F0760066565C /* framebuffer.hpp in Headers */,
6729A5641A69213A007D5872 /* attribute_buffer_mutator.hpp in Headers */,
6729A5811A69213A007D5872 /* glsl_types.hpp in Headers */,
6729A57A1A69213A007D5872 /* glconstants.hpp in Headers */,
@@ -411,6 +424,7 @@
6729A5891A69213A007D5872 /* gpu_program_manager.hpp in Headers */,
6729A5AB1A69213A007D5872 /* texture.hpp in Headers */,
6729A57F1A69213A007D5872 /* glIncludes.hpp in Headers */,
+ 4513BF0E1EC2F0760066565C /* viewport.hpp in Headers */,
6729A5A91A69213A007D5872 /* texture_of_colors.hpp in Headers */,
6729A5871A69213A007D5872 /* gpu_buffer.hpp in Headers */,
BB035F6C1E3A2A5C00519962 /* drape_diagnostics.hpp in Headers */,
@@ -486,8 +500,10 @@
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 */,
6729A5981A69213A007D5872 /* pointers.cpp in Sources */,
6729A5881A69213A007D5872 /* gpu_program_manager.cpp in Sources */,
6729A5A41A69213A007D5872 /* symbols_texture.cpp in Sources */,
diff --git a/xcode/drape_frontend/drape_frontend.xcodeproj/project.pbxproj b/xcode/drape_frontend/drape_frontend.xcodeproj/project.pbxproj
index 5340b67a7b..40fb7faddc 100644
--- a/xcode/drape_frontend/drape_frontend.xcodeproj/project.pbxproj
+++ b/xcode/drape_frontend/drape_frontend.xcodeproj/project.pbxproj
@@ -121,8 +121,6 @@
670947D71BDF9BE1005014C0 /* user_event_stream.hpp in Headers */ = {isa = PBXBuildFile; fileRef = 670947881BDF9BE0005014C0 /* user_event_stream.hpp */; };
670947D81BDF9BE1005014C0 /* user_mark_shapes.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 670947891BDF9BE0005014C0 /* user_mark_shapes.cpp */; };
670947D91BDF9BE1005014C0 /* user_mark_shapes.hpp in Headers */ = {isa = PBXBuildFile; fileRef = 6709478A1BDF9BE0005014C0 /* user_mark_shapes.hpp */; };
- 670947DC1BDF9BE1005014C0 /* viewport.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 6709478D1BDF9BE0005014C0 /* viewport.cpp */; };
- 670947DD1BDF9BE1005014C0 /* viewport.hpp in Headers */ = {isa = PBXBuildFile; fileRef = 6709478E1BDF9BE1005014C0 /* viewport.hpp */; };
670947DF1BDF9BE1005014C0 /* visual_params.hpp in Headers */ = {isa = PBXBuildFile; fileRef = 670947901BDF9BE1005014C0 /* visual_params.hpp */; };
670947E41BDF9BEC005014C0 /* engine_context.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 670947E01BDF9BEC005014C0 /* engine_context.cpp */; };
670947E51BDF9BEC005014C0 /* engine_context.hpp in Headers */ = {isa = PBXBuildFile; fileRef = 670947E11BDF9BEC005014C0 /* engine_context.hpp */; };
@@ -193,8 +191,6 @@
672D249B1E892768004BB7B1 /* overlays_tracker.hpp in Headers */ = {isa = PBXBuildFile; fileRef = 672D24991E892768004BB7B1 /* overlays_tracker.hpp */; };
6743D36D1C3A9F090095054B /* arrow3d.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 6743D3671C3A9F090095054B /* arrow3d.cpp */; };
6743D36E1C3A9F090095054B /* arrow3d.hpp in Headers */ = {isa = PBXBuildFile; fileRef = 6743D3681C3A9F090095054B /* arrow3d.hpp */; };
- 6743D36F1C3A9F090095054B /* framebuffer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 6743D3691C3A9F090095054B /* framebuffer.cpp */; };
- 6743D3701C3A9F090095054B /* framebuffer.hpp in Headers */ = {isa = PBXBuildFile; fileRef = 6743D36A1C3A9F090095054B /* framebuffer.hpp */; };
675D21661BFB785900717E4F /* ruler.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 670948331BDF9C48005014C0 /* ruler.cpp */; };
675D218C1BFB871D00717E4F /* proto_to_styles.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 675D21851BFB871D00717E4F /* proto_to_styles.cpp */; };
675D218D1BFB871D00717E4F /* proto_to_styles.hpp in Headers */ = {isa = PBXBuildFile; fileRef = 675D21861BFB871D00717E4F /* proto_to_styles.hpp */; };
@@ -416,8 +412,6 @@
6709478A1BDF9BE0005014C0 /* user_mark_shapes.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = user_mark_shapes.hpp; sourceTree = "<group>"; };
6709478B1BDF9BE0005014C0 /* user_marks_provider.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = user_marks_provider.cpp; sourceTree = "<group>"; };
6709478C1BDF9BE0005014C0 /* user_marks_provider.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = user_marks_provider.hpp; sourceTree = "<group>"; };
- 6709478D1BDF9BE0005014C0 /* viewport.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = viewport.cpp; sourceTree = "<group>"; };
- 6709478E1BDF9BE1005014C0 /* viewport.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = viewport.hpp; sourceTree = "<group>"; };
6709478F1BDF9BE1005014C0 /* visual_params.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = visual_params.cpp; sourceTree = "<group>"; };
670947901BDF9BE1005014C0 /* visual_params.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = visual_params.hpp; sourceTree = "<group>"; };
670947E01BDF9BEC005014C0 /* engine_context.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = engine_context.cpp; sourceTree = "<group>"; };
@@ -494,8 +488,6 @@
672D24991E892768004BB7B1 /* overlays_tracker.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = overlays_tracker.hpp; sourceTree = "<group>"; };
6743D3671C3A9F090095054B /* arrow3d.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = arrow3d.cpp; sourceTree = "<group>"; };
6743D3681C3A9F090095054B /* arrow3d.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = arrow3d.hpp; sourceTree = "<group>"; };
- 6743D3691C3A9F090095054B /* framebuffer.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = framebuffer.cpp; sourceTree = "<group>"; };
- 6743D36A1C3A9F090095054B /* framebuffer.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = framebuffer.hpp; sourceTree = "<group>"; };
675D21851BFB871D00717E4F /* proto_to_styles.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = proto_to_styles.cpp; sourceTree = "<group>"; };
675D21861BFB871D00717E4F /* proto_to_styles.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = proto_to_styles.hpp; sourceTree = "<group>"; };
675D21871BFB871D00717E4F /* rect.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = rect.h; sourceTree = "<group>"; };
@@ -653,8 +645,6 @@
670E39391C46C59000E9C0A6 /* color_constants.hpp */,
6743D3671C3A9F090095054B /* arrow3d.cpp */,
6743D3681C3A9F090095054B /* arrow3d.hpp */,
- 6743D3691C3A9F090095054B /* framebuffer.cpp */,
- 6743D36A1C3A9F090095054B /* framebuffer.hpp */,
45580AB91E28DB2600CD535D /* scenario_manager.hpp */,
45580AB81E28DB2600CD535D /* scenario_manager.cpp */,
F6B2830B1C1B04680081957A /* gps_track_point.hpp */,
@@ -751,8 +741,6 @@
6709478A1BDF9BE0005014C0 /* user_mark_shapes.hpp */,
6709478B1BDF9BE0005014C0 /* user_marks_provider.cpp */,
6709478C1BDF9BE0005014C0 /* user_marks_provider.hpp */,
- 6709478D1BDF9BE0005014C0 /* viewport.cpp */,
- 6709478E1BDF9BE1005014C0 /* viewport.hpp */,
6709478F1BDF9BE1005014C0 /* visual_params.cpp */,
670947901BDF9BE1005014C0 /* visual_params.hpp */,
);
@@ -914,7 +902,6 @@
670947C11BDF9BE1005014C0 /* shape_view_params.hpp in Headers */,
670948461BDF9C48005014C0 /* gui_text.hpp in Headers */,
670947E51BDF9BEC005014C0 /* engine_context.hpp in Headers */,
- 6743D3701C3A9F090095054B /* framebuffer.hpp in Headers */,
F6B283141C1B04680081957A /* gps_track_shape.hpp in Headers */,
670947BE1BDF9BE1005014C0 /* rule_drawer.hpp in Headers */,
6709487C1BDF9C7F005014C0 /* pen_info.hpp in Headers */,
@@ -955,7 +942,6 @@
453EEA6E1E3A28F400505E09 /* colored_symbol_shape.hpp in Headers */,
670948201BDF9C39005014C0 /* value_mapping.hpp in Headers */,
670948441BDF9C48005014C0 /* drape_gui.hpp in Headers */,
- 670947DD1BDF9BE1005014C0 /* viewport.hpp in Headers */,
670947B41BDF9BE1005014C0 /* render_group.hpp in Headers */,
452C9EE51CEDCF3200A55E57 /* sequence_animation.hpp in Headers */,
670948771BDF9C7F005014C0 /* glyph_cache_impl.hpp in Headers */,
@@ -1120,10 +1106,8 @@
347F52111DC2334A0064B273 /* drape_api.cpp in Sources */,
347F520F1DC2334A0064B273 /* drape_api_renderer.cpp in Sources */,
347F520D1DC2334A0064B273 /* drape_api_builder.cpp in Sources */,
- 670947DC1BDF9BE1005014C0 /* viewport.cpp in Sources */,
670947CA1BDF9BE1005014C0 /* threads_commutator.cpp in Sources */,
670947981BDF9BE1005014C0 /* map_data_provider.cpp in Sources */,
- 6743D36F1C3A9F090095054B /* framebuffer.cpp in Sources */,
670948181BDF9C39005014C0 /* interpolations.cpp in Sources */,
670948021BDF9BF5005014C0 /* drape_engine.cpp in Sources */,
56D545661C74A44900E3719C /* overlay_batcher.cpp in Sources */,