Update METADATA to add clang-format requirement for glsl files

also ran clang-format for good measure

PiperOrigin-RevId: 600759938
(cherry picked from commit acc78125d20b3f36859ceb6099c99f0ec251b00d)
This commit is contained in:
tofunmi 2024-01-23 05:46:42 -08:00 committed by SheenaChhabra
parent eda2080279
commit b8ff9cd715
5 changed files with 27 additions and 27 deletions

View File

@ -22,6 +22,6 @@ uniform float uAlphaScale;
varying vec2 vTexSamplingCoord; varying vec2 vTexSamplingCoord;
void main() { void main() {
vec4 src = texture2D(uTexSampler, vTexSamplingCoord); vec4 src = texture2D(uTexSampler, vTexSamplingCoord);
gl_FragColor = vec4(src.rgb, src.a * uAlphaScale); gl_FragColor = vec4(src.rgb, src.a * uAlphaScale);
} }

View File

@ -20,6 +20,4 @@ precision mediump float;
uniform sampler2D uTexSampler; uniform sampler2D uTexSampler;
varying vec2 vTexSamplingCoord; varying vec2 vTexSamplingCoord;
void main() { void main() { gl_FragColor = texture2D(uTexSampler, vTexSamplingCoord); }
gl_FragColor = texture2D(uTexSampler, vTexSamplingCoord);
}

View File

@ -156,7 +156,7 @@ highp vec3 applyPqBt2020ToBt709Ootf(highp vec3 linearRgbBt2020) {
const float maxInputLuminance = maxMasteringLuminance; const float maxInputLuminance = maxMasteringLuminance;
const float maxOutputLuminance = sdrMaxLuminance; const float maxOutputLuminance = sdrMaxLuminance;
highp vec3 color = linearRgbBt2020 * pqMaxLuminance; // Scale luminance. highp vec3 color = linearRgbBt2020 * pqMaxLuminance; // Scale luminance.
float nits = color.y; float nits = color.y;
nits = clamp(nits, 0.0, maxInputLuminance); nits = clamp(nits, 0.0, maxInputLuminance);
@ -182,19 +182,20 @@ highp vec3 applyPqBt2020ToBt709Ootf(highp vec3 linearRgbBt2020) {
} else if (nits < x2) { } else if (nits < x2) {
// Scale [x1, x2] to [y1, y2] using Hermite interpolation. // Scale [x1, x2] to [y1, y2] using Hermite interpolation.
float t = (nits - x1) / h12; float t = (nits - x1) / h12;
nits = (y1 * (1.0 + 2.0 * t) + h12 * m1 * t) * (1.0 - t) * (1.0 - 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; (y2 * (3.0 - 2.0 * t) + h12 * m2 * (t - 1.0)) * t * t;
} else { } else {
// Scale [x2, maxInputLuminance] to [y2, maxOutputLuminance] using // Scale [x2, maxInputLuminance] to [y2, maxOutputLuminance] using
// Hermite interpolation. // Hermite interpolation.
float t = (nits - x2) / h23; float t = (nits - x2) / h23;
nits = (y2 * (1.0 + 2.0 * t) + h23 * m2 * t) * (1.0 - t) * (1.0 - t) nits =
+ (maxOutputLuminance * (3.0 - 2.0 * t) + h23 * m3 * (t - 1.0)) * t * t; (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.y is greater than 0 and is thus non-zero.
color = color * (nits / color.y); color = color * (nits / color.y);
return color / sdrMaxLuminance; // Normalize luminance. return color / sdrMaxLuminance; // Normalize luminance.
} }
highp vec3 applyBt2020ToBt709Ootf(highp vec3 linearRgbBt2020) { highp vec3 applyBt2020ToBt709Ootf(highp vec3 linearRgbBt2020) {

View File

@ -148,7 +148,7 @@ highp vec3 applyPqBt2020ToBt709Ootf(highp vec3 linearRgbBt2020) {
const float maxInputLuminance = maxMasteringLuminance; const float maxInputLuminance = maxMasteringLuminance;
const float maxOutputLuminance = sdrMaxLuminance; const float maxOutputLuminance = sdrMaxLuminance;
highp vec3 color = linearRgbBt2020 * pqMaxLuminance; // Scale luminance. highp vec3 color = linearRgbBt2020 * pqMaxLuminance; // Scale luminance.
float nits = color.y; float nits = color.y;
nits = clamp(nits, 0.0, maxInputLuminance); nits = clamp(nits, 0.0, maxInputLuminance);
@ -174,19 +174,20 @@ highp vec3 applyPqBt2020ToBt709Ootf(highp vec3 linearRgbBt2020) {
} else if (nits < x2) { } else if (nits < x2) {
// Scale [x1, x2] to [y1, y2] using Hermite interpolation. // Scale [x1, x2] to [y1, y2] using Hermite interpolation.
float t = (nits - x1) / h12; float t = (nits - x1) / h12;
nits = (y1 * (1.0 + 2.0 * t) + h12 * m1 * t) * (1.0 - t) * (1.0 - 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; (y2 * (3.0 - 2.0 * t) + h12 * m2 * (t - 1.0)) * t * t;
} else { } else {
// Scale [x2, maxInputLuminance] to [y2, maxOutputLuminance] using // Scale [x2, maxInputLuminance] to [y2, maxOutputLuminance] using
// Hermite interpolation. // Hermite interpolation.
float t = (nits - x2) / h23; float t = (nits - x2) / h23;
nits = (y2 * (1.0 + 2.0 * t) + h23 * m2 * t) * (1.0 - t) * (1.0 - t) nits =
+ (maxOutputLuminance * (3.0 - 2.0 * t) + h23 * m3 * (t - 1.0)) * t * t; (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.y is greater than 0 and is thus non-zero.
color = color * (nits / color.y); color = color * (nits / color.y);
return color / sdrMaxLuminance; // Normalize luminance. return color / sdrMaxLuminance; // Normalize luminance.
} }
highp vec3 applyBt2020ToBt709Ootf(highp vec3 linearRgbBt2020) { highp vec3 applyBt2020ToBt709Ootf(highp vec3 linearRgbBt2020) {

View File

@ -21,15 +21,15 @@ uniform int uCount;
varying vec2 vTexSamplingCoord; varying vec2 vTexSamplingCoord;
void main() { void main() {
// Translate the coordinates from -1,+1 to 0,+2. // Translate the coordinates from -1,+1 to 0,+2.
float x = aFramePosition.x + 1.0; float x = aFramePosition.x + 1.0;
// Offset the frame by its index times its width (2). // Offset the frame by its index times its width (2).
x += float(uIndex) * 2.0; x += float(uIndex) * 2.0;
// Shrink the frame to fit the thumbnail strip. // Shrink the frame to fit the thumbnail strip.
x /= float(uCount); x /= float(uCount);
// Translate the coordinates back to -1,+1. // Translate the coordinates back to -1,+1.
x -= 1.0; x -= 1.0;
gl_Position = vec4(x, aFramePosition.yzw); gl_Position = vec4(x, aFramePosition.yzw);
vTexSamplingCoord = aFramePosition.xy * 0.5 + 0.5; vTexSamplingCoord = aFramePosition.xy * 0.5 + 0.5;
} }