Skip to content

[Sample] [Graphics] UltraHDR x OpenGL shaders with SurfaceView brightness control #131

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

Merged
merged 8 commits into from
Dec 18, 2023

Conversation

madebymozart
Copy link
Contributor

Description

This PR uses UltraHDR image, and processes them through a OpenGL pipeline using fragment & vertex shaders. This then displays the output frame on the SurfaceView and shows the developer how to control the brightness of the UltraHDR Image.

The included fragment shader is a tone-mapping shader. Big thanks for @johnreck for the graphics code here!

How Has This Been Tested?

Test Configuration #1 - Pixel 8 Pro API 34 Beta (Android 14)
Test Configuration #1 - Pixel 7 Pro API 34 Beta (Android 14 Beta)

Demo

Screenshot_20231206_124445

Recording

Screen_recording_20231206_124542.mp4

@madebymozart madebymozart added the enhancement New feature or request label Dec 6, 2023
@madebymozart madebymozart self-assigned this Dec 6, 2023
@@ -124,6 +124,7 @@ androidx-work-runtime-ktx = "androidx.work:work-runtime-ktx:2.8.1"
androidx-core-remoteviews = "androidx.core:core-remoteviews:1.0.0"
androidx-glance-appwidget = "androidx.glance:glance-appwidget:1.0.0"
androidx-glance-material3 = "androidx.glance:glance-material3:1.0.0"
androidx-graphics-core = { group = "androidx.graphics", name = "graphics-core", version = "1.0.0-alpha05" }
Copy link

Choose a reason for hiding this comment

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

Note as of Dec 13th the 1.0.0-beta01 release of the graphics-core library is now available.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updated it in latest patch

transaction.setDataSpace(targetSurfaceControl, if (isWideGamut) P3_XRB else SRGB_XRB)
transaction.setExtendedRangeBrightness(targetSurfaceControl, hdrSdrRatio, desiredRatio)
transaction.commit()
super.onDrawComplete(targetSurfaceControl, transaction, frameBuffer, syncFence)
Copy link

Choose a reason for hiding this comment

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

Just FYI, delegation to the base class method is not necessary.

Also the implementation of GLFrameBufferRenderer already calls transaction.commit on your behalf so explicitly calling commit here is not necessary.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

👍🏾 Perfect - Thanks for letting me know

# Conflicts:
#	samples/README.md
#	samples/graphics/ultrahdr/src/main/res/values/strings.xml
@madebymozart madebymozart merged commit 3856087 into main Dec 18, 2023
@madebymozart madebymozart deleted the ultrahdr-graphics-shaders branch December 18, 2023 19:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants