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

vk: Add VK_EXT_provoking_vertex optimization #1681

Merged
merged 7 commits into from
Oct 11, 2024

Conversation

Wunkolo
Copy link
Contributor

@Wunkolo Wunkolo commented Oct 9, 2024

The dreamcast uses the last vertex as the provoking vertex, while vulkan uses the first vertex.
This requires an additional call to setFirstProvokingVertex to reorder the vertices for all incoming geometry.
With VK_EXT_provoking_vertex, the pipeline can designate that the provoking vertex is to be the last vertex, which removes the need to re-order incoming geometry on the CPU.

The dreamcast uses the last vertex as the provoking vertex, while vulkan uses the first vertex.
This requires an additional call to `setFirstProvokingVertex` to reorder the vertices for all incoming geometry.
With `VK_EXT_provoking_vertex`, the pipeline can designate that the provoking vertex is to be the last vertex, which removes the need to re-order incoming geometry on the CPU.
Allows VMA to make assumptions such as using the `*KHR` or non-`KHR` versions of certain function names.
@Wunkolo Wunkolo changed the base branch from dev to master October 9, 2024 23:30
Despite the physical device possibly being 1.2 or 1.3, we only want up to 1.1. Otherwise we will be responsible for other API functions being resolved and loaded when passing to VMA.
Pretty much anything handling dreamcast-geometry should use this extension when available
@Wunkolo Wunkolo marked this pull request as ready for review October 10, 2024 04:42
@Wunkolo
Copy link
Contributor Author

Wunkolo commented Oct 10, 2024

Works fine in my limited tests, but I also don't know of any titles that are particularly sensitive to the order of the provoking vertex

@flyinghead
Copy link
Owner

A good test is games using flat shading (most games use Gouraud shading). For example, the first battle in Evolution - The World of Sacred Device.

@Wunkolo
Copy link
Contributor Author

Wunkolo commented Oct 10, 2024

master(556e2ea):

flycast_5Td61dT0Ax.mp4

This PR:

flycast_Ev9IsdBl6J.mp4

Seems to be interpreting the last vertex properly when using flat interpolation:
image

@flyinghead flyinghead merged commit 4d73cc8 into flyinghead:master Oct 11, 2024
15 checks passed
@flyinghead
Copy link
Owner

Looks good. Thanks!

@Wunkolo Wunkolo deleted the vk-provoking-vertex branch October 11, 2024 21:33
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