xref: /aosp_15_r20/external/skia/tools/graphite/mtl/GraphiteMtlTestContext.h (revision c8dee2aa9b3f27cf6c858bd81872bdeb2c07ed17)
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 #include "include/gpu/graphite/mtl/MtlBackendContext.h"
14 
15 namespace skiatest::graphite {
16 
17 class MtlTestContext : public GraphiteTestContext {
18 public:
~MtlTestContext()19     ~MtlTestContext() override {}
20 
21     static std::unique_ptr<GraphiteTestContext> Make();
22 
backend()23     skgpu::BackendApi backend() override { return skgpu::BackendApi::kMetal; }
24 
25     skgpu::ContextType contextType() override;
26 
27     std::unique_ptr<skgpu::graphite::Context> makeContext(const TestOptions&) override;
28 
getBackendContext()29     const skgpu::graphite::MtlBackendContext& getBackendContext() const {
30         return fMtl;
31     }
32 
33 protected:
MtlTestContext(const skgpu::graphite::MtlBackendContext & mtl)34     MtlTestContext(const skgpu::graphite::MtlBackendContext& mtl) : fMtl(mtl) {}
35 
36     skgpu::graphite::MtlBackendContext fMtl;
37 };
38 
39 }  // namespace skiatest::graphite
40 
41 #endif // skiatest_graphite_MtlTestContext_DEFINED
42