-
Notifications
You must be signed in to change notification settings - Fork 261
Add Display P3 color space support for macOS #719
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
base: dev
Are you sure you want to change the base?
Conversation
|
Fixes #198 for me |
|
It’s working for me |
|
@xCollateral is it possible? |
- refactor init
|
@BloCamLimb so its absolute incorrect to make? |
|
I don't think this PR actually fixes the root cause; in fact, it's essentially replicating a known color management flaw. The "vibrancy" experienced in the OpenGL version (Vanilla/Sodium) is a side effect of a long-standing GLFW bug glfw/glfw#2748 (or rather, a lack of implementation) where it fails to call The "muted" look in Vulkan is actually the correct, calibrated behavior. The system is properly remapping sRGB values to the P3 display so that a red in your app looks like the intended red, not an over-saturated version of it. By simply switching the Swapchain to P3 without adding a proper color space conversion pass in the shader, this PR is just matching one mistake with another. You're interpreting sRGB data as P3 coordinates, which is mathematically incorrect and breaks platform consistency. The implications of merging this:
If the goal is to truly support the P3 Wide Gamut, we shouldn't just toggle the Swapchain. A real wide-gamut implementation requires a much deeper architectural shift:
Without these steps, we aren't "supporting" P3; we're just abusing the wide gamut to mask an sRGB calibration issue. I suggest we revert this (since this is already cherry-picked) and stick to a standard sRGB workflow until we are ready to implement a full-pipeline wide-gamut solution.
Yes |
|
@BloCamLimb Thx for comment |
|
@BloCamLimb But i stull think some people playing vanilla with broken colors and just used to it. For the same reason, I didn't notice the incorrect colors and ended up repeating the mistake. |
|
@TNTpower0v0 This issue should be reported to Mojang. If they don't address this legacy behavior, players will continue to mistake broken (stretched) colors for "correct" ones. This is quite easy to fix in OpenGL side, adding these few lines of code during window initialization NSWindow *window = (NSWindow *) glfwGetCocoaWindow(glfwWindow);
[window setColorSpace:[NSColorSpace sRGBColorSpace]];long windowPtr = GLFWNativeCocoa.glfwGetCocoaWindow(glfwWindow);
NSObject window = new NSObject(new Pointer(windowPtr));
Client client = Client.getInstance();
Object srgbSpace = client.sendProxy("NSColorSpace", "class").sendProxy("sRGBColorSpace");
window.send("setColorSpace:", srgbSpace); |
|
Thanks for finding the root cause that's very interesting. I'm in favor of merging this PR anyway to match vanilla behavior because that's the way the game has looked on Mac for years, and the one users have come to expect. Plus if the glfw issue gets fixed in the future then VulkanMod can easily revert and match. Full P3 support is a different issue that I personally don't care about until after VulkanMod support custom shaders (I believe Iris has this). |
|
I agree with @BloCamLimb, the game is meant to be rendered in sRBG color space, mapping the output as is to P3 isn't a correct solution. Anyway this PR was meant to reproduce vanilla behavior, which macOS users have come to expect. I don't think that forcing P3 is correct, the only workaround for now might be to let users choice which color space they want to use. |
Hi! I did this with the help of AI, but I wrote the code myself. Everything is working well on MacOS, and my friend with Windows and Linux has also confirmed normal colors.
GLFW_COCOA_RETINA_FRAMEBUFFERto guarantee native resolution rendering on Retina displays