HDR: Rename GL_COLOR_TRANSFER instances to COLOR_TRANSFER

PiperOrigin-RevId: 469959215
This commit is contained in:
huangdarwin 2022-08-25 11:43:40 +00:00 committed by Marc Baechinger
parent 8457794978
commit 2a05a50403
3 changed files with 12 additions and 12 deletions

View File

@ -20,7 +20,7 @@
// https://www.khronos.org/registry/OpenGL/extensions/EXT/EXT_YUV_target.txt,
// 2. Applies a YUV to RGB conversion using the specified color transform
// uYuvToRgbColorTransform, yielding electrical (HLG or PQ) BT.2020 RGB,
// 3. If uEotfGlColorTransfer is GL_COLOR_TRANSFER_NO_VALUE, outputs electrical
// 3. If uEotfColorTransfer is COLOR_TRANSFER_NO_VALUE, outputs electrical
// (HLG or PQ) BT.2020 RGB. Otherwise, outputs optical linear BT.2020 RGB for
// intermediate shaders by applying the HLG or PQ EOTF.
// 4. Copies this converted texture color to the current output, with alpha = 1.
@ -30,8 +30,8 @@
precision mediump float;
uniform __samplerExternal2DY2YEXT uTexSampler;
uniform mat3 uYuvToRgbColorTransform;
// C.java#GlColorTransfer value.
uniform int uEotfGlColorTransfer;
// C.java#ColorTransfer value.
uniform int uEotfColorTransfer;
in vec2 vTexSamplingCoord;
out vec4 outColor;
@ -84,9 +84,9 @@ highp vec3 getOpticalColor(highp vec3 electricalColor) {
const int COLOR_TRANSFER_ST2084 = 6;
const int COLOR_TRANSFER_HLG = 7;
if (uEotfGlColorTransfer == COLOR_TRANSFER_ST2084) {
if (uEotfColorTransfer == COLOR_TRANSFER_ST2084) {
return pqEotf(electricalColor);
} else if (uEotfGlColorTransfer == COLOR_TRANSFER_HLG) {
} else if (uEotfColorTransfer == COLOR_TRANSFER_HLG) {
return hlgEotf(electricalColor);
} else {
return electricalColor;

View File

@ -24,9 +24,9 @@ precision mediump float;
uniform sampler2D uTexSampler;
in vec2 vTexSamplingCoord;
out vec4 outColor;
// C.java#GlColorTransfer value.
// Only GL_COLOR_TRANSFER_ST2084 and GL_COLOR_TRANSFER_HLG are allowed.
uniform int uOetfGlColorTransfer;
// C.java#ColorTransfer value.
// Only COLOR_TRANSFER_ST2084 and COLOR_TRANSFER_HLG are allowed.
uniform int uOetfColorTransfer;
uniform mat3 uColorTransform;
// TODO(b/227624622): Consider using mediump to save precision, if it won't lead
@ -76,8 +76,8 @@ highp vec3 pqOetf(highp vec3 linearColor) {
// electrical signals. Input and output are both normalzied to [0, 1].
highp vec3 getElectricalColor(highp vec3 linearColor) {
// LINT.IfChange(color_transfer)
const int GL_COLOR_TRANSFER_ST2084 = 6;
return (uOetfGlColorTransfer == GL_COLOR_TRANSFER_ST2084) ?
const int COLOR_TRANSFER_ST2084 = 6;
return (uOetfColorTransfer == COLOR_TRANSFER_ST2084) ?
pqOetf(linearColor) : hlgOetf(linearColor);
}

View File

@ -218,9 +218,9 @@ import java.util.Arrays;
// If electrical colors are both input and output, no EOTF is needed.
glProgram.setIntUniform(
"uEotfGlColorTransfer", outputElectricalColors ? Format.NO_VALUE : colorTransfer);
"uEotfColorTransfer", outputElectricalColors ? Format.NO_VALUE : colorTransfer);
} else if (outputElectricalColors) {
glProgram.setIntUniform("uOetfGlColorTransfer", colorTransfer);
glProgram.setIntUniform("uOetfColorTransfer", colorTransfer);
}
}