Skip to content
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

Implementation of baseVertex support #6978

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

AlexAPPi
Copy link
Contributor

@AlexAPPi AlexAPPi commented Sep 20, 2024

Fixes #6751

Added support primitive baseVertex for WebGPU and Batching.

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

* - `indexed` specifies whether to interpret the primitive as indexed, thereby using the
* currently set index buffer.
*
* @type {{type: number, base: number, count: number, indexed?: boolean}[]}
* @type {{type: number, base: number, count: number, baseVertex?: number, indexed?: boolean}[]}
Copy link
Contributor

Choose a reason for hiding this comment

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

we should initialize it to 0 here as well, instead of leaving it undefined

Copy link
Contributor Author

Choose a reason for hiding this comment

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

In most cases, this parameter will be of little use, and there is no need to store it in memory for each primitive.

Copy link
Contributor

Choose a reason for hiding this comment

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

It's really not much memory. It's more important to have these objects the same "layout" to avoid chrome possibly deoptimizing functions as they accept polymorphic parameters.

@Maksims
Copy link
Collaborator

Maksims commented Sep 23, 2024

Is there an alternative of base vertex but for the WebGL to ensure parity between renderers?

@AlexAPPi
Copy link
Contributor Author

Is there an alternative of base vertex but for the WebGL to ensure parity between renderers?

There is no cheap alternative for WebGL2. Only if you change the array of indices directly, via Mesh.setIndices

@mvaligursky
Copy link
Contributor

Is there an alternative of base vertex but for the WebGL to ensure parity between renderers?

There is no cheap alternative for WebGL2. Only if you change the array of indices directly, via Mesh.setIndices

The real solution is for WebGL to support WEBGL_draw_instanced_base_vertex_base_instance on more devices. Till then this is a WebGPU feature (as compute shaders for example)

@willeastcott
Copy link
Contributor

@mvaligursky
Copy link
Contributor

LOL. 0.2% support.

https://web3dsurvey.com/webgl2/extensions/WEBGL_draw_instanced_base_vertex_base_instance

that is slightly less (-0.04%) than a month ago.

I don't get it. WebGPU supports it, meaning my mac book pro supports it. Some browsers support it on WebGL .. I assume that's not Chrome then?

Searching online, Chrome supports it behind a flag .. when they enable it, this will go to 50%

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
4 participants