Skip to content

Assert when glDrawElements cannot draw anything because of missing vertex bounds#26525

Open
paradust7 wants to merge 1 commit intoemscripten-core:mainfrom
paradust7:add_ibo_assert
Open

Assert when glDrawElements cannot draw anything because of missing vertex bounds#26525
paradust7 wants to merge 1 commit intoemscripten-core:mainfrom
paradust7:add_ibo_assert

Conversation

@paradust7
Copy link

@paradust7 paradust7 commented Mar 23, 2026

Even with FULL_ES2, glDrawElements cannot handle the case where the indices are in a buffer but the vertices are client-side. Nothing will be drawn in this case. Add an assertion to make this situation visible when debugging.

Fixes #26460

if (!cb.clientside || !cb.enabled) continue;

#if ASSERTIONS
assert(count || !GLctx.currentElementArrayBufferBinding, 'must use array buffers when using element buffer');
Copy link
Collaborator

Choose a reason for hiding this comment

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

Does this assert belong here inside this for loop? Could it not go outside the loop?

Copy link
Collaborator

Choose a reason for hiding this comment

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

Should this be !count || !GLctx.currentElementArrayBufferBinding ? (i.e. I'm not sure what the count || part is doing here.

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.

glDrawElements draws nothing when ELEMENT_ARRAY_BUFFER is bound, but ARRAY_BUFFER is not.

2 participants