mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-02-07 14:30:29 +01:00
pvr: add ycbcr formats
Reviewed-by: Simon Perretta <simon.perretta@imgtec.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/39231>
This commit is contained in:
parent
0a01f7aeeb
commit
5eeac21181
2 changed files with 32 additions and 2 deletions
|
|
@ -59,6 +59,14 @@
|
|||
.bind = FLAGS_##bind_, \
|
||||
}
|
||||
|
||||
#define FORMAT_YCBCR(vk, tex_fmt) \
|
||||
[PIPE_FORMAT_##vk] = { \
|
||||
.tex_format = ROGUE_TEXSTATE_FORMAT_##tex_fmt, \
|
||||
.depth_tex_format = ROGUE_TEXSTATE_FORMAT_INVALID, \
|
||||
.stencil_tex_format = ROGUE_TEXSTATE_FORMAT_INVALID, \
|
||||
.bind = FLAGS__T__, \
|
||||
}
|
||||
|
||||
#define FORMAT_COMPRESSED(vk, tex_fmt) \
|
||||
[PIPE_FORMAT_##vk] = { \
|
||||
.tex_format = ROGUE_TEXSTATE_FORMAT_COMPRESSED_##tex_fmt, \
|
||||
|
|
@ -157,9 +165,12 @@ static const struct pvr_format pvr_format_table[] = {
|
|||
FORMAT_COMPRESSED(ETC2_R11_SNORM, EAC_R11_SIGNED),
|
||||
FORMAT_COMPRESSED(ETC2_RG11_UNORM, EAC_RG11_UNSIGNED),
|
||||
FORMAT_COMPRESSED(ETC2_RG11_SNORM, EAC_RG11_SIGNED),
|
||||
FORMAT_YCBCR(G8_B8R8_420_UNORM, YVU420_2PLANE),
|
||||
FORMAT_YCBCR(G8_B8_R8_420_UNORM, YUV420_3PLANE),
|
||||
};
|
||||
/* clang-format on */
|
||||
|
||||
#undef FORMAT_YCBCR
|
||||
#undef FORMAT
|
||||
#undef FORMAT_DEPTH_STENCIL
|
||||
#undef FORMAT_COMPRESSED
|
||||
|
|
|
|||
|
|
@ -257,6 +257,9 @@ pvr_get_image_format_features2(struct pvr_physical_device *pdevice,
|
|||
|
||||
assert(pvr_format->bind != 0);
|
||||
|
||||
const struct vk_format_ycbcr_info *ycbcr_info =
|
||||
vk_format_get_ycbcr_info(vk_format);
|
||||
|
||||
if (pvr_format->bind & PVR_BIND_SAMPLER_VIEW) {
|
||||
if (vk_tiling == VK_IMAGE_TILING_OPTIMAL) {
|
||||
const uint32_t first_component_size =
|
||||
|
|
@ -265,7 +268,6 @@ pvr_get_image_format_features2(struct pvr_physical_device *pdevice,
|
|||
0);
|
||||
|
||||
flags |= VK_FORMAT_FEATURE_2_SAMPLED_IMAGE_BIT |
|
||||
VK_FORMAT_FEATURE_2_BLIT_SRC_BIT |
|
||||
VK_FORMAT_FEATURE_2_TRANSFER_SRC_BIT |
|
||||
VK_FORMAT_FEATURE_2_TRANSFER_DST_BIT;
|
||||
|
||||
|
|
@ -275,11 +277,22 @@ pvr_get_image_format_features2(struct pvr_physical_device *pdevice,
|
|||
vk_format_is_block_compressed(vk_format))) {
|
||||
flags |= VK_FORMAT_FEATURE_2_SAMPLED_IMAGE_FILTER_LINEAR_BIT;
|
||||
}
|
||||
|
||||
if (ycbcr_info) {
|
||||
flags |= VK_FORMAT_FEATURE_2_COSITED_CHROMA_SAMPLES_BIT;
|
||||
} else {
|
||||
flags |= VK_FORMAT_FEATURE_2_BLIT_SRC_BIT;
|
||||
}
|
||||
} else if (!vk_format_is_block_compressed(vk_format)) {
|
||||
flags |= VK_FORMAT_FEATURE_2_SAMPLED_IMAGE_BIT |
|
||||
VK_FORMAT_FEATURE_2_BLIT_SRC_BIT |
|
||||
VK_FORMAT_FEATURE_2_TRANSFER_SRC_BIT |
|
||||
VK_FORMAT_FEATURE_2_TRANSFER_DST_BIT;
|
||||
|
||||
if (ycbcr_info) {
|
||||
flags |= VK_FORMAT_FEATURE_2_COSITED_CHROMA_SAMPLES_BIT;
|
||||
} else {
|
||||
flags |= VK_FORMAT_FEATURE_2_BLIT_SRC_BIT;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -741,6 +754,12 @@ VkResult pvr_GetPhysicalDeviceImageFormatProperties2(
|
|||
case VK_STRUCTURE_TYPE_EXTERNAL_IMAGE_FORMAT_PROPERTIES:
|
||||
external_props = (void *)ext;
|
||||
break;
|
||||
case VK_STRUCTURE_TYPE_SAMPLER_YCBCR_CONVERSION_IMAGE_FORMAT_PROPERTIES: {
|
||||
VkSamplerYcbcrConversionImageFormatProperties *ycbcr_props =
|
||||
(void *)ext;
|
||||
ycbcr_props->combinedImageSamplerDescriptorCount = 1;
|
||||
break;
|
||||
}
|
||||
default:
|
||||
vk_debug_ignored_stype(ext->sType);
|
||||
break;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue