mirror of
https://github.com/outbackdingo/UltraGrid.git
synced 2026-03-21 08:40:19 +00:00
57 lines
1.8 KiB
Diff
57 lines
1.8 KiB
Diff
From 5f42640150f6b46e46c6908e02ebed88e4c8b331 Mon Sep 17 00:00:00 2001
|
|
From: Martin Pulec <martin.pulec@cesnet.cz>
|
|
Date: Fri, 22 Apr 2022 09:21:27 +0200
|
|
Subject: [PATCH] mac: set use 16-bit depth framebuffer
|
|
|
|
Use 16-bit depth framebuffer to allow rendering of higher bit-depth color spaces.
|
|
|
|
Using the code from this page:
|
|
https://www.zephray.me/post/edr_hdr_on_macos_opengl/
|
|
---
|
|
src/nsgl_context.m | 29 ++++++++++++++++++++---------
|
|
1 file changed, 20 insertions(+), 9 deletions(-)
|
|
|
|
diff --git a/src/nsgl_context.m b/src/nsgl_context.m
|
|
index fc1f7521..536d0b71 100644
|
|
--- a/src/nsgl_context.m
|
|
+++ b/src/nsgl_context.m
|
|
@@ -246,15 +246,26 @@ GLFWbool _glfwCreateContextNSGL(_GLFWwindow* window,
|
|
fbconfig->greenBits != GLFW_DONT_CARE &&
|
|
fbconfig->blueBits != GLFW_DONT_CARE)
|
|
{
|
|
- int colorBits = fbconfig->redBits +
|
|
- fbconfig->greenBits +
|
|
- fbconfig->blueBits;
|
|
-
|
|
- // macOS needs non-zero color size, so set reasonable values
|
|
- if (colorBits == 0)
|
|
- colorBits = 24;
|
|
- else if (colorBits < 15)
|
|
- colorBits = 15;
|
|
+ int colorBits;
|
|
+
|
|
+ if (fbconfig->redBits > 8 ||
|
|
+ fbconfig->greenBits > 8 ||
|
|
+ fbconfig->blueBits > 8)
|
|
+ {
|
|
+ colorBits = 64;
|
|
+ ADD_ATTRIB(NSOpenGLPFAColorFloat);
|
|
+ }
|
|
+ else {
|
|
+ colorBits = fbconfig->redBits +
|
|
+ fbconfig->greenBits +
|
|
+ fbconfig->blueBits;
|
|
+
|
|
+ // macOS needs non-zero color size, so set reasonable values
|
|
+ if (colorBits == 0)
|
|
+ colorBits = 24;
|
|
+ else if (colorBits < 15)
|
|
+ colorBits = 15;
|
|
+ }
|
|
|
|
SET_ATTRIB(NSOpenGLPFAColorSize, colorBits);
|
|
}
|
|
--
|
|
2.32.0 (Apple Git-132)
|
|
|