1/*
2 * Copyright 2020 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 D3DTestContext_DEFINED
9#define D3DTestContext_DEFINED
10
11#include "tools/gpu/TestContext.h"
12
13#ifdef SK_DIRECT3D
14
15#include "include/gpu/d3d/GrD3DBackendContext.h"
16
17namespace sk_gpu_test {
18class D3DTestContext : public TestContext {
19public:
20    virtual GrBackendApi backend() override { return GrBackendApi::kDirect3D; }
21
22    const GrD3DBackendContext& getD3DBackendContext() const {
23        return fD3D;
24    }
25
26protected:
27    D3DTestContext(const GrD3DBackendContext& d3d, bool ownsContext)
28            : fD3D(d3d)
29            , fOwnsContext(ownsContext) {}
30
31    GrD3DBackendContext fD3D;
32    bool fOwnsContext;
33
34private:
35    using INHERITED = TestContext;
36};
37
38/**
39 * Creates D3D context object bound to the native D3D library.
40 */
41D3DTestContext* CreatePlatformD3DTestContext(D3DTestContext*);
42
43}  // namespace sk_gpu_test
44
45#endif
46
47#endif
48