diff options
author | r.kuznetsov <r.kuznetsov@corp.mail.ru> | 2015-10-22 12:50:20 +0300 |
---|---|---|
committer | r.kuznetsov <r.kuznetsov@corp.mail.ru> | 2015-11-30 16:19:16 +0300 |
commit | ff589eba4adc2b0eb96b5697b648af43a972defe (patch) | |
tree | a5a6d1d1b232693e43aee4b208847ed739ee6246 /drape | |
parent | fff4914453006ded2762366d400caa4d3efd7fbe (diff) |
Fixed black outline around icons
Diffstat (limited to 'drape')
-rw-r--r-- | drape/drape_tests/compile_shaders_test.cpp | 3 | ||||
-rw-r--r-- | drape/dynamic_texture.hpp | 6 | ||||
-rw-r--r-- | drape/font_texture.hpp | 3 | ||||
-rw-r--r-- | drape/glstate.cpp | 13 | ||||
-rw-r--r-- | drape/glstate.hpp | 4 | ||||
-rw-r--r-- | drape/hw_texture.cpp | 16 | ||||
-rw-r--r-- | drape/hw_texture.hpp | 10 | ||||
-rw-r--r-- | drape/hw_texture_ios.mm | 4 | ||||
-rw-r--r-- | drape/shaders/dashed_fragment_shader.fsh | 2 | ||||
-rw-r--r-- | drape/shaders/dashed_vertex_shader.vsh | 4 | ||||
-rw-r--r-- | drape/stipple_pen_resource.hpp | 2 | ||||
-rw-r--r-- | drape/texture.cpp | 6 | ||||
-rw-r--r-- | drape/texture.hpp | 3 | ||||
-rw-r--r-- | drape/texture_of_colors.hpp | 3 |
14 files changed, 58 insertions, 21 deletions
diff --git a/drape/drape_tests/compile_shaders_test.cpp b/drape/drape_tests/compile_shaders_test.cpp index 2962581d73..9ab527df19 100644 --- a/drape/drape_tests/compile_shaders_test.cpp +++ b/drape/drape_tests/compile_shaders_test.cpp @@ -109,6 +109,7 @@ void ForEachShader(vector<string> const & shaders, { QTemporaryFile srcFile; TEST(srcFile.open(), ("Temporary File can't be created!")); + //srcFile.setAutoRemove(false); WriteShaderToFile(srcFile, src); RunShaderTest(glslCompiler, srcFile.fileName(), procPrepare, argsPrepare, successComparator, errorLog); @@ -188,7 +189,7 @@ void TestMaliShaders(QString const & driver, shaderType = "-f"; ForEachShader(gpu::FragmentEnum, compilerPath, procPrepare, argForming, succesComparator, ss); - TEST(errorLog.isEmpty(), (errorLog)); + TEST(errorLog.isEmpty(), (shaderType,release, hardware, driver, errorLog)); } UNIT_TEST(MALI_CompileShaders_Test) diff --git a/drape/dynamic_texture.hpp b/drape/dynamic_texture.hpp index e4c6242fe9..41c593b98c 100644 --- a/drape/dynamic_texture.hpp +++ b/drape/dynamic_texture.hpp @@ -38,8 +38,7 @@ protected: { m2::PointU m_size; dp::TextureFormat m_format; - glConst m_minFilter; - glConst m_magFilter; + glConst m_filter; }; void Init(ref_ptr<HWTextureAllocator> allocator, ref_ptr<TIndexer> indexer, TextureParams const & params) @@ -56,8 +55,7 @@ protected: p.m_width = params.m_size.x; p.m_height = params.m_size.y; p.m_format = params.m_format; - p.m_magFilter = params.m_magFilter; - p.m_minFilter = params.m_minFilter; + p.m_filter = params.m_filter; Create(p, data); } diff --git a/drape/font_texture.hpp b/drape/font_texture.hpp index 652f29bd12..e9da79e1a6 100644 --- a/drape/font_texture.hpp +++ b/drape/font_texture.hpp @@ -139,8 +139,7 @@ public: TBase::TextureParams params; params.m_size = size; params.m_format = TextureFormat::ALPHA; - params.m_minFilter = gl_const::GLLinear; - params.m_magFilter = gl_const::GLLinear; + params.m_filter = gl_const::GLLinear; vector<uint8_t> initData(params.m_size.x * params.m_size.y, 0); TBase::Init(allocator, make_ref(&m_index), params, make_ref(initData.data())); diff --git a/drape/glstate.cpp b/drape/glstate.cpp index 443f1ff278..d8e89834fe 100644 --- a/drape/glstate.cpp +++ b/drape/glstate.cpp @@ -48,6 +48,7 @@ GLState::GLState(uint32_t gpuProgramIndex, DepthLayer depthLayer) : m_gpuProgramIndex(gpuProgramIndex) , m_depthLayer(depthLayer) , m_depthFunction(gl_const::GLLessOrEqual) + , m_textureFilter(gl_const::GLLinear) , m_colorTexture(nullptr) , m_maskTexture(nullptr) { @@ -63,6 +64,16 @@ void GLState::SetDepthFunction(glConst functionName) m_depthFunction = functionName; } +glConst GLState::GetTextureFilter() const +{ + return m_textureFilter; +} + +void GLState::SetTextureFilter(glConst filter) +{ + m_textureFilter = filter; +} + bool GLState::operator<(GLState const & other) const { if (m_depthLayer != other.m_depthLayer) @@ -108,6 +119,7 @@ void ApplyTextures(GLState state, ref_ptr<GpuProgram> program) GLFunctions::glActiveTexture(gl_const::GLTexture0); tex->Bind(); GLFunctions::glUniformValuei(colorTexLoc, 0); + tex->SetFilter(state.GetTextureFilter()); } else { @@ -130,6 +142,7 @@ void ApplyTextures(GLState state, ref_ptr<GpuProgram> program) GLFunctions::glActiveTexture(gl_const::GLTexture0 + 1); tex->Bind(); GLFunctions::glUniformValuei(maskTexLoc, 1); + tex->SetFilter(state.GetTextureFilter()); } else { diff --git a/drape/glstate.hpp b/drape/glstate.hpp index d77360ce4e..e5a4e481e5 100644 --- a/drape/glstate.hpp +++ b/drape/glstate.hpp @@ -62,6 +62,9 @@ public: glConst GetDepthFunction() const; void SetDepthFunction(glConst functionName); + glConst GetTextureFilter() const; + void SetTextureFilter(glConst filter); + bool operator<(GLState const & other) const; bool operator==(GLState const & other) const; @@ -70,6 +73,7 @@ private: DepthLayer m_depthLayer; Blending m_blending; glConst m_depthFunction; + glConst m_textureFilter; ref_ptr<Texture> m_colorTexture; ref_ptr<Texture> m_maskTexture; diff --git a/drape/hw_texture.cpp b/drape/hw_texture.cpp index 8fb4cd8aec..37ee4980fc 100644 --- a/drape/hw_texture.cpp +++ b/drape/hw_texture.cpp @@ -19,6 +19,7 @@ HWTexture::HWTexture() , m_height(0) , m_format(UNSPECIFIED) , m_textureID(-1) + , m_filter(gl_const::GLLinear) { } @@ -32,6 +33,7 @@ void HWTexture::Create(Params const & params, ref_ptr<void> /*data*/) m_width = params.m_width; m_height = params.m_height; m_format = params.m_format; + m_filter = params.m_filter; #if defined(TRACK_GPU_MEM) glConst layout; @@ -106,6 +108,16 @@ void HWTexture::Bind() const GLFunctions::glBindTexture(GetID()); } +void HWTexture::SetFilter(glConst filter) +{ + if (m_filter != filter) + { + m_filter = filter; + GLFunctions::glTexParameter(gl_const::GLMinFilter, m_filter); + GLFunctions::glTexParameter(gl_const::GLMagFilter, m_filter); + } +} + int32_t HWTexture::GetID() const { return m_textureID; @@ -135,8 +147,8 @@ void OpenGLHWTexture::Create(Params const & params, ref_ptr<void> data) UnpackFormat(m_format, layout, pixelType); GLFunctions::glTexImage2D(m_width, m_height, layout, pixelType, data.get()); - GLFunctions::glTexParameter(gl_const::GLMinFilter, params.m_minFilter); - GLFunctions::glTexParameter(gl_const::GLMagFilter, params.m_magFilter); + GLFunctions::glTexParameter(gl_const::GLMinFilter, params.m_filter); + GLFunctions::glTexParameter(gl_const::GLMagFilter, params.m_filter); GLFunctions::glTexParameter(gl_const::GLWrapS, params.m_wrapSMode); GLFunctions::glTexParameter(gl_const::GLWrapT, params.m_wrapTMode); diff --git a/drape/hw_texture.hpp b/drape/hw_texture.hpp index 56383523f4..a408ee384f 100644 --- a/drape/hw_texture.hpp +++ b/drape/hw_texture.hpp @@ -19,8 +19,7 @@ public: struct Params { Params() - : m_minFilter(gl_const::GLLinear) - , m_magFilter(gl_const::GLLinear) + : m_filter(gl_const::GLLinear) , m_wrapSMode(gl_const::GLClampToEdge) , m_wrapTMode(gl_const::GLClampToEdge) , m_format(UNSPECIFIED) @@ -29,8 +28,7 @@ public: uint32_t m_width; uint32_t m_height; - glConst m_minFilter; - glConst m_magFilter; + glConst m_filter; glConst m_wrapSMode; glConst m_wrapTMode; TextureFormat m_format; @@ -44,6 +42,9 @@ public: void Bind() const; + // Texture must be bound before calling this method. + void SetFilter(glConst filter); + TextureFormat GetFormat() const; uint32_t GetWidth() const; uint32_t GetHeight() const; @@ -58,6 +59,7 @@ protected: uint32_t m_height; TextureFormat m_format; int32_t m_textureID; + glConst m_filter; }; class HWTextureAllocator diff --git a/drape/hw_texture_ios.mm b/drape/hw_texture_ios.mm index 884c35e203..f3d1b57086 100644 --- a/drape/hw_texture_ios.mm +++ b/drape/hw_texture_ios.mm @@ -145,8 +145,8 @@ void HWTextureApple::Create(Params const & params, ref_ptr<void> data) m_textureID = CVOpenGLESTextureGetName(m_texture); GLFunctions::glBindTexture(m_textureID); - GLFunctions::glTexParameter(gl_const::GLMinFilter, params.m_minFilter); - GLFunctions::glTexParameter(gl_const::GLMagFilter, params.m_magFilter); + GLFunctions::glTexParameter(gl_const::GLMinFilter, params.m_filter); + GLFunctions::glTexParameter(gl_const::GLMagFilter, params.m_filter); GLFunctions::glTexParameter(gl_const::GLWrapS, params.m_wrapSMode); GLFunctions::glTexParameter(gl_const::GLWrapT, params.m_wrapTMode); diff --git a/drape/shaders/dashed_fragment_shader.fsh b/drape/shaders/dashed_fragment_shader.fsh index c233b84576..aaa41df3fb 100644 --- a/drape/shaders/dashed_fragment_shader.fsh +++ b/drape/shaders/dashed_fragment_shader.fsh @@ -1,6 +1,6 @@ varying vec2 v_colorTexCoord; varying vec2 v_halfLength; -varying highp vec2 v_maskTexCoord; +varying vec2 v_maskTexCoord; uniform sampler2D u_colorTex; uniform sampler2D u_maskTex; diff --git a/drape/shaders/dashed_vertex_shader.vsh b/drape/shaders/dashed_vertex_shader.vsh index 4c95d2335a..a0e09a551f 100644 --- a/drape/shaders/dashed_vertex_shader.vsh +++ b/drape/shaders/dashed_vertex_shader.vsh @@ -1,13 +1,13 @@ attribute vec3 a_position; attribute vec3 a_normal; attribute vec2 a_colorTexCoord; -attribute highp vec2 a_maskTexCoord; +attribute vec2 a_maskTexCoord; uniform mat4 modelView; uniform mat4 projection; varying vec2 v_colorTexCoord; -varying highp vec2 v_maskTexCoord; +varying vec2 v_maskTexCoord; varying vec2 v_halfLength; void main(void) diff --git a/drape/stipple_pen_resource.hpp b/drape/stipple_pen_resource.hpp index b1b74a9a03..f016f8f70e 100644 --- a/drape/stipple_pen_resource.hpp +++ b/drape/stipple_pen_resource.hpp @@ -127,7 +127,7 @@ public: StipplePenTexture(m2::PointU const & size, ref_ptr<HWTextureAllocator> allocator) : m_index(size) { - TBase::TextureParams params{ size, TextureFormat::ALPHA, gl_const::GLNearest, gl_const::GLNearest }; + TBase::TextureParams params{ size, TextureFormat::ALPHA, gl_const::GLNearest }; TBase::Init(allocator, make_ref(&m_index), params); } diff --git a/drape/texture.cpp b/drape/texture.cpp index 57631cc49c..9731cfd25d 100644 --- a/drape/texture.cpp +++ b/drape/texture.cpp @@ -84,6 +84,12 @@ void Texture::Bind() const m_hwTexture->Bind(); } +void Texture::SetFilter(glConst filter) +{ + ASSERT(m_hwTexture != nullptr, ()); + m_hwTexture->SetFilter(filter); +} + uint32_t Texture::GetMaxTextureSize() { return GLFunctions::glGetInteger(gl_const::GLMaxTextureSize); diff --git a/drape/texture.hpp b/drape/texture.hpp index de60ec5add..c88cf4d737 100644 --- a/drape/texture.hpp +++ b/drape/texture.hpp @@ -67,6 +67,9 @@ public: void Bind() const; + // Texture must be bound before calling this method. + void SetFilter(glConst filter); + static uint32_t GetMaxTextureSize(); protected: diff --git a/drape/texture_of_colors.hpp b/drape/texture_of_colors.hpp index 7535090194..52ed9b462f 100644 --- a/drape/texture_of_colors.hpp +++ b/drape/texture_of_colors.hpp @@ -72,8 +72,7 @@ public: TBase::TextureParams params; params.m_size = size; params.m_format = TextureFormat::RGBA8; - params.m_minFilter = gl_const::GLNearest; - params.m_magFilter = gl_const::GLNearest; + params.m_filter = gl_const::GLNearest; TBase::Init(allocator, make_ref(&m_pallete), params); } |