From ae3b4fbdf833e3620484b03273f8cde6dc2a07da Mon Sep 17 00:00:00 2001 From: ExMix Date: Mon, 24 Feb 2014 16:23:16 +0300 Subject: [PATCH] [drape] remove texture from GLState --- drape/drape_tests/batcher_tests.cpp | 2 +- drape/glstate.cpp | 22 +--------------------- drape/glstate.hpp | 5 +---- drape/utils/list_generator.cpp | 3 +-- drape_frontend/area_shape.cpp | 2 +- drape_frontend/line_shape.cpp | 2 +- 6 files changed, 6 insertions(+), 30 deletions(-) diff --git a/drape/drape_tests/batcher_tests.cpp b/drape/drape_tests/batcher_tests.cpp index 13d1c10ae2..a049735a04 100644 --- a/drape/drape_tests/batcher_tests.cpp +++ b/drape/drape_tests/batcher_tests.cpp @@ -147,7 +147,7 @@ UNIT_TEST(BatchLists_Test) EXPECTGL(glDeleteProgram(ProgramID)); } - GLState state(0, 0, TextureBinding("", false, 0, RefPointer())); + GLState state(0, 0); BindingInfo binding(1); BindingDecl & decl = binding.GetBindingDecl(0); diff --git a/drape/glstate.cpp b/drape/glstate.cpp index f5f94d25cc..80f2ca84b9 100644 --- a/drape/glstate.cpp +++ b/drape/glstate.cpp @@ -3,10 +3,9 @@ #include "../std/bind.hpp" -GLState::GLState(uint32_t gpuProgramIndex, int16_t depthLayer, const TextureBinding & texture) +GLState::GLState(uint32_t gpuProgramIndex, int16_t depthLayer) : m_gpuProgramIndex(gpuProgramIndex) , m_depthLayer(depthLayer) - , m_texture(texture) { } @@ -14,17 +13,6 @@ int GLState::GetProgramIndex() const { return m_gpuProgramIndex; } - -const TextureBinding & GLState::GetTextureBinding() const -{ - return m_texture; -} - -TextureBinding & GLState::GetTextureBinding() -{ - return m_texture; -} - const UniformValuesStorage &GLState::GetUniformValues() const { return m_uniforms; @@ -50,13 +38,5 @@ void ApplyUniforms(const UniformValuesStorage & uniforms, RefPointer void ApplyState(GLState state, RefPointer program) { - TextureBinding & binding = state.GetTextureBinding(); - if (binding.IsEnabled()) - { - int8_t textureLocation = program->GetUniformLocation(binding.GetUniformName()); - if (textureLocation != -1) - binding.Bind(textureLocation); - } - ApplyUniforms(state.GetUniformValues(), program); } diff --git a/drape/glstate.hpp b/drape/glstate.hpp index 244c284c50..76c14ec2a6 100644 --- a/drape/glstate.hpp +++ b/drape/glstate.hpp @@ -8,11 +8,9 @@ class GLState { public: - GLState(uint32_t gpuProgramIndex, int16_t depthLayer, const TextureBinding & texture); + GLState(uint32_t gpuProgramIndex, int16_t depthLayer); int GetProgramIndex() const; - const TextureBinding & GetTextureBinding() const; - TextureBinding & GetTextureBinding(); const UniformValuesStorage & GetUniformValues() const; UniformValuesStorage & GetUniformValues(); @@ -29,7 +27,6 @@ public: private: uint32_t m_gpuProgramIndex; uint16_t m_depthLayer; - TextureBinding m_texture; UniformValuesStorage m_uniforms; }; diff --git a/drape/utils/list_generator.cpp b/drape/utils/list_generator.cpp index 7641eb07e4..5244180947 100644 --- a/drape/utils/list_generator.cpp +++ b/drape/utils/list_generator.cpp @@ -105,8 +105,7 @@ void ListGenerator::Generate(int count, Batcher & batcher) provider.InitStream(1, info, MakeStackRefPointer(&depthMemory[0])); } - TextureBinding textureBinding("", false, 0, RefPointer()); - GLState state(m_programIndex, (int16_t)m_depth, textureBinding); + GLState state(m_programIndex, (int16_t)m_depth); state.GetUniformValues() = m_uniforms; batcher.InsertTriangleList(state, MakeStackRefPointer(&provider)); } diff --git a/drape_frontend/area_shape.cpp b/drape_frontend/area_shape.cpp index b699c30d1b..c18d319176 100644 --- a/drape_frontend/area_shape.cpp +++ b/drape_frontend/area_shape.cpp @@ -21,7 +21,7 @@ namespace df void AreaShape::Draw(RefPointer batcher) const { - GLState state(gpu::SOLID_AREA_PROGRAM, 0, TextureBinding("", false, 0, MakeStackRefPointer(NULL))); + GLState state(gpu::SOLID_AREA_PROGRAM, 0); float r, g, b, a; ::Convert(m_color, r, g, b, a); state.GetUniformValues().SetFloatValue("color", r, g, b, a); diff --git a/drape_frontend/line_shape.cpp b/drape_frontend/line_shape.cpp index 1943faa3da..32969e4cd8 100644 --- a/drape_frontend/line_shape.cpp +++ b/drape_frontend/line_shape.cpp @@ -197,7 +197,7 @@ namespace df } // - GLState state(gpu::SOLID_LINE_PROGRAM, 0, TextureBinding("", false, 0, MakeStackRefPointer(NULL))); + GLState state(gpu::SOLID_LINE_PROGRAM, 0); float r, g, b, a; ::Convert(GetColor(), r, g, b, a); state.GetUniformValues().SetFloatValue("u_color", r, g, b, a);