Multidraw BVBI - when? Help to test it on your device.

116 views
Skip to first unread message

Ivan Popelyshev

unread,
Apr 21, 2023, 9:22:13 AM4/21/23
to WebGL Dev List


A year has passed and certain extension is still in draft:
https://registry.khronos.org/webgl/extensions/WEBGL_multi_draw_instanced_base_vertex_base_instance/

This extension is crucial for my current project, because it helps to lower memory usage, a lot.

I reported the algorithm that prepares big dynamic geometries for multidraw optimization in one of khronos meetings: https://www.khronos.org/events/webgl-webgpu-meetup-october-4-2022

After many months of work, we finally removed all bottlenecks in the app, and now its much easier to test if extension actually helps.

TRANSFORM_FEEDBACK trick that was discovered last week is final nail in the coffin of lagggggs.

If you are interested in extension , please help to test it by posting here FPS on your device.

Ivan Popelyshev

unread,
Apr 22, 2023, 6:48:39 AM4/22/23
to WebGL Dev List
For example

on my lenovo legion 5 , with nvidia 3080:

im looking around with about 1-1.5m quads in frustum, 3-5m total.

big buffer, multidraw 165FPS
big buffer, no multidraw 165FPS
one buffer per chunk 40-50FPS

big buffer,  no multidraw - 17% of cpu is eaten by vertexAttribPointer

image.png   

пятница, 21 апреля 2023 г. в 16:22:13 UTC+3, Ivan Popelyshev:

Ken Russell

unread,
Apr 25, 2023, 8:30:50 PM4/25/23
to webgl-d...@googlegroups.com
Hi Ivan,

Unfortunately Madcraft isn't working well with ANGLE's Metal backend. On an M1 MacBook Pro it frequently reports:
WebGL: INVALID_OPERATION: uniform1f: location not for current program

and none of the voxel geometry renders.

If it's possible to reduce this to a smaller test case we'd like to get to the bottom of it.

-Ken



--
You received this message because you are subscribed to the Google Groups "WebGL Dev List" group.
To unsubscribe from this group and stop receiving emails from it, send an email to webgl-dev-lis...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/webgl-dev-list/458063c6-8ea3-4d98-b3a0-9549071219f9n%40googlegroups.com.

Ivan Popelyshev

unread,
Apr 26, 2023, 4:15:17 AM4/26/23
to WebGL Dev List
i have macbook air m2, i can debug it asap ) how to check out new metal backend?

среда, 26 апреля 2023 г. в 03:30:50 UTC+3, Kenneth Russell:

Ken Russell

unread,
Apr 26, 2023, 12:18:38 PM4/26/23
to webgl-d...@googlegroups.com
On Canary, go to about:flags, "Choose ANGLE graphics backend", and switch it from "Default" to "Metal". After restarting the browser, you can confirm it took effect by looking at the GL_RENDERER string in about:gpu and verifying it now contains "ANGLE Metal Renderer".

Thanks for any initial diagnosis on your side.

-Ken



Ivan Popelyshev

unread,
Apr 26, 2023, 12:24:00 PM4/26/23
to WebGL Dev List
most probably rogue "uniform1f(null)" calls, that regular ANGLE just ignores. I updated the site, please try again. I'll try on my M2 air in a few hours.

Ivan.

среда, 26 апреля 2023 г. в 19:18:38 UTC+3, Kenneth Russell:

Ken Russell

unread,
Apr 26, 2023, 12:29:53 PM4/26/23
to webgl-d...@googlegroups.com
Hmm, those should be passed through and silently ignored because that's the specified OpenGL behavior when an invalid uniform location is passed in. Will test again myself a bit later too.

-Ken



Ivan Popelyshev

unread,
Apr 26, 2023, 6:44:33 PM4/26/23
to WebGL Dev List
It works, 

metal 40FPS / opengl 50FPS on same scene

strange black squares appearing with centers on diagonals because i didnt set gl_PointSize neither gl_Position in my transform feedback shader (POINTS mode) that I use to copy info around.
when i set "gl_PointSize = 0.0" in vertex shader, artifact disappears )

-Ivan

среда, 26 апреля 2023 г. в 20:29:53 UTC+4, Kenneth Russell:

Mark Callow

unread,
Apr 27, 2023, 12:02:30 AM4/27/23
to WebGL Dev List


On Apr 27, 2023, at 7:44, Ivan Popelyshev <ivan.po...@gmail.com> wrote:

It works, 

metal 40FPS / opengl 50FPS on same scene

That is a surprise to me given Brenwill's claims that MoltenGL is faster than macOS OpenGL, something I have not verified my self. The only explanation I could see for that, as we have the same API on the top and the same hardware on the bottom, is that Apple’s OpenGL driver is not very good.

Regards

    -Mark

signature.asc

Ivan Popelyshev

unread,
Apr 27, 2023, 3:57:27 AM4/27/23
to WebGL Dev List
I tested it one time, on M2 air without power supply. I'll locate which operations take more time. Its definitely not js-side, its 3ms per frame. 

четверг, 27 апреля 2023 г. в 07:02:30 UTC+3, Mark Callow:

Ivan Popelyshev

unread,
Apr 27, 2023, 7:47:55 AM4/27/23
to WebGL Dev List
Tried again, with power supply.

In the same place, same settings, regular drawcall count is about 200, multidraw is less

================  OPENGL === METAL
BIG, MD BVBI =========40=======30====
BIG, VERTEXATTRIB====40=======10====
ONE PER CHUNK======30=======30====

I can spend time on investigating which parts are slower a bit later )

-Ivan

четверг, 27 апреля 2023 г. в 11:57:27 UTC+4, Ivan Popelyshev:
Reply all
Reply to author
Forward
0 new messages