summaryrefslogtreecommitdiffstats
path: root/RenderScript
diff options
context:
space:
mode:
authorEgor Yusov <egor.yusov@gmail.com>2018-11-24 16:19:06 +0000
committerEgor Yusov <egor.yusov@gmail.com>2018-11-24 16:19:06 +0000
commite12d5ea9b35feb985c2756789d2e739dd4d9d781 (patch)
treeed17ffaa2f1d12264c4f679a10cef6a93817ec42 /RenderScript
parentFixing linux/mac build - another attempt (diff)
downloadDiligentTools-e12d5ea9b35feb985c2756789d2e739dd4d9d781.tar.gz
DiligentTools-e12d5ea9b35feb985c2756789d2e739dd4d9d781.zip
Added GetShaderResourceBindingByName() function
Added InitStaticResources parameter to CreateShaderResourceBinding lua function
Diffstat (limited to 'RenderScript')
-rw-r--r--RenderScript/include/ScriptParser.h1
-rw-r--r--RenderScript/src/ScriptParser.cpp5
-rw-r--r--RenderScript/src/ShaderResourceBindingParser.cpp9
3 files changed, 14 insertions, 1 deletions
diff --git a/RenderScript/include/ScriptParser.h b/RenderScript/include/ScriptParser.h
index d8d0d07..c537484 100644
--- a/RenderScript/include/ScriptParser.h
+++ b/RenderScript/include/ScriptParser.h
@@ -76,6 +76,7 @@ namespace Diligent
void GetBufferViewByName( const Char *BufferViewName, IBufferView** ppTextureView );
void GetPipelineStateByName( const Char *PSOName, IPipelineState** ppPSO );
void GetShaderVariableByName( const Char *ShaderVarName, IShaderVariable** ppShaderVar );
+ void GetShaderResourceBindingByName( const Char *SRBName, IShaderResourceBinding** ppSRB );
template<typename ValType>
void SetGlobalVariable( const Char *Name, ValType Var )
diff --git a/RenderScript/src/ScriptParser.cpp b/RenderScript/src/ScriptParser.cpp
index a31f308..5cb13b5 100644
--- a/RenderScript/src/ScriptParser.cpp
+++ b/RenderScript/src/ScriptParser.cpp
@@ -244,6 +244,11 @@ namespace Diligent
m_pShaderVariableParser->GetObjectByName( m_LuaState, ShaderVarName, ppShaderVar );
}
+ void ScriptParser::GetShaderResourceBindingByName( const Char *SRBName, IShaderResourceBinding** ppSRB )
+ {
+ m_pShaderResBindingParser->GetObjectByName( m_LuaState, SRBName, ppSRB );
+ }
+
void ScriptParser::QueryInterface( const Diligent::INTERFACE_ID &IID, IObject **ppInterface )
{
UNSUPPORTED( "Not implemented" );
diff --git a/RenderScript/src/ShaderResourceBindingParser.cpp b/RenderScript/src/ShaderResourceBindingParser.cpp
index 0613f59..80a5092 100644
--- a/RenderScript/src/ShaderResourceBindingParser.cpp
+++ b/RenderScript/src/ShaderResourceBindingParser.cpp
@@ -51,8 +51,15 @@ namespace Diligent
// Shader should be the first argument
auto *pPSO = *GetUserData<IPipelineState**>( L, 1, m_PSOLibMetatableName.c_str() );
+ bool InitStaticResources = false;
+ auto NumArgs = lua_gettop( L );
+ if( NumArgs >= 2 )
+ {
+ InitStaticResources = ReadValueFromLua<Bool>( L, 2 );
+ }
+
auto pNewShaderResBndngLuaObj = reinterpret_cast<IShaderResourceBinding**>(lua_newuserdata( L, sizeof( IShaderResourceBinding* ) ));
- pPSO->CreateShaderResourceBinding(pNewShaderResBndngLuaObj);
+ pPSO->CreateShaderResourceBinding(pNewShaderResBndngLuaObj, InitStaticResources);
CHECK_LUA_STACK_HEIGHT( +1 );
}