Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(507)

Side by Side Diff: src/gpu/vk/GrVkExtensions.h

Issue 1785813002: Enable extension support and debug layer. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Fixes for line endings and versioning Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « include/gpu/vk/GrVkInterface.h ('k') | src/gpu/vk/GrVkExtensions.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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 GrVkExtensions_DEFINED
9 #define GrVkExtensions_DEFINED
10
11 #include "../../private/SkTArray.h"
12 #include "SkString.h"
13 #include "vulkan/vulkan.h"
14
15 /**
16 * This helper queries the current Vulkan context for its extensions and layers, remembers them,
17 * and can be queried. It supports queries for both instance and device extensio ns and layers.
18 */
19 class SK_API GrVkExtensions {
20 public:
21 GrVkExtensions() : fInitialized(false)
22 , fInstanceExtensionStrings(new SkTArray<SkString>)
23 , fDeviceExtensionStrings(new SkTArray<SkString>)
24 , fInstanceLayerStrings(new SkTArray<SkString>)
25 , fDeviceLayerStrings(new SkTArray<SkString>) {}
26
27 GrVkExtensions(const GrVkExtensions&);
28
29 GrVkExtensions& operator=(const GrVkExtensions&);
30
31 void swap(GrVkExtensions* that) {
32 fInstanceExtensionStrings.swap(that->fInstanceExtensionStrings);
33 fDeviceExtensionStrings.swap(that->fDeviceExtensionStrings);
34 fInstanceLayerStrings.swap(that->fInstanceLayerStrings);
35 fDeviceLayerStrings.swap(that->fDeviceLayerStrings);
36
37 SkTSwap(fInitialized, that->fInitialized);
38 }
39
40 /**
41 * We sometimes need to use this class without having yet created a GrVkInte rface.
42 */
43 bool init(uint32_t specVersion,
44 PFN_vkEnumerateInstanceExtensionProperties enumerateInstanceExtens ionProperties,
45 PFN_vkEnumerateDeviceExtensionProperties enumerateDeviceExtensionP roperties,
46 PFN_vkEnumerateInstanceLayerProperties enumerateInstanceLayerPrope rties,
47 PFN_vkEnumerateDeviceLayerProperties enumerateDeviceLayerPropertie s);
48
49 bool isInitialized() const { return fInitialized; }
50
51 /**
52 * Queries whether an extension or layer is present. Will fail if init() has not been called.
53 */
54 bool hasInstanceExtension(const char[]) const;
55 bool hasDeviceExtension(const char[]) const;
56 bool hasInstanceLayer(const char[]) const;
57 bool hasDeviceLayer(const char[]) const;
58
59 /**
60 * Removes an extension or layer if present. Returns true if it was present before the call.
61 */
62 bool removeInstanceExtension(const char[]);
63 bool removeDeviceExtension(const char[]);
64 bool removeInstanceLayer(const char[]);
65 bool removeDeviceLayer(const char[]);
66
67 /**
68 * Adds an extension or layer to list
69 */
70 void addInstanceExtension(const char[]);
71 void addDeviceExtension(const char[]);
72 void addInstanceLayer(const char[]);
73 void addDeviceLayer(const char[]);
74
75 void reset() {
76 fInstanceExtensionStrings->reset();
77 fDeviceExtensionStrings->reset();
78 fInstanceLayerStrings->reset();
79 fDeviceLayerStrings->reset();
80 }
81
82 void print(const char* sep = "\n") const;
83
84 private:
85 bool fInitialized;
86 SkAutoTDelete<SkTArray<SkString> > fInstanceExtensionStrings;
87 SkAutoTDelete<SkTArray<SkString> > fDeviceExtensionStrings;
88 SkAutoTDelete<SkTArray<SkString> > fInstanceLayerStrings;
89 SkAutoTDelete<SkTArray<SkString> > fDeviceLayerStrings;
90 };
91
92 #endif
OLDNEW
« no previous file with comments | « include/gpu/vk/GrVkInterface.h ('k') | src/gpu/vk/GrVkExtensions.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698