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 software renderer wrong depth_size reported? #1659

Open
alexheretic opened this issue Dec 22, 2023 · 8 comments
Open

Macos software renderer wrong depth_size reported? #1659

alexheretic opened this issue Dec 22, 2023 · 8 comments
Labels

Comments

@alexheretic
Copy link
Contributor

My config selection logic is not working on macos. I expect depth=24, stencil=8, however in my macos vm (software renderer) I see depth size as 32, which seems wrong.

// macos vm the only Config
config.depth_size() = 32
config.stencil_size() = 8

Can you tell me if this something that can be fixed in glutin or shall I work around it?

@kchibisov
Copy link
Member

We get the values from the macOS itself and the config you request is a suggestion, and macos basically replies based on that suggestion.

It decided that you don't have a config with the depth 24, while you could try manually playing with glutin config requests and see whether it's possible to get something different, I'm not sure we can do anything to prevent it, because of how macOS works and that it exposes only a single config at a time, so you basically try to create them until it kind of works...

Maybe there's a better way to deal with that which and I'm just not familiar with it.

@kchibisov kchibisov added the CGL label Dec 22, 2023
@alexheretic
Copy link
Contributor Author

There is only one Config to use in this environment :(. I shall work around it then, thanks for the quick response!

@kchibisov
Copy link
Member

I mean, maybe there're more, we can't get more than one at the time no macOS because that's how macOS works....

@MarijnS95
Copy link
Member

MarijnS95 commented Dec 23, 2023

Re requesting 32 in the config and getting a config with 24, ""shouldn't"" it error that no compatible config is found?

A similar thing happened on Android; I have a native window/surface with RGB565, no alpha. Put that in the EGL ColorBufferType::Rgb{} config, but it still returns all configs, including 8-bit and 10-bit formats :(

(Filtering does work when specifying one of the 10-bit or 8-bit formats...)

@kchibisov
Copy link
Member

The way config matching works is that it sorts + filters config based on what you passed (if you read the EGL/GLX/WGL) spec.

I intentionally decided that we should just do what spec is doing and it's documented that it gives you at least. Maybe we should have an option for matcher to alter the behavior, but I don't think that starting to filter is a good idea without adding option.

@MarijnS95
Copy link
Member

and it's documented that it gives you at least

Ah you are right, for some attributes it gives you configs that are equal or higher (at least on EGL). Not sure how the sorting works, for RGB set to 8 and depth set to 0 I get the 10-bit configs first followed by 8-bit configs, but when setting RGB to 0 too I get 565 and 444 RGB formats before some 888 and 101010 formats intertwined

Not saying that we should change glutin for this, letting the user filter is fine, though we might provide Ord helpers in some places to make it more trivial?

@kchibisov
Copy link
Member

Not saying that we should change glutin for this, letting the user filter is fine, though we might provide Ord helpers in some places to make it more trivial?

Geneeral Ord could be opinionated, but for individual types it's probably fine. Though, I'm not sure how you'd sort e.g. rgb components, by sum? There's also luminance, etc.

@MarijnS95
Copy link
Member

Exactly, RGB is nontrivial though it could be implemented with PartialOrd (i.e. return None when comparing Rgb to Luminance, or if there is an unlikely case where one component is higher and the other is lower. Most formats are 444, 555, 565, 888 or 101010 though).

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

No branches or pull requests

3 participants