blob: 9fd4170d9d0593125de98d863b253a4e9157538c [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; }
bsalomon18a2f9d2016-05-11 10:09:18 -070021
Greg Daniel007267b2018-06-28 23:31:00 +000022 sk_sp<const GrVkBackendContext> getVkBackendContext() {
Greg Daniel604b1972017-05-15 13:50:35 -040023 return fVk;
24 }
25
Greg Daniel007267b2018-06-28 23:31:00 +000026 const GrVkInterface* vk() const { return fVk->fInterface.get(); }
bsalomon18a2f9d2016-05-11 10:09:18 -070027
28protected:
Greg Daniel007267b2018-06-28 23:31:00 +000029 VkTestContext(sk_sp<const GrVkBackendContext> vk) : fVk(std::move(vk)) {}
bsalomon18a2f9d2016-05-11 10:09:18 -070030
Greg Daniel007267b2018-06-28 23:31:00 +000031 sk_sp<const GrVkBackendContext> fVk;
bsalomon18a2f9d2016-05-11 10:09:18 -070032
33private:
34 typedef TestContext INHERITED;
35};
36
37/**
38 * Creates Vk context object bound to the native Vk library.
39 */
Greg Daniel604b1972017-05-15 13:50:35 -040040VkTestContext* CreatePlatformVkTestContext(VkTestContext*);
bsalomon18a2f9d2016-05-11 10:09:18 -070041
42} // namespace sk_gpu_test
43
44#endif
45
46#endif