Files
comaps/shaders/program_manager.hpp
Konstantin Pastbin e3e4a1985a Organic Maps sources as of 02.04.2025 (fad26bbf22ac3da75e01e62aa01e5c8e11861005)
To expand with full Organic Maps and Maps.ME commits history run:
  git remote add om-historic [om-historic.git repo url]
  git fetch --tags om-historic
  git replace squashed-history historic-commits
2025-05-08 21:10:51 +07:00

51 lines
1.3 KiB
C++

#pragma once
#include "shaders/program_pool.hpp"
#include "shaders/program_params.hpp"
#include "drape/drape_global.hpp"
#include "drape/graphics_context.hpp"
#include "drape/gpu_program.hpp"
#include "drape/pointers.hpp"
#include "base/macros.hpp"
#include "base/thread_checker.hpp"
#include <array>
#include <string>
namespace gpu
{
class ProgramManager
{
public:
ProgramManager() = default;
void Init(ref_ptr<dp::GraphicsContext> context);
void Destroy(ref_ptr<dp::GraphicsContext> context);
ref_ptr<dp::GpuProgram> GetProgram(Program program);
ref_ptr<ProgramParamsSetter> GetParamsSetter() const;
private:
void InitForOpenGL(ref_ptr<dp::GraphicsContext> context);
void InitForVulkan(ref_ptr<dp::GraphicsContext> context);
void DestroyForVulkan(ref_ptr<dp::GraphicsContext> context);
#if defined(OMIM_METAL_AVAILABLE)
// Definition of this method is in a .mm-file.
void InitForMetal(ref_ptr<dp::GraphicsContext> context);
void DestroyForMetal(ref_ptr<dp::GraphicsContext> context);
#endif
using Programs = std::array<drape_ptr<dp::GpuProgram>,
static_cast<size_t>(Program::ProgramsCount)>;
drape_ptr<ProgramPool> m_pool;
Programs m_programs;
drape_ptr<ProgramParamsSetter> m_paramsSetter;
DECLARE_THREAD_CHECKER(m_threadChecker);
DISALLOW_COPY_AND_MOVE(ProgramManager);
};
} // namespace gpu