MCPcopy Create free account
hub / github.com/RavEngine/RavEngine / createInstance

Function createInstance

deps/SDL2/test/testvulkan.c:245–291  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

243}
244
245static void createInstance(void)
246{
247 VkApplicationInfo appInfo = {0};
248 VkInstanceCreateInfo instanceCreateInfo = {0};
249 const char **extensions = NULL;
250 unsigned extensionCount = 0;
251 VkResult result;
252
253
254 appInfo.sType = VK_STRUCTURE_TYPE_APPLICATION_INFO;
255 appInfo.apiVersion = VK_API_VERSION_1_0;
256 instanceCreateInfo.sType = VK_STRUCTURE_TYPE_INSTANCE_CREATE_INFO;
257 instanceCreateInfo.pApplicationInfo = &appInfo;
258 if(!SDL_Vulkan_GetInstanceExtensions(NULL, &extensionCount, NULL))
259 {
260 SDL_LogError(SDL_LOG_CATEGORY_APPLICATION,
261 "SDL_Vulkan_GetInstanceExtensions(): %s\n",
262 SDL_GetError());
263 quit(2);
264 }
265 extensions = SDL_malloc(sizeof(const char *) * extensionCount);
266 if(!extensions)
267 {
268 SDL_OutOfMemory();
269 quit(2);
270 }
271 if(!SDL_Vulkan_GetInstanceExtensions(NULL, &extensionCount, extensions))
272 {
273 SDL_free((void*)extensions);
274 SDL_LogError(SDL_LOG_CATEGORY_APPLICATION,
275 "SDL_Vulkan_GetInstanceExtensions(): %s\n",
276 SDL_GetError());
277 quit(2);
278 }
279 instanceCreateInfo.enabledExtensionCount = extensionCount;
280 instanceCreateInfo.ppEnabledExtensionNames = extensions;
281 result = vkCreateInstance(&instanceCreateInfo, NULL, &vulkanContext.instance);
282 SDL_free((void*)extensions);
283 if(result != VK_SUCCESS)
284 {
285 vulkanContext.instance = VK_NULL_HANDLE;
286 SDL_LogError(SDL_LOG_CATEGORY_APPLICATION,
287 "vkCreateInstance(): %s\n",
288 getVulkanResultString(result));
289 quit(2);
290 }
291}
292
293static void loadInstanceFunctions(void)
294{

Callers 12

createInstanceMethod · 0.85
createInstanceMethod · 0.85
PxCreateBasePhysicsFunction · 0.85
addMethod · 0.85
addRigidNoSimMethod · 0.85
processUserUpdatesMethod · 0.85
PxCreateFoundationFunction · 0.85
createInstanceMethod · 0.85
initVulkanFunction · 0.85

Calls 7

SDL_LogErrorFunction · 0.85
SDL_GetErrorFunction · 0.85
SDL_mallocFunction · 0.85
SDL_freeFunction · 0.85
getVulkanResultStringFunction · 0.85
quitFunction · 0.70

Tested by

no test coverage detected