Implementation of baseVertex support #7765
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.