util/format: Add new 12-bit P012 RGB/planar formats

Introduce three 12-bit formats: X4R12_UNORM, X4R12X4G12_UNORM, and X4G12_X4B12X4R12_420_UNORM.
These formats allocate 12 bits for each color channel with 4 bits of padding to align with Vulkan's P012
and related planar formats.

Reviewed-by: Faith Ekstrand <faith.ekstrand@collabora.com>
Signed-off-by: Valentine Burley <valentine.burley@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/30821>
This commit is contained in:
Valentine Burley
2024-08-23 08:25:38 +00:00
committed by Marge Bot
parent 1134ad8799
commit 81ebd6ea8d
3 changed files with 27 additions and 1 deletions
+22 -1
View File
@@ -1902,7 +1902,7 @@
swizzles: [X, 0, 0, 1]
# RGB versions of NV12, YV12, and P010 for hardware that supports sampling
# RGB versions of NV12, YV12, P010, and P012 for hardware that supports sampling
# from multiplane textures but needs color-space conversion in the shader.
- name: R8_G8B8_420_UNORM
layout: planar2
@@ -1952,6 +1952,12 @@
block: {width: 1, height: 1, depth: 1}
channels: [X6, UN10]
swizzles: [X, Y, Z, W]
- name: X4G12_X4B12X4R12_420_UNORM
layout: planar2
colorspace: RGB
block: {width: 1, height: 1, depth: 1}
channels: [X4, UN12]
swizzles: [X, Y, Z, W]
# While most of Mesa uses R8 for Y, U, and V planes, freedreno requires
# distinguishing between tiled Y8 data and tiled R8 data.
@@ -1976,6 +1982,21 @@
channels: [X6, UN10, X6, UN10]
swizzles: [Y, W, 0, 1]
# Formats for plane 0/plane 1 of P012
- name: X4R12_UNORM
layout: plain
colorspace: RGB
block: {width: 1, height: 1, depth: 1}
channels: [X4, UN12]
swizzles: [Y, 0, 0, 1]
- name: X4R12X4G12_UNORM
layout: plain
colorspace: RGB
block: {width: 1, height: 1, depth: 1}
channels: [X4, UN12, X4, UN12]
swizzles: [Y, W, 0, 1]
- name: Y8_U8_V8_422_UNORM
layout: planar3
colorspace: YUV