Skip to content

Commit

Permalink
Fix crash on Samsung phones when compiling the HDR fragment shaders
Browse files Browse the repository at this point in the history
Not all phones compile these the same way, and some are more strict
about the #extension macro than others.

Bug: 307621381
Test: Tested HDR capture with MediaCodec / MediaRecorder.
Change-Id: I0dfaaa5cbb2e5e4a37bb5aa17ed9c91287d8140d
  • Loading branch information
gborgera2 committed Oct 25, 2023
1 parent 9f7b654 commit 0db56e0
Showing 1 changed file with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ void main() {

/** Passthrough fragment shader, simply copies from the source texture */
private val PASSTHROUGH_FSHADER = """
#extension GL_OES_EGL_image_external : require
#extension GL_OES_EGL_image_external_essl3 : require
precision mediump float;
varying vec2 vTextureCoord;
uniform samplerExternalOES sTexture;
Expand All @@ -180,7 +180,7 @@ void main() {
"""

private val PASSTHROUGH_HDR_FSHADER = """#version 300 es
#extension GL_OES_EGL_image_external : require
#extension GL_OES_EGL_image_external_essl3 : require
precision mediump float;
in vec2 vTextureCoord;
uniform samplerExternalOES sTexture;
Expand All @@ -192,7 +192,7 @@ void main() {

private val YUV_TO_RGB_PASSTHROUGH_HDR_FSHADER = """#version 300 es
#extension GL_EXT_YUV_target : require
#extension GL_OES_EGL_image_external : require
#extension GL_OES_EGL_image_external_essl3 : require
precision mediump float;
uniform __samplerExternal2DY2YEXT sTexture;
in vec2 vTextureCoord;
Expand All @@ -208,7 +208,7 @@ void main() {

private val YUV_TO_RGB_PORTRAIT_HDR_FSHADER = """#version 300 es
#extension GL_EXT_YUV_target : require
#extension GL_OES_EGL_image_external : require
#extension GL_OES_EGL_image_external_essl3 : require
precision mediump float;
uniform __samplerExternal2DY2YEXT sTexture;
in vec2 vTextureCoord;
Expand Down Expand Up @@ -260,7 +260,7 @@ void main() {
"""

private val HLG_TO_LINEAR_HDR_FSHADER = """#version 300 es
#extension GL_OES_EGL_image_external : require
#extension GL_OES_EGL_image_external_essl3 : require
precision mediump float;
uniform samplerExternalOES sTexture;
in vec2 vTextureCoord;
Expand All @@ -278,7 +278,7 @@ void main() {
"""

private val HLG_TO_PQ_HDR_FSHADER = """#version 300 es
#extension GL_OES_EGL_image_external : require
#extension GL_OES_EGL_image_external_essl3 : require
precision mediump float;
uniform samplerExternalOES sTexture;
in vec2 vTextureCoord;
Expand Down

0 comments on commit 0db56e0

Please sign in to comment.