#include "gpu.h" VkFormat rtPixelFormatToVkFormat(rt_pixel_format format) { switch (format) { case RT_PIXEL_FORMAT_R8G8B8A8_SRGB: return VK_FORMAT_R8G8B8A8_SRGB; case RT_PIXEL_FORMAT_DEPTH24_STENCIL8: return VK_FORMAT_D24_UNORM_S8_UINT; default: return VK_FORMAT_UNDEFINED; } } VkSampleCountFlagBits rtSampleCountToFlags(unsigned int count) { /* Limit to what the gpu supports */ VkSampleCountFlags counts = g_gpu.phys_device_props.limits.framebufferColorSampleCounts & g_gpu.phys_device_props.limits.framebufferDepthSampleCounts & g_gpu.phys_device_props.limits.sampledImageColorSampleCounts & g_gpu.phys_device_props.limits.sampledImageDepthSampleCounts; while (count > 1) { if ((counts & count) == 0) count >>= 1; } return (VkSampleCountFlagBits)count; }