Welcome to mirror list, hosted at ThFree Co, Russian Federation.

program_manager.hpp « shaders - github.com/mapsme/omim.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 7ff99fbf84d746f594dfadfdf8aef2394156789b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#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 <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);
#endif

  using Programs = std::array<drape_ptr<dp::GpuProgram>,
                              static_cast<size_t>(Program::ProgramsCount)>;
  Programs m_programs;
  drape_ptr<ProgramPool> m_pool;
  drape_ptr<ProgramParamsSetter> m_paramsSetter;

  DISALLOW_COPY_AND_MOVE(ProgramManager);
};
}  // namespace gpu