summaryrefslogtreecommitdiffstats
path: root/RenderScript/src/PSODescParser.cpp
diff options
context:
space:
mode:
authorEgor Yusov <egor.yusov@gmail.com>2018-03-11 19:07:40 +0000
committerEgor Yusov <egor.yusov@gmail.com>2018-03-11 19:07:40 +0000
commit7c8b67fda40132b4378eb21a6b8ff45892a28a90 (patch)
tree4e127b4c8ae3eb884743ebd6acd968f007b07604 /RenderScript/src/PSODescParser.cpp
parentUpdate README.md (diff)
downloadDiligentTools-7c8b67fda40132b4378eb21a6b8ff45892a28a90.tar.gz
DiligentTools-7c8b67fda40132b4378eb21a6b8ff45892a28a90.zip
Added PSO:IsCompatibleWith method to Lua bindings
Diffstat (limited to 'RenderScript/src/PSODescParser.cpp')
-rw-r--r--RenderScript/src/PSODescParser.cpp21
1 files changed, 20 insertions, 1 deletions
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<IPipelineState>( 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<IPipelineState**>(L, 1, m_MetatableRegistryName.c_str());
+
+ // Buffer should be the first argument
+ auto *pPSO = *GetUserData<IPipelineState**>(L, 2, m_MetatableRegistryName.c_str());
+
+ auto IsCompatible = pThisPSO->IsCompatibleWith(pPSO);
+
+ // Push existing object
+ PushValue(L, IsCompatible);
+
+ // Returning one value to Lua
+ return 1;
+ }
}