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

gpu_program.hpp « drape - github.com/mapsme/omim.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 09c03724f23679e04fb3d54a5187f5750000b208 (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
#pragma once

#include "drape/shader.hpp"
#include "drape/pointers.hpp"
#include "drape/glconstants.hpp"

#include "std/string.hpp"

#ifdef DEBUG
  #include "../std/unique_ptr.hpp"
#endif

namespace dp
{

#ifdef DEBUG
  class UniformValidator;
  typedef int32_t UniformSize;
  typedef pair<glConst, UniformSize> UniformTypeAndSize;
#endif

class GpuProgram
{
public:
  GpuProgram(RefPointer<Shader> vertexShader,
             RefPointer<Shader> fragmentShader);
  ~GpuProgram();

  void Bind();
  void Unbind();

  int8_t GetAttributeLocation(string const & attributeName) const;
  int8_t GetUniformLocation(string const & uniformName) const;

private:
  uint32_t m_programID;

#ifdef DEBUG
private:
  unique_ptr<UniformValidator> m_validator;
public:
  bool HasUniform(string const & name, glConst type, UniformSize size);
#endif
};

} // namespace dp