Devil's Third crashes when loading 2nd level
Current Behavior
I'm using latest Cemu 2.6 on Windows 11. Devil's Third USA ver 16. During the 2nd level, right after using missile lock-ons to destroy the 4 trucks, I made my way to the area with the sniper rifle and then died from a melee enemy. Once I tried to restart at last checkpoint, Cemu crashed. Then after rebooting the game and trying to load into the 2nd level, the game crashes. The furthest it can get into loading the second level is a few audio lines during a black screen and then crash.
Expected Behavior
Cemu can load the 2nd level without crashing.
Steps to Reproduce
Read above.
System Info (Optional)
OS: Window 11 GPU: Nvidia 4070 TI
Emulation Settings (Optional)
No response
Logs (Optional)
No response
partial duplicate of #1590
Which specific checkpoint? I did more testing on my end and the game is a crashfest on level two using Vulkan, unlike the first level. I know that you can finish the game with OpenGL since that's how I got it done on my PC where Vulkan wouldn´t work at all.
There is a section in Level 2 that is a hard crash, which is the airstrike scene.
What you need to do to get past this is to look away from the explosions.
I can confirm I was using Vulkan as well. The crash for me is in the tunnel where you pick up the sniper rifle, right after blowing up the trucks with the lock-on missle launcher. I died right after picking up the sniper rifle, and couldn't load into Level 2 anymore after that check-point. Every load is a crash.
Go through the double doors to the Sniper Rifle. Then die to the guys around the corner and game will crash on Vulkan.
I could reproduce a consistent crash on stage 2 as well, it was due to a failed vkAllocateDescriptorSets(). I put a patch in #1590 that fixed it for me on Linux + AMD(RADV). Though there might be a deeper issue causing the game to allocate so many descriptor sets.
Try on https://github.com/Exzap/Cemu/releases/tag/v2.4
I get the same crash on v2.4.
Backtrace from e91740cf29248bfbf2f059ac7e42159e8e7e9e9a:
#0 0x00007ffff3a9cf3c in __pthread_kill_implementation () at /nix/store/q4wq65gl3r8fy746v9bbwgx4gzn0r2kl-glibc-2.40-66/lib/libc.so.6
#1 0x00007ffff3a4190e in raise () at /nix/store/q4wq65gl3r8fy746v9bbwgx4gzn0r2kl-glibc-2.40-66/lib/libc.so.6
#2 0x00007ffff3a28942 in abort () at /nix/store/q4wq65gl3r8fy746v9bbwgx4gzn0r2kl-glibc-2.40-66/lib/libc.so.6
#3 0x00007ffff3eadc3d in __gnu_cxx::__verbose_terminate_handler() [clone .cold] () at /nix/store/l7d6vwajpfvgsd3j4cr25imd1mzb7d1d-gcc-14.3.0-lib/lib/libstdc++.so.6
#4 0x00007ffff3ebf1aa in __cxxabiv1::__terminate(void (*)()) () at /nix/store/l7d6vwajpfvgsd3j4cr25imd1mzb7d1d-gcc-14.3.0-lib/lib/libstdc++.so.6
#5 0x00007ffff3ead7e9 in std::terminate() () at /nix/store/l7d6vwajpfvgsd3j4cr25imd1mzb7d1d-gcc-14.3.0-lib/lib/libstdc++.so.6
#6 0x00007ffff3ebf427 in __cxa_throw () at /nix/store/l7d6vwajpfvgsd3j4cr25imd1mzb7d1d-gcc-14.3.0-lib/lib/libstdc++.so.6
#7 0x00000000004c5c26 in VulkanRenderer::UnrecoverableError (this=this@entry=0x1ca8dd0, errMsg=<optimized out>) at /home/andrew/c/contrib/cemu/cemu-test/src/Cafe/HW/Latte/Renderer/Vulkan/VulkanRenderer.cpp:1703
#8 0x0000000000b3df54 in VulkanRenderer::draw_getOrCreateDescriptorSet (this=this@entry=0x1ca8dd0, pipeline_info=pipeline_info@entry=0x7ffe349d8710, shader=shader@entry=0x7ffe3495e9d0)
at /nix/store/sa7j7cddyblhcb3ch3ds10w7nw75yjj1-gcc-14.3.0/include/c++/14.3.0/bits/basic_string.h:227
#9 0x0000000000b3e8a3 in operator() (__closure=<synthetic pointer>, shader=0x7ffe3495e9d0) at /home/andrew/c/contrib/cemu/cemu-test/src/Cafe/HW/Latte/Renderer/Vulkan/VulkanRendererCore.cpp:1171
#10 VulkanRenderer::draw_prepareDescriptorSets (this=this@entry=0x1ca8dd0, pipeline_info=pipeline_info@entry=0x7ffe349d8710, vertexDS=@0x7ffe437fd2c8: 0x7ffe349da410, pixelDS=@0x7ffe437fd2d0: 0x0, geometryDS=@0x7ffe437fd2d8: 0x0)
at /home/andrew/c/contrib/cemu/cemu-test/src/Cafe/HW/Latte/Renderer/Vulkan/VulkanRendererCore.cpp:1177
#11 0x0000000000b3eef8 in VulkanRenderer::draw_execute
(this=0x1ca8dd0, baseVertex=0, baseInstance=0, instanceCount=1, count=231, indexDataMPTR=<optimized out>, indexType=Latte::LATTE_VGT_DMA_INDEX_TYPE::E_INDEX_TYPE::U16_BE, isFirst=true)
at /home/andrew/c/contrib/cemu/cemu-test/src/Cafe/HW/Latte/Renderer/Vulkan/VulkanRendererCore.cpp:1503
#12 0x0000000000aa1838 in DrawPassContext::executeDraw (this=0x7ffe437fd5f0, count=231, isAutoIndex=false, physIndices=1013427456) at /home/andrew/c/contrib/cemu/cemu-test/src/Cafe/HW/Latte/Core/LatteCommandProcessor.cpp:82
#13 LatteCP_itDrawIndex2 (cmd=0x7ffed89d1988, cmd@entry=0x7ffed89d1974, nWords=nWords@entry=5, drawPassCtx=...) at /home/andrew/c/contrib/cemu/cemu-test/src/Cafe/HW/Latte/Core/LatteCommandProcessor.cpp:684
#14 0x0000000000aa5fb8 in LatteCP_processCommandBuffer (drawPassCtx=...) at /home/andrew/c/contrib/cemu/cemu-test/src/Cafe/HW/Latte/Core/LatteCommandProcessor.cpp:1184
#15 0x0000000000aa621d in LatteCP_itIndirectBufferDepr (cmd=<optimized out>, cmd@entry=0x7ffe437fd740, nWords=nWords@entry=3) at /home/andrew/c/contrib/cemu/cemu-test/src/Cafe/HW/Latte/Core/LatteCommandProcessor.cpp:231
#16 0x0000000000aa66b7 in LatteCP_ProcessRingbuffer () at /home/andrew/c/contrib/cemu/cemu-test/src/Cafe/HW/Latte/Core/LatteCommandProcessor.cpp:1439
#17 0x00000000006ae9ed in Latte_ThreadEntry () at /home/andrew/c/contrib/cemu/cemu-test/src/Cafe/HW/Latte/Core/LatteThread.cpp:210
#18 0x00007ffff3eed064 in execute_native_thread_routine () at /nix/store/l7d6vwajpfvgsd3j4cr25imd1mzb7d1d-gcc-14.3.0-lib/lib/libstdc++.so.6
#19 0x00007ffff3a9af08 in start_thread () at /nix/store/q4wq65gl3r8fy746v9bbwgx4gzn0r2kl-glibc-2.40-66/lib/libc.so.6
#20 0x00007ffff3b230ac in __clone3 () at /nix/store/q4wq65gl3r8fy746v9bbwgx4gzn0r2kl-glibc-2.40-66/lib/libc.so.6
I did some more testing and it appears just increasing the COMBINED_IMAGE_SAMPLER count is enough to avoid the crash.
diff --git a/src/Cafe/HW/Latte/Renderer/Vulkan/VulkanRenderer.cpp b/src/Cafe/HW/Latte/Renderer/Vulkan/VulkanRenderer.cpp
index aed0db2..75c8017 100644
--- a/src/Cafe/HW/Latte/Renderer/Vulkan/VulkanRenderer.cpp
+++ b/src/Cafe/HW/Latte/Renderer/Vulkan/VulkanRenderer.cpp
@@ -3083,7 +3083,7 @@ void VulkanRenderer::CreateDescriptorPool()
{
std::array<VkDescriptorPoolSize, 4> poolSizes = {};
poolSizes[0].type = VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER;
- poolSizes[0].descriptorCount = 1024 * 128;
+ poolSizes[0].descriptorCount = 1024 * 512;
poolSizes[1].type = VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER;
poolSizes[1].descriptorCount = 1024 * 1;
poolSizes[2].type = VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER_DYNAMIC;
Descriptors=75875 TextureSamplers=451139 DynUniformBuffers=75859 StorageBuffers=0
This is the max allocations I was able to observe by running through the 2nd level as fast as possible, so I think it may still be possible to cause a crash with this change.
it might be better to put VK_EXT_descriptor_indexing to work here instead of just jacking up the descriptor counts. any changes with this?