pex-gl / pex-renderer

Physically based renderer (PBR) and scene graph for PEX.
https://pex-gl.github.io/pex-renderer/examples/index.html
MIT License
234 stars 16 forks source link

Maximum call stack size exceeded #350

Open vorg opened 8 months ago

vorg commented 8 months ago

Happens when pipeline crash. Looks like RAF stacks to infinity on error

Screenshot 2023-10-18 at 12 06 37

Can this be caused by requestAnimationFrame(frame.bind(this)); in pex-renderer?

vorg commented 8 months ago

It was added in pex-context@3 alpha to avoid self = this variable.

vorg commented 8 months ago

Easiest way ATM to recreate issue it to create lineMaterial

const cubeEntity = createEntity({
  transform: components.transform(),
  geometry: components.geometry(cube()),
  material: components.material({ type: "line" }),
});
world.add(cubeEntity);

That will crash lineRendererSystem at buffer: entity._geometry.attributes.aVertexColor.buffer, as vertex colors are missing

dmnsgn commented 8 months ago

We should try/catch renderEngine.update/render in ctx.frame and return false on error to stop the loop. Restarting the raf will need better devx than a reload in Nodes.