Skip to content

Conversation

@greggman
Copy link
Collaborator

No description provided.

const adapter = await navigator.gpu?.requestAdapter({
featureLevel: 'compatibility',
});
if (adapter.limits.maxStorageBuffersInVertexStage < 2) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

This will be undefined (if not in chrome with compat enabled). Technically this would work because undefined < 2 == NaN < 2 == false but we should be somehow explicit about it.

I made the limit members optional in gpuweb/types#168 which I think would catch this issue (but not the other one).

}
const device = await adapter?.requestDevice({
requiredLimits: {
maxStorageBuffersInVertexStage: 2,
Copy link
Collaborator

Choose a reason for hiding this comment

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

I believe this will produce an error in standard browsers. It should only be set if the limit exists in adapter.limits.

@greggman greggman closed this Mar 17, 2025
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.

2 participants