In some game launches I see high values of the UpdateRSI parameter in the profiler, but I don’t really understand what they are based on. What exactly does this value mean? Searching the forum and manual did not give an answer.
upd.
Hmm. From source code it looks like it’s the render script execution time, but that doesn’t give any insight into what’s taking so long.
DM_PROFILE("DispatchRSI");
DispatchContext context;
context.m_Instance = instance;
context.m_Result = RENDER_SCRIPT_RESULT_OK;
dmMessage::Dispatch(instance->m_RenderContext->m_Socket, DispatchCallback, (void*)&context);
return context.m_Result;
}
RenderScriptResult UpdateRenderScriptInstance(HRenderScriptInstance instance, float dt)
{
DM_PROFILE("UpdateRSI");
instance->m_CommandBuffer.SetSize(0);
dmScript::UpdateScriptWorld(instance->m_ScriptWorld, dt);
RenderScriptResult result = RunScript(instance, RENDER_SCRIPT_FUNCTION_UPDATE, (void*)&dt);
if (instance->m_CommandBuffer.Size() > 0)
ParseCommands(instance->m_RenderContext, &instance->m_CommandBuffer.Front(), instance->m_CommandBuffer.Size());
return result;
}
1 Like
britzl
November 26, 2024, 7:21pm
2
It looks like we are not measuring all parts of the UpdateRenderScriptInstance()
function. In your screenshot there’s a few sub-scopes
Then we iterate over the command buffer via ParseCommands
:
RenderScriptResult UpdateRenderScriptInstance(HRenderScriptInstance instance, float dt)
{
DM_PROFILE("UpdateRSI");
instance->m_CommandBuffer.SetSize(0);
dmScript::UpdateScriptWorld(instance->m_ScriptWorld, dt);
RenderScriptResult result = RunScript(instance, RENDER_SCRIPT_FUNCTION_UPDATE, (void*)&dt);
if (instance->m_CommandBuffer.Size() > 0)
ParseCommands(instance->m_RenderContext, &instance->m_CommandBuffer.Front(), instance->m_CommandBuffer.Size());
return result;
}
void OnReloadRenderScriptInstance(HRenderScriptInstance render_script_instance)
{
RunScript(render_script_instance, RENDER_SCRIPT_FUNCTION_ONRELOAD, 0x0);
}
}
I bet it is one of the commands that take long and we do not profile all of them.
void ParseCommands(dmRender::HRenderContext render_context, Command* commands, uint32_t command_count)
{
dmGraphics::HContext context = dmRender::GetGraphicsContext(render_context);
for (uint32_t i=0; i<command_count; i++)
{
Command* c = &commands[i];
switch (c->m_Type)
{
case COMMAND_TYPE_ENABLE_STATE:
{
dmGraphics::EnableState(context, (dmGraphics::State)c->m_Operands[0]);
break;
}
case COMMAND_TYPE_DISABLE_STATE:
{
dmGraphics::DisableState(context, (dmGraphics::State)c->m_Operands[0]);
break;
}
case COMMAND_TYPE_SET_RENDER_TARGET:
This file has been truncated. show original
Thanks for the reply. I did some more research comparing two technically identical projects, but one has a large RSI the other is regular and found out suddenly that in the first project the checkbox verify graphics calls was switched off. After switching it on the values normalised.
3 Likes