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

Commit 3bd7ec30 authored by Alec Mouri's avatar Alec Mouri
Browse files

Sample from texel centers in downchunk shaders

Previously we weren't sampling from texel centers, which caused
incorrect pixels to be sampled when using nearest neighbor sampling.

Bug: 329464641
Flag: com.android.graphics.surfaceflinger.flags.local_tonemap_screenshots
Test: librenderengine_test
Test: Screenshots of UltraHDR and HDR video
Change-Id: Id1e3ea070368aecb18e5bd1ae7093537c76f6ddf
parent ae98dd73
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -35,7 +35,7 @@ const SkString kCrosstalkAndChunk16x16(R"(
        float maximum = 0.0;
        for (int y = 0; y < 16; y++) {
            for (int x = 0; x < 16; x++) {
                float3 linear = toLinearSrgb(bitmap.eval(xy * 16 + vec2(x, y)).rgb) * hdrSdrRatio;
                float3 linear = toLinearSrgb(bitmap.eval((xy - 0.5) * 16 + 0.5 + vec2(x, y)).rgb) * hdrSdrRatio;
                float maxRGB = max(linear.r, max(linear.g, linear.b));
                maximum = max(maximum, log2(max(maxRGB, 1.0)));
            }
@@ -49,7 +49,7 @@ const SkString kChunk8x8(R"(
        float maximum = 0.0;
        for (int y = 0; y < 8; y++) {
            for (int x = 0; x < 8; x++) {
                maximum = max(maximum, bitmap.eval(xy * 8 + vec2(x, y)).r);
                maximum = max(maximum, bitmap.eval((xy - 0.5) * 8 + 0.5 + vec2(x, y)).r);
            }
        }
        return float4(float3(maximum), 1.0);