diff --git a/android/jni/rendering.cpp b/android/jni/rendering.cpp index 57a1576147..cbbaaaaded 100644 --- a/android/jni/rendering.cpp +++ b/android/jni/rendering.cpp @@ -10,14 +10,14 @@ shared_ptr CreateResourceManager() { - int bigVBSize = pow(2, ceil(log(15000 * sizeof(yg::gl::Vertex)))); - int bigIBSize = pow(2, ceil(log(30000 * sizeof(unsigned short)))); + int bigVBSize = pow(2, ceil(log(15000.0 * sizeof(yg::gl::Vertex)))); + int bigIBSize = pow(2, ceil(log(30000.0 * sizeof(unsigned short)))); - int smallVBSize = pow(2, ceil(log(1500 * sizeof(yg::gl::Vertex)))); - int smallIBSize = pow(2, ceil(log(3000 * sizeof(unsigned short)))); + int smallVBSize = pow(2, ceil(log(1500.0 * sizeof(yg::gl::Vertex)))); + int smallIBSize = pow(2, ceil(log(3000.0 * sizeof(unsigned short)))); - int blitVBSize = pow(2, ceil(log(10 * sizeof(yg::gl::AuxVertex)))); - int blitIBSize = pow(2, ceil(log(10 * sizeof(unsigned short)))); + int blitVBSize = pow(2, ceil(log(10.0 * sizeof(yg::gl::AuxVertex)))); + int blitIBSize = pow(2, ceil(log(10.0 * sizeof(unsigned short)))); Platform & pl = GetPlatform(); yg::ResourceManager * pRM = new yg::ResourceManager( @@ -26,11 +26,11 @@ shared_ptr CreateResourceManager() blitVBSize, blitIBSize, 10, 512, 256, 6, 512, 256, 4, + pl.TileSize(), pl.TileSize(), pl.MaxTilesCount(), "unicode_blocks.txt", "fonts_whitelist.txt", "fonts_blacklist.txt", - 1 * 1024 * 1024, - 500 * 1024, + 1.5 * 1024 * 1024, yg::Rt8Bpp, !yg::gl::g_isBufferObjectsSupported, !pl.IsMultiSampled()); diff --git a/android/jni/rendering.h b/android/jni/rendering.h index 2cf4619a31..9b7d4dc29f 100644 --- a/android/jni/rendering.h +++ b/android/jni/rendering.h @@ -4,6 +4,7 @@ #include "../../yg/rendercontext.hpp" #include "../../yg/resource_manager.hpp" +#include "../../std/shared_ptr.hpp" shared_ptr CreateResourceManager(); diff --git a/platform/platform.cpp b/platform/platform.cpp index 512b66f55e..aa13252ab5 100644 --- a/platform/platform.cpp +++ b/platform/platform.cpp @@ -102,21 +102,6 @@ string BasePlatformImpl::SkinName() const return "basic.skn"; } -bool BasePlatformImpl::IsMultiSampled() const -{ - return true; -} - -bool BasePlatformImpl::DoPeriodicalUpdate() const -{ - return true; -} - -double BasePlatformImpl::PeriodicalUpdateInterval() const -{ - return 0.3; -} - bool BasePlatformImpl::IsBenchmarking() const { bool res = false; diff --git a/platform/platform.hpp b/platform/platform.hpp index 624a4133bc..2b86b6b126 100644 --- a/platform/platform.hpp +++ b/platform/platform.hpp @@ -60,12 +60,6 @@ public: virtual string SkinName() const = 0; - virtual bool IsMultiSampled() const = 0; - - virtual bool DoPeriodicalUpdate() const = 0; - - virtual double PeriodicalUpdateInterval() const = 0; - virtual void GetFontNames(FilesList & res) const = 0; virtual bool IsBenchmarking() const = 0; @@ -98,9 +92,6 @@ public: virtual double VisualScale() const; virtual string SkinName() const; - virtual bool IsMultiSampled() const; - virtual bool DoPeriodicalUpdate() const; - virtual double PeriodicalUpdateInterval() const; virtual bool IsBenchmarking() const; virtual bool IsVisualLog() const; virtual int ScaleEtalonSize() const; diff --git a/qt/widgets.cpp b/qt/widgets.cpp index 1b0d0c4fbf..9a3ad8fc2a 100644 --- a/qt/widgets.cpp +++ b/qt/widgets.cpp @@ -59,7 +59,7 @@ namespace qt 2 * 1024 * 1024, yg::Rt8Bpp, !yg::gl::g_isBufferObjectsSupported, - !pl.IsMultiSampled())); + true)); Platform::FilesList fonts; pl.GetFontNames(fonts); @@ -68,7 +68,6 @@ namespace qt DrawerYG::params_t p; p.m_resourceManager = m_resourceManager; - p.m_isMultiSampled = false; p.m_frameBuffer = make_shared_ptr(new yg::gl::FrameBuffer(true)); p.m_dynamicPagesCount = 2; p.m_textPagesCount = 2; diff --git a/qt_tstfrm/tstwidgets.cpp b/qt_tstfrm/tstwidgets.cpp index c0fe7fb400..a818058679 100644 --- a/qt_tstfrm/tstwidgets.cpp +++ b/qt_tstfrm/tstwidgets.cpp @@ -63,7 +63,7 @@ void GLDrawWidget::initializeGL() 2 * 1024 * 1024, yg::Rt8Bpp, !yg::gl::g_isBufferObjectsSupported, - !GetPlatform().IsMultiSampled())); + true)); Platform::FilesList fonts; GetPlatform().GetFontNames(fonts); @@ -73,7 +73,6 @@ void GLDrawWidget::initializeGL() DrawerYG::Params params; params.m_resourceManager = m_resourceManager; - params.m_isMultiSampled = false; params.m_frameBuffer = m_frameBuffer; params.m_glyphCacheID = m_resourceManager->guiThreadGlyphCacheID(); diff --git a/yg/geometry_batcher.cpp b/yg/geometry_batcher.cpp index ad9c8dae70..3a1741d16e 100644 --- a/yg/geometry_batcher.cpp +++ b/yg/geometry_batcher.cpp @@ -25,7 +25,7 @@ namespace yg namespace gl { GeometryBatcher::GeometryBatcher(base_t::Params const & params) - : base_t(params), m_isAntiAliased(!params.m_isMultiSampled) + : base_t(params), m_isAntiAliased(true) { reset(-1); applyStates(); diff --git a/yg/renderbuffer.cpp b/yg/renderbuffer.cpp index ecb5f7e5ba..dfaea568d2 100644 --- a/yg/renderbuffer.cpp +++ b/yg/renderbuffer.cpp @@ -40,8 +40,8 @@ namespace yg renderBufferStack.pop_back(); } - RenderBuffer::RenderBuffer(size_t width, size_t height, bool isDepthBuffer, bool isMultiSampled) - : m_isDepthBuffer(isDepthBuffer), m_isMultiSampled(isMultiSampled), m_width(width), m_height(height) + RenderBuffer::RenderBuffer(size_t width, size_t height, bool isDepthBuffer) + : m_isDepthBuffer(isDepthBuffer), m_width(width), m_height(height) { pushCurrent(); #ifdef OMIM_GL_ES @@ -51,20 +51,10 @@ namespace yg GLenum target = GL_RENDERBUFFER_OES; GLenum internalFormat = m_isDepthBuffer ? GL_DEPTH_COMPONENT24_OES : GL_RGBA8_OES; - /// @TODO: fix for android -#ifndef OMIM_OS_ANDROID - if (m_isMultiSampled) - OGLCHECK(glRenderbufferStorageMultisampleAPPLE(target, - 2, - internalFormat, - width, - height)); - else -#endif - OGLCHECK(glRenderbufferStorageOES(GL_RENDERBUFFER_OES, - internalFormat, - width, - height)); + OGLCHECK(glRenderbufferStorageOES(GL_RENDERBUFFER_OES, + internalFormat, + width, + height)); #else OGLCHECK(glGenRenderbuffers(1, &m_id)); makeCurrent(); @@ -72,17 +62,10 @@ namespace yg GLenum target = GL_RENDERBUFFER_EXT; GLenum internalFormat = m_isDepthBuffer ? GL_DEPTH_COMPONENT24 : GL_RGBA8; - if (m_isMultiSampled) - OGLCHECK(glRenderbufferStorageMultisample(target, - 4, - internalFormat, - width, - height)); - else - OGLCHECK(glRenderbufferStorageEXT(target, - internalFormat, - width, - height)); + OGLCHECK(glRenderbufferStorageEXT(target, + internalFormat, + width, + height)); #endif popCurrent(); @@ -141,11 +124,6 @@ namespace yg return m_isDepthBuffer; } - bool RenderBuffer::isMultiSampled() const - { - return m_isMultiSampled; - } - unsigned RenderBuffer::width() const { return m_width; diff --git a/yg/renderbuffer.hpp b/yg/renderbuffer.hpp index 99e05ac4d3..a2c6a411a5 100644 --- a/yg/renderbuffer.hpp +++ b/yg/renderbuffer.hpp @@ -13,14 +13,13 @@ namespace yg unsigned int m_id; bool m_isDepthBuffer; - bool m_isMultiSampled; size_t m_width; size_t m_height; public: - RenderBuffer(size_t width, size_t height, bool isDepthBuffer = false, bool isMultiSampled = false); + RenderBuffer(size_t width, size_t height, bool isDepthBuffer = false); ~RenderBuffer(); unsigned int id() const; @@ -29,7 +28,6 @@ namespace yg void attachToFrameBuffer(); bool isDepthBuffer() const; - bool isMultiSampled() const; static int current(); diff --git a/yg/renderer.cpp b/yg/renderer.cpp index 6e86d402b5..5e91fcd7ed 100644 --- a/yg/renderer.cpp +++ b/yg/renderer.cpp @@ -11,17 +11,14 @@ namespace yg { namespace gl { - Renderer::Params::Params() : m_isMultiSampled(false), m_isDebugging(false) + Renderer::Params::Params() : m_isDebugging(false) {} Renderer::Renderer(Params const & params) : m_frameBuffer(params.m_frameBuffer), - m_isMultiSampled(params.m_isMultiSampled), m_isDebugging(params.m_isDebugging), m_isRendering(false) { - if (m_isMultiSampled) - m_multiSampledFrameBuffer = make_shared_ptr(new FrameBuffer()); m_resourceManager = params.m_resourceManager; } @@ -33,11 +30,8 @@ namespace yg void Renderer::beginFrame() { m_isRendering = true; - if (m_isMultiSampled) - m_multiSampledFrameBuffer->makeCurrent(); - else - if (m_frameBuffer.get() != 0) - m_frameBuffer->makeCurrent(); + if (m_frameBuffer.get() != 0) + m_frameBuffer->makeCurrent(); } bool Renderer::isRendering() const @@ -47,8 +41,6 @@ namespace yg void Renderer::endFrame() { -// if (m_isMultiSampled) - updateFrameBuffer(); m_isRendering = false; } @@ -57,16 +49,6 @@ namespace yg return m_frameBuffer; } - shared_ptr const & Renderer::multiSampledFrameBuffer() const - { - return m_multiSampledFrameBuffer; - } - -/* void Renderer::setFrameBuffer(shared_ptr const & fb) - { - m_frameBuffer = fb; - }*/ - shared_ptr const & Renderer::renderTarget() const { return m_frameBuffer->renderTarget(); @@ -74,49 +56,8 @@ namespace yg void Renderer::setRenderTarget(shared_ptr const & rt) { - if (isRendering()) - updateFrameBuffer(); - m_frameBuffer->setRenderTarget(rt); m_frameBuffer->makeCurrent(); //< to attach renderTarget - - if (m_isMultiSampled) - m_multiSampledFrameBuffer->makeCurrent(); - } - - - void Renderer::updateFrameBuffer() - { - if (m_isMultiSampled) - { -#ifdef OMIM_GL_ES - - /// @TODO: fix for android -#ifndef OMIM_OS_ANDROID - OGLCHECK(glBindFramebufferOES(GL_READ_FRAMEBUFFER_APPLE, m_multiSampledFrameBuffer->id())); - OGLCHECK(glBindFramebufferOES(GL_DRAW_FRAMEBUFFER_APPLE, m_frameBuffer->id())); - OGLCHECK(glResolveMultisampleFramebufferAPPLE()); - OGLCHECK(glBindFramebufferOES(GL_DRAW_FRAMEBUFFER_APPLE, m_multiSampledFrameBuffer->id())); -#endif - -#else - OGLCHECK(glBindFramebuffer(GL_READ_FRAMEBUFFER, m_multiSampledFrameBuffer->id())); - OGLCHECK(glBindFramebuffer(GL_DRAW_FRAMEBUFFER, m_frameBuffer->id())); - OGLCHECK(glBlitFramebuffer(0, 0, width(), height(), - 0, 0, width(), height(), - GL_COLOR_BUFFER_BIT, - GL_NEAREST)); - OGLCHECK(glBindFramebuffer(GL_DRAW_FRAMEBUFFER, m_multiSampledFrameBuffer->id())); - -#endif -// m_multiSampledFrameBuffer->makeCurrent(); - OGLCHECK(glFinish()); - } - } - - bool Renderer::isMultiSampled() const - { - return m_isMultiSampled; } void Renderer::clear(yg::Color const & c, bool clearRT, float depth, bool clearDepth) @@ -145,23 +86,6 @@ namespace yg m_width = width; m_height = height; - if (m_isMultiSampled) - { - m_multiSampledFrameBuffer->onSize(m_width, m_height); - if ( (!m_multiSampledRenderTarget.get()) - || (m_multiSampledRenderTarget->width() != width) - || (m_multiSampledRenderTarget->height() != height) ) - { - m_multiSampledRenderTarget.reset(); - m_multiSampledRenderTarget = make_shared_ptr(new RenderBuffer(width, height, false, true)); - m_multiSampledFrameBuffer->setRenderTarget(m_multiSampledRenderTarget); - - m_multiSampledDepthBuffer.reset(); - m_multiSampledDepthBuffer = make_shared_ptr(new RenderBuffer(width, height, true, true)); - m_multiSampledFrameBuffer->setDepthBuffer(m_multiSampledDepthBuffer); - } - } - if (m_frameBuffer) m_frameBuffer->onSize(width, height); } diff --git a/yg/renderer.hpp b/yg/renderer.hpp index 4a6a480042..3fa6442c25 100644 --- a/yg/renderer.hpp +++ b/yg/renderer.hpp @@ -23,7 +23,6 @@ namespace yg { shared_ptr m_resourceManager; shared_ptr m_frameBuffer; - bool m_isMultiSampled; bool m_isDebugging; Params(); }; @@ -36,11 +35,6 @@ namespace yg shared_ptr m_renderTarget; shared_ptr m_depthBuffer; - shared_ptr m_multiSampledFrameBuffer; - shared_ptr m_multiSampledRenderTarget; - shared_ptr m_multiSampledDepthBuffer; - - bool m_isMultiSampled; bool m_isDebugging; bool m_isRendering; @@ -59,9 +53,6 @@ namespace yg shared_ptr const & resourceManager() const; - void setIsMultiSampled(bool isMultiSampled); - bool isMultiSampled() const; - shared_ptr const & frameBuffer() const; // void setFrameBuffer(shared_ptr const & fb); @@ -70,8 +61,6 @@ namespace yg void setRenderTarget(shared_ptr const & rt); shared_ptr const & renderTarget() const; - void updateFrameBuffer(); - /// @param clearRT - should we clear the renderTarget data (visible pixels)? /// @param clearDepth - should we clear depthBuffer data? /// @warning this function respects the clipping rect set and enabled(!)