Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
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 GrVkBackendContext& getVkBackendContext() const {
26 return fVk;
27 }
28
29 const skgpu::VulkanExtensions* getVkExtensions() const {
30 return fExtensions;
31 }
32
33 const VkPhysicalDeviceFeatures2* getVkFeatures() const {
34 return fFeatures;
35 }
36
37protected:
38 VkTestContext(const GrVkBackendContext& vk, const skgpu::VulkanExtensions* extensions,
39 const VkPhysicalDeviceFeatures2* features, 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,...)
void(VKAPI_PTR * PFN_vkDestroyDebugReportCallbackEXT)(VkInstance instance, VkDebugReportCallbackEXT callback, const VkAllocationCallbacks *pAllocator)
#define VK_NULL_HANDLE
Definition vulkan_core.h:46