From fcedb9ca3fa14607451ca24f32539a36f2261912 Mon Sep 17 00:00:00 2001 From: Alec Mouri Date: Mon, 11 Apr 2022 20:02:17 +0000 Subject: Support RenderIntents in libtonemap. Add RenderIntent as a supported uniform which is needed as some devices may perform contrast enhancements intended for SDR content which must be compensated for pre-blend for HDR content. Bug: 227779465 Test: builds Change-Id: Id74277e727d73cb9e371c37a83bef805e66271f4 --- libs/shaders/shaders.cpp | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) (limited to 'libs/shaders/shaders.cpp') diff --git a/libs/shaders/shaders.cpp b/libs/shaders/shaders.cpp index 5935589fdf..f0d45c2123 100644 --- a/libs/shaders/shaders.cpp +++ b/libs/shaders/shaders.cpp @@ -464,12 +464,10 @@ std::string buildLinearEffectSkSL(const LinearEffect& linearEffect) { } // Generates a list of uniforms to set on the LinearEffect shader above. -std::vector buildLinearEffectUniforms(const LinearEffect& linearEffect, - const mat4& colorTransform, - float maxDisplayLuminance, - float currentDisplayLuminanceNits, - float maxLuminance, - AHardwareBuffer* buffer) { +std::vector buildLinearEffectUniforms( + const LinearEffect& linearEffect, const mat4& colorTransform, float maxDisplayLuminance, + float currentDisplayLuminanceNits, float maxLuminance, AHardwareBuffer* buffer, + aidl::android::hardware::graphics::composer3::RenderIntent renderIntent) { std::vector uniforms; if (linearEffect.inputDataspace == linearEffect.outputDataspace) { uniforms.push_back({.name = "in_rgbToXyz", .value = buildUniformValue(mat4())}); @@ -495,7 +493,8 @@ std::vector buildLinearEffectUniforms(const LinearEffect .currentDisplayLuminance = currentDisplayLuminanceNits > 0 ? currentDisplayLuminanceNits : maxDisplayLuminance, - .buffer = buffer}; + .buffer = buffer, + .renderIntent = renderIntent}; for (const auto uniform : tonemap::getToneMapper()->generateShaderSkSLUniforms(metadata)) { uniforms.push_back(uniform); -- cgit v1.2.3-59-g8ed1b