Debian Codegraph @

tools/ganesh/vk/VkTestContext.h

raw
1 /*
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 "tools/ganesh/TestContext.h"
12
13 #ifdef SK_VULKAN
14
15 #include "include/gpu/vk/VulkanBackendContext.h"
16 #include "tools/gpu/vk/VkTestUtils.h"
17 #include "tools/gpu/vk/VulkanDefines.h"
18
19 namespace skgpu { class VulkanExtensions; }
20
21 namespace sk_gpu_test {
22 class VkTestContext : public TestContext {
23 public:
24 GrBackendApi backend() override { return GrBackendApi::kVulkan; }
25
26 const skgpu::VulkanBackendContext& getVkBackendContext() const { return fVk; }
27
28 const skgpu::VulkanExtensions* getVkExtensions() const {
29 return fExtensions;
30 }
31
32 const sk_gpu_test::TestVkFeatures* getVkFeatures() const { return fFeatures; }
33
34 protected:
35 VkTestContext(const skgpu::VulkanBackendContext& vk,
36 const skgpu::VulkanExtensions* extensions,
37 const sk_gpu_test::TestVkFeatures* features,
38 bool ownsContext,
39 VkDebugUtilsMessengerEXT debugMessenger,
40 PFN_vkDestroyDebugUtilsMessengerEXT destroyCallback)
41 : fVk(vk)
42 , fExtensions(extensions)
43 , fFeatures(features)
44 , fOwnsContext(ownsContext)
45 , fDebugMessenger(debugMessenger)
46 , fDestroyDebugUtilsMessengerEXT(destroyCallback) {}
47
48 skgpu::VulkanBackendContext fVk;
49 const skgpu::VulkanExtensions* fExtensions;
50 const sk_gpu_test::TestVkFeatures* fFeatures;
51 bool fOwnsContext;
52 VkDebugUtilsMessengerEXT fDebugMessenger = VK_NULL_HANDLE;
53 PFN_vkDestroyDebugUtilsMessengerEXT fDestroyDebugUtilsMessengerEXT = nullptr;
54
55 private:
56 using INHERITED = TestContext;
57 };
58
59 /**
60 * Creates Vk context object bound to the native Vk library.
61 */
62 VkTestContext* CreatePlatformVkTestContext(VkTestContext*);
63
64 } // namespace sk_gpu_test
65
66 #endif
67
68 #endif