Skip to content

Conversation

@AlexAPPi
Copy link
Contributor

@AlexAPPi AlexAPPi commented Jun 13, 2025

Fixes #6751

This PR introduces an important update related to support for the baseVertex parameter when rendering primitives. This functionality allows specifying an offset for vertex indices, which is especially useful for batching—combining multiple objects into a single draw call to improve efficiency.

Support for baseVertex is fully implemented for WebGPU, providing compatibility and high performance on modern graphics APIs designed for web applications. This implementation enables correct usage of baseVertex during batching, allowing more flexible management of indices and vertices without the need to duplicate data.

Regarding WebGL2, support for baseVertex is limited. Currently, WebGL2 does not offer full support for this feature, which imposes some restrictions on its use in browsers and applications based on WebGL2. However, partial support can be achieved through extensions such as WEBGL_draw_instanced_base_vertex_base_instance, which broadens rendering capabilities and optimization options.

It’s also worth noting that a previous PR on this topic was prepared but had to be closed due to certain issues—possibly related to technical difficulties or compatibility concerns.

For more detailed information, you can refer to the following sources:

Official PR on GitHub: KhronosGroup/WebGL#2941
WebGL extension documentation: https://web3dsurvey.com/webgl2/extensions/WEBGL_draw_instanced_base_vertex_base_instance

I confirm I have read the contributing guidelines and signed the Contributor License Agreement.

Copy link
Contributor

@mvaligursky mvaligursky left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good, thanks!

@mvaligursky mvaligursky merged commit 7aa4b0c into playcanvas:main Jun 16, 2025
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add support baseVertex for GPURenderPassEncoder

2 participants