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-24 12:49:34 +0300
committerGitHub <noreply@github.com>2017-05-24 12:49:34 +0300
commit3a00a30e65e65c9120b7ee076bd809f5ac800fee (patch)
treece7bd15f9274fa2e24e7a949159e19d711d56be1
parent3e2f56071e1b6ba52b3a19dc42a6f48197a81404 (diff)
parentd72ab7c8cd8be0eb5a622d9d33ae943b391d5707 (diff)
Merge pull request #6105 from rokuz/fixes-es3-android-freezesbeta-823
Fixed fps fall on Android in ES3 mode
-rw-r--r--drape/glextensions_list.cpp15
-rw-r--r--drape/gpu_buffer.cpp10
-rw-r--r--drape/vertex_array_buffer.cpp3
-rwxr-xr-xdrape_frontend/frontend_renderer.cpp2
4 files changed, 24 insertions, 6 deletions
diff --git a/drape/glextensions_list.cpp b/drape/glextensions_list.cpp
index 69647f4fa5..b950b22c27 100644
--- a/drape/glextensions_list.cpp
+++ b/drape/glextensions_list.cpp
@@ -15,18 +15,27 @@ GLExtensionsList::GLExtensionsList(dp::ApiVersion apiVersion)
{
#ifdef OMIM_OS_ANDROID
SetExtension(VertexArrayObject, false);
+ // On some Android devices glMapBufferRange/glMapBuffer works very slow.
+ // We have to substitute these functions to glBufferData/glBufferSubData.
+ SetExtension(MapBuffer, false);
+ SetExtension(MapBufferRange, false);
#else
CheckExtension(VertexArrayObject, "GL_OES_vertex_array_object");
-#endif
CheckExtension(MapBuffer, "GL_OES_mapbuffer");
- CheckExtension(UintIndices, "GL_OES_element_index_uint");
CheckExtension(MapBufferRange, "GL_EXT_map_buffer_range");
+#endif
+ CheckExtension(UintIndices, "GL_OES_element_index_uint");
}
else
{
- SetExtension(VertexArrayObject, true);
+#ifdef OMIM_OS_ANDROID
+ SetExtension(MapBuffer, false);
+ SetExtension(MapBufferRange, false);
+#else
SetExtension(MapBuffer, true);
SetExtension(MapBufferRange, true);
+#endif
+ SetExtension(VertexArrayObject, true);
SetExtension(UintIndices, true);
}
#elif defined(OMIM_OS_WINDOWS)
diff --git a/drape/gpu_buffer.cpp b/drape/gpu_buffer.cpp
index 12afc9109c..6cdb8c648a 100644
--- a/drape/gpu_buffer.cpp
+++ b/drape/gpu_buffer.cpp
@@ -76,6 +76,7 @@ void GPUBuffer::UploadData(void const * data, uint32_t elementCount)
}
void GPUBuffer::Bind() { GLFunctions::glBindBuffer(m_bufferID, glTarget(m_t)); }
+
void * GPUBuffer::Map(uint32_t elementOffset, uint32_t elementCount)
{
#ifdef DEBUG
@@ -90,7 +91,11 @@ void * GPUBuffer::Map(uint32_t elementOffset, uint32_t elementCount)
}
else if (GLFunctions::CurrentApiVersion == dp::ApiVersion::OpenGLES3)
{
- ASSERT(IsMapBufferSupported(), ());
+ if (!IsMapBufferSupported())
+ {
+ m_mappingOffset = elementOffset;
+ return nullptr;
+ }
m_mappingOffset = 0;
uint32_t const elementSize = GetElementSize();
uint32_t const byteOffset = elementOffset * elementSize;
@@ -125,7 +130,7 @@ void GPUBuffer::UpdateData(void * gpuPtr, void const * data, uint32_t elementOff
{
ASSERT(gpuPtr == nullptr, ());
if (byteOffset == 0 && byteCount == byteCapacity)
- GLFunctions::glBufferData(glTarget(m_t), byteCount, data, gl_const::GLStaticDraw);
+ GLFunctions::glBufferData(glTarget(m_t), byteCount, data, gl_const::GLDynamicDraw);
else
GLFunctions::glBufferSubData(glTarget(m_t), byteCount, data, byteOffset);
}
@@ -137,6 +142,7 @@ void GPUBuffer::Unmap()
ASSERT(m_isMapped, ());
m_isMapped = false;
#endif
+
m_mappingOffset = 0;
if (IsMapBufferSupported())
GLFunctions::glUnmapBuffer(glTarget(m_t));
diff --git a/drape/vertex_array_buffer.cpp b/drape/vertex_array_buffer.cpp
index 9da306ec15..aeea0b67f8 100644
--- a/drape/vertex_array_buffer.cpp
+++ b/drape/vertex_array_buffer.cpp
@@ -245,6 +245,7 @@ uint32_t VertexArrayBuffer::GetDynamicBufferOffset(BindingInfo const & bindingIn
}
uint32_t VertexArrayBuffer::GetIndexCount() const { return GetIndexBuffer()->GetCurrentSize(); }
+
void VertexArrayBuffer::UploadIndexes(void const * data, uint32_t count)
{
ASSERT_LESS_OR_EQUAL(count, GetIndexBuffer()->GetAvailableSize(), ());
@@ -317,7 +318,9 @@ void VertexArrayBuffer::Unbind() const
}
void VertexArrayBuffer::BindStaticBuffers() const { BindBuffers(m_staticBuffers); }
+
void VertexArrayBuffer::BindDynamicBuffers() const { BindBuffers(m_dynamicBuffers); }
+
void VertexArrayBuffer::BindBuffers(BuffersMap const & buffers) const
{
for (auto it = buffers.begin(); it != buffers.end(); ++it)
diff --git a/drape_frontend/frontend_renderer.cpp b/drape_frontend/frontend_renderer.cpp
index 4ae75f8c39..ee52189864 100755
--- a/drape_frontend/frontend_renderer.cpp
+++ b/drape_frontend/frontend_renderer.cpp
@@ -1268,7 +1268,7 @@ void FrontendRenderer::PrepareBucket(dp::GLState const & state, drape_ptr<dp::Re
void FrontendRenderer::MergeBuckets()
{
- if (BatchMergeHelper::IsMergeSupported() == false)
+ if (!BatchMergeHelper::IsMergeSupported())
return;
++m_mergeBucketsCounter;