blob: 17c421563d0e204ee5bfead08d57a30c9463853a [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
Greg Daniel98bffae2018-08-01 13:25:41 -040018class GrVkExtensions;
19
bsalomon18a2f9d2016-05-11 10:09:18 -070020namespace sk_gpu_test {
21class VkTestContext : public TestContext {
22public:
23 virtual GrBackend backend() override { return kVulkan_GrBackend; }
bsalomon18a2f9d2016-05-11 10:09:18 -070024
Greg Daniel98bffae2018-08-01 13:25:41 -040025 const GrVkBackendContext& getVkBackendContext() const {
Greg Daniel604b1972017-05-15 13:50:35 -040026 return fVk;
27 }
28
Greg Daniel98bffae2018-08-01 13:25:41 -040029 const GrVkExtensions* getVkExtensions() const {
30 return fExtensions;
31 }
bsalomon18a2f9d2016-05-11 10:09:18 -070032
Greg Daniel98bffae2018-08-01 13:25:41 -040033protected:
34 VkTestContext(const GrVkBackendContext& vk, const GrVkExtensions* extensions, bool ownsContext,
35 VkDebugReportCallbackEXT debugCallback)
36 : fVk(vk)
37 , fExtensions(extensions)
38 , fOwnsContext(ownsContext)
39 , fDebugCallback(debugCallback) {}
40
41 GrVkBackendContext fVk;
42 const GrVkExtensions* fExtensions;
43 bool fOwnsContext;
Greg Daniel37329b32018-07-02 20:16:44 +000044 VkDebugReportCallbackEXT fDebugCallback = VK_NULL_HANDLE;
bsalomon18a2f9d2016-05-11 10:09:18 -070045
46private:
47 typedef TestContext INHERITED;
48};
49
50/**
51 * Creates Vk context object bound to the native Vk library.
52 */
Greg Daniel604b1972017-05-15 13:50:35 -040053VkTestContext* CreatePlatformVkTestContext(VkTestContext*);
bsalomon18a2f9d2016-05-11 10:09:18 -070054
55} // namespace sk_gpu_test
56
57#endif
58
59#endif