Add missing formats

This commit is contained in:
Lander Gallastegi 2024-10-14 23:28:23 +02:00
parent ea95d83f32
commit 6de8e29550

View File

@ -1007,6 +1007,32 @@ vk::ClearValue ColorBufferClearValue(const AmdGpu::Liverpool::ColorBuffer& color
break;
}
break;
case AmdGpu::DataFormat::Format5_6_5:
color.float32[0] = NumberUtils::U5ToUnorm( c0 & 0x1f);
color.float32[1] = NumberUtils::U6ToUnorm((c0 >> 5) & 0x3f);
color.float32[2] = NumberUtils::U5ToUnorm( c0 >> 11);
break;
case AmdGpu::DataFormat::Format1_5_5_5:
color.float32[0] = NumberUtils::U5ToUnorm( c0 & 0x1f);
color.float32[1] = NumberUtils::U5ToUnorm((c0 >> 5) & 0x1f);
color.float32[2] = NumberUtils::U5ToUnorm((c0 >> 10) & 0x1f);
color.float32[3] = (c0 >> 15) ? 1.0f : 0.0f;
break;
case AmdGpu::DataFormat::Format5_5_5_1:
color.float32[0] = (c0 & 0x1) ? 1.0f : 0.0f;
color.float32[1] = NumberUtils::U5ToUnorm((c0 >> 1) & 0x1f);
color.float32[2] = NumberUtils::U5ToUnorm((c0 >> 6) & 0x1f);
color.float32[3] = NumberUtils::U5ToUnorm((c0 >> 11) & 0x1f);
break;
case AmdGpu::DataFormat::Format4_4_4_4:
color.float32[0] = NumberUtils::U4ToUnorm( c0 & 0xf);
color.float32[1] = NumberUtils::U4ToUnorm((c0 >> 4) & 0xf);
color.float32[2] = NumberUtils::U4ToUnorm((c0 >> 8) & 0xf);
color.float32[3] = NumberUtils::U4ToUnorm( c0 >> 12);
break;
default:
LOG_ERROR(Render_Vulkan, "Unsupported color buffer format: {}", format);
break;
}
return {.color = color};