summaryrefslogtreecommitdiff
path: root/libs/shaders/shaders.cpp
diff options
context:
space:
mode:
author Alec Mouri <alecmouri@google.com> 2022-04-11 20:02:17 +0000
committer Alec Mouri <alecmouri@google.com> 2022-04-14 22:59:27 +0000
commitfcedb9ca3fa14607451ca24f32539a36f2261912 (patch)
tree8b09a3c0a491b2f53d8826a9380ef3383cd2a6c2 /libs/shaders/shaders.cpp
parent168f6ccfce328a1224297ba5b7af2779fcee0d9a (diff)
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
Diffstat (limited to 'libs/shaders/shaders.cpp')
-rw-r--r--libs/shaders/shaders.cpp13
1 files changed, 6 insertions, 7 deletions
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<tonemap::ShaderUniform> buildLinearEffectUniforms(const LinearEffect& linearEffect,
- const mat4& colorTransform,
- float maxDisplayLuminance,
- float currentDisplayLuminanceNits,
- float maxLuminance,
- AHardwareBuffer* buffer) {
+std::vector<tonemap::ShaderUniform> buildLinearEffectUniforms(
+ const LinearEffect& linearEffect, const mat4& colorTransform, float maxDisplayLuminance,
+ float currentDisplayLuminanceNits, float maxLuminance, AHardwareBuffer* buffer,
+ aidl::android::hardware::graphics::composer3::RenderIntent renderIntent) {
std::vector<tonemap::ShaderUniform> uniforms;
if (linearEffect.inputDataspace == linearEffect.outputDataspace) {
uniforms.push_back({.name = "in_rgbToXyz", .value = buildUniformValue<mat4>(mat4())});
@@ -495,7 +493,8 @@ std::vector<tonemap::ShaderUniform> 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);