Skip to content

rendering: avoid primitive restart for Lua VAO model submissions - #3156

Open
Kitrae wants to merge 1 commit into
beyond-all-reason:masterfrom
Kitrae:fix/zink-primitive-restart
Open

rendering: avoid primitive restart for Lua VAO model submissions#3156
Kitrae wants to merge 1 commit into
beyond-all-reason:masterfrom
Kitrae:fix/zink-primitive-restart

Conversation

@Kitrae

@Kitrae Kitrae commented Jul 31, 2026

Copy link
Copy Markdown

What changed:

LuaVAOImpl::Submit() no longer enables primitive restart around model multi draw submissions.

The regular LuaVAOImpl::DrawElements() path is unchanged and continues to support the primitive restart.

Why:

Lua VAO model submissions use ordinary triangle lists and dont contain primitive restart indices.

Enabling primitive restart caused Zink to enter an extremely slow path when BARS custom unit shaders were active. Model rendering dropped the game to roughly 2-4 fps.

Removing the unnecessary state avoids that bottleneck without disabling CUS, changing any shaders, or introducing a zink specific fallback.

Tested:

  • Zink: BAR loaded with CUS enabled and full shaders, then rendered models without the previous severe framerate hit.

  • Native OpenGL on NVIDIA: CUS initialized, compiled, and rendered successfully.

  • RelWithDebInfo engine build completed

@Kitrae
Kitrae marked this pull request as ready for review July 31, 2026 20:27
@bruno-dasilva

Copy link
Copy Markdown
Collaborator

Hmm I do wonder why this was here in the first place... is it vestigial or there for some good reason (that we need to make sure is fixed in some other way)?

Good find nonetheless!

@Kitrae

Kitrae commented Jul 31, 2026

Copy link
Copy Markdown
Author

Hmm I do wonder why this was here in the first place... is it vestigial or there for some good reason (that we need to make sure is fixed in some other way)?

Good find nonetheless!

From what i can actually tell, Primitive restart was added to the generic DrawElements() path in 2021, where lua provided index buffers can contain restart indices.
Submit() was added later as part of the multi draw model submission work, and it appears the same setup was carried over.
So it does appear to be a vestigial state

@Kitrae

Kitrae commented Aug 3, 2026

Copy link
Copy Markdown
Author

hoping this could get approved?

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