gfx-rs / portability

Vulkan Portability Implementation
Mozilla Public License 2.0
384 stars 25 forks source link

Issue running VulkanCapsViewer for MacOS.. #152

Open oscarbg opened 6 years ago

oscarbg commented 6 years ago

Hi, Ok so last bug for today.. I compiled VulkanCapsViewer for MacOS as soon as MoltenVK was open sourced.. VulkanCapsViewer it's open source and in case you want to build from soruce I posted my dirty patch: https://github.com/SaschaWillems/VulkanCapsViewer/issues/45 My precompiled binary app (DOWNLOAD in follow up response) expects a vulkan.framework from MacOS SDK in: @rpath/vulkan.framework/Versions/A/vulkan which will load Vulkan lib pointed by /etc/vulkan icd file..

the program runs with MoltenVK dylib although an error is printed on console: [MoltenVK ERROR] VK_ERROR_INITIALIZATION_FAILED: On-screen rendering requires a view that is backed by a layer of type CAMetalLayer.

instead overwriting MoltenVK dylib with portability dylib RPCS3 binary I get: Segmentation fault: 11 and Apple crash info:

Thread 0 Crashed:: Dispatch queue: com.apple.main-thread
0   libMoltenVK.dylib               0x000000010ecfda9c _$LT$gfx_backend_metal..window..Surface$u20$as$u20$gfx_hal..window..Surface$LT$gfx_backend_metal..Backend$GT$$GT$::compatibility::h9adc9e34365a442d + 60
1   libMoltenVK.dylib               0x000000010ecd96e7 portability_gfx::impls::gfxGetPhysicalDeviceSurfaceCapabilitiesKHR::hb2bc2067a7206218 + 39
2   com.yourcompany.vulkanCapsViewer    0x00000001087a0897 VulkanSurfaceInfo::get(VkPhysicalDevice_T*, VkSurfaceKHR_T*) + 39
3   com.yourcompany.vulkanCapsViewer    0x0000000108775ffe vulkanCapsViewer::getGPUinfo(VulkanDeviceInfo*, unsigned int, VkPhysicalDevice_T*) + 222
4   com.yourcompany.vulkanCapsViewer    0x0000000108770c7f vulkanCapsViewer::getGPUs() + 655

with debug library it gets a little more info:

Thread 0 Crashed:: Dispatch queue: com.apple.main-thread
0   libMoltenVK.dylib               0x0000000114621b61 gfx_backend_metal::window::SurfaceInner::dimensions::hca7117889f67e362 + 241
1   libMoltenVK.dylib               0x0000000114621679 _$LT$gfx_backend_metal..window..Surface$u20$as$u20$gfx_hal..window..Surface$LT$gfx_backend_metal..Backend$GT$$GT$::compatibility::h4e7de1b478c806d3 + 89
2   libMoltenVK.dylib               0x00000001143b20ad portability_gfx::impls::gfxGetPhysicalDeviceSurfaceCapabilitiesKHR::hd6c9d48a647a1227 + 141
3   com.yourcompany.vulkanCapsViewer    0x000000010e824897 VulkanSurfaceInfo::get(VkPhysicalDevice_T*, VkSurfaceKHR_T*) + 39

maybe it's related to vulkaninfo bug of having no screen..

kvark commented 6 years ago

Yes, that sounds exactly like that bug I just fixed. Next portability release will carry it.

oscarbg commented 6 years ago

nice! just attaching binary in case you want to test by yourself: vulkanCapsViewerfixed.zip

kvark commented 6 years ago

Should be fixed in https://github.com/gfx-rs/portability/releases/tag/0.2

oscarbg commented 5 years ago

still crashing.. using 0.2 libportality_icd.dylib (no recompiled app just pointing libMoltenVK to that libportality_icd.dylib) shows:

thread '<unnamed>' panicked at 'window does not have a valid contentView', /Users/travis/.cargo/git/checkouts/gfx-e86e7f3ebdbc4218/e7b3ede/src/backend/metal/src/lib.rs:194:17
stack backtrace:
   0: std::sys::unix::backtrace::tracing::imp::unwind_backtrace
   1: std::sys_common::backtrace::print
   2: std::panicking::default_hook::{{closure}}
   3: std::panicking::default_hook
   4: std::panicking::rust_panic_with_hook
Abort trap: 6

using no icd libportality.dylib one

0   libMoltenVK.dylib               0x0000000115ff7f56 _$LT$gfx_backend_metal..window..Surface$u20$as$u20$gfx_hal..window..Surface$LT$gfx_backend_metal..Backend$GT$$GT$::compatibility::h559c58ea9674c5b5 + 118
1   libMoltenVK.dylib               0x0000000115fcb267 portability_gfx::impls::gfxGetPhysicalDeviceSurfaceCapabilitiesKHR::h09f20f7d0597600e + 39
2   com.yourcompany.vulkanCapsViewer    0x000000010fa2a897 VulkanSurfaceInfo::get(VkPhysicalDevice_T*, VkSurfaceKHR_T*) + 39
3   com.yourcompany.vulkanCapsViewer    0x000000010f9ffffe vulkanCapsViewer::getGPUinfo(VulkanDeviceInfo*, unsigned int, VkPhysicalDevice_T*) + 222
4   com.yourcompany.vulkanCapsViewer    0x000000010f9fac7f vulkanCapsViewer::getGPUs() + 655
5   com.yourcompany.vulkanCapsViewer    0x000000010f9f4465 vulkanCapsViewer::vulkanCapsViewer(QWidget*) + 1989
6   com.yourcompany.vulkanCapsViewer    0x000000010f9eff43 main + 1619
7   libdyld.dylib                   0x00007fff649c8085 start + 1

iMac:lib oscar$ /Users/oscar/Downloads/vulkanCapsViewerfixed.app/Contents/MacOS/vulkanCapsViewer 
libpng warning: iCCP: known incorrect sRGB profile
libpng warning: iCCP: known incorrect sRGB profile
libpng warning: iCCP: known incorrect sRGB profile
libpng warning: iCCP: known incorrect sRGB profile
libpng warning: iCCP: known incorrect sRGB profile
libpng warning: iCCP: known incorrect sRGB profile
libpng warning: iCCP: known incorrect sRGB profile
libpng warning: iCCP: known incorrect sRGB profile
Segmentation fault: 11
kvark commented 5 years ago

Where did you get the libportability_icd.dylib?

On Sep 16, 2018, at 09:33, Oscar Barenys notifications@github.com wrote:

still crashing.. using libportality_icd.dylib (no recompiled app just pointing libMoltenVK to that libportality_icd.dylib) shows:

thread '' panicked at 'window does not have a valid contentView', /Users/travis/.cargo/git/checkouts/gfx-e86e7f3ebdbc4218/e7b3ede/src/backend/metal/src/lib.rs:194:17 stack backtrace: 0: std::sys::unix::backtrace::tracing::imp::unwind_backtrace 1: std::sys_common::backtrace::print 2: std::panicking::default_hook::{{closure}} 3: std::panicking::default_hook 4: std::panicking::rust_panic_with_hook Abort trap: 6 using no icd one seems

0 libMoltenVK.dylib 0x0000000115ff7f56 _$LT$gfx_backend_metal..window..Surface$u20$as$u20$gfx_hal..window..Surface$LT$gfx_backend_metal..Backend$GT$$GT$::compatibility::h559c58ea9674c5b5 + 118 1 libMoltenVK.dylib 0x0000000115fcb267 portability_gfx::impls::gfxGetPhysicalDeviceSurfaceCapabilitiesKHR::h09f20f7d0597600e + 39 2 com.yourcompany.vulkanCapsViewer 0x000000010fa2a897 VulkanSurfaceInfo::get(VkPhysicalDevice_T, VkSurfaceKHR_T) + 39 3 com.yourcompany.vulkanCapsViewer 0x000000010f9ffffe vulkanCapsViewer::getGPUinfo(VulkanDeviceInfo, unsigned int, VkPhysicalDevice_T) + 222 4 com.yourcompany.vulkanCapsViewer 0x000000010f9fac7f vulkanCapsViewer::getGPUs() + 655 5 com.yourcompany.vulkanCapsViewer 0x000000010f9f4465 vulkanCapsViewer::vulkanCapsViewer(QWidget*) + 1989 6 com.yourcompany.vulkanCapsViewer 0x000000010f9eff43 main + 1619 7 libdyld.dylib 0x00007fff649c8085 start + 1

iMac:lib oscar$ /Users/oscar/Downloads/vulkanCapsViewerfixed.app/Contents/MacOS/vulkanCapsViewer libpng warning: iCCP: known incorrect sRGB profile libpng warning: iCCP: known incorrect sRGB profile libpng warning: iCCP: known incorrect sRGB profile libpng warning: iCCP: known incorrect sRGB profile libpng warning: iCCP: known incorrect sRGB profile libpng warning: iCCP: known incorrect sRGB profile libpng warning: iCCP: known incorrect sRGB profile libpng warning: iCCP: known incorrect sRGB profile Segmentation fault: 11 — You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHub, or mute the thread.

oscarbg commented 5 years ago

from here: https://github.com/gfx-rs/portability/releases/download/0.2/gfx-portability-macos-0.2.zip

kvark commented 5 years ago

Reopening until I double check what's going on. Thanks for raising the issue again!

kvark commented 5 years ago

Holy smokes. I just realized that there is no upstream support of MacOS, and the custom patch isn't directly applicable (and not expressed as a PR in the first place). And after all, the project can only be built with Qt Creator IDE. uh, that's quite a few steps! @oscarbg would you mind sharing a debug build of this program for me to play with?

oscarbg commented 5 years ago

yep.. deleted all qt sdk stuff around 10gb as I was on space limited SSD.. seems I only have the build I shared.. perhaps will do a new (debug) rebuild when have some time..