1 /* 2 * Copyright 2021 Google LLC 3 * 4 * Use of this source code is governed by a BSD-style license that can be 5 * found in the LICENSE file. 6 */ 7 8 #ifndef skiatest_graphite_MtlTestContext_DEFINED 9 #define skiatest_graphite_MtlTestContext_DEFINED 10 11 #include "tools/graphite/GraphiteTestContext.h" 12 13 #ifdef SK_METAL 14 15 #include "experimental/graphite/include/mtl/MtlBackendContext.h" 16 17 namespace skiatest::graphite::mtl { 18 19 class TestContext : public GraphiteTestContext { 20 public: ~TestContext()21 ~TestContext() override {} 22 23 static std::unique_ptr<GraphiteTestContext> Make(); 24 backend()25 skgpu::BackendApi backend() override { return skgpu::BackendApi::kMetal; } 26 27 sk_sp<skgpu::Context> makeContext() override; 28 getBackendContext()29 const skgpu::mtl::BackendContext& getBackendContext() const { 30 return fMtl; 31 } 32 33 protected: TestContext(const skgpu::mtl::BackendContext & mtl)34 TestContext(const skgpu::mtl::BackendContext& mtl) : fMtl(mtl) {} 35 36 skgpu::mtl::BackendContext fMtl; 37 }; 38 39 } // namespace skiatest::graphite::mtl 40 41 #endif // SK_METAL 42 43 #endif // skiatest_graphite_MtlTestContext_DEFINED 44