Silk.NET
Silk.NET copied to clipboard
"Tutorial 2.2 - Camera" don't work on macos
Summary
"Tutorial 2.2 - Camera" works as expected on Windows, but it seems to have a depth detection problem on my Mac.
Steps to reproduce
- Platform: Desktop
- Framework Version: .NET 8
- API: OpenGL
- API Version: OpenGL Version: 4.1 Metal - 88
- Just run "Tutorial 2.2 - Camera" on Mac
Comments
I am testing in an Apple M1 Pro macOS: Sonoma 14.2.1
Looks like the PreferredDepthBufferBits aren’t set.
I manually set it with
options.PreferredDepthBufferBits = 24;
before the window.create with no change in behaviour. also, why is this not needed for Windows but would be needed for Mac?
Oh, in which case I’ll put this down to Apple’s terrible OpenGL support. PreferredDepthBufferBits being null means that the depth buffer is in an entirely undefined state, which in my experience leads NVIDIA to set up a sensible depth buffer but AMD and other implementations tend to interpret this as “oh well we don’t need a depth buffer then”.
I wonder if the depth function is inversed. OpenGL is probably in a weird state. (I know mac doesnt play nice from what I've seen in PPSSPP)
Looks like the PreferredDepthBufferBits aren’t set.
I had the same problem on linux and this solved it. Thanks!!!
Can confirm this also happened on MacOS M1 Pro. PreferredDepthBufferBits had to be set. Maybe the example should include the, or have some sort of comment regarding this weird behaviour.
Can confirm this appears for Windows 11 Pro 22631.3296 with Silk.NET 2.20.0 Tutorial 2.1 Coordinate system
GPU is integrated AMD Radeon, CPU is Ryzen 5 5500U
Also on Windows 10 Pro 19045.4046 (GPU integrated AMD Ryzen 7 4700U) Also on Manjaro Linux x86_64 (GPU: Intel CometLake-H GT2 [UHD Graphics])
The problem is global
This fixes:
var windowOptions = WindowOptions.Default with
{
// ...
PreferredDepthBufferBits = 24,
};
In response to user feedback we've changed the default behaviour to always use 24/8 if both preference properties are null (as they are by default), see #1991