Silk.NET icon indicating copy to clipboard operation
Silk.NET copied to clipboard

"Tutorial 2.2 - Camera" don't work on macos

Open thenuts opened this issue 1 year ago • 5 comments

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
  1. Just run "Tutorial 2.2 - Camera" on Mac

Comments

I am testing in an Apple M1 Pro macOS: Sonoma 14.2.1

Screenshot 2023-12-27 at 12 16 49

thenuts avatar Dec 27 '23 20:12 thenuts

Looks like the PreferredDepthBufferBits aren’t set.

Perksey avatar Dec 27 '23 20:12 Perksey

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?

thenuts avatar Dec 27 '23 20:12 thenuts

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

Perksey avatar Dec 27 '23 20:12 Perksey

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)

tilkinsc avatar Dec 27 '23 22:12 tilkinsc

Looks like the PreferredDepthBufferBits aren’t set.

I had the same problem on linux and this solved it. Thanks!!!

MichaelMay81 avatar Feb 14 '24 18:02 MichaelMay81

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.

WoozChucky avatar Feb 25 '24 23:02 WoozChucky

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

image

tvardero avatar Mar 14 '24 12:03 tvardero

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

tvardero avatar Mar 14 '24 12:03 tvardero

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

Perksey avatar Mar 20 '24 19:03 Perksey