Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 84218a21 authored by Alec Mouri's avatar Alec Mouri Committed by Android (Google) Code Review
Browse files

Merge "Supply extra brightness parameters to RenderEngine"

parents a97c991f b21d94e6
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -43,6 +43,9 @@ struct DisplaySettings {
    // Maximum luminance pulled from the display's HDR capabilities.
    float maxLuminance = 1.0f;

    // Current luminance of the display
    float currentLuminanceNits = -1.f;

    // Output dataspace that will be populated if wide color gamut is used, or
    // DataSpace::UNKNOWN otherwise.
    ui::Dataspace outputDataspace = ui::Dataspace::UNKNOWN;
+1 −0
Original line number Diff line number Diff line
@@ -656,6 +656,7 @@ sk_sp<SkShader> SkiaGLRenderEngine::createRuntimeEffectShader(
                                 parameters.layerDimmingRatio, 1.f));
        return createLinearEffectShader(parameters.shader, effect, runtimeEffect, colorTransform,
                                        parameters.display.maxLuminance,
                                        parameters.display.currentLuminanceNits,
                                        parameters.layer.source.buffer.maxLuminanceNits);
    }
    return parameters.shader;
+4 −3
Original line number Diff line number Diff line
@@ -44,14 +44,15 @@ sk_sp<SkShader> createLinearEffectShader(sk_sp<SkShader> shader,
                                         const shaders::LinearEffect& linearEffect,
                                         sk_sp<SkRuntimeEffect> runtimeEffect,
                                         const mat4& colorTransform, float maxDisplayLuminance,
                                         float maxLuminance) {
                                         float currentDisplayLuminanceNits, float maxLuminance) {
    ATRACE_CALL();
    SkRuntimeShaderBuilder effectBuilder(runtimeEffect);

    effectBuilder.child("child") = shader;

    const auto uniforms = shaders::buildLinearEffectUniforms(linearEffect, colorTransform,
                                                             maxDisplayLuminance, maxLuminance);
    const auto uniforms =
            shaders::buildLinearEffectUniforms(linearEffect, colorTransform, maxDisplayLuminance,
                                               currentDisplayLuminanceNits, maxLuminance);

    for (const auto& uniform : uniforms) {
        effectBuilder.uniform(uniform.name.c_str()).set(uniform.value.data(), uniform.value.size());
+2 −1
Original line number Diff line number Diff line
@@ -37,13 +37,14 @@ sk_sp<SkRuntimeEffect> buildRuntimeEffect(const shaders::LinearEffect& linearEff
// matrix transforming from linear XYZ to linear RGB immediately before OETF.
// We also provide additional HDR metadata upon creating the shader:
// * The max display luminance is the max luminance of the physical display in nits
// * The current luminance of the physical display in nits
// * The max luminance is provided as the max luminance for the buffer, either from the SMPTE 2086
// or as the max light level from the CTA 861.3 standard.
sk_sp<SkShader> createLinearEffectShader(sk_sp<SkShader> inputShader,
                                         const shaders::LinearEffect& linearEffect,
                                         sk_sp<SkRuntimeEffect> runtimeEffect,
                                         const mat4& colorTransform, float maxDisplayLuminance,
                                         float maxLuminance);
                                         float currentDisplayLuminanceNits, float maxLuminance);
} // namespace skia
} // namespace renderengine
} // namespace android
+1 −0
Original line number Diff line number Diff line
@@ -100,6 +100,7 @@ std::string buildLinearEffectSkSL(const LinearEffect& linearEffect);
std::vector<tonemap::ShaderUniform> buildLinearEffectUniforms(const LinearEffect& linearEffect,
                                                              const mat4& colorTransform,
                                                              float maxDisplayLuminance,
                                                              float currentDisplayLuminanceNits,
                                                              float maxLuminance);

} // namespace android::shaders
Loading