Flutter Engine
The Flutter Engine
VkTestContext.h
Go to the documentation of this file.
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
12
13#ifdef SK_VULKAN
14
17
18namespace skgpu { class VulkanExtensions; }
19
20namespace sk_gpu_test {
21class VkTestContext : public TestContext {
22public:
23 GrBackendApi backend() override { return GrBackendApi::kVulkan; }
24
25 const skgpu::VulkanBackendContext& getVkBackendContext() const { return fVk; }
26
27 const skgpu::VulkanExtensions* getVkExtensions() const {
28 return fExtensions;
29 }
30
31 const VkPhysicalDeviceFeatures2* getVkFeatures() const {
32 return fFeatures;
33 }
34
35protected:
36 VkTestContext(const skgpu::VulkanBackendContext& vk,
38 const VkPhysicalDeviceFeatures2* features,
39 bool ownsContext,
40 VkDebugReportCallbackEXT debugCallback,
42 : fVk(vk)
43 , fExtensions(extensions)
44 , fFeatures(features)
45 , fOwnsContext(ownsContext)
46 , fDebugCallback(debugCallback)
47 , fDestroyDebugReportCallbackEXT(destroyCallback) {}
48
50 const skgpu::VulkanExtensions* fExtensions;
51 const VkPhysicalDeviceFeatures2* fFeatures;
52 bool fOwnsContext;
53 VkDebugReportCallbackEXT fDebugCallback = VK_NULL_HANDLE;
54 PFN_vkDestroyDebugReportCallbackEXT fDestroyDebugReportCallbackEXT = nullptr;
55
56private:
57 using INHERITED = TestContext;
58};
59
60/**
61 * Creates Vk context object bound to the native Vk library.
62 */
63VkTestContext* CreatePlatformVkTestContext(VkTestContext*);
64
65} // namespace sk_gpu_test
66
67#endif
68
69#endif
const char * backend
GrBackendApi
Definition: GrTypes.h:95
#define INHERITED(method,...)
Definition: SkRecorder.cpp:128
vk
Definition: malisc.py:42
Definition: GpuTools.h:21
void(VKAPI_PTR * PFN_vkDestroyDebugReportCallbackEXT)(VkInstance instance, VkDebugReportCallbackEXT callback, const VkAllocationCallbacks *pAllocator)
#define VK_NULL_HANDLE
Definition: vulkan_core.h:46