rtengine/src/renderer/vk/helper.c
Kevin Trogant bdd3db98bb Add creation function for framegraphs and render targets
- The framegraph code currently does not attempt to alias render
  targets, but this should be pretty straightforward to add.
2024-02-05 21:49:09 +01:00

25 lines
939 B
C

#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;
}