1/*
2 * Copyright 2016 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 VkTestContext_DEFINED
9#define VkTestContext_DEFINED
10
11#include "TestContext.h"
12
13#ifdef SK_VULKAN
14
15#include "vk/GrVkBackendContext.h"
16
17namespace sk_gpu_test {
18class VkTestContext : public TestContext {
19public:
20    virtual GrBackend backend() override { return kVulkan_GrBackend; }
21    virtual GrBackendContext backendContext() override {
22        return reinterpret_cast<GrBackendContext>(fVk.get());
23    }
24
25    sk_sp<const GrVkBackendContext> getVkBackendContext() {
26        return fVk;
27    }
28
29    const GrVkInterface* vk() const { return fVk->fInterface.get(); }
30
31protected:
32    VkTestContext(sk_sp<const GrVkBackendContext> vk) : fVk(std::move(vk)) {}
33
34    sk_sp<const GrVkBackendContext> fVk;
35
36private:
37    typedef TestContext INHERITED;
38};
39
40/**
41 * Creates Vk context object bound to the native Vk library.
42 */
43VkTestContext* CreatePlatformVkTestContext(VkTestContext*);
44
45}  // namespace sk_gpu_test
46
47#endif
48
49#endif
50