adding BC compressed format support
Test / build_and_test (push) Successful in 2m21s
Build / build (push) Successful in 3m58s

This commit is contained in:
2026-07-04 01:17:18 +02:00
parent 3a79103ca3
commit bfc5c3933c
6 changed files with 514 additions and 41 deletions
+46 -16
View File
@@ -335,22 +335,22 @@ pub fn getFormatProperties(interface: *Interface, format: vk.Format) VkError!vk.
.r32g32b32a32_sfloat,
.b10g11r11_ufloat_pack32,
.e5b9g9r9_ufloat_pack32,
//.bc1_rgb_unorm_block,
//.bc1_rgb_srgb_block,
//.bc1_rgba_unorm_block,
//.bc1_rgba_srgb_block,
//.bc2_unorm_block,
//.bc2_srgb_block,
//.bc3_unorm_block,
//.bc3_srgb_block,
//.bc4_unorm_block,
//.bc4_snorm_block,
//.bc5_unorm_block,
//.bc5_snorm_block,
//.bc6h_ufloat_block,
//.bc6h_sfloat_block,
//.bc7_unorm_block,
//.bc7_srgb_block,
.bc1_rgb_unorm_block,
.bc1_rgb_srgb_block,
.bc1_rgba_unorm_block,
.bc1_rgba_srgb_block,
.bc2_unorm_block,
.bc2_srgb_block,
.bc3_unorm_block,
.bc3_srgb_block,
.bc4_unorm_block,
.bc4_snorm_block,
.bc5_unorm_block,
.bc5_snorm_block,
.bc6h_ufloat_block,
.bc6h_sfloat_block,
.bc7_unorm_block,
.bc7_srgb_block,
//.etc2_r8g8b8_unorm_block,
//.etc2_r8g8b8_srgb_block,
//.etc2_r8g8b8a1_unorm_block,
@@ -446,6 +446,33 @@ pub fn getFormatProperties(interface: *Interface, format: vk.Format) VkError!vk.
else => {},
}
switch (format) {
.bc1_rgb_unorm_block,
.bc1_rgb_srgb_block,
.bc1_rgba_unorm_block,
.bc1_rgba_srgb_block,
.bc2_unorm_block,
.bc2_srgb_block,
.bc3_unorm_block,
.bc3_srgb_block,
.bc4_unorm_block,
.bc4_snorm_block,
.bc5_unorm_block,
.bc5_snorm_block,
.bc6h_ufloat_block,
.bc6h_sfloat_block,
.bc7_unorm_block,
.bc7_srgb_block,
=> {
properties.optimal_tiling_features.blit_src_bit = true;
properties.optimal_tiling_features.sampled_image_bit = true;
properties.optimal_tiling_features.sampled_image_filter_linear_bit = true;
properties.optimal_tiling_features.transfer_dst_bit = true;
properties.optimal_tiling_features.transfer_src_bit = true;
},
else => {},
}
switch (format) {
// Vulkan 1.0 mandatory storage image formats supporting atomic operations
.r32_uint,
@@ -819,6 +846,9 @@ fn isFormatSupported(
tiling: vk.ImageTiling,
usage: vk.ImageUsageFlags,
) VkError!bool {
if (base.format.isCompressed(format) and (usage.transfer_src_bit or usage.transfer_dst_bit))
return false;
const format_properties = try self.interface.getFormatProperties(format);
const format_features = switch (tiling) {
.linear => format_properties.linear_tiling_features,