-
-
Notifications
You must be signed in to change notification settings - Fork 644
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix batch drawing for primitive shapes #1172
Labels
Comments
obiot
added a commit
that referenced
this issue
Feb 11, 2023
obiot
added a commit
that referenced
this issue
Feb 14, 2023
obiot
added a commit
that referenced
this issue
Feb 19, 2023
Changes: - use g.LINES when possible/applicable - split the WebGLCompositor into two classes, `QuadCompositor` for Quad (Sprite) drawing, and `PrimitiveCompositor` to draw vertices - fixed binding of active shader when switching - color for drawing primitive is now a vertex attributes (as opposed to an uniform previously) TODO : - Optimize the `arcTo` function to use gl.LINES and enable batching for circle/ellipse and rounded rectangles - Cache of optimize triangulation for filling operations. currently the bottleneck when drawing large amount (> 1000) of shapes
this one is done ! |
obiot
added a commit
that referenced
this issue
Feb 21, 2023
obiot
added a commit
that referenced
this issue
Feb 21, 2023
obiot
referenced
this issue
Mar 3, 2023
obiot
referenced
this issue
Mar 3, 2023
…compositor instances - VertexBuffer is created by the WebGLRenderer and shared by the different compositor - renamed the previous Compositor.vertexBuffer object to Compositor.vertexData; which is better more correct name for it.
obiot
referenced
this issue
Mar 3, 2023
obiot
added a commit
that referenced
this issue
Mar 14, 2023
… compositors `viewport` applies to the global gl context, so it should be defined at the [WebGL]Renderer level now, and not anymore in the Compositor class. this follows #1172
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Describe the bug
Running the https://github.com/Shirajuki/js-game-rendering-benchmark benchmark actually shows that batching primitive shapes drawing is actually broken in melonJS. for sprite based games, sprite batching is actually working, and primitive batching does not really matter, unless it heavily relies on manually drawing shapes everywhere, but this is still something to be fixed (noticed also the flickering when drawing sprites in the benchmark, which is a side effect of the broken primitive batching).
To Reproduce
melonJS
Stroke
ofFill
Expected behavior
at least maintain 60fps when count is at 2500 stroke of fill operations (even Pixi fps is dropping at 5000 and higher)
Device :
Additional context
Proposed solution:
make sure that all primitive drawing use the same type (e.g. gl.LINES, GL.LINE_STRIP, gl_LINE_LOOP) to enable batching :
use different vertex buffer instance for quads (sprite) and primitive drawing. Right now the default compositor "re-use" the Quad Vertex Buffer, leading to a waste of unused data when drawing shapes
talking about the compositor, finally split the compositor into two different ones. One to draw quads/sprites, and one to draw primitives/shapes. This way they can both managed data and batching independently. There was some initial work done but it was never really finished.
Any other idea/suggestion, feel free to comment.
The text was updated successfully, but these errors were encountered: