FNA-XNA / FNA3D

FNA3D - 3D Graphics Library for FNA
http://fna-xna.github.io/
Other
287 stars 48 forks source link

FNA3D_FORCE_DRIVER=Vulkan does not draw anything on MacOS and causes crash on Windows when using prebuilt binary #205

Open chutneyio opened 4 months ago

chutneyio commented 4 months ago

This happened last month after I updated FNA to latest version from https://fna.flibitijibibo.com/archive/fnalibs.tar.bz2

On MacOS (Macbook Pro 2018 Sonoma), setting driver to Vulkan does not draw anything result in a black window

On Windows (HP Envy 13, Windows 11), setting driver to Vulkan causes the game crashes after launch:

Validation layers not found, continuing without validation
VULKAN DEBUG: Checking for Driver Manifest files in Registry at SOFTWARE\Khronos\Vulkan\ImplicitLayers
VULKAN DEBUG: windows_get_device_registry_files: opening device PCI\VEN_8086&DEV_9B41&SUBSYS_86AD103C&REV_02\3&11583659&0&10
VULKAN DEBUG: windows_get_device_registry_entry: Device ID(41) Does not contain a value for "VulkanImplicitLayers"
VULKAN DEBUG: windows_get_device_registry_files: Opening child device 141 - SWD\DRIVERENUM\CUI&4&FE5641B&2
VULKAN DEBUG: windows_get_device_registry_entry: Device ID(141) Does not contain a value for "VulkanImplicitLayers"
VULKAN DEBUG: windows_get_device_registry_files: Opening child device 105 - SWD\DRIVERENUM\IGCC&4&FE5641B&2
VULKAN DEBUG: windows_get_device_registry_entry: Device ID(105) Does not contain a value for "VulkanImplicitLayers"
VULKAN DEBUG: windows_get_device_registry_files: Opening child device 128 - DISPLAY\AUO552D\4&FE5641B&2&UID265988
VULKAN DEBUG: windows_get_device_registry_files: GUID for 128 is not SoftwareComponent skipping
VULKAN DEBUG: Located json file "C:\Program Files (x86)\Steam\SteamOverlayVulkanLayer64.json" from registry "HKEY_LOCAL_MACHINE\SOFTWARE\Khronos\Vulkan\ImplicitLayers"
VULKAN DEBUG: Located json file "C:\Program Files (x86)\Steam\SteamFossilizeVulkanLayer64.json" from registry "HKEY_LOCAL_MACHINE\SOFTWARE\Khronos\Vulkan\ImplicitLayers"
VULKAN DEBUG: Found manifest file C:\Program Files (x86)\Steam\SteamOverlayVulkanLayer64.json (file version "1.0.0")
VULKAN DEBUG: Found manifest file C:\Program Files (x86)\Steam\SteamFossilizeVulkanLayer64.json (file version "1.0.0")
VULKAN DEBUG: Checking for Driver Manifest files in Registry at SOFTWARE\Khronos\Vulkan\ExplicitLayers
VULKAN DEBUG: windows_get_device_registry_files: opening device PCI\VEN_8086&DEV_9B41&SUBSYS_86AD103C&REV_02\3&11583659&0&10
VULKAN DEBUG: windows_get_device_registry_entry: Device ID(41) Does not contain a value for "VulkanExplicitLayers"
VULKAN DEBUG: windows_get_device_registry_files: Opening child device 141 - SWD\DRIVERENUM\CUI&4&FE5641B&2
VULKAN DEBUG: windows_get_device_registry_entry: Device ID(141) Does not contain a value for "VulkanExplicitLayers"
VULKAN DEBUG: windows_get_device_registry_files: Opening child device 105 - SWD\DRIVERENUM\IGCC&4&FE5641B&2
VULKAN DEBUG: windows_get_device_registry_entry: Device ID(105) Does not contain a value for "VulkanExplicitLayers"
VULKAN DEBUG: windows_get_device_registry_files: Opening child device 128 - DISPLAY\AUO552D\4&FE5641B&2&UID265988
VULKAN DEBUG: windows_get_device_registry_files: GUID for 128 is not SoftwareComponent skipping
VULKAN DEBUG: windows_read_data_files_in_registry: Registry lookup failed to get layer manifest files.
VULKAN DEBUG: Checking for Driver Manifest files in Registry at SOFTWARE\Khronos\Vulkan\Drivers
VULKAN DEBUG: windows_add_json_entry: Located json file "C:\Windows\System32\DriverStore\FileRepository\iigd_dch.inf_amd64_87a05f372b04db63\igvk64.json" from PnP registry: E       
VULKAN DEBUG: Found ICD manifest file C:\Windows\System32\DriverStore\FileRepository\iigd_dch.inf_amd64_87a05f372b04db63\igvk64.json, version "1.0.0"
VULKAN DEBUG: Searching for ICD drivers named .\igvk64.dll
VULKAN DEBUG: Build ICD instance extension list
VULKAN DEBUG: Instance Extension: VK_KHR_surface (C:\Windows\System32\DriverStore\FileRepository\iigd_dch.inf_amd64_87a05f372b04db63\.\igvk64.dll) version 0.0.25
VULKAN DEBUG: Instance Extension: VK_KHR_win32_surface (C:\Windows\System32\DriverStore\FileRepository\iigd_dch.inf_amd64_87a05f372b04db63\.\igvk64.dll) version 0.0.5
VULKAN DEBUG: Instance Extension: VK_KHR_external_memory_capabilities (C:\Windows\System32\DriverStore\FileRepository\iigd_dch.inf_amd64_87a05f372b04db63\.\igvk64.dll) version 0.0.1
VULKAN DEBUG: Instance Extension: VK_KHR_external_semaphore_capabilities (C:\Windows\System32\DriverStore\FileRepository\iigd_dch.inf_amd64_87a05f372b04db63\.\igvk64.dll) version 0.0.1
VULKAN DEBUG: Instance Extension: VK_KHR_external_fence_capabilities (C:\Windows\System32\DriverStore\FileRepository\iigd_dch.inf_amd64_87a05f372b04db63\.\igvk64.dll) version 0.0.1
VULKAN DEBUG: Instance Extension: VK_KHR_get_physical_device_properties2 (C:\Windows\System32\DriverStore\FileRepository\iigd_dch.inf_amd64_87a05f372b04db63\.\igvk64.dll) version 0.0.2
VULKAN DEBUG: Instance Extension: VK_KHR_get_surface_capabilities2 (C:\Windows\System32\DriverStore\FileRepository\iigd_dch.inf_amd64_87a05f372b04db63\.\igvk64.dll) version 0.0.1  
VULKAN DEBUG: Instance Extension: VK_KHR_device_group_creation (C:\Windows\System32\DriverStore\FileRepository\iigd_dch.inf_amd64_87a05f372b04db63\.\igvk64.dll) version 0.0.1      
VULKAN DEBUG: Instance Extension: VK_EXT_swapchain_colorspace (C:\Windows\System32\DriverStore\FileRepository\iigd_dch.inf_amd64_87a05f372b04db63\.\igvk64.dll) version 0.0.3       
VULKAN DEBUG: Build ICD instance extension list
VULKAN DEBUG: Instance Extension: VK_KHR_surface (C:\Windows\System32\DriverStore\FileRepository\iigd_dch.inf_amd64_87a05f372b04db63\.\igvk64.dll) version 0.0.25
VULKAN DEBUG: Instance Extension: VK_KHR_win32_surface (C:\Windows\System32\DriverStore\FileRepository\iigd_dch.inf_amd64_87a05f372b04db63\.\igvk64.dll) version 0.0.5
VULKAN DEBUG: Instance Extension: VK_KHR_external_memory_capabilities (C:\Windows\System32\DriverStore\FileRepository\iigd_dch.inf_amd64_87a05f372b04db63\.\igvk64.dll) version 0.0.1
VULKAN DEBUG: Instance Extension: VK_KHR_external_semaphore_capabilities (C:\Windows\System32\DriverStore\FileRepository\iigd_dch.inf_amd64_87a05f372b04db63\.\igvk64.dll) version 0.0.1
VULKAN DEBUG: Instance Extension: VK_KHR_external_fence_capabilities (C:\Windows\System32\DriverStore\FileRepository\iigd_dch.inf_amd64_87a05f372b04db63\.\igvk64.dll) version 0.0.1
VULKAN DEBUG: Instance Extension: VK_KHR_get_physical_device_properties2 (C:\Windows\System32\DriverStore\FileRepository\iigd_dch.inf_amd64_87a05f372b04db63\.\igvk64.dll) version 0.0.2
VULKAN DEBUG: Instance Extension: VK_KHR_get_surface_capabilities2 (C:\Windows\System32\DriverStore\FileRepository\iigd_dch.inf_amd64_87a05f372b04db63\.\igvk64.dll) version 0.0.1  
VULKAN DEBUG: Instance Extension: VK_KHR_device_group_creation (C:\Windows\System32\DriverStore\FileRepository\iigd_dch.inf_amd64_87a05f372b04db63\.\igvk64.dll) version 0.0.1      
VULKAN DEBUG: Instance Extension: VK_EXT_swapchain_colorspace (C:\Windows\System32\DriverStore\FileRepository\iigd_dch.inf_amd64_87a05f372b04db63\.\igvk64.dll) version 0.0.3       
FNA3D Driver: Vulkan
Vulkan Device: Intel(R) UHD Graphics
Vulkan Driver: Intel Corporation Intel driver
Vulkan Conformance: 1.2.2
Fatal error. System.AccessViolationException: Attempted to read or write protected memory. This is often an indication that other memory is corrupt.
Repeat 2 times:
--------------------------------
at Microsoft.Xna.Framework.Graphics.FNA3D.FNA3D_DrawIndexedPrimitives(IntPtr, Microsoft.Xna.Framework.Graphics.PrimitiveType, Int32, Int32, Int32, Int32, Int32, IntPtr, Microsoft.Xna.Framework.Graphics.IndexElementSize)
--------------------------------
at Microsoft.Xna.Framework.Graphics.GraphicsDevice.DrawIndexedPrimitives(Microsoft.Xna.Framework.Graphics.PrimitiveType, Int32, Int32, Int32, Int32, Int32)
at Microsoft.Xna.Framework.Graphics.SpriteBatch.DrawPrimitives(Microsoft.Xna.Framework.Graphics.Texture, Int32, Int32)
at Microsoft.Xna.Framework.Graphics.SpriteBatch.FlushBatch()
at Microsoft.Xna.Framework.Graphics.SpriteBatch.End()
at ConsoleApp1.Game1.Draw(Microsoft.Xna.Framework.GameTime)
at Microsoft.Xna.Framework.Game.Tick()
at Microsoft.Xna.Framework.Game.RunLoop()
at Microsoft.Xna.Framework.Game.Run()
at Program.Main(System.String[])

Process finished with exit code -1,073,741,819.

It worked fine with OpenGL & D3D11

Reproduce project: https://gitlab.com/chutneyy/mygame

chutneyio commented 4 months ago

I build FNA3D and got it working. But when using prebuilt binary from https://fna.flibitijibibo.com/archive/fnalibs.tar.bz2 then the error occured again.

flibitijibibo commented 4 months ago

I'll try to rebuild fnalibs soon, but be warned: The Vulkan renderer is getting deprecated in 24.08, so I wouldn't worry too much about this - SDL_GPU will be replacing it: #201

chutneyio commented 4 months ago

It is so confusing that after deleting the bin folder It stopped working again, even with older FNA3D build. Maybe some issue on my machine so don't worry too much about this. Keep up your good work on SDL_gpu then. Update: This build works for me: https://github.com/kiddkaffeine/fnalibs

flibitijibibo commented 2 months ago

The most recent SPIR-V work has desync'd from FNA3D Vulkan's expectation for descriptor layouts - I think it just needs to skip the descriptors that refer to empty sampler/uniform layouts. Until that's fixed the Vulkan renderer probably won't start up again.