MCPcopy Create free account
hub / github.com/Inori/GPCS4 / createInstance

Method createInstance

GPCS4/Graphics/Violet/VltInstance.cpp:56–144  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

54 }
55
56 VkInstance VltInstance::createInstance()
57 {
58 VltInstanceExtensions insExtensions;
59
60 std::vector<VltExt*> insExtensionList = { {
61 &insExtensions.khrGetSurfaceCapabilities2,
62 &insExtensions.khrSurface,
63 } };
64
65 // merge platform extensions
66 auto platformExtensions = getPlatformExtensions();
67 for (auto& ext : platformExtensions)
68 {
69 insExtensionList.push_back(&ext);
70 }
71
72 std::vector<const char*> insLayers;
73
74#ifdef VLT_VALIDATION_AND_DEBUG
75 insExtensionList.push_back(&insExtensions.extDebugUtils);
76 insLayers.push_back("VK_LAYER_KHRONOS_validation");
77
78 VkDebugUtilsMessengerCreateInfoEXT debugInfo = {};
79 debugInfo.sType = VK_STRUCTURE_TYPE_DEBUG_UTILS_MESSENGER_CREATE_INFO_EXT;
80 debugInfo.messageSeverity = VK_DEBUG_UTILS_MESSAGE_SEVERITY_WARNING_BIT_EXT |
81 VK_DEBUG_UTILS_MESSAGE_SEVERITY_ERROR_BIT_EXT;
82 debugInfo.messageType = VK_DEBUG_UTILS_MESSAGE_TYPE_GENERAL_BIT_EXT |
83 VK_DEBUG_UTILS_MESSAGE_TYPE_VALIDATION_BIT_EXT
84 /* |VK_DEBUG_UTILS_MESSAGE_TYPE_PERFORMANCE_BIT_EXT*/;
85 debugInfo.pfnUserCallback = debugCallback;
86 debugInfo.pUserData = this;
87
88#endif
89
90 VltNameSet extensionsEnabled;
91 VltNameSet extensionsAvailable = VltNameSet::enumInstanceExtensions();
92
93 if (!extensionsAvailable.enableExtensions(
94 insExtensionList.size(),
95 insExtensionList.data(),
96 extensionsEnabled))
97 Logger::exception("DxvkInstance: Failed to create instance");
98
99 m_extensions = insExtensions;
100 VltNameList extensionNameList = extensionsEnabled.toNameList();
101
102 Logger::info("Enabled instance extensions:");
103 this->logNameList(extensionNameList);
104
105 std::string appName = GPCS4_APP_NAME;
106
107 VkApplicationInfo appInfo;
108 appInfo.sType = VK_STRUCTURE_TYPE_APPLICATION_INFO;
109 appInfo.pNext = nullptr;
110 appInfo.pApplicationName = appName.c_str();
111 appInfo.applicationVersion = 0;
112 appInfo.pEngineName = "Violet";
113 appInfo.engineVersion = VK_MAKE_VERSION(1, 0, 0);

Callers 1

VltInstanceMethod · 0.95

Calls 11

logNameListMethod · 0.95
exceptionFunction · 0.85
toNameListMethod · 0.80
namesMethod · 0.80
infoFunction · 0.50
push_backMethod · 0.45
enableExtensionsMethod · 0.45
sizeMethod · 0.45
dataMethod · 0.45
c_strMethod · 0.45
countMethod · 0.45

Tested by

no test coverage detected