summaryrefslogtreecommitdiffstats
path: root/RenderScript/src/DeviceContextFuncBindings.cpp
diff options
context:
space:
mode:
authorEgor Yusov <egor.yusov@gmail.com>2018-12-01 04:21:56 +0000
committerEgor Yusov <egor.yusov@gmail.com>2018-12-01 04:21:56 +0000
commit910b0eab787b460c6d0b28269a5b388dfa6540f6 (patch)
tree14870bdb9d02b272b5484e7a522ee63fab96835c /RenderScript/src/DeviceContextFuncBindings.cpp
parentImproved type safety of flag enums (diff)
downloadDiligentTools-910b0eab787b460c6d0b28269a5b388dfa6540f6.tar.gz
DiligentTools-910b0eab787b460c6d0b28269a5b388dfa6540f6.zip
Added parsing SET_RENDER_TARGETS_FLAGS
Diffstat (limited to 'RenderScript/src/DeviceContextFuncBindings.cpp')
-rw-r--r--RenderScript/src/DeviceContextFuncBindings.cpp49
1 files changed, 32 insertions, 17 deletions
diff --git a/RenderScript/src/DeviceContextFuncBindings.cpp b/RenderScript/src/DeviceContextFuncBindings.cpp
index f32f350..02fd2b4 100644
--- a/RenderScript/src/DeviceContextFuncBindings.cpp
+++ b/RenderScript/src/DeviceContextFuncBindings.cpp
@@ -49,6 +49,12 @@ namespace Diligent
DEFINE_ENUM_ELEMENT_MAPPING( m_CommitShaderResFlagsEnumMapping, COMMIT_SHADER_RESOURCES_FLAG_NONE );
DEFINE_ENUM_ELEMENT_MAPPING( m_CommitShaderResFlagsEnumMapping, COMMIT_SHADER_RESOURCES_FLAG_TRANSITION_RESOURCES );
DEFINE_ENUM_ELEMENT_MAPPING( m_CommitShaderResFlagsEnumMapping, COMMIT_SHADER_RESOURCES_FLAG_VERIFY_STATES );
+
+ DEFINE_ENUM_ELEMENT_MAPPING( m_SetRenderTargetsFlagsEnumMapping, SET_RENDER_TARGETS_FLAG_NONE );
+ DEFINE_ENUM_ELEMENT_MAPPING( m_SetRenderTargetsFlagsEnumMapping, SET_RENDER_TARGETS_FLAG_TRANSITION_COLOR );
+ DEFINE_ENUM_ELEMENT_MAPPING( m_SetRenderTargetsFlagsEnumMapping, SET_RENDER_TARGETS_FLAG_TRANSITION_DEPTH );
+ DEFINE_ENUM_ELEMENT_MAPPING( m_SetRenderTargetsFlagsEnumMapping, SET_RENDER_TARGETS_FLAG_TRANSITION_ALL );
+ DEFINE_ENUM_ELEMENT_MAPPING( m_SetRenderTargetsFlagsEnumMapping, SET_RENDER_TARGETS_FLAG_VERIFY_STATES );
};
int DeviceContextFuncBindings::SetRenderTargets( lua_State *L )
@@ -57,36 +63,45 @@ namespace Diligent
ITextureView *pRTVs[MaxRenderTargets] = {};
ITextureView *pDSV = nullptr;
Uint32 NumRTs = 0;
+ SET_RENDER_TARGETS_FLAGS Flags = SET_RENDER_TARGETS_FLAG_NONE;
for( int CurrArg = 1; CurrArg <= NumArgs; ++CurrArg )
{
- auto *pView = *GetUserData<ITextureView**>( L, CurrArg, m_TexViewMetatableName.c_str() );
- auto ViewType = pView->GetDesc().ViewType;
- if( ViewType == TEXTURE_VIEW_RENDER_TARGET )
+ if( lua_type( L, CurrArg ) == LUA_TUSERDATA )
{
- if( NumRTs < MaxRenderTargets )
+ auto *pView = *GetUserData<ITextureView**>( L, CurrArg, m_TexViewMetatableName.c_str() );
+ auto ViewType = pView->GetDesc().ViewType;
+ if( ViewType == TEXTURE_VIEW_RENDER_TARGET )
{
- pRTVs[NumRTs] = pView;
- ++NumRTs;
+ if( NumRTs < MaxRenderTargets )
+ {
+ pRTVs[NumRTs] = pView;
+ ++NumRTs;
+ }
+ else
+ {
+ SCRIPT_PARSING_ERROR( L, "Too many render targets are being set. ", MaxRenderTargets, " at most are allowed." );
+ }
}
- else
+ else if( ViewType == TEXTURE_VIEW_DEPTH_STENCIL )
{
- SCRIPT_PARSING_ERROR( L, "Too many render targets are being set. ", MaxRenderTargets, " at most are allowed." );
+ if( pDSV != nullptr )
+ SCRIPT_PARSING_ERROR( L, "Respecifying depth stencil view. Only one is allowed" );
+ pDSV = pView;
+ }
+ else
+ {
+ SCRIPT_PARSING_ERROR( L, "Unexpected view type. Only render target and depth stencil are allowed" );
}
- }
- else if( ViewType == TEXTURE_VIEW_DEPTH_STENCIL )
- {
- if( pDSV != nullptr )
- SCRIPT_PARSING_ERROR( L, "Respecifying depth stencil view. Only one is allowed" );
- pDSV = pView;
}
else
- {
- SCRIPT_PARSING_ERROR( L, "Unexpected view type. Only render target and depth stencil are allowed" );
+ {
+ FlagsLoader<SET_RENDER_TARGETS_FLAGS> RTFlagsLoader(0, "SetRenderTargetsFlags", m_SetRenderTargetsFlagsEnumMapping);
+ RTFlagsLoader.SetValue( L, CurrArg, &Flags );
}
}
auto *pContext = EngineObjectParserBase::LoadDeviceContextFromRegistry( L );
- pContext->SetRenderTargets( NumRTs, pRTVs, pDSV );
+ pContext->SetRenderTargets( NumRTs, pRTVs, pDSV, Flags );
// Return no values to Lua
return 0;