From c09883fbe3951cd77543003ae1c6fdf6e5a11517 Mon Sep 17 00:00:00 2001 From: Egor Yusov Date: Sat, 14 Apr 2018 11:29:09 -0700 Subject: Moved primitive topology from draw attribs to pipeline desc; fixed multiple issue with mismatching types used by Lua parsers --- RenderScript/include/DrawAttribsParser.h | 6 -- RenderScript/include/LuaBindings.h | 22 +++--- RenderScript/include/SamplerParser.h | 28 +++---- RenderScript/src/BlendStateDescParser.cpp | 20 ++--- RenderScript/src/BufferParser.cpp | 17 ++-- RenderScript/src/BufferViewParser.cpp | 10 +-- RenderScript/src/DepthStencilStateDescParser.cpp | 24 +++--- RenderScript/src/DrawAttribsParser.cpp | 67 ++++------------ RenderScript/src/InputLayoutDescParser.cpp | 19 +++-- RenderScript/src/PSODescParser.cpp | 99 ++++++++++++++++-------- RenderScript/src/RasterizerStateDescParser.cpp | 18 ++--- RenderScript/src/ResourceMappingParser.cpp | 4 +- RenderScript/src/ScissorRectParser.cpp | 8 +- RenderScript/src/ShaderParser.cpp | 8 +- RenderScript/src/TextureParser.cpp | 58 ++++++++++---- RenderScript/src/TextureViewParser.cpp | 55 +++++++++---- RenderScript/src/ViewportParser.cpp | 12 +-- 17 files changed, 262 insertions(+), 213 deletions(-) (limited to 'RenderScript') 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 m_DispatchComputeBinding; - EnumMapping m_PrimTopologyEnumMapping; EnumMapping 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 > BindingsMapType; -#define DEFINE_BINDER(BindingsMap, Struct, Member, type, ValidationFunc) \ - {\ +#define DEFINE_BINDER_EX(BindingsMap, Struct, Member, type, ValidationFunc) \ + do{\ auto *pNewBinder = new MemberBinder( 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(pNewBinder) ) ); \ - } + }while(false) + +#define DEFINE_BINDER(BindingsMap, Struct, Member) DEFINE_BINDER_EX(BindingsMap, Struct, Member, decltype(Struct::Member), Validator() ) template void SkipValidationFunc( const ValueType & ) @@ -451,13 +453,13 @@ namespace Diligent const EnumMapping &m_EnumMapping; }; -#define DEFINE_ENUM_BINDER(BindingsMap, Struct, Member, type, EnumMapping ) \ - {\ - auto *pNewBinder = new EnumMemberBinder( offsetof( Struct, Member ), #Member, EnumMapping ); \ +#define DEFINE_ENUM_BINDER(BindingsMap, Struct, Member, EnumMapping ) \ + do{\ + auto *pNewBinder = new EnumMemberBinder( 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(pNewBinder) ) ); \ - } + }while(false) template< typename EnumType, typename FlagsType = Uint32 > class FlagsLoader : public MemberBinderBase @@ -534,12 +536,12 @@ namespace Diligent const EnumMapping &m_EnumMapping; }; #define DEFINE_FLAGS_BINDER(BindingsMap, Struct, Member, type, EnumMapping ) \ - {\ - auto *pNewBinder = new FlagsLoader( offsetof( Struct, Member ), #Member, EnumMapping ); \ + do{\ + auto *pNewBinder = new FlagsLoader( 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(pNewBinder) ) ); \ - } + }while(false) template 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 DummyValidatorF( SkipValidationFunc ); - DEFINE_BINDER( Bindings, StructType, MipLODBias, Float32, DummyValidatorF ) + DEFINE_BINDER( Bindings, StructType, MipLODBias ); - Validator MaxAnisotropyValidator( "Max Anisotropy", 0, 32 ); - DEFINE_BINDER( Bindings, StructType, MaxAnisotropy, Uint32, MaxAnisotropyValidator ) + using MaxAnisotropyType = decltype(StructType::MaxAnisotropy); + Validator 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 diff --git a/RenderScript/src/BlendStateDescParser.cpp b/RenderScript/src/BlendStateDescParser.cpp index c5a1d98..d5a2d84 100644 --- a/RenderScript/src/BlendStateDescParser.cpp +++ b/RenderScript/src/BlendStateDescParser.cpp @@ -45,7 +45,7 @@ namespace Diligent MemberBinder( size_t MemberOffset, size_t Dummy ) : MemberBinderBase( MemberOffset ) { - DEFINE_BINDER( m_Bindings, RenderTargetBlendDesc, BlendEnable, Bool, Validator() ) + DEFINE_BINDER( m_Bindings, RenderTargetBlendDesc, BlendEnable ); DEFINE_ENUM_ELEMENT_MAPPING( m_BlendFactorEnumMapping, BLEND_FACTOR_ZERO); DEFINE_ENUM_ELEMENT_MAPPING( m_BlendFactorEnumMapping, BLEND_FACTOR_ONE); @@ -69,10 +69,10 @@ namespace Diligent VERIFY( m_BlendFactorEnumMapping.m_Val2StrMap.size() == BLEND_FACTOR_NUM_FACTORS - 1, "Unexpected map size. Did you update BLEND_FACTOR enum?" ); - DEFINE_ENUM_BINDER( m_Bindings, RenderTargetBlendDesc, SrcBlend, BLEND_FACTOR, m_BlendFactorEnumMapping ); - DEFINE_ENUM_BINDER( m_Bindings, RenderTargetBlendDesc, DestBlend, BLEND_FACTOR, m_BlendFactorEnumMapping ); - DEFINE_ENUM_BINDER( m_Bindings, RenderTargetBlendDesc, SrcBlendAlpha, BLEND_FACTOR, m_BlendFactorEnumMapping ); - DEFINE_ENUM_BINDER( m_Bindings, RenderTargetBlendDesc, DestBlendAlpha, BLEND_FACTOR, m_BlendFactorEnumMapping ); + DEFINE_ENUM_BINDER( m_Bindings, RenderTargetBlendDesc, SrcBlend, m_BlendFactorEnumMapping ); + DEFINE_ENUM_BINDER( m_Bindings, RenderTargetBlendDesc, DestBlend, m_BlendFactorEnumMapping ); + DEFINE_ENUM_BINDER( m_Bindings, RenderTargetBlendDesc, SrcBlendAlpha, m_BlendFactorEnumMapping ); + DEFINE_ENUM_BINDER( m_Bindings, RenderTargetBlendDesc, DestBlendAlpha, m_BlendFactorEnumMapping ); DEFINE_ENUM_ELEMENT_MAPPING( m_BlendOpEnumMapping, BLEND_OPERATION_ADD ); @@ -85,8 +85,8 @@ namespace Diligent VERIFY( m_BlendOpEnumMapping.m_Val2StrMap.size() == BLEND_OPERATION_NUM_OPERATIONS - 1, "Unexpected map size. Did you update BLEND_OPERATION enum?" ); - DEFINE_ENUM_BINDER( m_Bindings, RenderTargetBlendDesc, BlendOp, BLEND_OPERATION, m_BlendOpEnumMapping ); - DEFINE_ENUM_BINDER( m_Bindings, RenderTargetBlendDesc, BlendOpAlpha, BLEND_OPERATION, m_BlendOpEnumMapping ); + DEFINE_ENUM_BINDER( m_Bindings, RenderTargetBlendDesc, BlendOp, m_BlendOpEnumMapping ); + DEFINE_ENUM_BINDER( m_Bindings, RenderTargetBlendDesc, BlendOpAlpha, m_BlendOpEnumMapping ); DEFINE_ENUM_ELEMENT_MAPPING( m_ColorMaskEnumMapping, COLOR_MASK_RED ); @@ -134,10 +134,10 @@ namespace Diligent MemberBinder :: MemberBinder( size_t MemberOffset, size_t Dummy ) : MemberBinderBase( MemberOffset ) { - DEFINE_BINDER( m_Bindings, BlendStateDesc, AlphaToCoverageEnable, Bool, Validator() ) - DEFINE_BINDER( m_Bindings, BlendStateDesc, IndependentBlendEnable, Bool, Validator() ) + DEFINE_BINDER( m_Bindings, BlendStateDesc, AlphaToCoverageEnable ); + DEFINE_BINDER( m_Bindings, BlendStateDesc, IndependentBlendEnable ); - DEFINE_BINDER( m_Bindings, BlendStateDesc, RenderTargets, RenderTargetBlendDescArrayParser, 0 ) + DEFINE_BINDER_EX( m_Bindings, BlendStateDesc, RenderTargets, RenderTargetBlendDescArrayParser, 0 ); } void MemberBinder ::GetValue(lua_State *L, const void* pBasePointer) diff --git a/RenderScript/src/BufferParser.cpp b/RenderScript/src/BufferParser.cpp index 25ce23c..98e72d0 100644 --- a/RenderScript/src/BufferParser.cpp +++ b/RenderScript/src/BufferParser.cpp @@ -36,9 +36,10 @@ namespace Diligent MemberBinder( size_t MemberOffset, size_t Dummy ) : MemberBinderBase( MemberOffset ) { - DEFINE_ENUM_BINDER( m_Bindings, BufferDesc::BufferFormat, ValueType, VALUE_TYPE, m_ValueTypeEnumMapping ) - DEFINE_BINDER( m_Bindings, BufferDesc::BufferFormat, NumComponents, Uint32, Validator( "Num Components", 1, 4 ) ) - DEFINE_BINDER( m_Bindings, BufferDesc::BufferFormat, IsNormalized, Bool, Validator() ) + DEFINE_ENUM_BINDER( m_Bindings, BufferDesc::BufferFormat, ValueType, m_ValueTypeEnumMapping ); + using NumComponentsType = decltype(BufferDesc::BufferFormat::NumComponents); + DEFINE_BINDER_EX( m_Bindings, BufferDesc::BufferFormat, NumComponents, NumComponentsType, Validator( "Num Components", 1, 4 ) ); + DEFINE_BINDER( m_Bindings, BufferDesc::BufferFormat, IsNormalized ); } virtual void GetValue( lua_State *L, const void* pBasePointer ) @@ -64,7 +65,7 @@ namespace Diligent { DEFINE_BUFFERED_STRING_BINDER( m_Bindings, SBuffDescWrapper, Name, NameBuffer ); - DEFINE_BINDER( m_Bindings, SBuffDescWrapper, uiSizeInBytes, Uint32, Validator() ) + DEFINE_BINDER( m_Bindings, SBuffDescWrapper, uiSizeInBytes ); DEFINE_ENUM_ELEMENT_MAPPING( m_BindFlagEnumMapping, BIND_VERTEX_BUFFER ); DEFINE_ENUM_ELEMENT_MAPPING( m_BindFlagEnumMapping, BIND_INDEX_BUFFER ); @@ -79,7 +80,7 @@ namespace Diligent // name conflicts when building for windows store DEFINE_FLAGS_BINDER( m_Bindings, SBuffDescWrapper, BindFlags, Diligent::BIND_FLAGS, m_BindFlagEnumMapping ); - DEFINE_ENUM_BINDER( m_Bindings, SBuffDescWrapper, Usage, USAGE, m_UsageEnumMapping ) + DEFINE_ENUM_BINDER( m_Bindings, SBuffDescWrapper, Usage, m_UsageEnumMapping ); DEFINE_FLAGS_BINDER( m_Bindings, SBuffDescWrapper, CPUAccessFlags, CPU_ACCESS_FLAG, m_CpuAccessFlagEnumMapping ); DEFINE_ENUM_ELEMENT_MAPPING( m_BuffModeEnumMapping, BUFFER_MODE_UNDEFINED ); @@ -90,10 +91,10 @@ namespace Diligent "Unexpected map size. Did you update BUFFER_MODE enum?" ); VERIFY( m_BuffModeEnumMapping.m_Val2StrMap.size() == BUFFER_MODE_NUM_MODES, "Unexpected map size. Did you update BUFFER_MODE enum?" ); - DEFINE_ENUM_BINDER( m_Bindings, SBuffDescWrapper, Mode, BUFFER_MODE, m_BuffModeEnumMapping ); + DEFINE_ENUM_BINDER( m_Bindings, SBuffDescWrapper, Mode, m_BuffModeEnumMapping ); - DEFINE_BINDER( m_Bindings, SBuffDescWrapper, Format, BufferDesc::BufferFormat, 0 ); - DEFINE_BINDER( m_Bindings, SBuffDescWrapper, ElementByteStride, Uint32, Validator() ); + DEFINE_BINDER_EX( m_Bindings, SBuffDescWrapper, Format, decltype(BufferDesc::Format), 0 ); + DEFINE_BINDER( m_Bindings, SBuffDescWrapper, ElementByteStride ); DEFINE_ENUM_ELEMENT_MAPPING( m_SetVBFlagEnumMapping, SET_VERTEX_BUFFERS_FLAG_RESET ); }; diff --git a/RenderScript/src/BufferViewParser.cpp b/RenderScript/src/BufferViewParser.cpp index fda2999..cbd7aec 100644 --- a/RenderScript/src/BufferViewParser.cpp +++ b/RenderScript/src/BufferViewParser.cpp @@ -31,8 +31,8 @@ namespace Diligent const Char* BufferViewParser::BufferViewLibName = "BufferView"; BufferViewParser::BufferViewParser( BufferParser *pBufParser, - IRenderDevice *pRenderDevice, - lua_State *L ) : + IRenderDevice *pRenderDevice, + lua_State *L ) : EngineObjectParserCommon( pRenderDevice, L, BufferViewLibName ), m_BufferLibMetatableName(pBufParser->GetMetatableName()), m_CreateViewBinding( this, L, m_BufferLibMetatableName.c_str(), "CreateView", &BufferViewParser::CreateView ), @@ -47,10 +47,10 @@ namespace Diligent "Unexpected map size. Did you update BUFFER_VIEW_TYPE enum?" ); VERIFY( m_ViewTypeEnumMapping.m_Val2StrMap.size() == BUFFER_VIEW_NUM_VIEWS - 1, "Unexpected map size. Did you update BUFFER_VIEW_TYPE enum?" ); - DEFINE_ENUM_BINDER( m_Bindings, SBuffViewDescWrapper, ViewType, BUFFER_VIEW_TYPE, m_ViewTypeEnumMapping ); + DEFINE_ENUM_BINDER( m_Bindings, SBuffViewDescWrapper, ViewType, m_ViewTypeEnumMapping ); - DEFINE_BINDER( m_Bindings, SBuffViewDescWrapper, ByteOffset, Uint32, Validator() ); - DEFINE_BINDER( m_Bindings, SBuffViewDescWrapper, ByteWidth, Uint32, Validator() ); + DEFINE_BINDER( m_Bindings, SBuffViewDescWrapper, ByteOffset); + DEFINE_BINDER( m_Bindings, SBuffViewDescWrapper, ByteWidth); }; void BufferViewParser::CreateObj( lua_State *L ) diff --git a/RenderScript/src/DepthStencilStateDescParser.cpp b/RenderScript/src/DepthStencilStateDescParser.cpp index 5308316..001e4d2 100644 --- a/RenderScript/src/DepthStencilStateDescParser.cpp +++ b/RenderScript/src/DepthStencilStateDescParser.cpp @@ -51,10 +51,10 @@ namespace Diligent VERIFY( m_StencilOpEnumMapping.m_Val2StrMap.size() == STENCIL_OP_NUM_OPS - 1, "Unexpected map size. Did you update STENCIL_OP enum?" ); - DEFINE_ENUM_BINDER( m_Bindings, StencilOpDesc, StencilFailOp, STENCIL_OP, m_StencilOpEnumMapping ) - DEFINE_ENUM_BINDER( m_Bindings, StencilOpDesc, StencilDepthFailOp, STENCIL_OP, m_StencilOpEnumMapping ) - DEFINE_ENUM_BINDER( m_Bindings, StencilOpDesc, StencilPassOp, STENCIL_OP, m_StencilOpEnumMapping ) - DEFINE_ENUM_BINDER( m_Bindings, StencilOpDesc, StencilFunc, COMPARISON_FUNCTION, m_CmpFuncEnumMapping ) + DEFINE_ENUM_BINDER( m_Bindings, StencilOpDesc, StencilFailOp, m_StencilOpEnumMapping ); + DEFINE_ENUM_BINDER( m_Bindings, StencilOpDesc, StencilDepthFailOp, m_StencilOpEnumMapping ); + DEFINE_ENUM_BINDER( m_Bindings, StencilOpDesc, StencilPassOp, m_StencilOpEnumMapping ); + DEFINE_ENUM_BINDER( m_Bindings, StencilOpDesc, StencilFunc, m_CmpFuncEnumMapping ); } virtual void GetValue( lua_State *L, const void* pBasePointer ) @@ -78,15 +78,15 @@ namespace Diligent MemberBinder::MemberBinder( size_t MemberOffset, size_t Dummy ) : MemberBinderBase( MemberOffset ) { - DEFINE_BINDER( m_Bindings, DepthStencilStateDesc, DepthEnable, Bool, Validator() ) - DEFINE_BINDER( m_Bindings, DepthStencilStateDesc, DepthWriteEnable, Bool, Validator() ) - DEFINE_ENUM_BINDER( m_Bindings, DepthStencilStateDesc, DepthFunc, COMPARISON_FUNCTION, m_CmpFuncEnumMapping ) + DEFINE_BINDER( m_Bindings, DepthStencilStateDesc, DepthEnable ); + DEFINE_BINDER( m_Bindings, DepthStencilStateDesc, DepthWriteEnable ); + DEFINE_ENUM_BINDER( m_Bindings, DepthStencilStateDesc, DepthFunc, m_CmpFuncEnumMapping ); - DEFINE_BINDER( m_Bindings, DepthStencilStateDesc, StencilEnable, Bool, Validator() ) - DEFINE_BINDER( m_Bindings, DepthStencilStateDesc, StencilReadMask, Uint8, Validator() ) - DEFINE_BINDER( m_Bindings, DepthStencilStateDesc, StencilWriteMask, Uint8, Validator() ) - DEFINE_BINDER( m_Bindings, DepthStencilStateDesc, FrontFace, StencilOpDesc, 0 ) - DEFINE_BINDER( m_Bindings, DepthStencilStateDesc, BackFace, StencilOpDesc, 0 ) + DEFINE_BINDER( m_Bindings, DepthStencilStateDesc, StencilEnable ); + DEFINE_BINDER( m_Bindings, DepthStencilStateDesc, StencilReadMask ); + DEFINE_BINDER( m_Bindings, DepthStencilStateDesc, StencilWriteMask ); + DEFINE_BINDER_EX( m_Bindings, DepthStencilStateDesc, FrontFace, StencilOpDesc, 0 ); + DEFINE_BINDER_EX( m_Bindings, DepthStencilStateDesc, BackFace, StencilOpDesc, 0 ); }; void MemberBinder ::GetValue(lua_State *L, const void* pBasePointer) diff --git a/RenderScript/src/DrawAttribsParser.cpp b/RenderScript/src/DrawAttribsParser.cpp index 629c283..c620e02 100644 --- a/RenderScript/src/DrawAttribsParser.cpp +++ b/RenderScript/src/DrawAttribsParser.cpp @@ -35,70 +35,29 @@ namespace Diligent m_DispatchComputeBinding( this, L, "Context", "DispatchCompute", &DrawAttribsParser::DispatchCompute ), m_BufferMetatableName(pBuffParser->GetMetatableName()) { - DEFINE_ENUM_ELEMENT_MAPPING( m_PrimTopologyEnumMapping, PRIMITIVE_TOPOLOGY_TRIANGLE_LIST ); - DEFINE_ENUM_ELEMENT_MAPPING( m_PrimTopologyEnumMapping, PRIMITIVE_TOPOLOGY_TRIANGLE_STRIP ); - DEFINE_ENUM_ELEMENT_MAPPING( m_PrimTopologyEnumMapping, PRIMITIVE_TOPOLOGY_POINT_LIST ); - DEFINE_ENUM_ELEMENT_MAPPING( m_PrimTopologyEnumMapping, PRIMITIVE_TOPOLOGY_LINE_LIST ); - DEFINE_ENUM_ELEMENT_MAPPING( m_PrimTopologyEnumMapping, PRIMITIVE_TOPOLOGY_1_CONTROL_POINT_PATCHLIST ); - DEFINE_ENUM_ELEMENT_MAPPING( m_PrimTopologyEnumMapping, PRIMITIVE_TOPOLOGY_2_CONTROL_POINT_PATCHLIST ); - DEFINE_ENUM_ELEMENT_MAPPING( m_PrimTopologyEnumMapping, PRIMITIVE_TOPOLOGY_3_CONTROL_POINT_PATCHLIST ); - DEFINE_ENUM_ELEMENT_MAPPING( m_PrimTopologyEnumMapping, PRIMITIVE_TOPOLOGY_4_CONTROL_POINT_PATCHLIST ); - DEFINE_ENUM_ELEMENT_MAPPING( m_PrimTopologyEnumMapping, PRIMITIVE_TOPOLOGY_5_CONTROL_POINT_PATCHLIST ); - DEFINE_ENUM_ELEMENT_MAPPING( m_PrimTopologyEnumMapping, PRIMITIVE_TOPOLOGY_6_CONTROL_POINT_PATCHLIST ); - DEFINE_ENUM_ELEMENT_MAPPING( m_PrimTopologyEnumMapping, PRIMITIVE_TOPOLOGY_7_CONTROL_POINT_PATCHLIST ); - DEFINE_ENUM_ELEMENT_MAPPING( m_PrimTopologyEnumMapping, PRIMITIVE_TOPOLOGY_8_CONTROL_POINT_PATCHLIST ); - DEFINE_ENUM_ELEMENT_MAPPING( m_PrimTopologyEnumMapping, PRIMITIVE_TOPOLOGY_9_CONTROL_POINT_PATCHLIST ); - DEFINE_ENUM_ELEMENT_MAPPING( m_PrimTopologyEnumMapping, PRIMITIVE_TOPOLOGY_10_CONTROL_POINT_PATCHLIST ); - DEFINE_ENUM_ELEMENT_MAPPING( m_PrimTopologyEnumMapping, PRIMITIVE_TOPOLOGY_11_CONTROL_POINT_PATCHLIST ); - DEFINE_ENUM_ELEMENT_MAPPING( m_PrimTopologyEnumMapping, PRIMITIVE_TOPOLOGY_12_CONTROL_POINT_PATCHLIST ); - DEFINE_ENUM_ELEMENT_MAPPING( m_PrimTopologyEnumMapping, PRIMITIVE_TOPOLOGY_13_CONTROL_POINT_PATCHLIST ); - DEFINE_ENUM_ELEMENT_MAPPING( m_PrimTopologyEnumMapping, PRIMITIVE_TOPOLOGY_14_CONTROL_POINT_PATCHLIST ); - DEFINE_ENUM_ELEMENT_MAPPING( m_PrimTopologyEnumMapping, PRIMITIVE_TOPOLOGY_15_CONTROL_POINT_PATCHLIST ); - DEFINE_ENUM_ELEMENT_MAPPING( m_PrimTopologyEnumMapping, PRIMITIVE_TOPOLOGY_16_CONTROL_POINT_PATCHLIST ); - DEFINE_ENUM_ELEMENT_MAPPING( m_PrimTopologyEnumMapping, PRIMITIVE_TOPOLOGY_17_CONTROL_POINT_PATCHLIST ); - DEFINE_ENUM_ELEMENT_MAPPING( m_PrimTopologyEnumMapping, PRIMITIVE_TOPOLOGY_18_CONTROL_POINT_PATCHLIST ); - DEFINE_ENUM_ELEMENT_MAPPING( m_PrimTopologyEnumMapping, PRIMITIVE_TOPOLOGY_19_CONTROL_POINT_PATCHLIST ); - DEFINE_ENUM_ELEMENT_MAPPING( m_PrimTopologyEnumMapping, PRIMITIVE_TOPOLOGY_20_CONTROL_POINT_PATCHLIST ); - DEFINE_ENUM_ELEMENT_MAPPING( m_PrimTopologyEnumMapping, PRIMITIVE_TOPOLOGY_21_CONTROL_POINT_PATCHLIST ); - DEFINE_ENUM_ELEMENT_MAPPING( m_PrimTopologyEnumMapping, PRIMITIVE_TOPOLOGY_22_CONTROL_POINT_PATCHLIST ); - DEFINE_ENUM_ELEMENT_MAPPING( m_PrimTopologyEnumMapping, PRIMITIVE_TOPOLOGY_23_CONTROL_POINT_PATCHLIST ); - DEFINE_ENUM_ELEMENT_MAPPING( m_PrimTopologyEnumMapping, PRIMITIVE_TOPOLOGY_24_CONTROL_POINT_PATCHLIST ); - DEFINE_ENUM_ELEMENT_MAPPING( m_PrimTopologyEnumMapping, PRIMITIVE_TOPOLOGY_25_CONTROL_POINT_PATCHLIST ); - DEFINE_ENUM_ELEMENT_MAPPING( m_PrimTopologyEnumMapping, PRIMITIVE_TOPOLOGY_26_CONTROL_POINT_PATCHLIST ); - DEFINE_ENUM_ELEMENT_MAPPING( m_PrimTopologyEnumMapping, PRIMITIVE_TOPOLOGY_27_CONTROL_POINT_PATCHLIST ); - DEFINE_ENUM_ELEMENT_MAPPING( m_PrimTopologyEnumMapping, PRIMITIVE_TOPOLOGY_28_CONTROL_POINT_PATCHLIST ); - DEFINE_ENUM_ELEMENT_MAPPING( m_PrimTopologyEnumMapping, PRIMITIVE_TOPOLOGY_29_CONTROL_POINT_PATCHLIST ); - DEFINE_ENUM_ELEMENT_MAPPING( m_PrimTopologyEnumMapping, PRIMITIVE_TOPOLOGY_30_CONTROL_POINT_PATCHLIST ); - DEFINE_ENUM_ELEMENT_MAPPING( m_PrimTopologyEnumMapping, PRIMITIVE_TOPOLOGY_31_CONTROL_POINT_PATCHLIST ); - DEFINE_ENUM_ELEMENT_MAPPING( m_PrimTopologyEnumMapping, PRIMITIVE_TOPOLOGY_32_CONTROL_POINT_PATCHLIST ); - VERIFY( m_PrimTopologyEnumMapping.m_Str2ValMap.size() == PRIMITIVE_TOPOLOGY_NUM_TOPOLOGIES - 1, - "Unexpected map size. Did you update PRIMITIVE_TOPOLOGY enum?" ); - VERIFY( m_PrimTopologyEnumMapping.m_Val2StrMap.size() == PRIMITIVE_TOPOLOGY_NUM_TOPOLOGIES - 1, - "Unexpected map size. Did you update PRIMITIVE_TOPOLOGY enum?" ); - DEFINE_ENUM_BINDER( m_Bindings, DrawAttribs, Topology, PRIMITIVE_TOPOLOGY, m_PrimTopologyEnumMapping ); - // NumVertices and NumIndices are in Union - DEFINE_BINDER( m_Bindings, DrawAttribs, NumVertices, Uint32, Validator() ); - DEFINE_BINDER( m_Bindings, DrawAttribs, NumIndices, Uint32, Validator() ); + DEFINE_BINDER( m_Bindings, DrawAttribs, NumVertices ); + DEFINE_BINDER( m_Bindings, DrawAttribs, NumIndices ); DEFINE_ENUM_ELEMENT_MAPPING( m_ValueTypeEnumMapping, VT_UINT16 ); DEFINE_ENUM_ELEMENT_MAPPING( m_ValueTypeEnumMapping, VT_UINT32 ); - DEFINE_ENUM_BINDER( m_Bindings, DrawAttribs, IndexType, VALUE_TYPE, m_ValueTypeEnumMapping ); + DEFINE_ENUM_BINDER( m_Bindings, DrawAttribs, IndexType, m_ValueTypeEnumMapping ); + + DEFINE_BINDER( m_Bindings, DrawAttribs, IsIndexed ); + DEFINE_BINDER( m_Bindings, DrawAttribs, NumInstances ); + DEFINE_BINDER( m_Bindings, DrawAttribs, IsIndirect ); - DEFINE_BINDER( m_Bindings, DrawAttribs, IsIndexed, Bool, Validator() ); - DEFINE_BINDER( m_Bindings, DrawAttribs, NumInstances, Uint32, Validator() ); - DEFINE_BINDER( m_Bindings, DrawAttribs, IsIndirect, Bool, Validator() ); - DEFINE_BINDER( m_Bindings, DrawAttribs, BaseVertex, Uint32, Validator() ); - DEFINE_BINDER( m_Bindings, DrawAttribs, IndirectDrawArgsOffset, Uint32, Validator() ); + DEFINE_BINDER( m_Bindings, DrawAttribs, BaseVertex ); + DEFINE_BINDER( m_Bindings, DrawAttribs, IndirectDrawArgsOffset ); // StartVertexLocation and FirstIndexLocation are in union - DEFINE_BINDER( m_Bindings, DrawAttribs, StartVertexLocation, Uint32, Validator() ); - DEFINE_BINDER( m_Bindings, DrawAttribs, FirstIndexLocation, Uint32, Validator() ); + DEFINE_BINDER( m_Bindings, DrawAttribs, StartVertexLocation ); + DEFINE_BINDER( m_Bindings, DrawAttribs, FirstIndexLocation ); - DEFINE_BINDER( m_Bindings, DrawAttribs, FirstInstanceLocation, Uint32, Validator() ); + DEFINE_BINDER( m_Bindings, DrawAttribs, FirstInstanceLocation ); std::vector AllowedMetatable = { "Metatables.Buffer" }; - DEFINE_BINDER( m_Bindings, DrawAttribs, pIndirectDrawAttribs, EngineObjectPtrLoader, AllowedMetatable ); + DEFINE_BINDER_EX( m_Bindings, DrawAttribs, pIndirectDrawAttribs, EngineObjectPtrLoader, AllowedMetatable ); }; void DrawAttribsParser::CreateObj( lua_State *L ) diff --git a/RenderScript/src/InputLayoutDescParser.cpp b/RenderScript/src/InputLayoutDescParser.cpp index 3045cb2..0bf237d 100644 --- a/RenderScript/src/InputLayoutDescParser.cpp +++ b/RenderScript/src/InputLayoutDescParser.cpp @@ -30,14 +30,17 @@ namespace Diligent MemberBinderBase( InputLayoutOffset ), m_LayoutElementsBufferOffset(ElementsBufferOffset) { - DEFINE_BINDER( m_Bindings, LayoutElement, InputIndex, Uint32, Validator( "Input Index", 0, 32 ) ) - DEFINE_BINDER( m_Bindings, LayoutElement, BufferSlot, Uint32, Validator( "Buffer Slot", 0, MaxBufferSlots ) ) - DEFINE_BINDER( m_Bindings, LayoutElement, NumComponents, Uint32, Validator( "Num Components", 1, 4 ) ) + using InputIndexType = decltype(LayoutElement::InputIndex); + DEFINE_BINDER_EX( m_Bindings, LayoutElement, InputIndex, InputIndexType, Validator( "Input Index", 0, 32 ) ); + using BufferSlotType = decltype(LayoutElement::BufferSlot); + DEFINE_BINDER_EX( m_Bindings, LayoutElement, BufferSlot, BufferSlotType, Validator( "Buffer Slot", 0, MaxBufferSlots ) ); + using NumComponentsType = decltype(LayoutElement::NumComponents); + DEFINE_BINDER_EX( m_Bindings, LayoutElement, NumComponents, NumComponentsType, Validator( "Num Components", 1, 4 ) ); - DEFINE_ENUM_BINDER( m_Bindings, LayoutElement, ValueType, VALUE_TYPE, m_ValueTypeEnumMapping ) + DEFINE_ENUM_BINDER( m_Bindings, LayoutElement, ValueType, m_ValueTypeEnumMapping ); - DEFINE_BINDER( m_Bindings, LayoutElement, IsNormalized, Bool, Validator() ) - DEFINE_BINDER( m_Bindings, LayoutElement, RelativeOffset, Uint32, Validator() ) + DEFINE_BINDER( m_Bindings, LayoutElement, IsNormalized ); + DEFINE_BINDER( m_Bindings, LayoutElement, RelativeOffset ); m_FrequencyEnumMapping.AddMapping( "FREQUENCY_PER_VERTEX", LayoutElement::FREQUENCY_PER_VERTEX ); @@ -46,9 +49,9 @@ namespace Diligent "Unexpected map size. Did you update LayoutElement::FREQUENCY_PER_VERTEX enum?" ); VERIFY( m_FrequencyEnumMapping.m_Val2StrMap.size() == LayoutElement::FREQUENCY_NUM_FREQUENCIES - 1, "Unexpected map size. Did you update LayoutElement::FREQUENCY_PER_VERTEX enum?" ); - DEFINE_ENUM_BINDER( m_Bindings, LayoutElement, Frequency, LayoutElement::FREQUENCY, m_FrequencyEnumMapping ) + DEFINE_ENUM_BINDER( m_Bindings, LayoutElement, Frequency, m_FrequencyEnumMapping ); - DEFINE_BINDER( m_Bindings, LayoutElement, InstanceDataStepRate, Uint32, Validator() ) + DEFINE_BINDER( m_Bindings, LayoutElement, InstanceDataStepRate ); } void MemberBinder :: GetValue( lua_State *L, const void* pBasePointer ) diff --git a/RenderScript/src/PSODescParser.cpp b/RenderScript/src/PSODescParser.cpp index b6c17ae..baad900 100644 --- a/RenderScript/src/PSODescParser.cpp +++ b/RenderScript/src/PSODescParser.cpp @@ -30,7 +30,7 @@ namespace std { - DEFINE_ENUM_HASH( Diligent::PRIMITIVE_TOPOLOGY_TYPE ) + DEFINE_ENUM_HASH( Diligent::PRIMITIVE_TOPOLOGY ) } namespace Diligent @@ -98,8 +98,10 @@ namespace Diligent MemberBinder( size_t MemberOffset, size_t Dummy ) : MemberBinderBase( MemberOffset ) { - DEFINE_BINDER( m_Bindings, SampleDesc, Count, Uint32, Validator("Count", 1,32) ); - DEFINE_BINDER( m_Bindings, SampleDesc, Quality, Uint32, Validator("Quality", 0,std::numeric_limits::max()) ); + using CountType = decltype(SampleDesc::Count); + DEFINE_BINDER_EX( m_Bindings, SampleDesc, Count, CountType, Validator("Count", 1,32) ); + using QualityType = decltype(SampleDesc::Quality); + DEFINE_BINDER_EX( m_Bindings, SampleDesc, Quality, QualityType, Validator("Quality", 0,std::numeric_limits::max()) ); } virtual void GetValue( lua_State *L, const void* pBasePointer )override @@ -127,18 +129,18 @@ namespace Diligent { std::vector AllowedMetatable = { "Metatables.Shader" }; - DEFINE_BINDER( m_Bindings, GraphicsPipelineDesc, pVS, EngineObjectPtrLoader, AllowedMetatable ); - DEFINE_BINDER( m_Bindings, GraphicsPipelineDesc, pPS, EngineObjectPtrLoader, AllowedMetatable ); - DEFINE_BINDER( m_Bindings, GraphicsPipelineDesc, pDS, EngineObjectPtrLoader, AllowedMetatable ); - DEFINE_BINDER( m_Bindings, GraphicsPipelineDesc, pHS, EngineObjectPtrLoader, AllowedMetatable ); - DEFINE_BINDER( m_Bindings, GraphicsPipelineDesc, pGS, EngineObjectPtrLoader, AllowedMetatable ); + DEFINE_BINDER_EX( m_Bindings, GraphicsPipelineDesc, pVS, EngineObjectPtrLoader, AllowedMetatable ); + DEFINE_BINDER_EX( m_Bindings, GraphicsPipelineDesc, pPS, EngineObjectPtrLoader, AllowedMetatable ); + DEFINE_BINDER_EX( m_Bindings, GraphicsPipelineDesc, pDS, EngineObjectPtrLoader, AllowedMetatable ); + DEFINE_BINDER_EX( m_Bindings, GraphicsPipelineDesc, pHS, EngineObjectPtrLoader, AllowedMetatable ); + DEFINE_BINDER_EX( m_Bindings, GraphicsPipelineDesc, pGS, EngineObjectPtrLoader, AllowedMetatable ); //D3D12_STREAM_OUTPUT_DESC StreamOutput; - DEFINE_BINDER( m_Bindings, GraphicsPipelineDesc, BlendDesc, BlendStateDesc, 0 ) - DEFINE_BINDER( m_Bindings, GraphicsPipelineDesc, SampleMask, Uint32, Validator() ) - DEFINE_BINDER( m_Bindings, GraphicsPipelineDesc, RasterizerDesc, RasterizerStateDesc, 0 ) - DEFINE_BINDER( m_Bindings, GraphicsPipelineDesc, DepthStencilDesc, DepthStencilStateDesc, 0 ) + DEFINE_BINDER_EX( m_Bindings, GraphicsPipelineDesc, BlendDesc, BlendStateDesc, 0 ); + DEFINE_BINDER( m_Bindings, GraphicsPipelineDesc, SampleMask ); + DEFINE_BINDER_EX( m_Bindings, GraphicsPipelineDesc, RasterizerDesc, RasterizerStateDesc, 0 ); + DEFINE_BINDER_EX( m_Bindings, GraphicsPipelineDesc, DepthStencilDesc, DepthStencilStateDesc, 0 ); auto *pLayoutElemBinder = new MemberBinder( @@ -149,21 +151,52 @@ namespace Diligent //D3D12_INDEX_BUFFER_STRIP_CUT_VALUE IBStripCutValue; - DEFINE_ENUM_ELEMENT_MAPPING( m_PrimTopologyTypeEnumMapping, PRIMITIVE_TOPOLOGY_TYPE_UNDEFINED ); - DEFINE_ENUM_ELEMENT_MAPPING( m_PrimTopologyTypeEnumMapping, PRIMITIVE_TOPOLOGY_TYPE_POINT ); - DEFINE_ENUM_ELEMENT_MAPPING( m_PrimTopologyTypeEnumMapping, PRIMITIVE_TOPOLOGY_TYPE_LINE ); - DEFINE_ENUM_ELEMENT_MAPPING( m_PrimTopologyTypeEnumMapping, PRIMITIVE_TOPOLOGY_TYPE_TRIANGLE ); - DEFINE_ENUM_ELEMENT_MAPPING( m_PrimTopologyTypeEnumMapping, PRIMITIVE_TOPOLOGY_TYPE_PATCH ); - VERIFY( m_PrimTopologyTypeEnumMapping.m_Str2ValMap.size() == PRIMITIVE_TOPOLOGY_TYPE_NUM_TYPES, - "Unexpected map size. Did you update PRIMITIVE_TOPOLOGY_TYPE enum?" ); - VERIFY( m_PrimTopologyTypeEnumMapping.m_Val2StrMap.size() == PRIMITIVE_TOPOLOGY_TYPE_NUM_TYPES, - "Unexpected map size. Did you update PRIMITIVE_TOPOLOGY_TYPE enum?" ); - DEFINE_ENUM_BINDER( m_Bindings, GraphicsPipelineDesc, PrimitiveTopologyType, PRIMITIVE_TOPOLOGY_TYPE, m_PrimTopologyTypeEnumMapping ); - - DEFINE_BINDER( m_Bindings, GraphicsPipelineDesc, RTVFormats, RTVFormatsParser, 0 ); - DEFINE_ENUM_BINDER( m_Bindings, GraphicsPipelineDesc, DSVFormat, TEXTURE_FORMAT, m_TexFmtEnumMapping ); + DEFINE_ENUM_ELEMENT_MAPPING( m_PrimTopologyEnumMapping, PRIMITIVE_TOPOLOGY_TRIANGLE_LIST ); + DEFINE_ENUM_ELEMENT_MAPPING( m_PrimTopologyEnumMapping, PRIMITIVE_TOPOLOGY_TRIANGLE_STRIP ); + DEFINE_ENUM_ELEMENT_MAPPING( m_PrimTopologyEnumMapping, PRIMITIVE_TOPOLOGY_POINT_LIST ); + DEFINE_ENUM_ELEMENT_MAPPING( m_PrimTopologyEnumMapping, PRIMITIVE_TOPOLOGY_LINE_LIST ); + DEFINE_ENUM_ELEMENT_MAPPING( m_PrimTopologyEnumMapping, PRIMITIVE_TOPOLOGY_1_CONTROL_POINT_PATCHLIST ); + DEFINE_ENUM_ELEMENT_MAPPING( m_PrimTopologyEnumMapping, PRIMITIVE_TOPOLOGY_2_CONTROL_POINT_PATCHLIST ); + DEFINE_ENUM_ELEMENT_MAPPING( m_PrimTopologyEnumMapping, PRIMITIVE_TOPOLOGY_3_CONTROL_POINT_PATCHLIST ); + DEFINE_ENUM_ELEMENT_MAPPING( m_PrimTopologyEnumMapping, PRIMITIVE_TOPOLOGY_4_CONTROL_POINT_PATCHLIST ); + DEFINE_ENUM_ELEMENT_MAPPING( m_PrimTopologyEnumMapping, PRIMITIVE_TOPOLOGY_5_CONTROL_POINT_PATCHLIST ); + DEFINE_ENUM_ELEMENT_MAPPING( m_PrimTopologyEnumMapping, PRIMITIVE_TOPOLOGY_6_CONTROL_POINT_PATCHLIST ); + DEFINE_ENUM_ELEMENT_MAPPING( m_PrimTopologyEnumMapping, PRIMITIVE_TOPOLOGY_7_CONTROL_POINT_PATCHLIST ); + DEFINE_ENUM_ELEMENT_MAPPING( m_PrimTopologyEnumMapping, PRIMITIVE_TOPOLOGY_8_CONTROL_POINT_PATCHLIST ); + DEFINE_ENUM_ELEMENT_MAPPING( m_PrimTopologyEnumMapping, PRIMITIVE_TOPOLOGY_9_CONTROL_POINT_PATCHLIST ); + DEFINE_ENUM_ELEMENT_MAPPING( m_PrimTopologyEnumMapping, PRIMITIVE_TOPOLOGY_10_CONTROL_POINT_PATCHLIST ); + DEFINE_ENUM_ELEMENT_MAPPING( m_PrimTopologyEnumMapping, PRIMITIVE_TOPOLOGY_11_CONTROL_POINT_PATCHLIST ); + DEFINE_ENUM_ELEMENT_MAPPING( m_PrimTopologyEnumMapping, PRIMITIVE_TOPOLOGY_12_CONTROL_POINT_PATCHLIST ); + DEFINE_ENUM_ELEMENT_MAPPING( m_PrimTopologyEnumMapping, PRIMITIVE_TOPOLOGY_13_CONTROL_POINT_PATCHLIST ); + DEFINE_ENUM_ELEMENT_MAPPING( m_PrimTopologyEnumMapping, PRIMITIVE_TOPOLOGY_14_CONTROL_POINT_PATCHLIST ); + DEFINE_ENUM_ELEMENT_MAPPING( m_PrimTopologyEnumMapping, PRIMITIVE_TOPOLOGY_15_CONTROL_POINT_PATCHLIST ); + DEFINE_ENUM_ELEMENT_MAPPING( m_PrimTopologyEnumMapping, PRIMITIVE_TOPOLOGY_16_CONTROL_POINT_PATCHLIST ); + DEFINE_ENUM_ELEMENT_MAPPING( m_PrimTopologyEnumMapping, PRIMITIVE_TOPOLOGY_17_CONTROL_POINT_PATCHLIST ); + DEFINE_ENUM_ELEMENT_MAPPING( m_PrimTopologyEnumMapping, PRIMITIVE_TOPOLOGY_18_CONTROL_POINT_PATCHLIST ); + DEFINE_ENUM_ELEMENT_MAPPING( m_PrimTopologyEnumMapping, PRIMITIVE_TOPOLOGY_19_CONTROL_POINT_PATCHLIST ); + DEFINE_ENUM_ELEMENT_MAPPING( m_PrimTopologyEnumMapping, PRIMITIVE_TOPOLOGY_20_CONTROL_POINT_PATCHLIST ); + DEFINE_ENUM_ELEMENT_MAPPING( m_PrimTopologyEnumMapping, PRIMITIVE_TOPOLOGY_21_CONTROL_POINT_PATCHLIST ); + DEFINE_ENUM_ELEMENT_MAPPING( m_PrimTopologyEnumMapping, PRIMITIVE_TOPOLOGY_22_CONTROL_POINT_PATCHLIST ); + DEFINE_ENUM_ELEMENT_MAPPING( m_PrimTopologyEnumMapping, PRIMITIVE_TOPOLOGY_23_CONTROL_POINT_PATCHLIST ); + DEFINE_ENUM_ELEMENT_MAPPING( m_PrimTopologyEnumMapping, PRIMITIVE_TOPOLOGY_24_CONTROL_POINT_PATCHLIST ); + DEFINE_ENUM_ELEMENT_MAPPING( m_PrimTopologyEnumMapping, PRIMITIVE_TOPOLOGY_25_CONTROL_POINT_PATCHLIST ); + DEFINE_ENUM_ELEMENT_MAPPING( m_PrimTopologyEnumMapping, PRIMITIVE_TOPOLOGY_26_CONTROL_POINT_PATCHLIST ); + DEFINE_ENUM_ELEMENT_MAPPING( m_PrimTopologyEnumMapping, PRIMITIVE_TOPOLOGY_27_CONTROL_POINT_PATCHLIST ); + DEFINE_ENUM_ELEMENT_MAPPING( m_PrimTopologyEnumMapping, PRIMITIVE_TOPOLOGY_28_CONTROL_POINT_PATCHLIST ); + DEFINE_ENUM_ELEMENT_MAPPING( m_PrimTopologyEnumMapping, PRIMITIVE_TOPOLOGY_29_CONTROL_POINT_PATCHLIST ); + DEFINE_ENUM_ELEMENT_MAPPING( m_PrimTopologyEnumMapping, PRIMITIVE_TOPOLOGY_30_CONTROL_POINT_PATCHLIST ); + DEFINE_ENUM_ELEMENT_MAPPING( m_PrimTopologyEnumMapping, PRIMITIVE_TOPOLOGY_31_CONTROL_POINT_PATCHLIST ); + DEFINE_ENUM_ELEMENT_MAPPING( m_PrimTopologyEnumMapping, PRIMITIVE_TOPOLOGY_32_CONTROL_POINT_PATCHLIST ); + VERIFY( m_PrimTopologyEnumMapping.m_Str2ValMap.size() == PRIMITIVE_TOPOLOGY_NUM_TOPOLOGIES - 1, + "Unexpected map size. Did you update PRIMITIVE_TOPOLOGY enum?" ); + VERIFY( m_PrimTopologyEnumMapping.m_Val2StrMap.size() == PRIMITIVE_TOPOLOGY_NUM_TOPOLOGIES - 1, + "Unexpected map size. Did you update PRIMITIVE_TOPOLOGY enum?" ); + DEFINE_ENUM_BINDER( m_Bindings, GraphicsPipelineDesc, PrimitiveTopology, m_PrimTopologyEnumMapping); + + DEFINE_BINDER_EX( m_Bindings, GraphicsPipelineDesc, RTVFormats, RTVFormatsParser, 0 ); + DEFINE_ENUM_BINDER( m_Bindings, GraphicsPipelineDesc, DSVFormat, m_TexFmtEnumMapping ); - DEFINE_BINDER( m_Bindings, GraphicsPipelineDesc, SmplDesc, SampleDesc, 0 ); + DEFINE_BINDER_EX( m_Bindings, GraphicsPipelineDesc, SmplDesc, SampleDesc, 0 ); //Uint32 NodeMask; } @@ -181,7 +214,7 @@ namespace Diligent } private: TextureFormatEnumMapping m_TexFmtEnumMapping; - EnumMapping < PRIMITIVE_TOPOLOGY_TYPE > m_PrimTopologyTypeEnumMapping; + EnumMapping < PRIMITIVE_TOPOLOGY > m_PrimTopologyEnumMapping; BindingsMapType m_Bindings; }; @@ -194,7 +227,7 @@ namespace Diligent MemberBinderBase( MemberOffset ) { std::vector AllowedMetatable = { "Metatables.Shader" }; - DEFINE_BINDER( m_Bindings, ComputePipelineDesc, pCS, EngineObjectPtrLoader, AllowedMetatable ); + DEFINE_BINDER_EX( m_Bindings, ComputePipelineDesc, pCS, EngineObjectPtrLoader, AllowedMetatable ); } virtual void GetValue( lua_State *L, const void* pBasePointer )override @@ -221,11 +254,13 @@ namespace Diligent { DEFINE_BUFFERED_STRING_BINDER( m_Bindings, PSODescWrapper, Name, NameBuffer ) - DEFINE_BINDER( m_Bindings, PSODescWrapper, IsComputePipeline, Bool, Validator() ) - DEFINE_BINDER( m_Bindings, PSODescWrapper, SRBAllocationGranularity, Uint32, Validator("SRBAllocationGranularity", 1, 65536) ) + DEFINE_BINDER( m_Bindings, PSODescWrapper, IsComputePipeline ); + using SRBAllocationGranularityType = decltype(PSODescWrapper::SRBAllocationGranularity); + Validator SRBValidator("SRBAllocationGranularity", 1, 65536); + DEFINE_BINDER_EX( m_Bindings, PSODescWrapper, SRBAllocationGranularity, SRBAllocationGranularityType, SRBValidator); - DEFINE_BINDER( m_Bindings, PSODescWrapper, GraphicsPipeline, GraphicsPipelineDesc, 0 ) - DEFINE_BINDER( m_Bindings, PSODescWrapper, ComputePipeline, ComputePipelineDesc, 0 ) + DEFINE_BINDER_EX( m_Bindings, PSODescWrapper, GraphicsPipeline, GraphicsPipelineDesc, 0 ); + DEFINE_BINDER_EX( m_Bindings, PSODescWrapper, ComputePipeline, ComputePipelineDesc, 0 ); }; void PSODescParser::CreateObj( lua_State *L ) diff --git a/RenderScript/src/RasterizerStateDescParser.cpp b/RenderScript/src/RasterizerStateDescParser.cpp index 876ec4a..a2901dd 100644 --- a/RenderScript/src/RasterizerStateDescParser.cpp +++ b/RenderScript/src/RasterizerStateDescParser.cpp @@ -36,7 +36,7 @@ namespace Diligent "Unexpected map size. Did you update FILL_MODE enum?" ); VERIFY( m_FillModeEnumMapping.m_Val2StrMap.size() == FILL_MODE_NUM_MODES-1, "Unexpected map size. Did you update FILL_MODE enum?" ); - DEFINE_ENUM_BINDER( m_Bindings, RasterizerStateDesc, FillMode, FILL_MODE, m_FillModeEnumMapping ); + DEFINE_ENUM_BINDER( m_Bindings, RasterizerStateDesc, FillMode, m_FillModeEnumMapping ); DEFINE_ENUM_ELEMENT_MAPPING( m_CullModeEnumMapping, CULL_MODE_NONE ); DEFINE_ENUM_ELEMENT_MAPPING( m_CullModeEnumMapping, CULL_MODE_FRONT ); @@ -45,15 +45,15 @@ namespace Diligent "Unexpected map size. Did you update CULL_MODE enum?" ); VERIFY( m_CullModeEnumMapping.m_Val2StrMap.size() == CULL_MODE_NUM_MODES-1, "Unexpected map size. Did you update CULL_MODE enum?" ); - DEFINE_ENUM_BINDER( m_Bindings, RasterizerStateDesc, CullMode, CULL_MODE, m_CullModeEnumMapping ); + DEFINE_ENUM_BINDER( m_Bindings, RasterizerStateDesc, CullMode, m_CullModeEnumMapping ); - DEFINE_BINDER( m_Bindings, RasterizerStateDesc, FrontCounterClockwise, Bool, Validator() ); - DEFINE_BINDER( m_Bindings, RasterizerStateDesc, DepthBias, Int32, Validator() ); - DEFINE_BINDER( m_Bindings, RasterizerStateDesc, DepthBiasClamp, Float32, Validator() ); - DEFINE_BINDER( m_Bindings, RasterizerStateDesc, SlopeScaledDepthBias, Float32, Validator() ); - DEFINE_BINDER( m_Bindings, RasterizerStateDesc, DepthClipEnable, Bool, Validator() ); - DEFINE_BINDER( m_Bindings, RasterizerStateDesc, ScissorEnable, Bool, Validator() ); - DEFINE_BINDER( m_Bindings, RasterizerStateDesc, AntialiasedLineEnable, Bool, Validator() ); + DEFINE_BINDER( m_Bindings, RasterizerStateDesc, FrontCounterClockwise ); + DEFINE_BINDER( m_Bindings, RasterizerStateDesc, DepthBias ); + DEFINE_BINDER( m_Bindings, RasterizerStateDesc, DepthBiasClamp ); + DEFINE_BINDER( m_Bindings, RasterizerStateDesc, SlopeScaledDepthBias ); + DEFINE_BINDER( m_Bindings, RasterizerStateDesc, DepthClipEnable ); + DEFINE_BINDER( m_Bindings, RasterizerStateDesc, ScissorEnable ); + DEFINE_BINDER( m_Bindings, RasterizerStateDesc, AntialiasedLineEnable ); }; void MemberBinder ::GetValue(lua_State *L, const void* pBasePointer) diff --git a/RenderScript/src/ResourceMappingParser.cpp b/RenderScript/src/ResourceMappingParser.cpp index e27f00d..1020635 100644 --- a/RenderScript/src/ResourceMappingParser.cpp +++ b/RenderScript/src/ResourceMappingParser.cpp @@ -41,8 +41,8 @@ namespace Diligent m_pBuffViewParser( pBuffViewParser ), m_MappedResourceMetatables( { pTexViewParser->GetMetatableName(), pBuffParser->GetMetatableName(), pBuffViewParser->GetMetatableName() } ) { - DEFINE_BINDER( m_Bindings, ResourceMappingEntry, Name, const Char*, SkipValidationFunc ) - DEFINE_BINDER( m_Bindings, ResourceMappingEntry, pObject, EngineObjectPtrLoader, m_MappedResourceMetatables ); + DEFINE_BINDER_EX( m_Bindings, ResourceMappingEntry, Name, const Char*, SkipValidationFunc ); + DEFINE_BINDER_EX( m_Bindings, ResourceMappingEntry, pObject, EngineObjectPtrLoader, m_MappedResourceMetatables ); }; void ResourceMappingParser::CreateObj( lua_State *L ) diff --git a/RenderScript/src/ScissorRectParser.cpp b/RenderScript/src/ScissorRectParser.cpp index 1123462..b37b75f 100644 --- a/RenderScript/src/ScissorRectParser.cpp +++ b/RenderScript/src/ScissorRectParser.cpp @@ -35,10 +35,10 @@ namespace Diligent m_ScissorRects.reserve( 8 ); // NumVertices and NumIndices are in Union - DEFINE_BINDER( m_Bindings, Rect, left, Int32, Validator() ) - DEFINE_BINDER( m_Bindings, Rect, top, Int32, Validator() ) - DEFINE_BINDER( m_Bindings, Rect, right, Int32, Validator() ) - DEFINE_BINDER( m_Bindings, Rect, bottom, Int32, Validator() ) + DEFINE_BINDER( m_Bindings, Rect, left ); + DEFINE_BINDER( m_Bindings, Rect, top ); + DEFINE_BINDER( m_Bindings, Rect, right ); + DEFINE_BINDER( m_Bindings, Rect, bottom ); }; void ScissorRectParser::CreateObj( lua_State *L ) diff --git a/RenderScript/src/ShaderParser.cpp b/RenderScript/src/ShaderParser.cpp index b6dd7e6..fb3e8ff 100644 --- a/RenderScript/src/ShaderParser.cpp +++ b/RenderScript/src/ShaderParser.cpp @@ -62,7 +62,7 @@ namespace Diligent m_VarDescBufferOffset(VarDescBufferOffset), m_VarNamesBufferOffset(VarNamesBufferOffset) { - DEFINE_ENUM_BINDER( m_Bindings, ShaderVariableDesc, Type, SHADER_VARIABLE_TYPE, m_ShaderVarTypeEnumMapping ) + DEFINE_ENUM_BINDER( m_Bindings, ShaderVariableDesc, Type, m_ShaderVarTypeEnumMapping ); } virtual void GetValue( lua_State *L, const void* pBasePointer )override @@ -289,9 +289,9 @@ namespace Diligent // keep pointer to it m_Bindings.insert( std::make_pair( "Name", std::unique_ptr(pNameBinder) ) ); - DEFINE_ENUM_BINDER( m_Bindings, ShaderDesc, ShaderType, SHADER_TYPE, m_ShaderTypeEnumMapping ) + DEFINE_ENUM_BINDER( m_Bindings, ShaderDesc, ShaderType, m_ShaderTypeEnumMapping ); - DEFINE_ENUM_BINDER( m_Bindings, ShaderDesc, DefaultVariableType, SHADER_VARIABLE_TYPE, m_ShaderVarTypeEnumMapping ) + DEFINE_ENUM_BINDER( m_Bindings, ShaderDesc, DefaultVariableType, m_ShaderVarTypeEnumMapping ); auto *pShaderDescBinder = new MemberBinder( @@ -343,7 +343,7 @@ namespace Diligent DEFINE_ENUM_ELEMENT_MAPPING( m_ShaderSourceLangEnumMapping, SHADER_SOURCE_LANGUAGE_DEFAULT ); DEFINE_ENUM_ELEMENT_MAPPING( m_ShaderSourceLangEnumMapping, SHADER_SOURCE_LANGUAGE_HLSL ); DEFINE_ENUM_ELEMENT_MAPPING( m_ShaderSourceLangEnumMapping, SHADER_SOURCE_LANGUAGE_GLSL ); - DEFINE_ENUM_BINDER( m_Bindings, ShaderCreationAttribsWrapper, SourceLanguage, SHADER_SOURCE_LANGUAGE, m_ShaderSourceLangEnumMapping ); + DEFINE_ENUM_BINDER( m_Bindings, ShaderCreationAttribsWrapper, SourceLanguage, m_ShaderSourceLangEnumMapping ); auto *pShaderDescBinder = new MemberBinder( diff --git a/RenderScript/src/TextureParser.cpp b/RenderScript/src/TextureParser.cpp index 168e7d6..2ccd683 100644 --- a/RenderScript/src/TextureParser.cpp +++ b/RenderScript/src/TextureParser.cpp @@ -36,8 +36,8 @@ namespace Diligent MemberBinder(size_t MemberOffset, int /*Dummy*/) : MemberBinderBase(MemberOffset) { - DEFINE_BINDER( m_Bindings, DepthStencilClearValue, Depth, Float32, Validator("Depth clear value", 0.f, 1.f) ) - DEFINE_BINDER( m_Bindings, DepthStencilClearValue, Stencil, Uint8, Validator() ) + DEFINE_BINDER_EX( m_Bindings, DepthStencilClearValue, Depth, Float32, Validator("Depth clear value", 0.f, 1.f) ); + DEFINE_BINDER( m_Bindings, DepthStencilClearValue, Stencil ); } virtual void GetValue(lua_State *L, const void* pBasePointer)override @@ -63,9 +63,9 @@ namespace Diligent MemberBinder(size_t MemberOffset, int /*Dummy*/) : MemberBinderBase(MemberOffset) { - DEFINE_ENUM_BINDER( m_Bindings, OptimizedClearValue, Format, TEXTURE_FORMAT, m_TexFmtEnumMapping ); - DEFINE_BINDER( m_Bindings, OptimizedClearValue, Color, RGBALoader, 0 ) - DEFINE_BINDER( m_Bindings, OptimizedClearValue, DepthStencil, DepthStencilClearValue, 0 ) + DEFINE_ENUM_BINDER( m_Bindings, OptimizedClearValue, Format, m_TexFmtEnumMapping ); + DEFINE_BINDER_EX( m_Bindings, OptimizedClearValue, Color, RGBALoader, 0 ); + DEFINE_BINDER_EX( m_Bindings, OptimizedClearValue, DepthStencil, DepthStencilClearValue, 0 ); } virtual void GetValue(lua_State *L, const void* pBasePointer)override @@ -91,17 +91,45 @@ namespace Diligent { DEFINE_BUFFERED_STRING_BINDER( m_Bindings, STexDescWrapper, Name, NameBuffer ) - DEFINE_ENUM_BINDER( m_Bindings, STexDescWrapper, Type, RESOURCE_DIMENSION, m_TexTypeEnumMapping ); + DEFINE_ENUM_BINDER( m_Bindings, STexDescWrapper, Type, m_TexTypeEnumMapping ); - DEFINE_BINDER( m_Bindings, STexDescWrapper, Width, Uint32, Validator( "Width", 1, 16384 ) ); - DEFINE_BINDER( m_Bindings, STexDescWrapper, Height, Uint32, Validator( "Heihght", 1, 16384 ) ); - DEFINE_BINDER( m_Bindings, STexDescWrapper, ArraySize, Uint32, Validator( "ArraySize", 1, 16384 ) ); - DEFINE_BINDER( m_Bindings, STexDescWrapper, Depth, Uint32, Validator( "Depth", 1, 16384 ) ); + { + using WidthType = decltype(STexDescWrapper::Width); + Validator WidthValidator("Width", 1, 16384); + DEFINE_BINDER_EX( m_Bindings, STexDescWrapper, Width, WidthType, WidthValidator); + } + + { + using HeightType = decltype(STexDescWrapper::Height); + Validator HeightValidator("Heihght", 1, 16384); + DEFINE_BINDER_EX( m_Bindings, STexDescWrapper, Height, HeightType, HeightValidator); + } + + { + using ArraySizeType = decltype(STexDescWrapper::ArraySize); + Validator ArraySizeValidator("ArraySize", 1, 16384); + DEFINE_BINDER_EX( m_Bindings, STexDescWrapper, ArraySize, ArraySizeType, ArraySizeValidator); + } + + { + using DepthType = decltype(STexDescWrapper::Depth); + Validator DepthValidator("Depth", 1, 16384); + DEFINE_BINDER_EX( m_Bindings, STexDescWrapper, Depth, DepthType, DepthValidator); + } + + DEFINE_ENUM_BINDER( m_Bindings, STexDescWrapper, Format, m_TexFormatEnumMapping ); - DEFINE_ENUM_BINDER( m_Bindings, STexDescWrapper, Format, TEXTURE_FORMAT, m_TexFormatEnumMapping ); + { + using MipLevelsType = decltype(STexDescWrapper::MipLevels); + Validator MipLevelsValidator("MipLevels", 1, 20); + DEFINE_BINDER_EX( m_Bindings, STexDescWrapper, MipLevels, MipLevelsType, MipLevelsValidator); + } - DEFINE_BINDER( m_Bindings, STexDescWrapper, MipLevels, Uint32, Validator( "MipLevels", 1, 20 ) ); - DEFINE_BINDER( m_Bindings, STexDescWrapper, SampleCount, Uint32, Validator( "SampleCount", 1, 32 ) ); + { + using SampleCountType = decltype(STexDescWrapper::SampleCount); + Validator SampleCountValidator("SampleCount", 1, 32); + DEFINE_BINDER_EX( m_Bindings, STexDescWrapper, SampleCount, SampleCountType, SampleCountValidator); + } //DEFINE_ENUM_ELEMENT_MAPPING( m_BindFlagEnumMapping, BIND_VERTEX_BUFFER ); //DEFINE_ENUM_ELEMENT_MAPPING( m_BindFlagEnumMapping, BIND_INDEX_BUFFER ); @@ -116,13 +144,13 @@ namespace Diligent // name conflicts when building for windows store DEFINE_FLAGS_BINDER( m_Bindings, STexDescWrapper, BindFlags, Diligent::BIND_FLAGS, m_BindFlagEnumMapping ); - DEFINE_ENUM_BINDER( m_Bindings, STexDescWrapper, Usage, USAGE, m_UsageEnumMapping ) + DEFINE_ENUM_BINDER( m_Bindings, STexDescWrapper, Usage, m_UsageEnumMapping ); DEFINE_FLAGS_BINDER( m_Bindings, STexDescWrapper, CPUAccessFlags, CPU_ACCESS_FLAG, m_CpuAccessFlagEnumMapping ); DEFINE_ENUM_ELEMENT_MAPPING( m_MiscFlagEnumMapping, MISC_TEXTURE_FLAG_GENERATE_MIPS ); DEFINE_FLAGS_BINDER( m_Bindings, STexDescWrapper, MiscFlags, Diligent::MISC_TEXTURE_FLAG, m_MiscFlagEnumMapping ); - DEFINE_BINDER( m_Bindings, STexDescWrapper, ClearValue, OptimizedClearValue, 0 ); + DEFINE_BINDER_EX( m_Bindings, STexDescWrapper, ClearValue, OptimizedClearValue, 0 ); }; void TextureParser::CreateObj( lua_State *L ) diff --git a/RenderScript/src/TextureViewParser.cpp b/RenderScript/src/TextureViewParser.cpp index 1abc373..c80fcc4 100644 --- a/RenderScript/src/TextureViewParser.cpp +++ b/RenderScript/src/TextureViewParser.cpp @@ -52,21 +52,48 @@ namespace Diligent "Unexpected map size. Did you update TEXTURE_VIEW_TYPE enum?" ); VERIFY( m_ViewTypeEnumMapping.m_Val2StrMap.size() == TEXTURE_VIEW_NUM_VIEWS - 1, "Unexpected map size. Did you update TEXTURE_VIEW_TYPE enum?" ); - DEFINE_ENUM_BINDER( m_Bindings, STexViewDescWrapper, ViewType, TEXTURE_VIEW_TYPE, m_ViewTypeEnumMapping ); + DEFINE_ENUM_BINDER( m_Bindings, STexViewDescWrapper, ViewType, m_ViewTypeEnumMapping ); - DEFINE_ENUM_BINDER( m_Bindings, STexViewDescWrapper, TextureDim, RESOURCE_DIMENSION, m_TexTypeEnumMapping ); - DEFINE_ENUM_BINDER( m_Bindings, STexViewDescWrapper, Format, TEXTURE_FORMAT, m_TexFormatEnumMapping ); - - DEFINE_BINDER( m_Bindings, STexViewDescWrapper, MostDetailedMip, Uint32, Validator( "MostDetailedMip", 0, 16384 ) ); - DEFINE_BINDER( m_Bindings, STexViewDescWrapper, NumMipLevels, Uint32, Validator( "NumMipLevels", 1, 16384 ) ); - - // The following two members are in enum - DEFINE_BINDER( m_Bindings, STexViewDescWrapper, FirstArraySlice, Uint32, Validator( "FirstArraySlice", 0, 16384 ) ); - DEFINE_BINDER( m_Bindings, STexViewDescWrapper, FirstDepthSlice, Uint32, Validator( "FirstDepthSlice", 0, 16384 ) ); - - // The following two members are in enum - DEFINE_BINDER( m_Bindings, STexViewDescWrapper, NumArraySlices, Uint32, Validator( "NumArraySlices", 0, 16384 ) ); - DEFINE_BINDER( m_Bindings, STexViewDescWrapper, NumDepthSlices, Uint32, Validator( "NumDepthSlices", 0, 16384 ) ); + DEFINE_ENUM_BINDER( m_Bindings, STexViewDescWrapper, TextureDim, m_TexTypeEnumMapping ); + DEFINE_ENUM_BINDER( m_Bindings, STexViewDescWrapper, Format, m_TexFormatEnumMapping ); + + { + using MostDetailedMipType = decltype(STexViewDescWrapper::MostDetailedMip); + Validator MostDetailedMipValidator("MostDetailedMip", 0, 16384); + DEFINE_BINDER_EX( m_Bindings, STexViewDescWrapper, MostDetailedMip, MostDetailedMipType, MostDetailedMipValidator); + } + + { + using NumMipLevelsType = decltype(STexViewDescWrapper::NumMipLevels); + Validator NumMipLevelsValidator("NumMipLevels", 1, 16384); + DEFINE_BINDER_EX( m_Bindings, STexViewDescWrapper, NumMipLevels, NumMipLevelsType, NumMipLevelsValidator); + } + + // The following two members are in union + { + using FirstArraySliceType = decltype(STexViewDescWrapper::FirstArraySlice); + Validator FirstArraySliceValidator("FirstArraySlice", 0, 16384); + DEFINE_BINDER_EX( m_Bindings, STexViewDescWrapper, FirstArraySlice, FirstArraySliceType, FirstArraySliceValidator); + } + + { + using FirstDepthSliceType = decltype(STexViewDescWrapper::FirstDepthSlice); + Validator FirstDepthSliceValidator("FirstDepthSlice", 0, 16384); + DEFINE_BINDER_EX( m_Bindings, STexViewDescWrapper, FirstDepthSlice, FirstDepthSliceType, FirstDepthSliceValidator); + } + + // The following two members are in union + { + using NumArraySlicesType = decltype(STexViewDescWrapper::NumArraySlices); + Validator NumArraySlicesValidator("NumArraySlices", 0, 16384); + DEFINE_BINDER_EX( m_Bindings, STexViewDescWrapper, NumArraySlices, NumArraySlicesType, NumArraySlicesValidator); + } + + { + using NumDepthSlicesType = decltype(STexViewDescWrapper::NumDepthSlices); + Validator NumDepthSlicesValidator("NumDepthSlices", 0, 16384); + DEFINE_BINDER_EX( m_Bindings, STexViewDescWrapper, NumDepthSlices, NumDepthSlicesType, NumDepthSlicesValidator); + } DEFINE_ENUM_ELEMENT_MAPPING( m_UAVAccessFlagEnumMapping, UAV_ACCESS_FLAG_READ ); DEFINE_ENUM_ELEMENT_MAPPING( m_UAVAccessFlagEnumMapping, UAV_ACCESS_FLAG_WRITE ); diff --git a/RenderScript/src/ViewportParser.cpp b/RenderScript/src/ViewportParser.cpp index 7e23222..9720b0e 100644 --- a/RenderScript/src/ViewportParser.cpp +++ b/RenderScript/src/ViewportParser.cpp @@ -35,12 +35,12 @@ namespace Diligent m_Viewports.reserve( 8 ); // NumVertices and NumIndices are in Union - DEFINE_BINDER( m_Bindings, Viewport, TopLeftX, Float32, Validator() ) - DEFINE_BINDER( m_Bindings, Viewport, TopLeftY, Float32, Validator() ) - DEFINE_BINDER( m_Bindings, Viewport, Width, Float32, Validator() ) - DEFINE_BINDER( m_Bindings, Viewport, Height, Float32, Validator() ) - DEFINE_BINDER( m_Bindings, Viewport, MinDepth, Float32, Validator() ) - DEFINE_BINDER( m_Bindings, Viewport, MaxDepth, Float32, Validator() ) + DEFINE_BINDER( m_Bindings, Viewport, TopLeftX ); + DEFINE_BINDER( m_Bindings, Viewport, TopLeftY ); + DEFINE_BINDER( m_Bindings, Viewport, Width ); + DEFINE_BINDER( m_Bindings, Viewport, Height ); + DEFINE_BINDER( m_Bindings, Viewport, MinDepth ); + DEFINE_BINDER( m_Bindings, Viewport, MaxDepth ); }; void ViewportParser::CreateObj( lua_State *L ) -- cgit v1.2.3