summaryrefslogtreecommitdiffstats
path: root/RenderScript/include
diff options
context:
space:
mode:
authorEgor Yusov <egor.yusov@gmail.com>2019-01-31 16:26:41 +0000
committerEgor Yusov <egor.yusov@gmail.com>2019-01-31 16:26:41 +0000
commitda3fd6d1f9a24f881ef09a170f998b471d054742 (patch)
tree48a27d8ed51d519388f42315ae50285cd19e01fe /RenderScript/include
parentUpdated HLSL2GLSLConverterApp (diff)
downloadDiligentTools-da3fd6d1f9a24f881ef09a170f998b471d054742.tar.gz
DiligentTools-da3fd6d1f9a24f881ef09a170f998b471d054742.zip
Improved handling unordered_maps
Diffstat (limited to 'RenderScript/include')
-rw-r--r--RenderScript/include/BufferParser.h6
-rw-r--r--RenderScript/include/BufferViewParser.h5
-rw-r--r--RenderScript/include/DeviceContextFuncBindings.h5
-rw-r--r--RenderScript/include/DrawAttribsParser.h5
-rw-r--r--RenderScript/include/EnumMappings.h30
-rw-r--r--RenderScript/include/InputLayoutDescParser.h5
-rw-r--r--RenderScript/include/LuaBindings.h4
-rw-r--r--RenderScript/include/RasterizerStateDescParser.h6
-rw-r--r--RenderScript/include/SamplerParser.h6
-rw-r--r--RenderScript/include/ShaderParser.h5
-rw-r--r--RenderScript/include/TextureParser.h5
-rw-r--r--RenderScript/include/TextureViewParser.h6
12 files changed, 5 insertions, 83 deletions
diff --git a/RenderScript/include/BufferParser.h b/RenderScript/include/BufferParser.h
index 2ae0349..82a244b 100644
--- a/RenderScript/include/BufferParser.h
+++ b/RenderScript/include/BufferParser.h
@@ -28,12 +28,6 @@
#include "EngineObjectParserCommon.h"
#include "ClassMethodBinding.h"
-namespace std
-{
- DEFINE_ENUM_HASH( Diligent::BUFFER_MODE )
- DEFINE_ENUM_HASH( Diligent::SET_VERTEX_BUFFERS_FLAGS )
-}
-
namespace Diligent
{
class BufferParser final : public EngineObjectParserCommon<IBuffer>
diff --git a/RenderScript/include/BufferViewParser.h b/RenderScript/include/BufferViewParser.h
index e62a982..43bdd47 100644
--- a/RenderScript/include/BufferViewParser.h
+++ b/RenderScript/include/BufferViewParser.h
@@ -28,11 +28,6 @@
#include "EngineObjectParserCommon.h"
#include "ClassMethodBinding.h"
-namespace std
-{
- DEFINE_ENUM_HASH( Diligent::BUFFER_VIEW_TYPE )
-}
-
namespace Diligent
{
class BufferViewParser final : public EngineObjectParserCommon<IBufferView>
diff --git a/RenderScript/include/DeviceContextFuncBindings.h b/RenderScript/include/DeviceContextFuncBindings.h
index 3fce60a..d541023 100644
--- a/RenderScript/include/DeviceContextFuncBindings.h
+++ b/RenderScript/include/DeviceContextFuncBindings.h
@@ -28,11 +28,6 @@
#include "ClassMethodBinding.h"
#include "EnumMappings.h"
-namespace std
-{
- DEFINE_ENUM_HASH( Diligent::CLEAR_DEPTH_STENCIL_FLAGS )
-}
-
namespace Diligent
{
class DeviceContextFuncBindings
diff --git a/RenderScript/include/DrawAttribsParser.h b/RenderScript/include/DrawAttribsParser.h
index b82ccbb..dff6161 100644
--- a/RenderScript/include/DrawAttribsParser.h
+++ b/RenderScript/include/DrawAttribsParser.h
@@ -28,11 +28,6 @@
#include "EngineObjectParserCommon.h"
#include "ClassMethodBinding.h"
-namespace std
-{
- DEFINE_ENUM_HASH( Diligent::DRAW_FLAGS )
-}
-
namespace Diligent
{
class DrawAttribsParser final : public EngineObjectParserBase
diff --git a/RenderScript/include/EnumMappings.h b/RenderScript/include/EnumMappings.h
index 8bf71b3..7fae1c0 100644
--- a/RenderScript/include/EnumMappings.h
+++ b/RenderScript/include/EnumMappings.h
@@ -23,33 +23,9 @@
#pragma once
+#include <unordered_map>
#include "HashUtils.h"
-#define DEFINE_ENUM_HASH(Type)\
-template<>struct hash<Type> \
-{ \
- size_t operator()( const Type &x ) const \
- { \
- return hash<int>()(x); \
- } \
-};
-
-namespace std
-{
- DEFINE_ENUM_HASH( Diligent::RESOURCE_DIMENSION )
- DEFINE_ENUM_HASH( Diligent::TEXTURE_FORMAT )
- DEFINE_ENUM_HASH( Diligent::VALUE_TYPE )
- DEFINE_ENUM_HASH( Diligent::USAGE )
- // Explicit namespace declaraion is necesseary to avoid
- // name conflicts when building for windows store
- DEFINE_ENUM_HASH( Diligent::BIND_FLAGS )
- DEFINE_ENUM_HASH( Diligent::CPU_ACCESS_FLAGS )
- DEFINE_ENUM_HASH( Diligent::COMPARISON_FUNCTION )
- DEFINE_ENUM_HASH( Diligent::BIND_SHADER_RESOURCES_FLAGS )
- DEFINE_ENUM_HASH( Diligent::SHADER_TYPE )
- DEFINE_ENUM_HASH( Diligent::RESOURCE_STATE_TRANSITION_MODE )
-}
-
namespace Diligent
{
template<typename EnumType>
@@ -61,8 +37,8 @@ namespace Diligent
m_Val2StrMap.insert( std::make_pair( Val, Str ) );
}
- std::unordered_map< Diligent::HashMapStringKey, EnumType> m_Str2ValMap;
- std::unordered_map<EnumType, String> m_Val2StrMap;
+ std::unordered_map<HashMapStringKey, EnumType, HashMapStringKey::Hasher> m_Str2ValMap;
+ std::unordered_map<EnumType, String, std::hash<typename std::underlying_type<EnumType>::type>> m_Val2StrMap;
};
#define DEFINE_ENUM_ELEMENT_MAPPING(EnumMapping, Elem) EnumMapping.AddMapping(#Elem, Elem)
diff --git a/RenderScript/include/InputLayoutDescParser.h b/RenderScript/include/InputLayoutDescParser.h
index 73b58ba..46d2c9b 100644
--- a/RenderScript/include/InputLayoutDescParser.h
+++ b/RenderScript/include/InputLayoutDescParser.h
@@ -26,11 +26,6 @@
#include "LuaWrappers.h"
#include "LuaBindings.h"
-namespace std
-{
- DEFINE_ENUM_HASH( Diligent::LayoutElement::FREQUENCY )
-}
-
namespace Diligent
{
template<>
diff --git a/RenderScript/include/LuaBindings.h b/RenderScript/include/LuaBindings.h
index 67a3e8f..a93142e 100644
--- a/RenderScript/include/LuaBindings.h
+++ b/RenderScript/include/LuaBindings.h
@@ -120,7 +120,7 @@ namespace Diligent
protected:
const size_t m_MemberOffset;
};
- typedef std::unordered_map<Diligent::HashMapStringKey, std::unique_ptr<MemberBinderBase> > BindingsMapType;
+ typedef std::unordered_map<HashMapStringKey, std::unique_ptr<MemberBinderBase>, HashMapStringKey::Hasher> BindingsMapType;
#define DEFINE_BINDER_EX(BindingsMap, Struct, Member, type, ValidationFunc) \
do{\
@@ -571,7 +571,7 @@ namespace Diligent
EnumMapping<VALUE_TYPE> m_ValueTypeEnumMapping;
EnumMemberBinder<VALUE_TYPE> m_ValueTypeBinder;
typedef void (*ParseNumericArrayFuncType)(lua_State *L, int StackIndex, std::vector< Uint8 >& RawData);
- std::unordered_map< VALUE_TYPE, ParseNumericArrayFuncType > m_ParseFuncJumpTbl;
+ std::unordered_map< VALUE_TYPE, ParseNumericArrayFuncType, std::hash<std::underlying_type<VALUE_TYPE>::type> > m_ParseFuncJumpTbl;
};
diff --git a/RenderScript/include/RasterizerStateDescParser.h b/RenderScript/include/RasterizerStateDescParser.h
index f114fc5..f025610 100644
--- a/RenderScript/include/RasterizerStateDescParser.h
+++ b/RenderScript/include/RasterizerStateDescParser.h
@@ -26,12 +26,6 @@
#include "PipelineState.h"
#include "LuaBindings.h"
-namespace std
-{
- DEFINE_ENUM_HASH( Diligent::FILL_MODE )
- DEFINE_ENUM_HASH( Diligent::CULL_MODE )
-}
-
namespace Diligent
{
template<>
diff --git a/RenderScript/include/SamplerParser.h b/RenderScript/include/SamplerParser.h
index 6d4203d..0172f04 100644
--- a/RenderScript/include/SamplerParser.h
+++ b/RenderScript/include/SamplerParser.h
@@ -29,12 +29,6 @@
#include "ClassMethodBinding.h"
#include "EngineObjectParserCommon.h"
-namespace std
-{
- DEFINE_ENUM_HASH( Diligent::FILTER_TYPE )
- DEFINE_ENUM_HASH( Diligent::TEXTURE_ADDRESS_MODE )
-}
-
namespace Diligent
{
template<typename StructType>
diff --git a/RenderScript/include/ShaderParser.h b/RenderScript/include/ShaderParser.h
index a0cf869..f3fae7e 100644
--- a/RenderScript/include/ShaderParser.h
+++ b/RenderScript/include/ShaderParser.h
@@ -29,11 +29,6 @@
#include "ClassMethodBinding.h"
#include "EngineObjectParserCommon.h"
-namespace std
-{
- DEFINE_ENUM_HASH( Diligent::SHADER_SOURCE_LANGUAGE )
-}
-
namespace Diligent
{
class ShaderParser final : public EngineObjectParserCommon<IShader>
diff --git a/RenderScript/include/TextureParser.h b/RenderScript/include/TextureParser.h
index 3c522c2..80eaef5 100644
--- a/RenderScript/include/TextureParser.h
+++ b/RenderScript/include/TextureParser.h
@@ -28,11 +28,6 @@
#include "EngineObjectParserCommon.h"
#include "ClassMethodBinding.h"
-namespace std
-{
- DEFINE_ENUM_HASH( Diligent::MISC_TEXTURE_FLAGS )
-}
-
namespace Diligent
{
class TextureParser final : public EngineObjectParserCommon<ITexture>
diff --git a/RenderScript/include/TextureViewParser.h b/RenderScript/include/TextureViewParser.h
index b4f2fc5..e8b2bee 100644
--- a/RenderScript/include/TextureViewParser.h
+++ b/RenderScript/include/TextureViewParser.h
@@ -28,12 +28,6 @@
#include "EngineObjectParserCommon.h"
#include "ClassMethodBinding.h"
-namespace std
-{
- DEFINE_ENUM_HASH( Diligent::TEXTURE_VIEW_TYPE )
- DEFINE_ENUM_HASH( Diligent::UAV_ACCESS_FLAG )
-}
-
namespace Diligent
{
class TextureViewParser final : public EngineObjectParserCommon<ITextureView>