processing/p5.js

[p5.js 2.0 RFC Proposal]: Batching for the rendering of objects.

Open

#6,805 创建于 2024年2月12日

在 GitHub 查看
 (15 评论) (0 反应) (1 负责人)JavaScript (3,178 fork)batch import
Area:CoreArea:WebGLDiscussionHelp Wantedp5.js 2.0+

仓库指标

Star
 (20,784 star)
PR 合并指标
 (平均合并 8天 13小时) (30 天内合并 45 个 PR)

描述

Increasing access

This would increase the speed of projects.

Which types of changes would be made?

  • Breaking change (Add-on libraries or sketches will work differently even if their code stays the same.)
  • Systemic change (Many features or contributor workflows will be affected.)
  • Overdue change (Modifications will be made that have been desirable for a long time.)
  • Unsure (The community can help to determine the type of change.)

Most appropriate sub-area of p5.js?

  • Accessibility
  • Color
  • Core/Environment/Rendering
  • Data
  • DOM
  • Events
  • Image
  • IO
  • Math
  • Typography
  • Utilities
  • WebGL
  • Build process
  • Unit testing
  • Internationalization
  • Friendly errors
  • Other (specify if possible)

What's the problem?

Currently projects with multiple shapes drawn can be very slow. This is largely due to draw calls.

What's the solution?

This can be partially fixed with instancing like seen here: https://github.com/processing/p5.js/pull/6276 and in issue https://github.com/processing/p5.js/issues/6275, but another effective strategy, especially for those who don't want to deal with more complex things like combining meshes manually or instancing would be to batch the rendering of objects together so that they may be able to be drawn within less drawn calls. This would however be quite the undertaking and require a decently substantial change to p5.js, so if it's not possible or worth it to implement this, I'd understand that too.

Pros (updated based on community comments)

Cons (updated based on community comments)

  • There aren't really any, it just changes the speed things are rendered at. The only one I can see is it being hard to implement.

Proposal status

Under review

Note: The original non-RFC 2.0 issue is #6279

贡献者指南