This repository was archived by the owner on Feb 25, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 3 files changed +19
-1
lines changed Expand file tree Collapse file tree 3 files changed +19
-1
lines changed Original file line number Diff line number Diff line change 10
10
#include " flutter/lib/ui/ui_dart_state.h"
11
11
#include " fml/make_copyable.h"
12
12
#include " impeller/core/platform.h"
13
+ #include " impeller/renderer/context.h"
13
14
#include " tonic/converter/dart_converter.h"
14
15
15
16
namespace flutter {
16
17
namespace gpu {
17
18
19
+ bool SupportsNormalOffscreenMSAA (const impeller::Context& context) {
20
+ auto & capabilities = context.GetCapabilities ();
21
+ return capabilities->SupportsOffscreenMSAA () &&
22
+ !capabilities->SupportsImplicitResolvingMSAA ();
23
+ }
24
+
18
25
IMPLEMENT_WRAPPERTYPEINFO (flutter_gpu, Context);
19
26
20
27
std::shared_ptr<impeller::Context> Context::default_context_;
@@ -114,5 +121,5 @@ extern int InternalFlutterGpu_Context_GetMinimumUniformByteAlignment(
114
121
115
122
extern bool InternalFlutterGpu_Context_GetSupportsOffscreenMSAA (
116
123
flutter::gpu::Context* wrapper) {
117
- return wrapper->GetContext ()-> GetCapabilities ()-> SupportsOffscreenMSAA ( );
124
+ return flutter::gpu::SupportsNormalOffscreenMSAA (* wrapper->GetContext ());
118
125
}
Original file line number Diff line number Diff line change 13
13
namespace flutter {
14
14
namespace gpu {
15
15
16
+ bool SupportsNormalOffscreenMSAA (const impeller::Context& context);
17
+
16
18
class Context : public RefCountedDartWrappable <Context> {
17
19
DEFINE_WRAPPERTYPEINFO ();
18
20
FML_FRIEND_MAKE_REF_COUNTED (Context);
Original file line number Diff line number Diff line change 20
20
#include " impeller/renderer/pipeline.h"
21
21
#include " impeller/renderer/pipeline_descriptor.h"
22
22
#include " impeller/renderer/pipeline_library.h"
23
+ #include " lib/gpu/context.h"
23
24
#include " lib/ui/ui_dart_state.h"
24
25
#include " tonic/converter/dart_converter.h"
25
26
@@ -242,6 +243,14 @@ Dart_Handle InternalFlutterGpu_RenderPass_SetColorAttachment(
242
243
tonic::DartConverter<flutter::gpu::Texture*>::FromDart (
243
244
resolve_texture_wrapper);
244
245
desc.resolve_texture = resolve_texture->GetTexture ();
246
+
247
+ // If the backend doesn't support normal MSAA, gracefully fallback to
248
+ // rendering without MSAA.
249
+ if (!flutter::gpu::SupportsNormalOffscreenMSAA (*wrapper->GetContext ())) {
250
+ desc.texture = desc.resolve_texture ;
251
+ desc.resolve_texture = nullptr ;
252
+ desc.store_action = impeller::StoreAction::kStore ;
253
+ }
245
254
}
246
255
wrapper->GetRenderTarget ().SetColorAttachment (desc, color_attachment_index);
247
256
return Dart_Null ();
You can’t perform that action at this time.
0 commit comments