blob: 9d0a5e227aed1e3a8fc109aa202c26313a79d1b9 [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
Greg Danielda16cce2018-08-01 09:23:57 -040015#include "GrVulkanDefines.h"
bsalomon18a2f9d2016-05-11 10:09:18 -070016#include "vk/GrVkBackendContext.h"
17
18namespace sk_gpu_test {
19class VkTestContext : public TestContext {
20public:
21 virtual GrBackend backend() override { return kVulkan_GrBackend; }
bsalomon18a2f9d2016-05-11 10:09:18 -070022
Greg Danielf730c182018-07-02 20:15:37 +000023 const GrVkBackendContext& getVkBackendContext() {
Greg Daniel604b1972017-05-15 13:50:35 -040024 return fVk;
25 }
26
bsalomon18a2f9d2016-05-11 10:09:18 -070027protected:
Greg Daniel37329b32018-07-02 20:16:44 +000028 VkTestContext(const GrVkBackendContext& vk, bool ownsContext,
29 VkDebugReportCallbackEXT debugCallback)
30 : fVk(vk), fOwnsContext(ownsContext), fDebugCallback(debugCallback) {}
bsalomon18a2f9d2016-05-11 10:09:18 -070031
Greg Danielf730c182018-07-02 20:15:37 +000032 GrVkBackendContext fVk;
33 bool fOwnsContext;
Greg Daniel37329b32018-07-02 20:16:44 +000034 VkDebugReportCallbackEXT fDebugCallback = VK_NULL_HANDLE;
bsalomon18a2f9d2016-05-11 10:09:18 -070035
36private:
37 typedef TestContext INHERITED;
38};
39
40/**
41 * Creates Vk context object bound to the native Vk library.
42 */
Greg Daniel604b1972017-05-15 13:50:35 -040043VkTestContext* CreatePlatformVkTestContext(VkTestContext*);
bsalomon18a2f9d2016-05-11 10:09:18 -070044
45} // namespace sk_gpu_test
46
47#endif
48
49#endif