blob: 8de28f4d49c9a9f65ee95865564a0063aa5df695 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
|
/*
* Copyright 2016 Google Inc.
*
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
#ifndef GrVkExtensions_DEFINED
#define GrVkExtensions_DEFINED
#include "../private/SkTArray.h"
#include "SkString.h"
#include "vk/GrVkDefines.h"
#include "vk/GrVkInterface.h"
/**
* This helper queries the Vulkan driver for available extensions and layers, remembers them,
* and can be queried. It supports queries for both instance and device extensions and layers.
*/
class SK_API GrVkExtensions {
public:
GrVkExtensions(GrVkInterface::GetProc getProc)
: fGetProc(getProc)
, fInstanceExtensionStrings(new SkTArray<SkString>)
, fDeviceExtensionStrings(new SkTArray<SkString>)
, fInstanceLayerStrings(new SkTArray<SkString>)
, fDeviceLayerStrings(new SkTArray<SkString>) {}
bool initInstance(uint32_t specVersion);
bool initDevice(uint32_t specVersion, VkInstance, VkPhysicalDevice);
/**
* Queries whether an extension or layer is present. Will fail if not initialized.
*/
bool hasInstanceExtension(const char[]) const;
bool hasDeviceExtension(const char[]) const;
bool hasInstanceLayer(const char[]) const;
bool hasDeviceLayer(const char[]) const;
void print(const char* sep = "\n") const;
private:
GrVkInterface::GetProc fGetProc;
std::unique_ptr<SkTArray<SkString>> fInstanceExtensionStrings;
std::unique_ptr<SkTArray<SkString>> fDeviceExtensionStrings;
std::unique_ptr<SkTArray<SkString>> fInstanceLayerStrings;
std::unique_ptr<SkTArray<SkString>> fDeviceLayerStrings;
};
#endif
|