diff --git a/src/mbgl/renderer/render_orchestrator.cpp b/src/mbgl/renderer/render_orchestrator.cpp index cd62a97cf..f89ec5086 100644 --- a/src/mbgl/renderer/render_orchestrator.cpp +++ b/src/mbgl/renderer/render_orchestrator.cpp @@ -34,13 +34,13 @@ namespace mbgl { using namespace style; -static RendererObserver& nullObserver() { +namespace { + +RendererObserver& nullObserver() { static RendererObserver observer; return observer; } -namespace { - class LayerRenderItem final : public RenderItem { public: LayerRenderItem(RenderLayer& layer_, RenderSource* source_, uint32_t index_) @@ -378,8 +378,8 @@ std::unique_ptr RenderOrchestrator::createRenderTree( #if MLN_DRAWABLE_RENDERER // Mark layers included in the renderable set as renderable // @TODO: Optimize this logic, combine with the above - for (size_t i = 0; i < orderedLayers.size(); ++i) { - RenderLayer& layer = orderedLayers[i]; + for (auto orderedLayer : orderedLayers) { + RenderLayer& layer = orderedLayer; layer.markLayerRenderable( layerRenderItems.find(LayerRenderItem(layer, nullptr, static_cast(layer.getLayerIndex()))) != layerRenderItems.end(), diff --git a/src/mbgl/shaders/gl/shader_program_gl.cpp b/src/mbgl/shaders/gl/shader_program_gl.cpp index 7421ae3ab..d06a8b5f9 100644 --- a/src/mbgl/shaders/gl/shader_program_gl.cpp +++ b/src/mbgl/shaders/gl/shader_program_gl.cpp @@ -13,7 +13,9 @@ namespace mbgl { namespace gl { -static gfx::AttributeDataType mapType(platform::GLenum attrType) { +namespace { + +gfx::AttributeDataType mapType(platform::GLenum attrType) { using T = gfx::AttributeDataType; switch (attrType) { case GL_FLOAT: @@ -67,6 +69,20 @@ static gfx::AttributeDataType mapType(platform::GLenum attrType) { } } +using namespace platform; + +void addAttr(VertexAttributeArrayGL& attrs, const char* name, GLint index, GLsizei length, GLint count, GLenum glType) { + const auto elementType = mapType(glType); + if (elementType != gfx::AttributeDataType::Invalid && length > 0) { + if (const auto& newAttr = attrs.add(name, index, elementType, count)) { + const auto& glAttr = static_cast(newAttr.get()); + glAttr->setGLType(glType); + } + } +} + +} // namespace + ShaderProgramGL::ShaderProgramGL(UniqueProgram&& glProgram_) : ShaderProgramBase(), glProgram(std::move(glProgram_)) {} @@ -85,19 +101,6 @@ ShaderProgramGL::ShaderProgramGL(ShaderProgramGL&& other) uniformBlocks(std::move(other.uniformBlocks)), vertexAttributes(std::move(other.vertexAttributes)) {} -using namespace platform; - -static void addAttr( - VertexAttributeArrayGL& attrs, const char* name, GLint index, GLsizei length, GLint count, GLenum glType) { - const auto elementType = mapType(glType); - if (elementType != gfx::AttributeDataType::Invalid && length > 0) { - if (const auto& newAttr = attrs.add(name, index, elementType, count)) { - const auto& glAttr = static_cast(newAttr.get()); - glAttr->setGLType(glType); - } - } -} - std::optional ShaderProgramGL::getSamplerLocation(const std::string_view name) const { GLint sampler_location = MBGL_CHECK_ERROR(glGetUniformLocation(glProgram, name.data())); return (sampler_location == -1) ? std::optional{} : sampler_location;