Optimize CPU particles impl parts

This commit is contained in:
Wojtek Figat
2021-08-30 20:30:52 +02:00
parent e284a88da4
commit e3b98c902b
4 changed files with 11 additions and 8 deletions

View File

@@ -131,7 +131,7 @@ void ParticleEmitterGraphCPUExecutor::Init(ParticleEmitter* emitter, ParticleEff
context.DeltaTime = dt;
context.ParticleIndex = 0;
context.ViewTask = effect->GetRenderTask();
context.CallStack.Clear();
context.CallStackSize = 0;
context.Functions.Clear();
}
@@ -588,7 +588,7 @@ VisjectExecutor::Value ParticleEmitterGraphCPUExecutor::eatBox(Node* caller, Box
{
// Check if graph is looped or is too deep
auto& context = Context.Get();
if (context.CallStack.Count() >= PARTICLE_EMITTER_MAX_CALL_STACK)
if (context.CallStackSize >= PARTICLE_EMITTER_MAX_CALL_STACK)
{
OnError(caller, box, TEXT("Graph is looped or too deep!"));
return Value::Zero;
@@ -602,7 +602,7 @@ VisjectExecutor::Value ParticleEmitterGraphCPUExecutor::eatBox(Node* caller, Box
#endif
// Add to the calling stack
context.CallStack.Add(caller);
context.CallStack[context.CallStackSize++] = caller;
// Call per group custom processing event
Value value;
@@ -611,7 +611,7 @@ VisjectExecutor::Value ParticleEmitterGraphCPUExecutor::eatBox(Node* caller, Box
(this->*func)(box, parentNode, value);
// Remove from the calling stack
context.CallStack.RemoveLast();
context.CallStackSize--;
return value;
}