Skip to content

Commit

Permalink
Added getting an error when creating vkDevice
Browse files Browse the repository at this point in the history
  • Loading branch information
tx00100xt committed Jun 2, 2022
1 parent c8b8907 commit f92e991
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 6 deletions.
27 changes: 24 additions & 3 deletions SamTFE/Sources/Engine/Graphics/Gfx_Vulkan.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -808,9 +808,30 @@ BOOL SvkMain::CreateDevice()
createInfo.ppEnabledLayerNames = &gl_VkLayers[0];
#endif

if (vkCreateDevice(gl_VkPhysDevice, &createInfo, nullptr, &gl_VkDevice) != VK_SUCCESS)
{
return FALSE;
VkResult result = vkCreateDevice(gl_VkPhysDevice, &createInfo, nullptr, &gl_VkDevice);
if (result == VK_ERROR_OUT_OF_HOST_MEMORY) {
CPrintF("Vulkan error: VK_ERROR_OUT_OF_HOST_MEMORY!\n");
return FALSE;
} else if (result == VK_ERROR_OUT_OF_DEVICE_MEMORY) {
CPrintF("Vulkan error: VK_ERROR_OUT_OF_DEVICE_MEMORY!\n");
return FALSE;
} else if (result == VK_ERROR_INITIALIZATION_FAILED) {
CPrintF("Vulkan error: VK_ERROR_INITIALIZATION_FAILED!\n");
return FALSE;
} else if (result == VK_ERROR_EXTENSION_NOT_PRESENT) {
CPrintF("Vulkan error: VK_ERROR_EXTENSION_NOT_PRESENT!\n");
return FALSE;
} else if (result == VK_ERROR_FEATURE_NOT_PRESENT) {
CPrintF("Vulkan error: VK_ERROR_FEATURE_NOT_PRESENT!\n");
return FALSE;
} else if (result == VK_ERROR_TOO_MANY_OBJECTS) {
CPrintF("Vulkan error: VK_ERROR_TOO_MANY_OBJECTS!\n");
return FALSE;
} else if (result == VK_ERROR_DEVICE_LOST) {
CPrintF("Vulkan error: VK_ERROR_DEVICE_LOST!\n");
return FALSE;
} else if (result == VK_SUCCESS) {
CPrintF("Vulkan: vkCreateDevice Success\n");
}

vkGetDeviceQueue(gl_VkDevice, gl_VkQueueFamGraphics, 0, &gl_VkQueueGraphics);
Expand Down
27 changes: 24 additions & 3 deletions SamTSE/Sources/Engine/Graphics/Gfx_Vulkan.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -808,9 +808,30 @@ BOOL SvkMain::CreateDevice()
createInfo.ppEnabledLayerNames = &gl_VkLayers[0];
#endif

if (vkCreateDevice(gl_VkPhysDevice, &createInfo, nullptr, &gl_VkDevice) != VK_SUCCESS)
{
return FALSE;
VkResult result = vkCreateDevice(gl_VkPhysDevice, &createInfo, nullptr, &gl_VkDevice);
if (result == VK_ERROR_OUT_OF_HOST_MEMORY) {
CPrintF("Vulkan error: VK_ERROR_OUT_OF_HOST_MEMORY!\n");
return FALSE;
} else if (result == VK_ERROR_OUT_OF_DEVICE_MEMORY) {
CPrintF("Vulkan error: VK_ERROR_OUT_OF_DEVICE_MEMORY!\n");
return FALSE;
} else if (result == VK_ERROR_INITIALIZATION_FAILED) {
CPrintF("Vulkan error: VK_ERROR_INITIALIZATION_FAILED!\n");
return FALSE;
} else if (result == VK_ERROR_EXTENSION_NOT_PRESENT) {
CPrintF("Vulkan error: VK_ERROR_EXTENSION_NOT_PRESENT!\n");
return FALSE;
} else if (result == VK_ERROR_FEATURE_NOT_PRESENT) {
CPrintF("Vulkan error: VK_ERROR_FEATURE_NOT_PRESENT!\n");
return FALSE;
} else if (result == VK_ERROR_TOO_MANY_OBJECTS) {
CPrintF("Vulkan error: VK_ERROR_TOO_MANY_OBJECTS!\n");
return FALSE;
} else if (result == VK_ERROR_DEVICE_LOST) {
CPrintF("Vulkan error: VK_ERROR_DEVICE_LOST!\n");
return FALSE;
} else if (result == VK_SUCCESS) {
CPrintF("Vulkan: vkCreateDevice Success\n");
}

vkGetDeviceQueue(gl_VkDevice, gl_VkQueueFamGraphics, 0, &gl_VkQueueGraphics);
Expand Down

0 comments on commit f92e991

Please sign in to comment.