mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-08 02:38:04 +02:00
mesa: Add R8G8_R8B8 and G8R8_B8R8 formats
These aren't real formats. They cannot be used with RenderbufferObjects, Textures, or anything else visible through the GL API. The only purpose is to support YUYV textures imported through EGL_image_external. There is hardware that can sample from this subsampled format, but the hardware does not do the colorspace conversion automatically. v2: Treat these formats as compressed. This is a lie, but it seems to be a less egregious lie than what I was doing before. It also passes 'ninja test'. Reviewed-by: Emma Anholt <emma@anholt.net> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9610>
This commit is contained in:
parent
3fa16b3025
commit
53fc6ba930
5 changed files with 12 additions and 2 deletions
|
|
@ -128,6 +128,8 @@ def get_channel_bits(fmat, chan_name):
|
|||
return bits if fmat.has_channel(chan_name) else 0
|
||||
elif fmat.layout == 'atc':
|
||||
return 8 if fmat.has_channel(chan_name) else 0
|
||||
elif fmat.layout == 'other' and ('RG_RB' in fmat.name or 'GR_BR' in fmat.name):
|
||||
return 8 if fmat.has_channel(chan_name) else 0
|
||||
else:
|
||||
assert False
|
||||
else:
|
||||
|
|
|
|||
|
|
@ -518,7 +518,7 @@ def _get_datatype(type, size):
|
|||
else:
|
||||
assert False
|
||||
|
||||
def _parse_channels(fields, layout, colorspace, swizzle):
|
||||
def _parse_channels(fields):
|
||||
channels = []
|
||||
for field in fields:
|
||||
if not field:
|
||||
|
|
@ -569,6 +569,7 @@ def parse(filename):
|
|||
swizzle = Swizzle(fields[9])
|
||||
except:
|
||||
sys.exit("error parsing swizzle for format " + name)
|
||||
channels = _parse_channels(fields[5:9], layout, colorspace, swizzle)
|
||||
|
||||
channels = _parse_channels(fields[5:9])
|
||||
|
||||
yield Format(name, layout, block_width, block_height, block_depth, channels, swizzle, colorspace)
|
||||
|
|
|
|||
|
|
@ -1024,6 +1024,8 @@ _mesa_uncompressed_format_to_type_and_comps(mesa_format format,
|
|||
|
||||
case MESA_FORMAT_YCBCR:
|
||||
case MESA_FORMAT_YCBCR_REV:
|
||||
case MESA_FORMAT_RG_RB_UNORM8:
|
||||
case MESA_FORMAT_GR_BR_UNORM8:
|
||||
*datatype = GL_UNSIGNED_SHORT;
|
||||
*comps = 2;
|
||||
return;
|
||||
|
|
|
|||
|
|
@ -93,6 +93,9 @@ MESA_FORMAT_A2R10G10B10_UNORM , packed, 1, 1, 1, un2 , un10, un10, u
|
|||
MESA_FORMAT_YCBCR , other , 1, 1, 1, x16 , , , , xyzw, yuv
|
||||
MESA_FORMAT_YCBCR_REV , other , 1, 1, 1, x16 , , , , xyzw, yuv
|
||||
|
||||
MESA_FORMAT_RG_RB_UNORM8 , other , 2, 1, 1, x16 , , , , xyz1, rgb
|
||||
MESA_FORMAT_GR_BR_UNORM8 , other , 2, 1, 1, x16 , , , , xyz1, rgb
|
||||
|
||||
# Array normalized formats
|
||||
MESA_FORMAT_A_UNORM8 , array , 1, 1, 1, un8 , , , , 000x, rgb
|
||||
MESA_FORMAT_A_UNORM16 , array , 1, 1, 1, un16, , , , 000x, rgb
|
||||
|
|
|
|||
|
Can't render this file because it contains an unexpected character in line 9 and column 3.
|
|
|
@ -385,6 +385,8 @@ typedef enum pipe_format mesa_format;
|
|||
#define MESA_FORMAT_A2R10G10B10_UNORM PIPE_FORMAT_A2R10G10B10_UNORM
|
||||
#define MESA_FORMAT_YCBCR PIPE_FORMAT_UYVY
|
||||
#define MESA_FORMAT_YCBCR_REV PIPE_FORMAT_YUYV
|
||||
#define MESA_FORMAT_RG_RB_UNORM8 PIPE_FORMAT_R8G8_R8B8_UNORM
|
||||
#define MESA_FORMAT_GR_BR_UNORM8 PIPE_FORMAT_G8R8_B8R8_UNORM
|
||||
#define MESA_FORMAT_A_UNORM8 PIPE_FORMAT_A8_UNORM
|
||||
#define MESA_FORMAT_A_UNORM16 PIPE_FORMAT_A16_UNORM
|
||||
#define MESA_FORMAT_L_UNORM8 PIPE_FORMAT_L8_UNORM
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue