diff options
| author | Egor Yusov <egor.yusov@gmail.com> | 2018-04-14 18:29:09 +0000 |
|---|---|---|
| committer | Egor Yusov <egor.yusov@gmail.com> | 2018-04-14 18:29:09 +0000 |
| commit | c09883fbe3951cd77543003ae1c6fdf6e5a11517 (patch) | |
| tree | 4bbcf4b08d6825f904bb613f3463dcfda7964a61 /RenderScript/include | |
| parent | Minor update to comply with updated graphics types (diff) | |
| download | DiligentTools-c09883fbe3951cd77543003ae1c6fdf6e5a11517.tar.gz DiligentTools-c09883fbe3951cd77543003ae1c6fdf6e5a11517.zip | |
Moved primitive topology from draw attribs to pipeline desc; fixed multiple issue with mismatching types used by Lua parsers
Diffstat (limited to 'RenderScript/include')
| -rw-r--r-- | RenderScript/include/DrawAttribsParser.h | 6 | ||||
| -rw-r--r-- | RenderScript/include/LuaBindings.h | 22 | ||||
| -rw-r--r-- | RenderScript/include/SamplerParser.h | 28 |
3 files changed, 26 insertions, 30 deletions
diff --git a/RenderScript/include/DrawAttribsParser.h b/RenderScript/include/DrawAttribsParser.h index cd1a9cb..e5eb3a9 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::PRIMITIVE_TOPOLOGY ) -} - namespace Diligent { class DrawAttribsParser : public EngineObjectParserBase @@ -55,7 +50,6 @@ namespace Diligent int DispatchCompute( lua_State * ); ClassMethodCaller<DrawAttribsParser> m_DispatchComputeBinding; - EnumMapping<PRIMITIVE_TOPOLOGY> m_PrimTopologyEnumMapping; EnumMapping<VALUE_TYPE> m_ValueTypeEnumMapping; String m_BufferMetatableName; diff --git a/RenderScript/include/LuaBindings.h b/RenderScript/include/LuaBindings.h index 74ea9e8..8f04f5f 100644 --- a/RenderScript/include/LuaBindings.h +++ b/RenderScript/include/LuaBindings.h @@ -122,13 +122,15 @@ namespace Diligent }; typedef std::unordered_map<Diligent::HashMapStringKey, std::unique_ptr<MemberBinderBase> > BindingsMapType; -#define DEFINE_BINDER(BindingsMap, Struct, Member, type, ValidationFunc) \ - {\ +#define DEFINE_BINDER_EX(BindingsMap, Struct, Member, type, ValidationFunc) \ + do{\ auto *pNewBinder = new MemberBinder<type>( offsetof( Struct, Member ), ValidationFunc ); \ /* No need to make a copy of #Member since it is constant string. */ \ /* HashMapStringKey will simply keep pointer to it */ \ BindingsMap.insert( std::make_pair( #Member, std::unique_ptr<MemberBinderBase>(pNewBinder) ) ); \ - } + }while(false) + +#define DEFINE_BINDER(BindingsMap, Struct, Member) DEFINE_BINDER_EX(BindingsMap, Struct, Member, decltype(Struct::Member), Validator<decltype(Struct::Member)>() ) template<typename ValueType> void SkipValidationFunc( const ValueType & ) @@ -451,13 +453,13 @@ namespace Diligent const EnumMapping<EnumType> &m_EnumMapping; }; -#define DEFINE_ENUM_BINDER(BindingsMap, Struct, Member, type, EnumMapping ) \ - {\ - auto *pNewBinder = new EnumMemberBinder<type>( offsetof( Struct, Member ), #Member, EnumMapping ); \ +#define DEFINE_ENUM_BINDER(BindingsMap, Struct, Member, EnumMapping ) \ + do{\ + auto *pNewBinder = new EnumMemberBinder<decltype(Struct::Member)>( offsetof( Struct, Member ), #Member, EnumMapping ); \ /* No need to make a copy of #Member since it is constant string. */ \ /* HashMapStringKey will simply keep pointer to it */ \ BindingsMap.insert( std::make_pair( #Member, std::unique_ptr<MemberBinderBase>(pNewBinder) ) ); \ - } + }while(false) template< typename EnumType, typename FlagsType = Uint32 > class FlagsLoader : public MemberBinderBase @@ -534,12 +536,12 @@ namespace Diligent const EnumMapping<EnumType> &m_EnumMapping; }; #define DEFINE_FLAGS_BINDER(BindingsMap, Struct, Member, type, EnumMapping ) \ - {\ - auto *pNewBinder = new FlagsLoader<type>( offsetof( Struct, Member ), #Member, EnumMapping ); \ + do{\ + auto *pNewBinder = new FlagsLoader<type, decltype(Struct::Member)>( offsetof( Struct, Member ), #Member, EnumMapping ); \ /* No need to make a copy of #Member since it is constant string. */ \ /* HashMapStringKey will simply keep pointer to it */ \ BindingsMap.insert( std::make_pair( #Member, std::unique_ptr<MemberBinderBase>(pNewBinder) ) ); \ - } + }while(false) template<typename FieldType> diff --git a/RenderScript/include/SamplerParser.h b/RenderScript/include/SamplerParser.h index 296fdaf..3cc5dc3 100644 --- a/RenderScript/include/SamplerParser.h +++ b/RenderScript/include/SamplerParser.h @@ -57,9 +57,9 @@ namespace Diligent DEFINE_ENUM_ELEMENT_MAPPING( FilterTypeEnumMapping, FILTER_TYPE_MAXIMUM_ANISOTROPIC ); VERIFY( FilterTypeEnumMapping.m_Str2ValMap.size() == FILTER_TYPE_NUM_FILTERS - 1, "Unexpected map size. Did you update FILTER_TYPE enum?" ); VERIFY( FilterTypeEnumMapping.m_Val2StrMap.size() == FILTER_TYPE_NUM_FILTERS - 1, "Unexpected map size. Did you update FILTER_TYPE enum?" ); - DEFINE_ENUM_BINDER( Bindings, StructType, MinFilter, FILTER_TYPE, FilterTypeEnumMapping ) - DEFINE_ENUM_BINDER( Bindings, StructType, MagFilter, FILTER_TYPE, FilterTypeEnumMapping ) - DEFINE_ENUM_BINDER( Bindings, StructType, MipFilter, FILTER_TYPE, FilterTypeEnumMapping ) + DEFINE_ENUM_BINDER( Bindings, StructType, MinFilter, FilterTypeEnumMapping ); + DEFINE_ENUM_BINDER( Bindings, StructType, MagFilter, FilterTypeEnumMapping ); + DEFINE_ENUM_BINDER( Bindings, StructType, MipFilter, FilterTypeEnumMapping ); DEFINE_ENUM_ELEMENT_MAPPING( TexAddrModeEnumMapping, TEXTURE_ADDRESS_WRAP ); @@ -69,23 +69,23 @@ namespace Diligent DEFINE_ENUM_ELEMENT_MAPPING( TexAddrModeEnumMapping, TEXTURE_ADDRESS_MIRROR_ONCE ); VERIFY( TexAddrModeEnumMapping.m_Str2ValMap.size() == TEXTURE_ADDRESS_NUM_MODES - 1, "Unexpected map size. Did you update TEXTURE_ADDRESS_MODE enum?" ); VERIFY( TexAddrModeEnumMapping.m_Val2StrMap.size() == TEXTURE_ADDRESS_NUM_MODES - 1, "Unexpected map size. Did you update TEXTURE_ADDRESS_MODE enum?" ); - DEFINE_ENUM_BINDER( Bindings, StructType, AddressU, TEXTURE_ADDRESS_MODE, TexAddrModeEnumMapping ) - DEFINE_ENUM_BINDER( Bindings, StructType, AddressV, TEXTURE_ADDRESS_MODE, TexAddrModeEnumMapping ) - DEFINE_ENUM_BINDER( Bindings, StructType, AddressW, TEXTURE_ADDRESS_MODE, TexAddrModeEnumMapping ) + DEFINE_ENUM_BINDER( Bindings, StructType, AddressU, TexAddrModeEnumMapping ); + DEFINE_ENUM_BINDER( Bindings, StructType, AddressV, TexAddrModeEnumMapping ); + DEFINE_ENUM_BINDER( Bindings, StructType, AddressW, TexAddrModeEnumMapping ); - Validator<Float32> DummyValidatorF( SkipValidationFunc<float> ); - DEFINE_BINDER( Bindings, StructType, MipLODBias, Float32, DummyValidatorF ) + DEFINE_BINDER( Bindings, StructType, MipLODBias ); - Validator<Uint32> MaxAnisotropyValidator( "Max Anisotropy", 0, 32 ); - DEFINE_BINDER( Bindings, StructType, MaxAnisotropy, Uint32, MaxAnisotropyValidator ) + using MaxAnisotropyType = decltype(StructType::MaxAnisotropy); + Validator<MaxAnisotropyType> MaxAnisotropyValidator( "Max Anisotropy", 0, 32 ); + DEFINE_BINDER_EX( Bindings, StructType, MaxAnisotropy, MaxAnisotropyType, MaxAnisotropyValidator ); - DEFINE_ENUM_BINDER( Bindings, StructType, ComparisonFunc, COMPARISON_FUNCTION, CmpFuncEnumMapping ) + DEFINE_ENUM_BINDER( Bindings, StructType, ComparisonFunc, CmpFuncEnumMapping ); - DEFINE_BINDER( Bindings, StructType, BorderColor, RGBALoader, 0 ) + DEFINE_BINDER_EX( Bindings, StructType, BorderColor, RGBALoader, 0 ); - DEFINE_BINDER( Bindings, StructType, MinLOD, Float32, DummyValidatorF ) - DEFINE_BINDER( Bindings, StructType, MaxLOD, Float32, DummyValidatorF ) + DEFINE_BINDER( Bindings, StructType, MinLOD ); + DEFINE_BINDER( Bindings, StructType, MaxLOD ); } class SamplerParser : public EngineObjectParserCommon<ISampler> |
