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

Dynamically checking display depth for Mac client #1542

Conversation

colincornaby
Copy link
Contributor

@Hoikas - This is a possible optimization for older GPUs.

I'm not happy about the approach - the way this is implemented is promoting the color depth of the entire window instead of just the Metal output. I'd like to figure out if there is a better way to do this - so I'm leaving this as a draft until the implementation and the potential improvements are better understood.

Comment on lines +299 to +318
if (window)
{
NSDictionary<NSDeviceDescriptionKey, id> *windowProperties = [window deviceDescription];
NSUInteger bitsPerPixel = [windowProperties[NSDeviceBitsPerSample] unsignedIntValue];
#if PLASMA_PIPELINE_METAL
if (bitsPerPixel <=8)
{
if (self.metalLayer.pixelFormat != MTLPixelFormatBGRA8Unorm)
{
self.metalLayer.pixelFormat = MTLPixelFormatBGRA8Unorm;
}
} else {
if (self.metalLayer.pixelFormat != MTLPixelFormatBGR10A2Unorm)
{
self.metalLayer.pixelFormat = MTLPixelFormatBGR10A2Unorm;
}
}
#endif
}
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this the correct brace newline style?

@colincornaby
Copy link
Contributor Author

I'm going to close this. I've seen some Apple samples even default to 16 bit color without checking the monitor modes. So I don't think this is a serious performance concern.

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

Successfully merging this pull request may close these issues.

2 participants