diff options
author | r.kuznetsov <r.kuznetsov@corp.mail.ru> | 2018-08-27 12:37:52 +0300 |
---|---|---|
committer | Aleksey Belousov <beloal@users.noreply.github.com> | 2018-09-25 12:33:08 +0300 |
commit | a81f1fc4d1f698a0f0aaaa1e7a29f41516b05d11 (patch) | |
tree | cf7c511247ca2ae4da08e2a11d2b22232846a3da /drape/gl_gpu_program.hpp | |
parent | 5cca83542d89b081d668bccca7bf14c5c8c165ad (diff) |
[drape][metal] Added states.
Diffstat (limited to 'drape/gl_gpu_program.hpp')
-rw-r--r-- | drape/gl_gpu_program.hpp | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/drape/gl_gpu_program.hpp b/drape/gl_gpu_program.hpp new file mode 100644 index 0000000000..d446a3fb13 --- /dev/null +++ b/drape/gl_gpu_program.hpp @@ -0,0 +1,51 @@ +#pragma once + +#include "drape/gl_constants.hpp" +#include "drape/gpu_program.hpp" +#include "drape/pointers.hpp" +#include "drape/shader.hpp" + +#include <map> +#include <string> +#include <vector> + +namespace dp +{ +class GLGpuProgram : public GpuProgram +{ +public: + GLGpuProgram(std::string const & programName, + ref_ptr<Shader> vertexShader, ref_ptr<Shader> fragmentShader); + ~GLGpuProgram() override; + + void Bind() override; + void Unbind() override; + + int8_t GetAttributeLocation(std::string const & attributeName) const; + int8_t GetUniformLocation(std::string const & uniformName) const; + glConst GetUniformType(std::string const & uniformName) const; + + struct UniformInfo + { + int8_t m_location = -1; + glConst m_type = gl_const::GLFloatType; + }; + + using UniformsInfo = std::map<std::string, UniformInfo>; + UniformsInfo const & GetUniformsInfo() const; + uint32_t GetNumericUniformsCount() const { return m_numericUniformsCount; } + +private: + void LoadUniformLocations(); + uint32_t CalculateNumericUniformsCount() const; + + uint32_t m_programID; + + ref_ptr<Shader> m_vertexShader; + ref_ptr<Shader> m_fragmentShader; + + UniformsInfo m_uniforms; + uint8_t m_textureSlotsCount = 0; + uint32_t m_numericUniformsCount = 0; +}; +} // namespace dp |