summaryrefslogtreecommitdiffstats
path: root/RenderScript
diff options
context:
space:
mode:
authorEgor Yusov <egor.yusov@gmail.com>2018-12-01 18:45:13 +0000
committerEgor Yusov <egor.yusov@gmail.com>2018-12-01 18:45:13 +0000
commit767bfac9934c84b5e620b148961bac54fb34f05e (patch)
tree7a8a44acc7641554c2b930774bfb300de5794b33 /RenderScript
parentFixed linux build errors (diff)
downloadDiligentTools-767bfac9934c84b5e620b148961bac54fb34f05e.tar.gz
DiligentTools-767bfac9934c84b5e620b148961bac54fb34f05e.zip
Added state transition mode to ClearRenderTarget()
Diffstat (limited to 'RenderScript')
-rw-r--r--RenderScript/include/DeviceContextFuncBindings.h2
-rw-r--r--RenderScript/src/DeviceContextFuncBindings.cpp18
2 files changed, 19 insertions, 1 deletions
diff --git a/RenderScript/include/DeviceContextFuncBindings.h b/RenderScript/include/DeviceContextFuncBindings.h
index 2d3b8f9..3df5334 100644
--- a/RenderScript/include/DeviceContextFuncBindings.h
+++ b/RenderScript/include/DeviceContextFuncBindings.h
@@ -31,6 +31,7 @@ namespace std
{
DEFINE_ENUM_HASH( Diligent::COMMIT_SHADER_RESOURCES_FLAGS )
DEFINE_ENUM_HASH( Diligent::SET_RENDER_TARGETS_FLAGS )
+ DEFINE_ENUM_HASH( Diligent::CLEAR_RENDER_TARGET_STATE_TRANSITION_MODE )
}
namespace Diligent
@@ -64,6 +65,7 @@ namespace Diligent
EnumMapping<COMMIT_SHADER_RESOURCES_FLAGS> m_CommitShaderResFlagsEnumMapping;
EnumMapping<SET_RENDER_TARGETS_FLAGS> m_SetRenderTargetsFlagsEnumMapping;
+ EnumMapping<CLEAR_RENDER_TARGET_STATE_TRANSITION_MODE> m_ClearRTStateTransitionModeMapping;
String m_TexViewMetatableName;
String m_ShaderResBindingMetatableName;
diff --git a/RenderScript/src/DeviceContextFuncBindings.cpp b/RenderScript/src/DeviceContextFuncBindings.cpp
index 02fd2b4..76129f7 100644
--- a/RenderScript/src/DeviceContextFuncBindings.cpp
+++ b/RenderScript/src/DeviceContextFuncBindings.cpp
@@ -55,6 +55,10 @@ namespace Diligent
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 );
+
+ DEFINE_ENUM_ELEMENT_MAPPING( m_ClearRTStateTransitionModeMapping, CLEAR_RENDER_TARGET_NO_TRANSITION );
+ DEFINE_ENUM_ELEMENT_MAPPING( m_ClearRTStateTransitionModeMapping, CLEAR_RENDER_TARGET_TRANSITION_STATE );
+ DEFINE_ENUM_ELEMENT_MAPPING( m_ClearRTStateTransitionModeMapping, CLEAR_RENDER_TARGET_VERIFY_STATE );
};
int DeviceContextFuncBindings::SetRenderTargets( lua_State *L )
@@ -125,10 +129,22 @@ namespace Diligent
}
for( int c = 0; c < 4 && CurrArg <= NumArgs; ++c, ++CurrArg )
{
+ if( lua_type( L, CurrArg ) != LUA_TNUMBER )
+ break;
RGBA[c] = ReadValueFromLua<Float32>( L, CurrArg );
}
+
+ CLEAR_RENDER_TARGET_STATE_TRANSITION_MODE StateTransitionMode = CLEAR_RENDER_TARGET_NO_TRANSITION;
+ if( CurrArg <= NumArgs &&
+ (lua_type( L, CurrArg ) == LUA_TSTRING ||
+ lua_type( L, CurrArg ) == LUA_TTABLE ) )
+ {
+ EnumMemberBinder<CLEAR_RENDER_TARGET_STATE_TRANSITION_MODE> StateTransitionModeLoader(0, "ClearRTStateTransitionMode", m_ClearRTStateTransitionModeMapping);
+ StateTransitionModeLoader.SetValue( L, CurrArg, &StateTransitionMode );
+ ++CurrArg;
+ }
auto *pContext = EngineObjectParserBase::LoadDeviceContextFromRegistry( L );
- pContext->ClearRenderTarget( pView, RGBA );
+ pContext->ClearRenderTarget( pView, RGBA, StateTransitionMode );
return 0;
}