Debian Codegraph @

tools/graphite/vk/GraphiteVulkanTestContext.h

raw
1 /*
2 * Copyright 2022 Google LLC
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 skiatest_graphite_VulkanTestContext_DEFINED
9 #define skiatest_graphite_VulkanTestContext_DEFINED
10
11 #include "tools/gpu/vk/VkTestUtils.h"
12 #include "tools/graphite/GraphiteTestContext.h"
13
14 #include "include/gpu/vk/VulkanBackendContext.h"
15
16 namespace skiatest::graphite {
17
18 class VulkanTestContext : public GraphiteTestContext {
19 public:
20 ~VulkanTestContext() override;
21
22 static std::unique_ptr<GraphiteTestContext> Make();
23
24 skgpu::BackendApi backend() override { return skgpu::BackendApi::kVulkan; }
25
26 skgpu::ContextType contextType() override;
27
28 std::unique_ptr<skgpu::graphite::Context> makeContext(const TestOptions&) override;
29
30 const skgpu::VulkanBackendContext& getBackendContext() const {
31 return fVulkan;
32 }
33
34 private:
35 VulkanTestContext(const skgpu::VulkanBackendContext& vulkan,
36 const skgpu::VulkanExtensions* extensions,
37 const sk_gpu_test::TestVkFeatures* features,
38 VkDebugUtilsMessengerEXT debugMessenger,
39 PFN_vkDestroyDebugUtilsMessengerEXT destroyCallback)
40 : fVulkan(vulkan)
41 , fExtensions(extensions)
42 , fFeatures(features)
43 , fDebugMessenger(debugMessenger)
44 , fDestroyDebugUtilsMessengerEXT(destroyCallback) {}
45
46 skgpu::VulkanBackendContext fVulkan;
47 const skgpu::VulkanExtensions* fExtensions;
48 const sk_gpu_test::TestVkFeatures* fFeatures;
49 VkDebugUtilsMessengerEXT fDebugMessenger = VK_NULL_HANDLE;
50 PFN_vkDestroyDebugUtilsMessengerEXT fDestroyDebugUtilsMessengerEXT = nullptr;
51 };
52
53 } // namespace skiatest::graphite
54
55 #endif // skiatest_graphite_VulkanTestContext_DEFINED