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:
authorrachytski <siarhei.rachytski@gmail.com>2011-12-07 18:59:05 +0400
committerAlex Zolotarev <alex@maps.me>2015-09-23 01:29:53 +0300
commit0739197cce006b53ecb2c89e607f5dc88fa08fee (patch)
treecfdc65facb1a8e96ae13009037a1c2ffc7e84509
parent358a248ab31718449de164fb5e1ac85fccd07e06 (diff)
dynamic textures and render targets now may use different formats.
-rw-r--r--android/jni/com/mapswithme/maps/Framework.cpp3
-rw-r--r--iphone/Maps/Classes/EAGLView.mm8
-rw-r--r--map/partial_render_policy.cpp4
-rw-r--r--map/render_policy_mt.cpp8
-rw-r--r--map/render_policy_st.cpp5
-rw-r--r--map/tiling_render_policy_mt.cpp6
-rw-r--r--map/tiling_render_policy_st.cpp4
-rw-r--r--qt/draw_widget.cpp3
-rw-r--r--qt_tstfrm/tstwidgets.cpp7
-rw-r--r--yg/renderbuffer.cpp5
-rw-r--r--yg/resource_manager.cpp48
-rw-r--r--yg/resource_manager.hpp16
12 files changed, 70 insertions, 47 deletions
diff --git a/android/jni/com/mapswithme/maps/Framework.cpp b/android/jni/com/mapswithme/maps/Framework.cpp
index 726ea805fd..0f0b69ec8c 100644
--- a/android/jni/com/mapswithme/maps/Framework.cpp
+++ b/android/jni/com/mapswithme/maps/Framework.cpp
@@ -79,7 +79,8 @@ namespace android
yg::ResourceManager::Params rmParams;
rmParams.m_videoMemoryLimit = 15 * 1024 * 1024;
- rmParams.m_rtFormat = yg::Rt8Bpp;
+ rmParams.m_rtFormat = yg::Data8Bpp;
+ rmParams.m_texFormat = yg::Data4Bpp;
try
{
diff --git a/iphone/Maps/Classes/EAGLView.mm b/iphone/Maps/Classes/EAGLView.mm
index 02ba2dbb06..f1203026b4 100644
--- a/iphone/Maps/Classes/EAGLView.mm
+++ b/iphone/Maps/Classes/EAGLView.mm
@@ -82,9 +82,10 @@
- (void)initRenderPolicy
{
// to avoid grid bug on 3G device
- yg::RtFormat fmt = yg::Rt4Bpp;
+ yg::DataFormat rtFmt = yg::Data4Bpp;
+ yg::DataFormat texFmt = yg::Data4Bpp;
if ([[NSString stringWithFormat:@"%s", glGetString(GL_RENDERER)] hasPrefix:@"PowerVR MBX"])
- fmt = yg::Rt8Bpp;
+ rtFmt = yg::Data8Bpp;
typedef void (*drawFrameFn)(id, SEL);
SEL drawFrameSel = @selector(drawFrame);
@@ -94,7 +95,8 @@
yg::ResourceManager::Params rmParams;
rmParams.m_videoMemoryLimit = GetPlatform().VideoMemoryLimit();
- rmParams.m_rtFormat = fmt;
+ rmParams.m_rtFormat = rtFmt;
+ rmParams.m_texFormat = texFmt;
try
{
diff --git a/map/partial_render_policy.cpp b/map/partial_render_policy.cpp
index 3022f0531f..1bebf10516 100644
--- a/map/partial_render_policy.cpp
+++ b/map/partial_render_policy.cpp
@@ -65,7 +65,7 @@ PartialRenderPolicy::PartialRenderPolicy(VideoTimer * videoTimer,
rmp.m_primaryTexturesParams = yg::ResourceManager::TexturePoolParams(512,
256,
6,
- rmp.m_rtFormat,
+ rmp.m_texFormat,
true,
true,
true,
@@ -75,7 +75,7 @@ PartialRenderPolicy::PartialRenderPolicy(VideoTimer * videoTimer,
rmp.m_fontTexturesParams = yg::ResourceManager::TexturePoolParams(512,
256,
6,
- rmp.m_rtFormat,
+ rmp.m_texFormat,
true,
true,
true,
diff --git a/map/render_policy_mt.cpp b/map/render_policy_mt.cpp
index b68048f036..e5caa8a0aa 100644
--- a/map/render_policy_mt.cpp
+++ b/map/render_policy_mt.cpp
@@ -64,8 +64,8 @@ RenderPolicyMT::RenderPolicyMT(VideoTimer * videoTimer,
rmp.m_primaryTexturesParams = yg::ResourceManager::TexturePoolParams(512,
256,
- 10,
- rmp.m_rtFormat,
+ 7,
+ rmp.m_texFormat,
true,
true,
true,
@@ -74,8 +74,8 @@ RenderPolicyMT::RenderPolicyMT(VideoTimer * videoTimer,
rmp.m_fontTexturesParams = yg::ResourceManager::TexturePoolParams(512,
256,
- 15,
- rmp.m_rtFormat,
+ 7,
+ rmp.m_texFormat,
true,
true,
true,
diff --git a/map/render_policy_st.cpp b/map/render_policy_st.cpp
index ec7b56337b..9439dd29dd 100644
--- a/map/render_policy_st.cpp
+++ b/map/render_policy_st.cpp
@@ -6,6 +6,7 @@
#include "window_handle.hpp"
#include "../yg/info_layer.hpp"
#include "../yg/internal/opengl.hpp"
+#include "../yg/skin.hpp"
#include "../indexer/scales.hpp"
#include "../geometry/screenbase.hpp"
@@ -53,7 +54,7 @@ RenderPolicyST::RenderPolicyST(VideoTimer * videoTimer,
rmp.m_primaryTexturesParams = yg::ResourceManager::TexturePoolParams(512,
256,
10,
- rmp.m_rtFormat,
+ rmp.m_texFormat,
true,
true,
true,
@@ -63,7 +64,7 @@ RenderPolicyST::RenderPolicyST(VideoTimer * videoTimer,
rmp.m_fontTexturesParams = yg::ResourceManager::TexturePoolParams(512,
256,
5,
- rmp.m_rtFormat,
+ rmp.m_texFormat,
true,
true,
true,
diff --git a/map/tiling_render_policy_mt.cpp b/map/tiling_render_policy_mt.cpp
index 06f99f3131..1f4c9fea7c 100644
--- a/map/tiling_render_policy_mt.cpp
+++ b/map/tiling_render_policy_mt.cpp
@@ -75,7 +75,7 @@ TilingRenderPolicyMT::TilingRenderPolicyMT(VideoTimer * videoTimer,
rmp.m_primaryTexturesParams = yg::ResourceManager::TexturePoolParams(512,
256,
10,
- rmp.m_rtFormat,
+ rmp.m_texFormat,
true,
true,
true,
@@ -85,7 +85,7 @@ TilingRenderPolicyMT::TilingRenderPolicyMT(VideoTimer * videoTimer,
rmp.m_fontTexturesParams = yg::ResourceManager::TexturePoolParams(512,
256,
5,
- rmp.m_rtFormat,
+ rmp.m_texFormat,
true,
true,
true,
@@ -105,7 +105,7 @@ TilingRenderPolicyMT::TilingRenderPolicyMT(VideoTimer * videoTimer,
rmp.m_styleCacheTexturesParams = yg::ResourceManager::TexturePoolParams(rmp.m_fontTexturesParams.m_texWidth,
rmp.m_fontTexturesParams.m_texHeight,
2,
- rmp.m_rtFormat,
+ rmp.m_texFormat,
true,
true,
true,
diff --git a/map/tiling_render_policy_st.cpp b/map/tiling_render_policy_st.cpp
index 49a9269375..765d54794d 100644
--- a/map/tiling_render_policy_st.cpp
+++ b/map/tiling_render_policy_st.cpp
@@ -77,7 +77,7 @@ TilingRenderPolicyST::TilingRenderPolicyST(VideoTimer * videoTimer,
rmp.m_primaryTexturesParams = yg::ResourceManager::TexturePoolParams(512,
256,
10,
- rmp.m_rtFormat,
+ rmp.m_texFormat,
true,
true,
true,
@@ -87,7 +87,7 @@ TilingRenderPolicyST::TilingRenderPolicyST(VideoTimer * videoTimer,
rmp.m_fontTexturesParams = yg::ResourceManager::TexturePoolParams(512,
256,
5,
- rmp.m_rtFormat,
+ rmp.m_texFormat,
true,
true,
true,
diff --git a/qt/draw_widget.cpp b/qt/draw_widget.cpp
index 6b9b9e774a..aaae676ba3 100644
--- a/qt/draw_widget.cpp
+++ b/qt/draw_widget.cpp
@@ -206,7 +206,8 @@ namespace qt
shared_ptr<qt::gl::RenderContext> primaryRC(new qt::gl::RenderContext(this));
yg::ResourceManager::Params rmParams;
- rmParams.m_rtFormat = yg::Rt8Bpp;
+ rmParams.m_rtFormat = yg::Data8Bpp;
+ rmParams.m_texFormat = yg::Data8Bpp;
rmParams.m_videoMemoryLimit = GetPlatform().VideoMemoryLimit();
try
diff --git a/qt_tstfrm/tstwidgets.cpp b/qt_tstfrm/tstwidgets.cpp
index fb51286225..3f7205c9d4 100644
--- a/qt_tstfrm/tstwidgets.cpp
+++ b/qt_tstfrm/tstwidgets.cpp
@@ -85,7 +85,7 @@ void GLDrawWidget::initializeGL()
rmp.m_primaryTexturesParams = yg::ResourceManager::TexturePoolParams(512,
256,
10,
- rmp.m_rtFormat,
+ rmp.m_texFormat,
true,
true,
true,
@@ -95,7 +95,7 @@ void GLDrawWidget::initializeGL()
rmp.m_fontTexturesParams = yg::ResourceManager::TexturePoolParams(512,
256,
5,
- rmp.m_rtFormat,
+ rmp.m_texFormat,
true,
true,
true,
@@ -111,7 +111,8 @@ void GLDrawWidget::initializeGL()
rmp.m_useSingleThreadedOGL = false;
rmp.m_useVA = !yg::gl::g_isBufferObjectsSupported;
- rmp.m_rtFormat = yg::Rt8Bpp;
+ rmp.m_rtFormat = yg::Data8Bpp;
+ rmp.m_texFormat = yg::Data8Bpp;
m_resourceManager.reset(new yg::ResourceManager(rmp));
diff --git a/yg/renderbuffer.cpp b/yg/renderbuffer.cpp
index b439be534e..f801414e7a 100644
--- a/yg/renderbuffer.cpp
+++ b/yg/renderbuffer.cpp
@@ -36,11 +36,6 @@ namespace yg
internalFormat,
m_width,
m_height));
-
- OGLCHECK(glRenderbufferStorageFn(target,
- internalFormat,
- m_width,
- m_height));
}
}
diff --git a/yg/resource_manager.cpp b/yg/resource_manager.cpp
index 7b37434807..8ce6bcda47 100644
--- a/yg/resource_manager.cpp
+++ b/yg/resource_manager.cpp
@@ -21,14 +21,33 @@ namespace yg
DECLARE_EXCEPTION(ResourceManagerException, RootException);
- TTextureFactory::TTextureFactory(size_t w, size_t h, char const * resName)
- : BasePoolElemFactory(resName, w * h * sizeof(TDynamicTexture::pixel_t)),
- m_w(w), m_h(h)
+ size_t pixelSize(yg::DataFormat texFormat)
+ {
+ switch (texFormat)
+ {
+ case yg::Data8Bpp:
+ return 4;
+ case yg::Data4Bpp:
+ return 2;
+ default:
+ return 0;
+ }
+ }
+
+ TTextureFactory::TTextureFactory(size_t w, size_t h, yg::DataFormat format, char const * resName)
+ : BasePoolElemFactory(resName, w * h * pixelSize(format)),
+ m_w(w), m_h(h), m_format(format)
{}
shared_ptr<gl::BaseTexture> const TTextureFactory::Create()
{
- return shared_ptr<gl::BaseTexture>(new TDynamicTexture(m_w, m_h));
+ switch (m_format)
+ {
+ case yg::Data4Bpp:
+ return shared_ptr<gl::BaseTexture>(new gl::Texture<yg::RGBA4Traits, true>(m_w, m_h));
+ case yg::Data8Bpp:
+ return shared_ptr<gl::BaseTexture>(new gl::Texture<yg::RGBA8Traits, true>(m_w, m_h));
+ };
}
TStorageFactory::TStorageFactory(size_t vbSize, size_t ibSize, bool useVA, bool useSingleThreadedOGL, char const * resName)
@@ -159,7 +178,7 @@ namespace yg
: m_texWidth(0),
m_texHeight(0),
m_texCount(0),
- m_rtFormat(yg::Rt8Bpp),
+ m_format(yg::Data8Bpp),
m_isWidthFixed(true),
m_isHeightFixed(true),
m_isCountFixed(true),
@@ -170,7 +189,7 @@ namespace yg
ResourceManager::TexturePoolParams::TexturePoolParams(size_t texWidth,
size_t texHeight,
size_t texCount,
- yg::RtFormat rtFormat,
+ yg::DataFormat format,
bool isWidthFixed,
bool isHeightFixed,
bool isCountFixed,
@@ -179,7 +198,7 @@ namespace yg
: m_texWidth(texWidth),
m_texHeight(texHeight),
m_texCount(texCount),
- m_rtFormat(rtFormat),
+ m_format(format),
m_isWidthFixed(isWidthFixed),
m_isHeightFixed(isHeightFixed),
m_isCountFixed(isCountFixed),
@@ -200,12 +219,12 @@ namespace yg
size_t ResourceManager::TexturePoolParams::memoryUsage() const
{
size_t pixelSize = 0;
- switch (m_rtFormat)
+ switch (m_format)
{
- case yg::Rt4Bpp:
+ case yg::Data4Bpp:
pixelSize = 2;
break;
- case yg::Rt8Bpp:
+ case yg::Data8Bpp:
pixelSize = 4;
break;
}
@@ -307,7 +326,8 @@ namespace yg
{}
ResourceManager::Params::Params()
- : m_rtFormat(yg::Rt8Bpp),
+ : m_rtFormat(yg::Data8Bpp),
+ m_texFormat(yg::Data4Bpp),
m_useSingleThreadedOGL(false),
m_useVA(true),
m_videoMemoryLimit(0),
@@ -465,7 +485,7 @@ namespace yg
void ResourceManager::initTexturePool(TexturePoolParams const & p, auto_ptr<TTexturePool> & pool)
{
if (p.isValid())
- pool.reset(new TTexturePoolImpl(new TTexturePoolTraits(TTextureFactory(p.m_texWidth, p.m_texHeight, p.m_poolName.c_str()), p.m_texCount)));
+ pool.reset(new TTexturePoolImpl(new TTexturePoolTraits(TTextureFactory(p.m_texWidth, p.m_texHeight, p.m_format, p.m_poolName.c_str()), p.m_texCount)));
else
LOG(LINFO, ("no ", p.m_poolName, " resource"));
}
@@ -595,9 +615,9 @@ namespace yg
{
switch (m_params.m_rtFormat)
{
- case Rt8Bpp:
+ case Data8Bpp:
return make_shared_ptr(new gl::Texture<RGBA8Traits, false>(w, h));
- case Rt4Bpp:
+ case Data4Bpp:
return make_shared_ptr(new gl::Texture<RGBA4Traits, false>(w, h));
default:
MYTHROW(ResourceManagerException, ("unknown render target format"));
diff --git a/yg/resource_manager.hpp b/yg/resource_manager.hpp
index 14f354f33f..b8c0e4aef2 100644
--- a/yg/resource_manager.hpp
+++ b/yg/resource_manager.hpp
@@ -24,17 +24,18 @@ namespace yg
struct GlyphInfo;
- enum RtFormat
+ enum DataFormat
{
- Rt8Bpp,
- Rt4Bpp
+ Data8Bpp,
+ Data4Bpp
};
struct TTextureFactory : BasePoolElemFactory
{
size_t m_w;
size_t m_h;
- TTextureFactory(size_t w, size_t h, char const * resName);
+ yg::DataFormat m_format;
+ TTextureFactory(size_t w, size_t h, yg::DataFormat format, char const * resName);
shared_ptr<gl::BaseTexture> const Create();
};
@@ -112,7 +113,7 @@ namespace yg
size_t m_texWidth;
size_t m_texHeight;
size_t m_texCount;
- yg::RtFormat m_rtFormat;
+ yg::DataFormat m_format;
bool m_isWidthFixed;
bool m_isHeightFixed;
@@ -126,7 +127,7 @@ namespace yg
TexturePoolParams(size_t texWidth,
size_t texHeight,
size_t texCount,
- yg::RtFormat rtFormat,
+ yg::DataFormat format,
bool isWidthFixed,
bool isHeightFixed,
bool isCountFixed,
@@ -163,7 +164,8 @@ namespace yg
struct Params
{
- RtFormat m_rtFormat;
+ DataFormat m_rtFormat;
+ DataFormat m_texFormat;
bool m_useSingleThreadedOGL;
bool m_useVA;