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