Skip to content

Commit

Permalink
Fix diagnostic on iOS simulators. (flutter#71)
Browse files Browse the repository at this point in the history
  • Loading branch information
chinmaygarde authored and dnfield committed Apr 27, 2022
1 parent f3a6b3e commit 597c10e
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
7 changes: 7 additions & 0 deletions impeller/renderer/backend/metal/surface_mtl.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,12 @@ namespace impeller {

class SurfaceMTL final : public Surface {
public:
#pragma GCC diagnostic push
// Disable the diagnostic for iOS Simulators. Metal without emulation isn't
// available prior to iOS 13 and that's what the simulator headers say when
// support for CAMetalLayer begins. CAMetalLayer is available on iOS 8.0 and
// above which is well below Flutters support level.
#pragma GCC diagnostic ignored "-Wunguarded-availability-new"
//----------------------------------------------------------------------------
/// @brief Wraps the current drawable of the given Metal layer to create
/// a surface Impeller can render to. The surface must be created
Expand All @@ -29,6 +35,7 @@ class SurfaceMTL final : public Surface {
static std::unique_ptr<Surface> WrapCurrentMetalLayerDrawable(
std::shared_ptr<Context> context,
CAMetalLayer* layer);
#pragma GCC diagnostic pop

// |Surface|
~SurfaceMTL() override;
Expand Down
4 changes: 4 additions & 0 deletions impeller/renderer/backend/metal/surface_mtl.mm
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@

namespace impeller {

#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wunguarded-availability-new"

std::unique_ptr<Surface> SurfaceMTL::WrapCurrentMetalLayerDrawable(
std::shared_ptr<Context> context,
CAMetalLayer* layer) {
Expand Down Expand Up @@ -114,5 +117,6 @@
[drawable_ present];
return true;
}
#pragma GCC diagnostic pop

} // namespace impeller

0 comments on commit 597c10e

Please sign in to comment.