Fix diagnostic on iOS simulators. (flutter/engine#71)

This commit is contained in:
Chinmay Garde
2022-03-10 15:34:46 -08:00
committed by Dan Field
parent 0648a2a261
commit 0cef8082c3
2 changed files with 11 additions and 0 deletions

View File

@@ -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
@@ -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;

View File

@@ -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) {
@@ -114,5 +117,6 @@ bool SurfaceMTL::Present() const {
[drawable_ present];
return true;
}
#pragma GCC diagnostic pop
} // namespace impeller