aboutsummaryrefslogtreecommitdiffstats
path: root/src/amd/vulkan/radv_formats.c
diff options
context:
space:
mode:
authorBas Nieuwenhuizen <[email protected]>2018-01-04 01:32:04 +0100
committerBas Nieuwenhuizen <[email protected]>2018-07-27 01:31:32 +0200
commit3665f66ef26ae7f69e870b8f48e7e1f28616879c (patch)
tree6bc1cc01fe0b53e8be0ab99a2a2e999bff323061 /src/amd/vulkan/radv_formats.c
parent1e8b8e0878fc6342d6530fdaa04239315f511c50 (diff)
radv: Add support for ETC2 textures.
Was surprised that is even supported by Vega. Reviewed-by: Samuel Pitoiset <[email protected]>
Diffstat (limited to 'src/amd/vulkan/radv_formats.c')
-rw-r--r--src/amd/vulkan/radv_formats.c36
1 files changed, 36 insertions, 0 deletions
diff --git a/src/amd/vulkan/radv_formats.c b/src/amd/vulkan/radv_formats.c
index 958f2a2c821..f23ebfb2ad7 100644
--- a/src/amd/vulkan/radv_formats.c
+++ b/src/amd/vulkan/radv_formats.c
@@ -224,6 +224,28 @@ uint32_t radv_translate_tex_dataformat(VkFormat format,
}
}
+ if (desc->layout == VK_FORMAT_LAYOUT_ETC) {
+ switch (format) {
+ case VK_FORMAT_ETC2_R8G8B8_UNORM_BLOCK:
+ case VK_FORMAT_ETC2_R8G8B8_SRGB_BLOCK:
+ return V_008F14_IMG_DATA_FORMAT_ETC2_RGB;
+ case VK_FORMAT_ETC2_R8G8B8A1_UNORM_BLOCK:
+ case VK_FORMAT_ETC2_R8G8B8A1_SRGB_BLOCK:
+ return V_008F14_IMG_DATA_FORMAT_ETC2_RGBA1;
+ case VK_FORMAT_ETC2_R8G8B8A8_UNORM_BLOCK:
+ case VK_FORMAT_ETC2_R8G8B8A8_SRGB_BLOCK:
+ return V_008F14_IMG_DATA_FORMAT_ETC2_RGBA;
+ case VK_FORMAT_EAC_R11_UNORM_BLOCK:
+ case VK_FORMAT_EAC_R11_SNORM_BLOCK:
+ return V_008F14_IMG_DATA_FORMAT_ETC2_R;
+ case VK_FORMAT_EAC_R11G11_UNORM_BLOCK:
+ case VK_FORMAT_EAC_R11G11_SNORM_BLOCK:
+ return V_008F14_IMG_DATA_FORMAT_ETC2_RG;
+ default:
+ break;
+ }
+ }
+
if (format == VK_FORMAT_E5B9G9R9_UFLOAT_PACK32) {
return V_008F14_IMG_DATA_FORMAT_5_9_9_9;
} else if (format == VK_FORMAT_B10G11R11_UFLOAT_PACK32) {
@@ -349,10 +371,15 @@ uint32_t radv_translate_tex_numformat(VkFormat format,
case VK_FORMAT_BC2_SRGB_BLOCK:
case VK_FORMAT_BC3_SRGB_BLOCK:
case VK_FORMAT_BC7_SRGB_BLOCK:
+ case VK_FORMAT_ETC2_R8G8B8_SRGB_BLOCK:
+ case VK_FORMAT_ETC2_R8G8B8A1_SRGB_BLOCK:
+ case VK_FORMAT_ETC2_R8G8B8A8_SRGB_BLOCK:
return V_008F14_IMG_NUM_FORMAT_SRGB;
case VK_FORMAT_BC4_SNORM_BLOCK:
case VK_FORMAT_BC5_SNORM_BLOCK:
case VK_FORMAT_BC6H_SFLOAT_BLOCK:
+ case VK_FORMAT_EAC_R11_SNORM_BLOCK:
+ case VK_FORMAT_EAC_R11G11_SNORM_BLOCK:
return V_008F14_IMG_NUM_FORMAT_SNORM;
default:
return V_008F14_IMG_NUM_FORMAT_UNORM;
@@ -584,6 +611,15 @@ radv_physical_device_get_format_properties(struct radv_physical_device *physical
return;
}
+ if (desc->layout == VK_FORMAT_LAYOUT_ETC &&
+ physical_device->rad_info.chip_class < GFX9 &&
+ physical_device->rad_info.family != CHIP_STONEY) {
+ out_properties->linearTilingFeatures = linear;
+ out_properties->optimalTilingFeatures = tiled;
+ out_properties->bufferFeatures = buffer;
+ return;
+ }
+
if (radv_is_storage_image_format_supported(physical_device, format)) {
tiled |= VK_FORMAT_FEATURE_STORAGE_IMAGE_BIT;
linear |= VK_FORMAT_FEATURE_STORAGE_IMAGE_BIT;