-
-
Notifications
You must be signed in to change notification settings - Fork 67
Add support for EGL_EXT_gl_colorspace_bt2020_pq #18
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: master
Are you sure you want to change the base?
Changes from 4 commits
1a36e40
684d67b
f0fe6f8
c5334b4
f5d8be7
4f44fe1
c9b9642
b9a86f9
3503d77
247bf59
075dbc4
7a8cd44
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||
|---|---|---|---|---|---|---|---|---|
|
|
@@ -347,6 +347,7 @@ - (void)constructor | |||||||
| _drawableDepthFormat = MGLDrawableDepthFormatNone; | ||||||||
| _drawableStencilFormat = MGLDrawableStencilFormatNone; | ||||||||
| _drawableMultisample = MGLDrawableMultisampleNone; | ||||||||
| _drawableColorSpace = MGLDrawableColorSpaceUnspecified; | ||||||||
|
|
||||||||
| _display = [MGLDisplay defaultDisplay]; | ||||||||
|
|
||||||||
|
|
@@ -710,6 +711,18 @@ - (void)ensureSurfaceCreated | |||||||
| red = green = blue = alpha = 8; | ||||||||
| colorSpace = EGL_GL_COLORSPACE_SRGB_KHR; | ||||||||
| break; | ||||||||
| case MGLDrawableColorFormatRGBA16: | ||||||||
| red = green = blue = alpha = 16; | ||||||||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Using
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. For a new config to be accepted (such as RGBA 16 bits), it must be added to the supported list inside
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Oh okay, I see. That function is a bit confusing to me, but I will try to figure out how to add the 16bit formats in there.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I was able to make this work. But I still don't understand what effect this has, as opposed to fbo format and texture formats used.
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Currently SurfaceMtl assumes users always create a window surface with 8 bits format (this is actually guaranteed by
If you add a new 16 bits config with default colorspace, the code should examine the color channels's configured bits size inside
However, I just realized you have no use for RGBA16 with default color space, maybe we can just omit
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thanks! I will reduce scope to BT2020 variant only as you suggested. |
||||||||
| switch (_drawableColorSpace) | ||||||||
| { | ||||||||
| case MGLDrawableColorSpaceBT2020PQ: | ||||||||
| colorSpace = EGL_GL_COLORSPACE_BT2020_PQ_EXT; | ||||||||
tmm1 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||||||||
| break; | ||||||||
| default: | ||||||||
| colorSpace = EGL_GL_COLORSPACE_LINEAR_KHR; | ||||||||
| break; | ||||||||
| } | ||||||||
| break; | ||||||||
| default: | ||||||||
| UNREACHABLE(); | ||||||||
| break; | ||||||||
|
|
||||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -206,6 +206,13 @@ void StopFrameCapture() | |
| { | ||
| mColorFormat = display->getPixelFormat(angle::FormatID::B8G8R8A8_UNORM_SRGB); | ||
| } | ||
| else if (attribs.get(EGL_GL_COLORSPACE, EGL_GL_COLORSPACE_LINEAR) == EGL_GL_COLORSPACE_BT2020_PQ_EXT) | ||
| { | ||
| mColorFormat.intendedFormatId = mColorFormat.actualFormatId = | ||
| angle::FormatID::R16G16B16A16_FLOAT; | ||
| mColorFormat.metalFormat = MTLPixelFormatRGBA16Float; | ||
| mColorFormat.metalColorspace = CGColorSpaceCreateWithName(kCGColorSpaceITUR_2020_PQ); | ||
|
||
| } | ||
| else | ||
| { | ||
| // https://developer.apple.com/metal/Metal-Feature-Set-Tables.pdf says that BGRA8Unorm is | ||
|
|
@@ -302,6 +309,7 @@ void StopFrameCapture() | |
|
|
||
| mMetalLayer.get().device = metalDevice; | ||
| mMetalLayer.get().pixelFormat = mColorFormat.metalFormat; | ||
| mMetalLayer.get().colorspace = mColorFormat.metalColorspace; | ||
| mMetalLayer.get().framebufferOnly = NO; // Support blitting and glReadPixels | ||
|
|
||
| #if TARGET_OS_OSX || TARGET_OS_MACCATALYST | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.