-
-
Notifications
You must be signed in to change notification settings - Fork 65
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
Add support for EGL_EXT_gl_colorspace_bt2020_pq #18
Draft
tmm1
wants to merge
12
commits into
kakashidinho:master
Choose a base branch
from
tmm1:bt2020-colorspace
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+52
−5
Draft
Changes from all commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
1a36e40
define EGL_EXT_gl_colorspace_bt2020_*
tmm1 684d67b
implement EGL_GL_COLORSPACE_BT2020_PQ_EXT for Metal
tmm1 f0fe6f8
expose MGLDrawableColorFormatRGBA16 and MGLDrawableColorSpaceBT2020PQ
tmm1 c5334b4
add to MGLKView also
tmm1 f5d8be7
switch back to 8bit window format
tmm1 4f44fe1
add missing validation checks for EGL_GL_COLORSPACE_BT2020_PQ_EXT
tmm1 c9b9642
remove MGLDrawableColorSpace
tmm1 b9a86f9
add MGLDrawableColorFormatRGBA16BT2020PQ
tmm1 3503d77
move metal layer colorspace into SurfaceMtl
tmm1 247bf59
fix mMetalLayerColorSpace lifecycle
tmm1 075dbc4
support 16-bit configs
tmm1 7a8cd44
remove unused header
tmm1 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -238,6 +238,7 @@ bool IsMetalDisplayAvailable() | |
outExtensions->fenceSync = true; | ||
outExtensions->waitSync = true; | ||
outExtensions->glColorspace = true; | ||
outExtensions->glColorspaceBT2020PQ = true; | ||
} | ||
|
||
void DisplayMtl::generateCaps(egl::Caps *outCaps) const {} | ||
|
@@ -301,17 +302,19 @@ bool IsMetalDisplayAvailable() | |
config.colorComponentType = EGL_COLOR_COMPONENT_TYPE_FIXED_EXT; | ||
|
||
constexpr int samplesSupported[] = {0, 4}; | ||
constexpr int sizesSupported[] = {8, 16}; | ||
|
||
for (int size : sizesSupported) | ||
for (int samples : samplesSupported) | ||
{ | ||
config.samples = samples; | ||
config.sampleBuffers = (samples == 0) ? 0 : 1; | ||
|
||
// Buffer sizes | ||
config.redSize = 8; | ||
config.greenSize = 8; | ||
config.blueSize = 8; | ||
config.alphaSize = 8; | ||
config.redSize = size; | ||
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. Based on your explanation I understand now this is not correct. Instead I should advertise only one RGBA16 format, and set allowed depth/stencil to 0 for that format. What should I use for |
||
config.greenSize = size; | ||
config.blueSize = size; | ||
config.alphaSize = size; | ||
config.bufferSize = config.redSize + config.greenSize + config.blueSize + config.alphaSize; | ||
|
||
// With DS | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Using
16
causesFailed to call eglChooseConfig()
exception. I think it is probably unnecessary since we are setting the metal pixel format and color space correctly.There was a problem hiding this comment.
Choose a reason for hiding this comment
The 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
DisplayMtl::generateConfigs()
There was a problem hiding this comment.
Choose a reason for hiding this comment
The 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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The 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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The 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
DisplayMtl::generateConfigs()
). Hence in this code, there wasn't any color channels' configured bits size's verification, thus it always choosesMTLPixelFormatBGRA8Unorm
metal format for default colorspace:metalangle/src/libANGLE/renderer/metal/SurfaceMtl.mm
Line 219 in 78017f0
If you add a new 16 bits config with default colorspace, the code should examine the color channels's configured bits size inside
egl::SurfaceState
parameter and choose appropriate metal format such asMTLPixelFormatBGRA8Unorm
orMTLPixelFormatRGBA16Float
similar to how depth & stencil bits configuration is handled:metalangle/src/libANGLE/renderer/metal/SurfaceMtl.mm
Line 228 in 78017f0
metalangle/src/libANGLE/renderer/metal/SurfaceMtl.mm
Line 232 in 78017f0
However, I just realized you have no use for RGBA16 with default color space, maybe we can just omit
MGLDrawableColorFormatRGBA16
and only keep its BT.2020 variant. Thus further hassles would be avoided.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! I will reduce scope to BT2020 variant only as you suggested.