Coverage Report

Created: 2024-05-20 07:14

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