Skip to content

Commit

Permalink
- vsync is disabled by default
Browse files Browse the repository at this point in the history
- fixed format search for swapchain
  • Loading branch information
sultim-t committed Feb 7, 2020
1 parent 9cf30c2 commit fe5cfbd
Showing 1 changed file with 12 additions and 8 deletions.
20 changes: 12 additions & 8 deletions Sources/Engine/Graphics/Vulkan/SvkUtils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -369,29 +369,33 @@ BOOL CGfxLibrary::PickPhysicalDevice()
// now select preferred settings
gl_VkSurfColorFormat = VK_FORMAT_UNDEFINED;

for (uint32_t i = 0; i < formatsCount; i++)
for (uint32_t j = 0; j < formatsCount; j++)
{
if (gl_VkPhSurfFormats[i].format == VK_FORMAT_R8G8B8A8_UNORM)
if (gl_VkPhSurfFormats[j].format == VK_FORMAT_R8G8B8A8_UNORM)
{
gl_VkSurfColorFormat = gl_VkPhSurfFormats[i].format;
gl_VkSurfColorSpace = gl_VkPhSurfFormats[i].colorSpace;
gl_VkSurfColorFormat = gl_VkPhSurfFormats[j].format;
gl_VkSurfColorSpace = gl_VkPhSurfFormats[j].colorSpace;
break;
}
}

for (uint32_t i = 0; i < presentModesCount; i++)
for (uint32_t j = 0; j < presentModesCount; j++)
{
if (gl_VkPhSurfPresentModes[i] == VK_PRESENT_MODE_FIFO_KHR)
if (gl_VkPhSurfPresentModes[j] == VK_PRESENT_MODE_IMMEDIATE_KHR)
{
gl_VkSurfPresentMode = gl_VkPhSurfPresentModes[i];
gl_VkSurfPresentMode = gl_VkPhSurfPresentModes[j];
break;
}
}

VkFormat depthFormats[3] = { VK_FORMAT_D32_SFLOAT, VK_FORMAT_D32_SFLOAT_S8_UINT, VK_FORMAT_D24_UNORM_S8_UINT };
gl_VkSurfDepthFormat = FindSupportedFormat(depthFormats, 3, VK_IMAGE_TILING_OPTIMAL, VK_FORMAT_FEATURE_DEPTH_STENCIL_ATTACHMENT_BIT);

// TODO: Vulkan: if required format is not found
if (gl_VkSurfColorFormat == VK_FORMAT_UNDEFINED)
{
gl_VkSurfColorFormat = gl_VkPhSurfFormats[0].format;
gl_VkSurfColorSpace = gl_VkPhSurfFormats[0].colorSpace;
}

// it's guaranteed that maxPushConstantSize will be >=128
ASSERT(gl_VkPhProperties.limits.maxPushConstantsSize >= 128);
Expand Down

0 comments on commit fe5cfbd

Please sign in to comment.