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

Commit 9ae8d618 authored by Alec Mouri's avatar Alec Mouri Committed by android-build-merger
Browse files

Merge "[RenderEngine] Allow rounded corners shader to use lower precision."...

Merge "[RenderEngine] Allow rounded corners shader to use lower precision." into qt-r1-dev am: e99a9c03 am: f076c019
am: 89372173

Change-Id: I248a3398726e469f7462b3545825bcfbd18e72ed
parents 7824aad6 89372173
Loading
Loading
Loading
Loading
+5 −4
Original line number Original line Diff line number Diff line
@@ -575,10 +575,11 @@ String8 ProgramCache::generateFragmentShader(const Key& needs) {
            float applyCornerRadius(vec2 cropCoords)
            float applyCornerRadius(vec2 cropCoords)
            {
            {
                vec2 position = cropCoords - cropCenter;
                vec2 position = cropCoords - cropCenter;
                // Increase precision here so that a large corner radius doesn't
                // Scale down the dist vector here, as otherwise large corner
                // cause floating point error
                // radii can cause floating point issues when computing the norm
                highp vec2 dist = abs(position) + vec2(cornerRadius) - cropCenter;
                vec2 dist = (abs(position) - cropCenter + vec2(cornerRadius)) / 16.0;
                float plane = length(max(dist, vec2(0.0)));
                // Once we've found the norm, then scale back up.
                float plane = length(max(dist, vec2(0.0))) * 16.0;
                return 1.0 - clamp(plane - cornerRadius, 0.0, 1.0);
                return 1.0 - clamp(plane - cornerRadius, 0.0, 1.0);
            }
            }
            )__SHADER__";
            )__SHADER__";