Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Commit 8b0e832

Browse files
committed
Delete Settings::msaa_samples.
Fixes flutter/flutter#148257
1 parent 7dcbd93 commit 8b0e832

28 files changed

+41
-234
lines changed

common/graphics/BUILD.gn

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ source_set("graphics") {
1010
sources = [
1111
"gl_context_switch.cc",
1212
"gl_context_switch.h",
13-
"msaa_sample_count.h",
1413
"persistent_cache.cc",
1514
"persistent_cache.h",
1615
"texture.cc",

common/graphics/msaa_sample_count.h

Lines changed: 0 additions & 17 deletions
This file was deleted.

common/settings.h

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -348,13 +348,6 @@ struct Settings {
348348
// Max bytes threshold of resource cache, or 0 for unlimited.
349349
size_t resource_cache_max_bytes_threshold = 0;
350350

351-
/// The minimum number of samples to require in multipsampled anti-aliasing.
352-
///
353-
/// Setting this value to 0 or 1 disables MSAA.
354-
/// If it is not 0 or 1, it must be one of 2, 4, 8, or 16. However, if the
355-
/// GPU does not support the requested sampling value, MSAA will be disabled.
356-
uint8_t msaa_samples = 0;
357-
358351
/// Enable embedder api on the embedder.
359352
///
360353
/// This is currently only used by iOS.

shell/common/shell_test_platform_view_metal.mm

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -116,8 +116,7 @@ GPUMTLTextureInfo offscreen_texture_info() const {
116116
return std::make_unique<GPUSurfaceMetalImpeller>(this,
117117
[metal_context_->impeller_context() context]);
118118
}
119-
return std::make_unique<GPUSurfaceMetalSkia>(this, [metal_context_->context() mainContext],
120-
MsaaSampleCount::kNone);
119+
return std::make_unique<GPUSurfaceMetalSkia>(this, [metal_context_->context() mainContext]);
121120
}
122121

123122
// |PlatformView|

shell/common/switches.cc

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -519,28 +519,6 @@ Settings SettingsFromCommandLine(const fml::CommandLine& command_line) {
519519
std::stoi(resource_cache_max_bytes_threshold);
520520
}
521521

522-
if (command_line.HasOption(FlagForSwitch(Switch::MsaaSamples))) {
523-
std::string msaa_samples;
524-
command_line.GetOptionValue(FlagForSwitch(Switch::MsaaSamples),
525-
&msaa_samples);
526-
if (msaa_samples == "0") {
527-
settings.msaa_samples = 0;
528-
} else if (msaa_samples == "1") {
529-
settings.msaa_samples = 1;
530-
} else if (msaa_samples == "2") {
531-
settings.msaa_samples = 2;
532-
} else if (msaa_samples == "4") {
533-
settings.msaa_samples = 4;
534-
} else if (msaa_samples == "8") {
535-
settings.msaa_samples = 8;
536-
} else if (msaa_samples == "16") {
537-
settings.msaa_samples = 16;
538-
} else {
539-
FML_DLOG(ERROR) << "Invalid value for --msaa-samples: '" << msaa_samples
540-
<< "' (expected 0, 1, 2, 4, 8, or 16).";
541-
}
542-
}
543-
544522
settings.enable_platform_isolates =
545523
command_line.HasOption(FlagForSwitch(Switch::EnablePlatformIsolates));
546524

shell/common/switches.h

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -288,13 +288,6 @@ DEF_SWITCH(LeakVM,
288288
"When the last shell shuts down, the shared VM is leaked by default "
289289
"(the leak_vm in VM settings is true). To clean up the leak VM, set "
290290
"this value to false.")
291-
DEF_SWITCH(
292-
MsaaSamples,
293-
"msaa-samples",
294-
"The minimum number of samples to require for multisampled anti-aliasing. "
295-
"Setting this value to 0 or 1 disables MSAA. If it is not 0 or 1, it must "
296-
"be one of 2, 4, 8, or 16. However, if the GPU does not support the "
297-
"requested sampling value, MSAA will be disabled.")
298291
DEF_SWITCH(EnableEmbedderAPI,
299292
"enable-embedder-api",
300293
"Enable the embedder api. Defaults to false. iOS only.")

shell/common/switches_unittests.cc

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -69,24 +69,6 @@ TEST(SwitchesTest, RouteParsedFlag) {
6969
EXPECT_TRUE(settings.route.empty());
7070
}
7171

72-
TEST(SwitchesTest, MsaaSamples) {
73-
for (int samples : {0, 1, 2, 4, 8, 16}) {
74-
fml::CommandLine command_line = fml::CommandLineFromInitializerList(
75-
{"command", ("--msaa-samples=" + std::to_string(samples)).c_str()});
76-
Settings settings = SettingsFromCommandLine(command_line);
77-
EXPECT_EQ(settings.msaa_samples, samples);
78-
}
79-
fml::CommandLine command_line =
80-
fml::CommandLineFromInitializerList({"command", "--msaa-samples=3"});
81-
Settings settings = SettingsFromCommandLine(command_line);
82-
EXPECT_EQ(settings.msaa_samples, 0);
83-
84-
command_line =
85-
fml::CommandLineFromInitializerList({"command", "--msaa-samples=foobar"});
86-
settings = SettingsFromCommandLine(command_line);
87-
EXPECT_EQ(settings.msaa_samples, 0);
88-
}
89-
9072
TEST(SwitchesTest, EnableEmbedderAPI) {
9173
{
9274
// enable

shell/gpu/gpu_surface_metal_skia.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
#ifndef FLUTTER_SHELL_GPU_GPU_SURFACE_METAL_SKIA_H_
66
#define FLUTTER_SHELL_GPU_GPU_SURFACE_METAL_SKIA_H_
77

8-
#include "flutter/common/graphics/msaa_sample_count.h"
98
#include "flutter/flow/surface.h"
109
#include "flutter/fml/macros.h"
1110
#include "flutter/shell/gpu/gpu_surface_metal_delegate.h"
@@ -17,7 +16,6 @@ class SK_API_AVAILABLE_CA_METAL_LAYER GPUSurfaceMetalSkia : public Surface {
1716
public:
1817
GPUSurfaceMetalSkia(GPUSurfaceMetalDelegate* delegate,
1918
sk_sp<GrDirectContext> context,
20-
MsaaSampleCount msaa_samples,
2119
bool render_to_surface = true);
2220

2321
// |Surface|
@@ -31,7 +29,6 @@ class SK_API_AVAILABLE_CA_METAL_LAYER GPUSurfaceMetalSkia : public Surface {
3129
const MTLRenderTargetType render_target_type_;
3230
sk_sp<GrDirectContext> context_;
3331
GrDirectContext* precompiled_sksl_context_ = nullptr;
34-
MsaaSampleCount msaa_samples_ = MsaaSampleCount::kNone;
3532
// TODO(38466): Refactor GPU surface APIs take into account the fact that an
3633
// external view embedder may want to render to the root surface. This is a
3734
// hack to make avoid allocating resources for the root surface when an

shell/gpu/gpu_surface_metal_skia.mm

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@
3939
sk_sp<SkSurface> CreateSurfaceFromMetalTexture(GrDirectContext* context,
4040
id<MTLTexture> texture,
4141
GrSurfaceOrigin origin,
42-
MsaaSampleCount sample_cnt,
4342
SkColorType color_type,
4443
sk_sp<SkColorSpace> color_space,
4544
const SkSurfaceProps* props,
@@ -49,20 +48,18 @@
4948
info.fTexture.reset([texture retain]);
5049
GrBackendTexture backend_texture =
5150
GrBackendTextures::MakeMtl(texture.width, texture.height, skgpu::Mipmapped::kNo, info);
52-
return SkSurfaces::WrapBackendTexture(
53-
context, backend_texture, origin, static_cast<int>(sample_cnt), color_type,
54-
std::move(color_space), props, release_proc, release_context);
51+
return SkSurfaces::WrapBackendTexture(context, backend_texture, origin, 1, color_type,
52+
std::move(color_space), props, release_proc,
53+
release_context);
5554
}
5655
} // namespace
5756

5857
GPUSurfaceMetalSkia::GPUSurfaceMetalSkia(GPUSurfaceMetalDelegate* delegate,
5958
sk_sp<GrDirectContext> context,
60-
MsaaSampleCount msaa_samples,
6159
bool render_to_surface)
6260
: delegate_(delegate),
6361
render_target_type_(delegate->GetRenderTargetType()),
6462
context_(std::move(context)),
65-
msaa_samples_(msaa_samples),
6663
render_to_surface_(render_to_surface) {
6764
// If this preference is explicitly set, we allow for disabling partial repaint.
6865
NSNumber* disablePartialRepaint =
@@ -141,7 +138,6 @@
141138

142139
auto surface = CreateSurfaceFromMetalTexture(context_.get(), drawable.get().texture,
143140
kTopLeft_GrSurfaceOrigin, // origin
144-
msaa_samples_, // sample count
145141
kBGRA_8888_SkColorType, // color type
146142
nullptr, // colorspace
147143
nullptr, // surface properties
@@ -213,8 +209,8 @@
213209
}
214210

215211
sk_sp<SkSurface> surface = CreateSurfaceFromMetalTexture(
216-
context_.get(), mtl_texture, kTopLeft_GrSurfaceOrigin, msaa_samples_, kBGRA_8888_SkColorType,
217-
nullptr, nullptr, static_cast<SkSurfaces::TextureReleaseProc>(texture.destruction_callback),
212+
context_.get(), mtl_texture, kTopLeft_GrSurfaceOrigin, kBGRA_8888_SkColorType, nullptr,
213+
nullptr, static_cast<SkSurfaces::TextureReleaseProc>(texture.destruction_callback),
218214
texture.destruction_context);
219215

220216
if (!surface) {

shell/platform/android/android_context_gl_skia.cc

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,7 @@ static EGLResult<EGLContext> CreateContext(EGLDisplay display,
2424
return {context != EGL_NO_CONTEXT, context};
2525
}
2626

27-
static EGLResult<EGLConfig> ChooseEGLConfiguration(EGLDisplay display,
28-
uint8_t msaa_samples) {
29-
EGLint sample_buffers = msaa_samples > 1 ? 1 : 0;
27+
static EGLResult<EGLConfig> ChooseEGLConfiguration(EGLDisplay display) {
3028
EGLint attributes[] = {
3129
// clang-format off
3230
EGL_RENDERABLE_TYPE, EGL_OPENGL_ES2_BIT,
@@ -37,8 +35,6 @@ static EGLResult<EGLConfig> ChooseEGLConfiguration(EGLDisplay display,
3735
EGL_ALPHA_SIZE, 8,
3836
EGL_DEPTH_SIZE, 0,
3937
EGL_STENCIL_SIZE, 0,
40-
EGL_SAMPLES, static_cast<EGLint>(msaa_samples),
41-
EGL_SAMPLE_BUFFERS, sample_buffers,
4238
EGL_NONE, // termination sentinel
4339
// clang-format on
4440
};
@@ -66,8 +62,7 @@ static bool TeardownContext(EGLDisplay display, EGLContext context) {
6662

6763
AndroidContextGLSkia::AndroidContextGLSkia(
6864
fml::RefPtr<AndroidEnvironmentGL> environment,
69-
const TaskRunners& task_runners,
70-
uint8_t msaa_samples)
65+
const TaskRunners& task_runners)
7166
: AndroidContext(AndroidRenderingAPI::kSkiaOpenGLES),
7267
environment_(std::move(environment)),
7368
task_runners_(task_runners) {
@@ -79,8 +74,7 @@ AndroidContextGLSkia::AndroidContextGLSkia(
7974
bool success = false;
8075

8176
// Choose a valid configuration.
82-
std::tie(success, config_) =
83-
ChooseEGLConfiguration(environment_->Display(), msaa_samples);
77+
std::tie(success, config_) = ChooseEGLConfiguration(environment_->Display());
8478
if (!success) {
8579
FML_LOG(ERROR) << "Could not choose an EGL configuration.";
8680
LogLastEGLError();

0 commit comments

Comments
 (0)