-
Notifications
You must be signed in to change notification settings - Fork 29.7k
Open
Labels
P2Important issues not at the top of the work listImportant issues not at the top of the work liste: impellerImpeller rendering backend issues and features requestsImpeller rendering backend issues and features requeststeam-engineOwned by Engine teamOwned by Engine teamtriaged-engineTriaged by Engine teamTriaged by Engine team
Description
Certain combinations of scale + sigma can cause the shader to overflow now that we are scaling the sigma based on the entity's transform.
I played around with this a bit and just increasing the sigma from zero to 1000 won't cause a crash. A scale is required.
The following patch will make it never possible. It seems like it isn't throwing much away in the case that hits this. The way that this should work is that GaussianBlurFilterContents::CalculateScale should accommodate for large sigmas with a counteracting downscale. There is a certain range of input that is falling through the cracks though.
diff --git a/impeller/entity/contents/filters/gaussian_blur_filter_contents.cc b/impeller/entity/contents/filters/gaussian_blur_filter_contents.cc
index 035109e519..96c585b3fe 100644
--- a/impeller/entity/contents/filters/gaussian_blur_filter_contents.cc
+++ b/impeller/entity/contents/filters/gaussian_blur_filter_contents.cc
@@ -653,6 +660,13 @@ GaussianBlurPipeline::FragmentShader::KernelSamples GenerateBlurInfo(
x_offset = 1;
}
+ // This is a safe-guard to make sure we don't overflow the fragment shader.
+ // The kernel size is multiplied by 2 since we'll use the lerp hack on the
+ // result.
+ if (result.sample_count > (2 * (kMaxKernelSize - 1))) {
+ result.sample_count = 2 * (kMaxKernelSize - 1);
+ }
+reproduction steps
- run the
EntityTest.GaussianBlurFilter - set the x scale to 3.0
- set the sigma to combined
- start increasing the sigma
- notice that around 300 sigma, there will be a crash
Metadata
Metadata
Assignees
Labels
P2Important issues not at the top of the work listImportant issues not at the top of the work liste: impellerImpeller rendering backend issues and features requestsImpeller rendering backend issues and features requeststeam-engineOwned by Engine teamOwned by Engine teamtriaged-engineTriaged by Engine teamTriaged by Engine team