Try to fix OSX build by using type index which is copy constructible

This commit is contained in:
Benau
2018-01-23 09:53:23 +08:00
parent e5cdf3a086
commit dea6dc1f3f
5 changed files with 18 additions and 15 deletions

View File

@@ -194,7 +194,7 @@ void SPShader::bindTextures(const std::array<GLuint, 6>& tex,
} // bindTextures
// ----------------------------------------------------------------------------
void SPShader::addUniform(const std::string& name, const std::type_info& ti,
void SPShader::addUniform(const std::string& name, const std::type_index& ti,
RenderPass rp)
{
#ifndef SERVER_ONLY

View File

@@ -30,11 +30,11 @@
#include <map>
#include <memory>
#include <string>
#include <typeinfo>
#include <typeindex>
#include <unordered_map>
#include <vector>
#include <SMaterial.h>
namespace SP
{
@@ -190,7 +190,7 @@ public:
SPUniformAssigner* getUniformAssigner(const std::string& name,
RenderPass rp = RP_1ST) const;
// ------------------------------------------------------------------------
void addUniform(const std::string& name, const std::type_info& ti,
void addUniform(const std::string& name, const std::type_index& ti,
RenderPass rp = RP_1ST);
// ------------------------------------------------------------------------
void setUniformsPerObject(SPPerObjectUniform* sppou,

View File

@@ -39,12 +39,12 @@ SPShaderManager::SPShaderManager()
#ifndef SERVER_ONLY
m_official_types =
{
{ "int", typeid(int) },
{ "float", typeid(float) },
{ "mat4", typeid(irr::core::matrix4) },
{ "vec4", typeid(std::array<float, 4>) },
{ "vec3", typeid(irr::core::vector3df) },
{ "vec2", typeid(irr::core::vector2df) }
{ "int", std::type_index(typeid(int)) },
{ "float", std::type_index(typeid(float)) },
{ "mat4", std::type_index(typeid(irr::core::matrix4)) },
{ "vec4", std::type_index(typeid(std::array<float, 4>)) },
{ "vec3", std::type_index(typeid(irr::core::vector3df)) },
{ "vec2", std::type_index(typeid(irr::core::vector2df)) }
};
m_official_sampler_types =
@@ -486,7 +486,7 @@ std::shared_ptr<SPShader> SPShaderManager::buildSPShader(const ShaderInfo& si,
// ----------------------------------------------------------------------------
void SPShaderManager::addUniformsToShader(SPShader* s,
const std::vector<std::pair<std::string, const std::type_info&> >& u,
const std::vector<std::pair<std::string, std::type_index> >& u,
RenderPass rp)
{
for (auto& p : u)

View File

@@ -22,6 +22,8 @@
#include <functional>
#include <memory>
#include <string>
#include <typeinfo>
#include <typeindex>
#include <unordered_map>
#include <vector>
@@ -71,7 +73,7 @@ private:
std::string m_skinned_mesh_shader;
std::vector<std::pair<std::string, const std::type_info&> > m_uniforms;
std::vector<std::pair<std::string, std::type_index> > m_uniforms;
std::vector<std::tuple<std::string, std::string, bool, SamplerType> >
m_prefilled_textures;
@@ -83,7 +85,7 @@ private:
std::vector<std::shared_ptr<SPShader> > m_official_shaders;
std::unordered_map<std::string, const std::type_info&> m_official_types;
std::unordered_map<std::string, std::type_index> m_official_types;
std::unordered_map<std::string, SamplerType> m_official_sampler_types;
@@ -111,7 +113,7 @@ private:
bool skinned);
// ------------------------------------------------------------------------
static void addUniformsToShader(SPShader* s,
const std::vector<std::pair<std::string, const std::type_info&> >& u,
const std::vector<std::pair<std::string, std::type_index> >& u,
RenderPass rp);
// ------------------------------------------------------------------------
static void addPrefilledTexturesToShader(SPShader* s,

View File

@@ -25,6 +25,7 @@
#include "utils/log.hpp"
#endif
#include <typeinfo>
#include <typeindex>
#include <array>
#include <string>
@@ -49,7 +50,7 @@ private:
public:
// ------------------------------------------------------------------------
SPUniformAssigner(const std::type_info& ti, GLuint location)
SPUniformAssigner(const std::type_index& ti, GLuint location)
: m_location(location), m_type(ti), m_assigned(false) {}
// ------------------------------------------------------------------------
bool rumtimeChecking(const std::type_info& ti) const