Open danipen opened 4 months ago
Could you please check if you get any warning or error log messages. The sample by default logs all warnings and error to Output window (Utilities.Log.LogLevel = LogLevels.Warn; Utilities.Log.IsLoggingToDebugOutput = true;
). You can also subscribe to events by:
Utilities.Log.AddLogListener((logLevel, logMessage) =>
{
// put breakpoin here
});
Yes, I can see a couple of warnings and an error in the log:
First one:
Ab4d.SharpEngine Warn: 0|0.003000|WARN|0|Ab4d.SharpEngine.Vulkan.VulkanInstance|1| Standard validation layers were requested when creating VulkanInstance, but they are not available on the system, probably because Vulkan SDK is not installed or enabled.||
Second one:
Ab4d.SharpEngine Warn: 0|4626.407000|WARN|0|Ab4d.SharpEngine.Vulkan.VulkanDevice|1|Creating a new VulkanDevice with EnableStandardValidation set to true, but the VulkanInstance that was created before was created without enabled standard validation so this cannot be enabled for the new VulkanDevice. Please update the creation of VulkanInstance (first VulkanDevice) so that validation support is enabled||
The error:
Ab4d.SharpEngine Error: 0|4629.737000|ERROR|25|Ab4d.SharpEngine.AvaloniaUI.SharpEngineSceneView|1|Failed to initialize Scene: No compatible memory type for typeFiler: 7 and flags: DeviceLocal, HostVisible, HostCoherent; Available types: 0: DeviceLocal; 1: HostVisible, HostCoherent, HostCached; 0: DeviceLocal, HostVisible, HostCached|SharpEngineException: No compatible memory type for typeFiler: 7 and flags: DeviceLocal, HostVisible, HostCoherent; Available types: 0: DeviceLocal; 1: HostVisible, HostCoherent, HostCached; 0: DeviceLocal, HostVisible, HostCached;
at Ab4d.SharpEngine.Vulkan.PhysicalDeviceDetails.FindMemoryType(UInt32 typeFilter, MemoryPropertyFlags flags, Boolean requireExactMemoryType, Boolean throwExceptionWhenNotFound)
at Ab4d.SharpEngine.Utilities.VulkanMemoryAllocator.AllocateMemory(MemoryRequirements memoryRequirements, MemoryPropertyFlags memoryProperties, Boolean isImage, Boolean isDedicatedAllocation, String name)
at Ab4d.SharpEngine.Utilities.VulkanMemoryAllocator.AllocateMemory(Buffer buffer, MemoryPropertyFlags memoryProperties, Boolean isDedicatedAllocation, String name)
at Ab4d.SharpEngine.Vulkan.VulkanDevice.AllocateMemory(Buffer buffer, MemoryPropertyFlags memoryProperties, Boolean isDedicatedAllocation, String name)
at Ab4d.SharpEngine.Core.GpuBuffer.♔(BufferCreateInfo ♔, MemoryPropertyFlags ♔, Boolean ♔)
at Ab4d.SharpEngine.Core.GpuBuffer..ctor(VulkanDevice vulkanDevice, BufferCreateInfo bufferCreateInfo, MemoryPropertyFlags memoryProperties, Type itemType, Int32 itemsCount, Boolean isPersistentlyMapped, Boolean isDedicatedAllocation, String name)
at Ab4d.SharpEngine.Vulkan.VulkanDevice.CreateBuffers(Int32 bufferSize, Int32 buffersCount, BufferUsageFlags bufferUsage, Type itemType, Int32 itemsCount, Boolean canUseDeviceLocalHostVisibleMemory, String name)
at Ab4d.SharpEngine.Vulkan.VulkanDevice.CreateUniformBuffers(Int32 bufferSize, Int32 buffersCount, Type uniformBufferType, String name)
at Ab4d.SharpEngine.Scene.♚(VulkanDevice ♔)
at Ab4d.SharpEngine.Scene.♔(VulkanDevice ♔)
at Ab4d.SharpEngine.Scene.Initialize(VulkanDevice vulkanDevice)
at Ab4d.SharpEngine.AvaloniaUI.SharpEngineSceneView.♖♔(Boolean ♔, Boolean ♔, VulkanSurfaceProvider ♔)
Thank you for sharing the log messages.
The first two are not problematic - the samples by defalt try to use standard validation layers, but if they are not supported on the system, then a warning is written.
But the error message describes the cause of the problem: it seems that you device does not have a memory type that would be DeviceLocal, HostVisible, HostCoherent. The closest match is DeviceLocal, HostVisible, HostCached. But because this memory type is not HostCoherent, SharpEngine would need to manually flush the memory. It seems that you have a different mac hardware that I used for testing so this was not expected and is currently not supported.
Because of vacations it is currently not possible to fix that. I will try to improve the SharpeEngine in the second half of Avgust.
I'm using macOS Sonoma 14.5 (23F79), 2,4 GHz 8-Core Intel Core i9, AMD Radeon Pro 5500M 8 GB.
@danipen, could you please try again by using version 2.1.9028-beta1, which is available from NuGet? This version adds support for devices that use non-coherent memory and this should fix your problems.
I tried to execute the sample in solution Ab4d.SharpEngine.Samples.AvaloniaUI.macos.sln, but I get blank content:
https://github.com/user-attachments/assets/98ba4f89-6c0a-4550-bc6a-cc207b797f2e