1 /* 2 * Copyright 2017 Google Inc. 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 MtlTestContext_h 9 #define MtlTestContext_h 10 11 #include "tools/gpu/TestContext.h" 12 13 #ifdef SK_METAL 14 15 #include "include/gpu/mtl/GrMtlBackendContext.h" 16 17 namespace sk_gpu_test { 18 class MtlTestContext : public TestContext { 19 public: backend()20 GrBackendApi backend() override { return GrBackendApi::kMetal; } 21 getMtlBackendContext()22 const GrMtlBackendContext& getMtlBackendContext() const { 23 return fMtl; 24 } 25 26 protected: MtlTestContext(const GrMtlBackendContext & mtl)27 MtlTestContext(const GrMtlBackendContext& mtl) 28 : fMtl(mtl) {} 29 30 GrMtlBackendContext fMtl; 31 32 private: 33 using INHERITED = TestContext; 34 }; 35 36 /** 37 * Creates Metal context object bound to the native Metal library. 38 */ 39 MtlTestContext* CreatePlatformMtlTestContext(MtlTestContext*); 40 41 } // namespace sk_gpu_test 42 43 #endif 44 45 #endif /* MtlTestContext_h */ 46