diff options
| author | Egor Yusov <egor.yusov@gmail.com> | 2018-11-24 19:09:26 +0000 |
|---|---|---|
| committer | Egor Yusov <egor.yusov@gmail.com> | 2018-11-24 19:09:26 +0000 |
| commit | c4ea9e14f1ab92265bb146207e11c0c40e5761e3 (patch) | |
| tree | 65a86382a3cd092a477a2a195c6d6fb66d717834 /RenderScript/src | |
| parent | Added GetShaderResourceBindingByName() function (diff) | |
| download | DiligentTools-c4ea9e14f1ab92265bb146207e11c0c40e5761e3.tar.gz DiligentTools-c4ea9e14f1ab92265bb146207e11c0c40e5761e3.zip | |
Added InitializeStaticResources lua function
Diffstat (limited to 'RenderScript/src')
| -rw-r--r-- | RenderScript/src/ShaderResourceBindingParser.cpp | 21 |
1 files changed, 19 insertions, 2 deletions
diff --git a/RenderScript/src/ShaderResourceBindingParser.cpp b/RenderScript/src/ShaderResourceBindingParser.cpp index 80a5092..7c0447a 100644 --- a/RenderScript/src/ShaderResourceBindingParser.cpp +++ b/RenderScript/src/ShaderResourceBindingParser.cpp @@ -38,7 +38,8 @@ namespace Diligent m_ShaderVarMetatableRegistryName(ShaderVarMetatableRegistryName), m_BindResourcesBinding( this, L, m_MetatableRegistryName.c_str(), "BindResources", &ShaderResourceBindingParser::BindResources ), m_GetVariableBinding( this, L, m_MetatableRegistryName.c_str(), "GetVariable", &ShaderResourceBindingParser::GetVariable ), - m_CreateShaderResourceBinding( this, L, PSOLibMetatableName.c_str(), "CreateShaderResourceBinding", &ShaderResourceBindingParser::CreateShaderResourceBinding ) + m_CreateShaderResourceBinding( this, L, PSOLibMetatableName.c_str(), "CreateShaderResourceBinding", &ShaderResourceBindingParser::CreateShaderResourceBinding ), + m_InitializeStaticResourcesBinding( this, L, m_MetatableRegistryName.c_str(), "InitializeStaticResources", &ShaderResourceBindingParser::InitializeStaticResources ) { } @@ -48,7 +49,7 @@ namespace Diligent { INIT_LUA_STACK_TRACKING(L); - // Shader should be the first argument + // PSO should be the first argument auto *pPSO = *GetUserData<IPipelineState**>( L, 1, m_PSOLibMetatableName.c_str() ); bool InitStaticResources = false; @@ -190,6 +191,22 @@ namespace Diligent return 1; } + int ShaderResourceBindingParser::InitializeStaticResources( lua_State *L ) + { + auto NumArgs = lua_gettop( L ); + // The object itself goes first + auto *pShaderResBinding = *GetUserData<IShaderResourceBinding**>( L, 1, m_MetatableRegistryName.c_str() ); + IPipelineState* pPSO = nullptr; + + if (NumArgs >= 2) + { + pPSO = *GetUserData<IPipelineState**>( L, 2, m_PSOLibMetatableName.c_str() ); + } + + pShaderResBinding->InitializeStaticResources(pPSO); + return 0; + } + void ShaderResourceBindingParser::GetObjectByName( lua_State *L, const Char *ShaderName, IShaderResourceBinding** ppObject ) { auto pObject = *GetGlobalObject<IShaderResourceBinding**>( L, ShaderName, m_MetatableRegistryName.c_str() ); |
