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

macOS samples don't display 3D content #17

Open
danipen opened this issue Jul 31, 2024 · 5 comments
Open

macOS samples don't display 3D content #17

danipen opened this issue Jul 31, 2024 · 5 comments

Comments

@danipen
Copy link

danipen commented Jul 31, 2024

I tried to execute the sample in solution Ab4d.SharpEngine.Samples.AvaloniaUI.macos.sln, but I get blank content:

Screen.Recording.2024-07-31.at.09.40.26.mov
@abenedik
Copy link
Member

abenedik commented Aug 2, 2024

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
});

@danipen
Copy link
Author

danipen commented Aug 2, 2024

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 ♔)

@abenedik
Copy link
Member

abenedik commented Aug 3, 2024

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.

@danipen
Copy link
Author

danipen commented Aug 3, 2024

I'm using macOS Sonoma 14.5 (23F79), 2,4 GHz 8-Core Intel Core i9, AMD Radeon Pro 5500M 8 GB.

@abenedik
Copy link
Member

abenedik commented Oct 3, 2024

@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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants