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

Vulkan: Update Vulkan headers, VulkanMemoryAllocator #12875

Merged
merged 2 commits into from
Jun 22, 2024

Conversation

luiscondesdi
Copy link
Contributor

@luiscondesdi luiscondesdi commented Jun 18, 2024

As part of my investigations on why Vulkan backend rendering via hardware for the Raspberry Pi 5 was not working in master latest I stumbled upon this VulkanMemoryAllocator issue. I checked on Core/VideoBackends/Vulkan/StagingBuffer.cpp and in RPi5 VMA was indeed having trouble allocating memory when VMA_ALLOCATION_CREATE_HOST_ACCESS_RANDOM_BIT was requested.

This PR updates the submodule to tag v3.1.0 of VulkanMemoryAllocator and as per @Xphalnos request at #12821, the vulkan headers to tag v1.3.288 from https://github.com/KhronosGroup/Vulkan-Headers. This resolves the issue for Raspberry Pi 5, potentially also fixes this same issue for Raspberry Pi 4 and does not modify dolphin emulator code.

I preserve a branch with only the VMA update just in case it is preferred to do just that (as it also solves the issue).

@iwubcode
Copy link
Contributor

iwubcode commented Jun 19, 2024

Thanks for doing this. Would you mind updating the vulkan headers to a submodule of the repo you have linked instead of updating them manually?

@luiscondesdi
Copy link
Contributor Author

luiscondesdi commented Jun 19, 2024

It has come to my attention the SDL library has its own copy of the vulkan headers. The good news is dolphin already has configured SDL as a submodule and the SDL Dev team updated the vulkan headers five months ago.

Should I worry? Should the SDL be updated as well? My gut tells me to do it in a separate PR if necessary.

@BhaaLseN
Copy link
Member

Windows still uses MSBuild projects (and not CMake,) so you'll have to update this section as well:

<AdditionalIncludeDirectories>$(ExternalsDir)Vulkan\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>

@BhaaLseN
Copy link
Member

No idea about this one, that feels like an upstream issue?

Externals\VulkanMemoryAllocator\include\vk_mem_alloc.h(3841,13): error C2220: the following warning is treated as an error [c:\buildbot\pr-win-x64\build\Source\Core\DolphinLib.vcxproj]
Externals\VulkanMemoryAllocator\include\vk_mem_alloc.h(3841,13): warning C4505: 'swap': unreferenced function with internal linkage has been removed [c:\buildbot\pr-win-x64\build\Source\Core\DolphinLib.vcxproj]

@iwubcode
Copy link
Contributor

iwubcode commented Jun 19, 2024

Are you sourcing from the tags or main? Would definitely suggest sourcing from the latest tag and referencing it in your commit message

@luiscondesdi
Copy link
Contributor Author

luiscondesdi commented Jun 19, 2024

Are you sourcing from the tags or main? Would definitely suggest sourcing from the latest tag and referencing it in your commit message

I am referencing the latest tag v3.1.0 and its in commit message from commit b6bd882. I'll make it explicit in the PR.

@luiscondesdi
Copy link
Contributor Author

No idea about this one, that feels like an upstream issue?

Externals\VulkanMemoryAllocator\include\vk_mem_alloc.h(3841,13): error C2220: the following warning is treated as an error [c:\buildbot\pr-win-x64\build\Source\Core\DolphinLib.vcxproj]
Externals\VulkanMemoryAllocator\include\vk_mem_alloc.h(3841,13): warning C4505: 'swap': unreferenced function with internal linkage has been removed [c:\buildbot\pr-win-x64\build\Source\Core\DolphinLib.vcxproj]

Yeah, its an unused function they left there...

@iwubcode
Copy link
Contributor

I am referencing the latest tag, v3.1.0 and its in commit message from commit b6bd882. I'll make it explicit in the PR.

That's good too. I was referring to the Vulkan headers submodule though. Latest tag there is v1.3.288

@luiscondesdi
Copy link
Contributor Author

luiscondesdi commented Jun 19, 2024

That's good too. I was referring to the Vulkan headers submodule though. Latest tag there is v1.3.288

You are absolutely right. Good catch. Vulkan-Headers are now on tag v1.3.288 as suggested.

@Xphalnos
Copy link

Tested on Android on Zelda Wind Waker: Before 25-27 fps and after 27-30 fps

Copy link
Contributor

@iwubcode iwubcode left a comment

Choose a reason for hiding this comment

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

Code LGTM. Tested on Windows.

@luiscondesdi
Copy link
Contributor Author

I am getting stable 29.9 fps on rpi5 at native res, default settings. I am getting stable 29.9 fps in menus, 16-ish fps on scenes at 2x native res, default settings. Color me impressed.

@Xphalnos
Copy link

Tested on Windows
Master:
Resident Evil Master
PR:
Resident Evil PR

@AdmiralCurtiss
Copy link
Contributor

The commit history here is a bit of a mess so I feel like we should clean this up before merging...

@JohnLoveJoy
Copy link

Sadly, even with this, the API implementation for Imagination BXM(Latest architecture) remains broken and fails to start.

Capt

@iwubcode
Copy link
Contributor

iwubcode commented Jun 21, 2024

The commit history here is a bit of a mess so I feel like we should clean this up before merging...

My suggestion @luiscondesdi would be one commit for the VMA update and one commit for the Vulkan headers (migration + turn to submodule).

Thanks again for doing this!

@luiscondesdi luiscondesdi force-pushed the updatevkheaders branch 2 times, most recently from e7e87ec to 2b0d3d5 Compare June 22, 2024 05:59
Copy link
Contributor

@AdmiralCurtiss AdmiralCurtiss left a comment

Choose a reason for hiding this comment

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

Yup, looks good now.

@AdmiralCurtiss AdmiralCurtiss merged commit d49304a into dolphin-emu:master Jun 22, 2024
11 checks passed
@luiscondesdi luiscondesdi deleted the updatevkheaders branch June 23, 2024 07:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

6 participants