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

Commit 43a96770 authored by Nathaniel Nifong's avatar Nathaniel Nifong Committed by Automerger Merge Worker
Browse files

Merge "Include skipContentDraw flag to cache blur and shadow shaders" into sc-dev am: 504a4d8f

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/native/+/15081398

Change-Id: Ieabe817215198bec55757e66cc3955e36e09297e
parents ea953ceb 504a4d8f
Loading
Loading
Loading
Loading
+8 −0
Original line number Original line Diff line number Diff line
@@ -72,6 +72,8 @@ static void drawShadowLayers(SkiaRenderEngine* renderengine, const DisplaySettin
            // have color correction added, and important that it be srgb, so the *vertex* shader
            // have color correction added, and important that it be srgb, so the *vertex* shader
            // doesn't have color correction added.
            // doesn't have color correction added.
            .sourceDataspace = kDestDataSpace,
            .sourceDataspace = kDestDataSpace,
            // setting this is mandatory for shadows and blurs
            .skipContentDraw = true,
    };
    };


    auto layers = std::vector<const LayerSettings*>{&layer};
    auto layers = std::vector<const LayerSettings*>{&layer};
@@ -173,9 +175,12 @@ static void drawBlurLayers(SkiaRenderEngine* renderengine, const DisplaySettings
                            .boundaries = rect,
                            .boundaries = rect,
                    },
                    },
            .alpha = 1,
            .alpha = 1,
            // setting this is mandatory for shadows and blurs
            .skipContentDraw = true,
    };
    };


    auto layers = std::vector<const LayerSettings*>{&layer};
    auto layers = std::vector<const LayerSettings*>{&layer};
    // Different blur code is invoked for radii less and greater than 30 pixels
    for (int radius : {9, 60}) {
    for (int radius : {9, 60}) {
        layer.backgroundBlurRadius = radius;
        layer.backgroundBlurRadius = radius;
        renderengine->drawLayers(display, layers, dstTexture, kUseFrameBufferCache,
        renderengine->drawLayers(display, layers, dstTexture, kUseFrameBufferCache,
@@ -290,10 +295,13 @@ void Cache::primeShaderCache(SkiaRenderEngine* renderengine) {
                                                  ExternalTexture::Usage::READABLE |
                                                  ExternalTexture::Usage::READABLE |
                                                          ExternalTexture::Usage::WRITEABLE);
                                                          ExternalTexture::Usage::WRITEABLE);


        // 6 shaders
        drawSolidLayers(renderengine, display, dstTexture);
        drawSolidLayers(renderengine, display, dstTexture);
        // 8 shaders
        drawShadowLayers(renderengine, display, srcTexture);
        drawShadowLayers(renderengine, display, srcTexture);


        if (renderengine->supportsBackgroundBlur()) {
        if (renderengine->supportsBackgroundBlur()) {
            // 2 shaders
            drawBlurLayers(renderengine, display, dstTexture);
            drawBlurLayers(renderengine, display, dstTexture);
        }
        }