From 7c8b67fda40132b4378eb21a6b8ff45892a28a90 Mon Sep 17 00:00:00 2001 From: Egor Yusov Date: Sun, 11 Mar 2018 12:07:40 -0700 Subject: Added PSO:IsCompatibleWith method to Lua bindings --- RenderScript/src/PSODescParser.cpp | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) (limited to 'RenderScript/src/PSODescParser.cpp') diff --git a/RenderScript/src/PSODescParser.cpp b/RenderScript/src/PSODescParser.cpp index 36c298f..b8a9109 100644 --- a/RenderScript/src/PSODescParser.cpp +++ b/RenderScript/src/PSODescParser.cpp @@ -216,7 +216,8 @@ namespace Diligent const Char* PSODescParser::PSODescLibName = "PipelineState"; PSODescParser::PSODescParser( IRenderDevice *pRenderDevice, lua_State *L ) : EngineObjectParserCommon( pRenderDevice, L, PSODescLibName ), - m_SetPSOBinding( this, L, "Context", "SetPipelineState", &PSODescParser::SetPSO ) + m_SetPSOBinding( this, L, "Context", "SetPipelineState", &PSODescParser::SetPSO ), + m_IsCompatibleWithBinding(this, L, m_MetatableRegistryName.c_str(), "IsCompatibleWith", &PSODescParser::IsCompatibleWith) { DEFINE_BUFFERED_STRING_BINDER( m_Bindings, PSODescWrapper, Name, NameBuffer ) @@ -254,4 +255,22 @@ namespace Diligent return 0; } + + int PSODescParser::IsCompatibleWith(lua_State *L) + { + INIT_LUA_STACK_TRACKING(L); + + auto *pThisPSO = *GetUserData(L, 1, m_MetatableRegistryName.c_str()); + + // Buffer should be the first argument + auto *pPSO = *GetUserData(L, 2, m_MetatableRegistryName.c_str()); + + auto IsCompatible = pThisPSO->IsCompatibleWith(pPSO); + + // Push existing object + PushValue(L, IsCompatible); + + // Returning one value to Lua + return 1; + } } -- cgit v1.2.3