You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-07 12:30:27 +00:00
Image: Implement 16-bit unorm and uint formats
This commit is contained in:
@@ -47,6 +47,12 @@ DDSFormat _dxgi_to_dds_format(uint32_t p_dxgi_format) {
|
||||
case DXGI_R16G16B16A16_FLOAT: {
|
||||
return DDS_RGBA16F;
|
||||
}
|
||||
case DXGI_R16G16B16A16_UNORM: {
|
||||
return DDS_RGBA16;
|
||||
}
|
||||
case DXGI_R16G16B16A16_UINT: {
|
||||
return DDS_RGBA16I;
|
||||
}
|
||||
case DXGI_R32G32_FLOAT: {
|
||||
return DDS_RG32F;
|
||||
}
|
||||
@@ -60,6 +66,12 @@ DDSFormat _dxgi_to_dds_format(uint32_t p_dxgi_format) {
|
||||
case DXGI_R16G16_FLOAT: {
|
||||
return DDS_RG16F;
|
||||
}
|
||||
case DXGI_R16G16_UNORM: {
|
||||
return DDS_RG16;
|
||||
}
|
||||
case DXGI_R16G16_UINT: {
|
||||
return DDS_RG16I;
|
||||
}
|
||||
case DXGI_R32_FLOAT: {
|
||||
return DDS_R32F;
|
||||
}
|
||||
@@ -70,6 +82,12 @@ DDSFormat _dxgi_to_dds_format(uint32_t p_dxgi_format) {
|
||||
case DXGI_R16_FLOAT: {
|
||||
return DDS_R16F;
|
||||
}
|
||||
case DXGI_R16_UNORM: {
|
||||
return DDS_R16;
|
||||
}
|
||||
case DXGI_R16_UINT: {
|
||||
return DDS_R16I;
|
||||
}
|
||||
case DXGI_R8G8_UNORM: {
|
||||
return DDS_LUMINANCE_ALPHA;
|
||||
}
|
||||
@@ -572,6 +590,9 @@ static Vector<Ref<Image>> _dds_load_images_from_buffer(Ref<FileAccess> p_f, DDSF
|
||||
case DDFCC_A2XY: {
|
||||
r_dds_format = DDS_ATI2;
|
||||
} break;
|
||||
case DDFCC_RGBA16: {
|
||||
r_dds_format = DDS_RGBA16;
|
||||
} break;
|
||||
case DDFCC_R16F: {
|
||||
r_dds_format = DDS_R16F;
|
||||
} break;
|
||||
@@ -652,6 +673,10 @@ static Vector<Ref<Image>> _dds_load_images_from_buffer(Ref<FileAccess> p_f, DDSF
|
||||
}
|
||||
}
|
||||
|
||||
if (format_rgb_bits == 32 && format_red_mask == 0xffff && format_green_mask == 0xffff0000) {
|
||||
r_dds_format = DDS_RG16;
|
||||
}
|
||||
|
||||
} else {
|
||||
// Other formats.
|
||||
if (format_flags & DDPF_ALPHAONLY && format_rgb_bits == 8 && format_alpha_mask == 0xff) {
|
||||
@@ -675,6 +700,8 @@ static Vector<Ref<Image>> _dds_load_images_from_buffer(Ref<FileAccess> p_f, DDSF
|
||||
// Without alpha.
|
||||
if (format_rgb_bits == 8 && format_red_mask == 0xff) {
|
||||
r_dds_format = DDS_LUMINANCE;
|
||||
} else if (format_rgb_bits == 16 && format_red_mask == 0xffff) {
|
||||
r_dds_format = DDS_R16;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user