blob: 0e62cc0b8cfc2018008f9ce3a674638ea8c74e49 [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 Danielf730c182018-07-02 20:15:37 +000022 const GrVkBackendContext& getVkBackendContext() {
Greg Daniel604b1972017-05-15 13:50:35 -040023 return fVk;
24 }
25
Greg Danielf730c182018-07-02 20:15:37 +000026 const GrVkInterface* vk() const { return fVk.fInterface.get(); }
bsalomon18a2f9d2016-05-11 10:09:18 -070027
28protected:
Greg Danielf730c182018-07-02 20:15:37 +000029 VkTestContext(const GrVkBackendContext& vk, bool ownsContext)
30 : fVk(vk), fOwnsContext(ownsContext) {}
bsalomon18a2f9d2016-05-11 10:09:18 -070031
Greg Danielf730c182018-07-02 20:15:37 +000032 GrVkBackendContext fVk;
33 bool fOwnsContext;
bsalomon18a2f9d2016-05-11 10:09:18 -070034
35private:
36 typedef TestContext INHERITED;
37};
38
39/**
40 * Creates Vk context object bound to the native Vk library.
41 */
Greg Daniel604b1972017-05-15 13:50:35 -040042VkTestContext* CreatePlatformVkTestContext(VkTestContext*);
bsalomon18a2f9d2016-05-11 10:09:18 -070043
44} // namespace sk_gpu_test
45
46#endif
47
48#endif