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

Unified Diff: src/gpu/vk/GrVkInterface.cpp

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 | « src/gpu/vk/GrVkGpu.cpp ('k') | src/gpu/vk/GrVkUtil.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/vk/GrVkInterface.cpp
diff --git a/src/gpu/vk/GrVkInterface.cpp b/src/gpu/vk/GrVkInterface.cpp
index 07e85fcd5b44d5184d6f141e52539f79c31dfce5..4b12e13f0cfeb1bea7ef793bdb5ce46416131cd1 100644
--- a/src/gpu/vk/GrVkInterface.cpp
+++ b/src/gpu/vk/GrVkInterface.cpp
@@ -6,14 +6,30 @@
*/
#include "vk/GrVkInterface.h"
+#include "vk/GrVkUtil.h"
GrVkInterface::GrVkInterface() {
}
#define GET_PROC(F) functions->f ## F = (PFN_vk ## F) vkGetInstanceProcAddr(instance, "vk" #F)
+#define GET_PROC_LOCAL(inst, F) PFN_vk ## F F = (PFN_vk ## F) vkGetInstanceProcAddr(inst, "vk" #F)
const GrVkInterface* GrVkCreateInterface(VkInstance instance) {
+ GET_PROC_LOCAL(nullptr, EnumerateInstanceExtensionProperties);
+ GET_PROC_LOCAL(instance, EnumerateDeviceExtensionProperties);
+ GET_PROC_LOCAL(nullptr, EnumerateInstanceLayerProperties);
+ GET_PROC_LOCAL(instance, EnumerateDeviceLayerProperties);
+
+ GrVkExtensions extensions;
+ if (!extensions.init(kGrVkMinimumVersion,
+ EnumerateInstanceExtensionProperties,
+ EnumerateDeviceExtensionProperties,
+ EnumerateInstanceLayerProperties,
+ EnumerateDeviceLayerProperties)) {
+ return nullptr;
+ }
+
GrVkInterface* interface = new GrVkInterface();
GrVkInterface::Functions* functions = &interface->fFunctions;
@@ -152,6 +168,7 @@ const GrVkInterface* GrVkCreateInterface(VkInstance instance) {
GET_PROC(CmdNextSubpass);
GET_PROC(CmdEndRenderPass);
GET_PROC(CmdExecuteCommands);
+ // TODO: break these out with extension checks
GET_PROC(DestroySurfaceKHR);
GET_PROC(GetPhysicalDeviceSurfaceSupportKHR);
GET_PROC(GetPhysicalDeviceSurfaceCapabilitiesKHR);
@@ -171,6 +188,14 @@ const GrVkInterface* GrVkCreateInterface(VkInstance instance) {
GET_PROC(CreateDisplayPlaneSurfaceKHR);
GET_PROC(CreateSharedSwapchainsKHR);
+ if (extensions.hasInstanceExtension(VK_EXT_DEBUG_REPORT_EXTENSION_NAME)) {
+ GET_PROC(CreateDebugReportCallbackEXT);
+ GET_PROC(DebugReportMessageEXT);
+ GET_PROC(DestroyDebugReportCallbackEXT);
+ }
+
+ interface->fExtensions.swap(&extensions);
+
return interface;
}
@@ -332,7 +357,10 @@ bool GrVkInterface::validate() const {
NULL == fFunctions.fCreateDisplayModeKHR ||
NULL == fFunctions.fGetDisplayPlaneCapabilitiesKHR ||
NULL == fFunctions.fCreateDisplayPlaneSurfaceKHR ||
- NULL == fFunctions.fCreateSharedSwapchainsKHR) {
+ NULL == fFunctions.fCreateSharedSwapchainsKHR ||
+ NULL == fFunctions.fCreateDebugReportCallbackEXT ||
+ NULL == fFunctions.fDebugReportMessageEXT ||
+ NULL == fFunctions.fDestroyDebugReportCallbackEXT) {
return false;
}
return true;
« no previous file with comments | « src/gpu/vk/GrVkGpu.cpp ('k') | src/gpu/vk/GrVkUtil.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698