playcanvas / engine

JavaScript game engine built on WebGL, WebGPU, WebXR and glTF
https://playcanvas.com
MIT License
9.36k stars 1.32k forks source link

Add support baseVertex for GPURenderPassEncoder #6751

Open AlexAPPi opened 1 month ago

AlexAPPi commented 1 month ago

Hi!

It would be nice to have baseVertex support for the mesh.

https://developer.mozilla.org/en-US/docs/Web/API/GPURenderPassEncoder/drawIndexed

https://github.com/playcanvas/engine/blob/03920ded44f6cee81ab16a904551b8b1ddecaeb5/src/platform/graphics/webgpu/webgpu-graphics-device.js#L521

https://github.com/playcanvas/engine/blob/03920ded44f6cee81ab16a904551b8b1ddecaeb5/src/scene/mesh.js#L256

mvaligursky commented 1 month ago

WebGL 2 adds support for this using WEBGL_draw_instanced_base_vertex_base_instance but its support seems to be very low (less than 1%) here https://web3dsurvey.com/webgl2

AlexAPPi commented 1 month ago

WebGL 2 adds support for this using WEBGL_draw_instanced_base_vertex_base_instance but its support seems to be very low (less than 1%) here https://web3dsurvey.com/webgl2

If you focus on chromium-like browsers, they have support; this greatly speeds up the work with indexes, for example for the LOD system.

mvaligursky commented 1 month ago

I see this:

Screenshot 2024-06-27 at 12 31 56

My MacOS on latest Chrome does not expose this extension.

What data do you see?

AlexAPPi commented 1 month ago

Sorry, I'm talking about webGPU support.

https://developer.mozilla.org/en-US/docs/Web/API/GPURenderBundleEncoder/drawIndexed#browser_compatibility