Add vk_pica translation unit

Intended for conversions and utils between PICA definitions and Vulkan.
This commit is contained in:
Wunkolo 2023-07-27 10:05:43 -07:00
parent d19b8cf364
commit bf8bb5d459
3 changed files with 39 additions and 0 deletions

View file

@ -0,0 +1,25 @@
#include "renderer_vk/vk_pica.hpp"
namespace Vulkan {
vk::Format colorFormatToVulkan(PICA::ColorFmt colorFormat) {
switch (colorFormat) {
case PICA::ColorFmt::RGBA8: return vk::Format::eR8G8B8A8Unorm;
case PICA::ColorFmt::RGB8: return vk::Format::eR8G8B8Unorm;
case PICA::ColorFmt::RGBA5551: return vk::Format::eR5G5B5A1UnormPack16;
case PICA::ColorFmt::RGB565: return vk::Format::eR5G6B5UnormPack16;
case PICA::ColorFmt::RGBA4: return vk::Format::eR4G4B4A4UnormPack16;
}
return vk::Format::eUndefined;
}
vk::Format depthFormatToVulkan(PICA::DepthFmt depthFormat) {
switch (depthFormat) {
case PICA::DepthFmt::Depth16: return vk::Format::eD16Unorm;
case PICA::DepthFmt::Unknown1: return vk::Format::eUndefined;
case PICA::DepthFmt::Depth24: return vk::Format::eX8D24UnormPack32;
case PICA::DepthFmt::Depth24Stencil8: return vk::Format::eD24UnormS8Uint;
}
return vk::Format::eUndefined;
}
} // namespace Vulkan