From acc78125d20b3f36859ceb6099c99f0ec251b00d Mon Sep 17 00:00:00 2001 From: tofunmi Date: Tue, 23 Jan 2024 05:46:42 -0800 Subject: [PATCH] Update METADATA to add `clang-format` requirement for glsl files also ran clang-format for good measure PiperOrigin-RevId: 600759938 --- .../fragment_shader_alpha_scale_es2.glsl | 4 ++-- .../shaders/fragment_shader_copy_es2.glsl | 4 +--- ...hader_transformation_external_yuv_es3.glsl | 13 ++++++------ ...hader_transformation_hdr_internal_es3.glsl | 13 ++++++------ .../vertex_shader_thumbnail_strip_es2.glsl | 20 +++++++++---------- 5 files changed, 27 insertions(+), 27 deletions(-) diff --git a/libraries/effect/src/main/assets/shaders/fragment_shader_alpha_scale_es2.glsl b/libraries/effect/src/main/assets/shaders/fragment_shader_alpha_scale_es2.glsl index aa15d4c588..154a3e5ff9 100644 --- a/libraries/effect/src/main/assets/shaders/fragment_shader_alpha_scale_es2.glsl +++ b/libraries/effect/src/main/assets/shaders/fragment_shader_alpha_scale_es2.glsl @@ -22,6 +22,6 @@ uniform float uAlphaScale; varying vec2 vTexSamplingCoord; void main() { - vec4 src = texture2D(uTexSampler, vTexSamplingCoord); - gl_FragColor = vec4(src.rgb, src.a * uAlphaScale); + vec4 src = texture2D(uTexSampler, vTexSamplingCoord); + gl_FragColor = vec4(src.rgb, src.a * uAlphaScale); } diff --git a/libraries/effect/src/main/assets/shaders/fragment_shader_copy_es2.glsl b/libraries/effect/src/main/assets/shaders/fragment_shader_copy_es2.glsl index 7ddee94d7a..0d38f9eae8 100644 --- a/libraries/effect/src/main/assets/shaders/fragment_shader_copy_es2.glsl +++ b/libraries/effect/src/main/assets/shaders/fragment_shader_copy_es2.glsl @@ -20,6 +20,4 @@ precision mediump float; uniform sampler2D uTexSampler; varying vec2 vTexSamplingCoord; -void main() { - gl_FragColor = texture2D(uTexSampler, vTexSamplingCoord); -} +void main() { gl_FragColor = texture2D(uTexSampler, vTexSamplingCoord); } diff --git a/libraries/effect/src/main/assets/shaders/fragment_shader_transformation_external_yuv_es3.glsl b/libraries/effect/src/main/assets/shaders/fragment_shader_transformation_external_yuv_es3.glsl index 8f0f43a4e7..3aa699e008 100644 --- a/libraries/effect/src/main/assets/shaders/fragment_shader_transformation_external_yuv_es3.glsl +++ b/libraries/effect/src/main/assets/shaders/fragment_shader_transformation_external_yuv_es3.glsl @@ -156,7 +156,7 @@ highp vec3 applyPqBt2020ToBt709Ootf(highp vec3 linearRgbBt2020) { const float maxInputLuminance = maxMasteringLuminance; const float maxOutputLuminance = sdrMaxLuminance; - highp vec3 color = linearRgbBt2020 * pqMaxLuminance; // Scale luminance. + highp vec3 color = linearRgbBt2020 * pqMaxLuminance; // Scale luminance. float nits = color.y; nits = clamp(nits, 0.0, maxInputLuminance); @@ -182,19 +182,20 @@ highp vec3 applyPqBt2020ToBt709Ootf(highp vec3 linearRgbBt2020) { } else if (nits < x2) { // Scale [x1, x2] to [y1, y2] using Hermite interpolation. float t = (nits - x1) / h12; - nits = (y1 * (1.0 + 2.0 * t) + h12 * m1 * t) * (1.0 - t) * (1.0 - t) - + (y2 * (3.0 - 2.0 * t) + h12 * m2 * (t - 1.0)) * t * t; + nits = (y1 * (1.0 + 2.0 * t) + h12 * m1 * t) * (1.0 - t) * (1.0 - t) + + (y2 * (3.0 - 2.0 * t) + h12 * m2 * (t - 1.0)) * t * t; } else { // Scale [x2, maxInputLuminance] to [y2, maxOutputLuminance] using // Hermite interpolation. float t = (nits - x2) / h23; - nits = (y2 * (1.0 + 2.0 * t) + h23 * m2 * t) * (1.0 - t) * (1.0 - t) - + (maxOutputLuminance * (3.0 - 2.0 * t) + h23 * m3 * (t - 1.0)) * t * t; + nits = + (y2 * (1.0 + 2.0 * t) + h23 * m2 * t) * (1.0 - t) * (1.0 - t) + + (maxOutputLuminance * (3.0 - 2.0 * t) + h23 * m3 * (t - 1.0)) * t * t; } // color.y is greater than 0 and is thus non-zero. color = color * (nits / color.y); - return color / sdrMaxLuminance; // Normalize luminance. + return color / sdrMaxLuminance; // Normalize luminance. } highp vec3 applyBt2020ToBt709Ootf(highp vec3 linearRgbBt2020) { diff --git a/libraries/effect/src/main/assets/shaders/fragment_shader_transformation_hdr_internal_es3.glsl b/libraries/effect/src/main/assets/shaders/fragment_shader_transformation_hdr_internal_es3.glsl index 904b765b99..1eec0222bf 100644 --- a/libraries/effect/src/main/assets/shaders/fragment_shader_transformation_hdr_internal_es3.glsl +++ b/libraries/effect/src/main/assets/shaders/fragment_shader_transformation_hdr_internal_es3.glsl @@ -148,7 +148,7 @@ highp vec3 applyPqBt2020ToBt709Ootf(highp vec3 linearRgbBt2020) { const float maxInputLuminance = maxMasteringLuminance; const float maxOutputLuminance = sdrMaxLuminance; - highp vec3 color = linearRgbBt2020 * pqMaxLuminance; // Scale luminance. + highp vec3 color = linearRgbBt2020 * pqMaxLuminance; // Scale luminance. float nits = color.y; nits = clamp(nits, 0.0, maxInputLuminance); @@ -174,19 +174,20 @@ highp vec3 applyPqBt2020ToBt709Ootf(highp vec3 linearRgbBt2020) { } else if (nits < x2) { // Scale [x1, x2] to [y1, y2] using Hermite interpolation. float t = (nits - x1) / h12; - nits = (y1 * (1.0 + 2.0 * t) + h12 * m1 * t) * (1.0 - t) * (1.0 - t) - + (y2 * (3.0 - 2.0 * t) + h12 * m2 * (t - 1.0)) * t * t; + nits = (y1 * (1.0 + 2.0 * t) + h12 * m1 * t) * (1.0 - t) * (1.0 - t) + + (y2 * (3.0 - 2.0 * t) + h12 * m2 * (t - 1.0)) * t * t; } else { // Scale [x2, maxInputLuminance] to [y2, maxOutputLuminance] using // Hermite interpolation. float t = (nits - x2) / h23; - nits = (y2 * (1.0 + 2.0 * t) + h23 * m2 * t) * (1.0 - t) * (1.0 - t) - + (maxOutputLuminance * (3.0 - 2.0 * t) + h23 * m3 * (t - 1.0)) * t * t; + nits = + (y2 * (1.0 + 2.0 * t) + h23 * m2 * t) * (1.0 - t) * (1.0 - t) + + (maxOutputLuminance * (3.0 - 2.0 * t) + h23 * m3 * (t - 1.0)) * t * t; } // color.y is greater than 0 and is thus non-zero. color = color * (nits / color.y); - return color / sdrMaxLuminance; // Normalize luminance. + return color / sdrMaxLuminance; // Normalize luminance. } highp vec3 applyBt2020ToBt709Ootf(highp vec3 linearRgbBt2020) { diff --git a/libraries/effect/src/main/assets/shaders/vertex_shader_thumbnail_strip_es2.glsl b/libraries/effect/src/main/assets/shaders/vertex_shader_thumbnail_strip_es2.glsl index 2d1837ab0a..a72b22a08b 100644 --- a/libraries/effect/src/main/assets/shaders/vertex_shader_thumbnail_strip_es2.glsl +++ b/libraries/effect/src/main/assets/shaders/vertex_shader_thumbnail_strip_es2.glsl @@ -21,15 +21,15 @@ uniform int uCount; varying vec2 vTexSamplingCoord; void main() { - // Translate the coordinates from -1,+1 to 0,+2. - float x = aFramePosition.x + 1.0; - // Offset the frame by its index times its width (2). - x += float(uIndex) * 2.0; - // Shrink the frame to fit the thumbnail strip. - x /= float(uCount); - // Translate the coordinates back to -1,+1. - x -= 1.0; + // Translate the coordinates from -1,+1 to 0,+2. + float x = aFramePosition.x + 1.0; + // Offset the frame by its index times its width (2). + x += float(uIndex) * 2.0; + // Shrink the frame to fit the thumbnail strip. + x /= float(uCount); + // Translate the coordinates back to -1,+1. + x -= 1.0; - gl_Position = vec4(x, aFramePosition.yzw); - vTexSamplingCoord = aFramePosition.xy * 0.5 + 0.5; + gl_Position = vec4(x, aFramePosition.yzw); + vTexSamplingCoord = aFramePosition.xy * 0.5 + 0.5; }