blob: ecec17b7dc08f6d4a31b2f128707fae1d0bd8a22 [file] [log] [blame]
bsalomon18a2f9d2016-05-11 10:09:18 -07001/*
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 bool isValid() const override { return NULL != this->vk(); }
26
bungeman6bd52842016-10-27 09:30:08 -070027 const GrVkInterface* vk() const { return fVk->fInterface.get(); }
bsalomon18a2f9d2016-05-11 10:09:18 -070028
29protected:
Mike Klein6ad6ba42016-09-27 10:52:35 -040030 VkTestContext(sk_sp<const GrVkBackendContext> vk) : fVk(std::move(vk)) {}
bsalomon18a2f9d2016-05-11 10:09:18 -070031
32 sk_sp<const GrVkBackendContext> fVk;
33
34private:
35 typedef TestContext INHERITED;
36};
37
38/**
39 * Creates Vk context object bound to the native Vk library.
40 */
41VkTestContext* CreatePlatformVkTestContext();
42
43} // namespace sk_gpu_test
44
45#endif
46
47#endif