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

Unified 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « include/gpu/vk/GrVkInterface.h ('k') | src/gpu/vk/GrVkExtensions.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/vk/GrVkExtensions.h
diff --git a/src/gpu/vk/GrVkExtensions.h b/src/gpu/vk/GrVkExtensions.h
new file mode 100644
index 0000000000000000000000000000000000000000..d1d57e424a8e3db07e6fa277798e72ab09cee7ab
--- /dev/null
+++ b/src/gpu/vk/GrVkExtensions.h
@@ -0,0 +1,92 @@
+/*
+ * 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 "vulkan/vulkan.h"
+
+/**
+ * This helper queries the current Vulkan context for its 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() : fInitialized(false)
+ , fInstanceExtensionStrings(new SkTArray<SkString>)
+ , fDeviceExtensionStrings(new SkTArray<SkString>)
+ , fInstanceLayerStrings(new SkTArray<SkString>)
+ , fDeviceLayerStrings(new SkTArray<SkString>) {}
+
+ GrVkExtensions(const GrVkExtensions&);
+
+ GrVkExtensions& operator=(const GrVkExtensions&);
+
+ void swap(GrVkExtensions* that) {
+ fInstanceExtensionStrings.swap(that->fInstanceExtensionStrings);
+ fDeviceExtensionStrings.swap(that->fDeviceExtensionStrings);
+ fInstanceLayerStrings.swap(that->fInstanceLayerStrings);
+ fDeviceLayerStrings.swap(that->fDeviceLayerStrings);
+
+ SkTSwap(fInitialized, that->fInitialized);
+ }
+
+ /**
+ * We sometimes need to use this class without having yet created a GrVkInterface.
+ */
+ bool init(uint32_t specVersion,
+ PFN_vkEnumerateInstanceExtensionProperties enumerateInstanceExtensionProperties,
+ PFN_vkEnumerateDeviceExtensionProperties enumerateDeviceExtensionProperties,
+ PFN_vkEnumerateInstanceLayerProperties enumerateInstanceLayerProperties,
+ PFN_vkEnumerateDeviceLayerProperties enumerateDeviceLayerProperties);
+
+ bool isInitialized() const { return fInitialized; }
+
+ /**
+ * Queries whether an extension or layer is present. Will fail if init() has not been called.
+ */
+ bool hasInstanceExtension(const char[]) const;
+ bool hasDeviceExtension(const char[]) const;
+ bool hasInstanceLayer(const char[]) const;
+ bool hasDeviceLayer(const char[]) const;
+
+ /**
+ * Removes an extension or layer if present. Returns true if it was present before the call.
+ */
+ bool removeInstanceExtension(const char[]);
+ bool removeDeviceExtension(const char[]);
+ bool removeInstanceLayer(const char[]);
+ bool removeDeviceLayer(const char[]);
+
+ /**
+ * Adds an extension or layer to list
+ */
+ void addInstanceExtension(const char[]);
+ void addDeviceExtension(const char[]);
+ void addInstanceLayer(const char[]);
+ void addDeviceLayer(const char[]);
+
+ void reset() {
+ fInstanceExtensionStrings->reset();
+ fDeviceExtensionStrings->reset();
+ fInstanceLayerStrings->reset();
+ fDeviceLayerStrings->reset();
+ }
+
+ void print(const char* sep = "\n") const;
+
+private:
+ bool fInitialized;
+ SkAutoTDelete<SkTArray<SkString> > fInstanceExtensionStrings;
+ SkAutoTDelete<SkTArray<SkString> > fDeviceExtensionStrings;
+ SkAutoTDelete<SkTArray<SkString> > fInstanceLayerStrings;
+ SkAutoTDelete<SkTArray<SkString> > fDeviceLayerStrings;
+};
+
+#endif
« 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