1cb93a386Sopenharmony_ci/* 2cb93a386Sopenharmony_ci * Copyright 2017 Google Inc. 3cb93a386Sopenharmony_ci * 4cb93a386Sopenharmony_ci * Use of this source code is governed by a BSD-style license that can be 5cb93a386Sopenharmony_ci * found in the LICENSE file. 6cb93a386Sopenharmony_ci */ 7cb93a386Sopenharmony_ci 8cb93a386Sopenharmony_ci#ifndef MtlTestContext_h 9cb93a386Sopenharmony_ci#define MtlTestContext_h 10cb93a386Sopenharmony_ci 11cb93a386Sopenharmony_ci#include "tools/gpu/TestContext.h" 12cb93a386Sopenharmony_ci 13cb93a386Sopenharmony_ci#ifdef SK_METAL 14cb93a386Sopenharmony_ci 15cb93a386Sopenharmony_ci#include "include/gpu/mtl/GrMtlBackendContext.h" 16cb93a386Sopenharmony_ci 17cb93a386Sopenharmony_cinamespace sk_gpu_test { 18cb93a386Sopenharmony_ciclass MtlTestContext : public TestContext { 19cb93a386Sopenharmony_cipublic: 20cb93a386Sopenharmony_ci GrBackendApi backend() override { return GrBackendApi::kMetal; } 21cb93a386Sopenharmony_ci 22cb93a386Sopenharmony_ci const GrMtlBackendContext& getMtlBackendContext() const { 23cb93a386Sopenharmony_ci return fMtl; 24cb93a386Sopenharmony_ci } 25cb93a386Sopenharmony_ci 26cb93a386Sopenharmony_ciprotected: 27cb93a386Sopenharmony_ci MtlTestContext(const GrMtlBackendContext& mtl) 28cb93a386Sopenharmony_ci : fMtl(mtl) {} 29cb93a386Sopenharmony_ci 30cb93a386Sopenharmony_ci GrMtlBackendContext fMtl; 31cb93a386Sopenharmony_ci 32cb93a386Sopenharmony_ciprivate: 33cb93a386Sopenharmony_ci using INHERITED = TestContext; 34cb93a386Sopenharmony_ci}; 35cb93a386Sopenharmony_ci 36cb93a386Sopenharmony_ci/** 37cb93a386Sopenharmony_ci * Creates Metal context object bound to the native Metal library. 38cb93a386Sopenharmony_ci */ 39cb93a386Sopenharmony_ciMtlTestContext* CreatePlatformMtlTestContext(MtlTestContext*); 40cb93a386Sopenharmony_ci 41cb93a386Sopenharmony_ci} // namespace sk_gpu_test 42cb93a386Sopenharmony_ci 43cb93a386Sopenharmony_ci#endif 44cb93a386Sopenharmony_ci 45cb93a386Sopenharmony_ci#endif /* MtlTestContext_h */ 46