WIP: Vulkan: Workbench #107886

Closed
Jeroen Bakker wants to merge 88 commits from Jeroen-Bakker:vulkan-draw-manager-workbench into main

When changing the target branch, be careful to rebase the branch in your fork to match. See documentation.
2 changed files with 12 additions and 0 deletions
Showing only changes of commit fbd53f81d4 - Show all commits

View File

@ -214,12 +214,14 @@ uint32_t convert_float_formats(uint32_t value)
const bool is_denormalized = exponent == 0;
if (!is_denormalized) {
exponent -= SourceFormat::ExponentBias;
/*
if constexpr (SourceFormat::ExponentLen > DestinationFormat::ExponentLen) {
exponent = exponent >> (SourceFormat::ExponentLen - DestinationFormat::ExponentLen);
}
else if constexpr (SourceFormat::ExponentLen < DestinationFormat::ExponentLen) {
exponent = exponent << (DestinationFormat::ExponentLen - SourceFormat::ExponentLen);
}
*/
exponent += DestinationFormat::ExponentBias;
}

View File

@ -9,5 +9,15 @@ TEST(VulkanDataConversion, ConvertF32F16)
uint32_t f16_2_expected = 0b0100000000000000;
uint32_t f16_2 = convert_float_formats<Format16F, Format32F>(f32_2);
EXPECT_EQ(f16_2, f16_2_expected);
uint32_t f32_3 = 0b01000000010000000000000000000000;
uint32_t f16_3_expected = 0b0100001000000000;
uint32_t f16_3 = convert_float_formats<Format16F, Format32F>(f32_2);
EXPECT_EQ(f16_3, f16_3_expected);
uint32_t f32_4 = 0b01000000100000000000000000000000;
uint32_t f16_4_expected = 0b0100010000000000;
uint32_t f16_4 = convert_float_formats<Format16F, Format32F>(f32_2);
EXPECT_EQ(f16_4, f16_4_expected);
}
} // namespace blender::gpu::tests