mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-05 13:58:04 +02:00
ail: generalize solid mode values
this is blocksize dependenant, fill in the gaps. Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io> Reviewed-by: Mary Guillemard <mary.guillemard@collabora.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/35662>
This commit is contained in:
parent
cdb4463b52
commit
9740474021
1 changed files with 27 additions and 3 deletions
|
|
@ -445,9 +445,6 @@ ail_can_compress(enum pipe_format format, unsigned w_px, unsigned h_px,
|
|||
ail_effective_height_sa(h_px, sample_count_sa) >= 16;
|
||||
}
|
||||
|
||||
/* AGX compression mode for a solid colour for the subtile */
|
||||
#define AIL_COMP_SOLID 0x3
|
||||
|
||||
/* AGX compression mode for an uncompessed subtile. Frustratingly, this seems to
|
||||
* depend on the format. It is possible that modes are actual 8-bit structures
|
||||
* with multiple fields rather than plain enumerations.
|
||||
|
|
@ -457,6 +454,12 @@ ail_can_compress(enum pipe_format format, unsigned w_px, unsigned h_px,
|
|||
#define AIL_COMP_UNCOMPRESSED_4 0x7f
|
||||
#define AIL_COMP_UNCOMPRESSED_8_16 0xff
|
||||
|
||||
/* AGX compression mode for a solid colour for the subtile. */
|
||||
#define AIL_COMP_SOLID_1 0x60
|
||||
#define AIL_COMP_SOLID_2 0x01
|
||||
#define AIL_COMP_SOLID_4 0x03
|
||||
#define AIL_COMP_SOLID_8_16 0x07
|
||||
|
||||
static inline uint8_t
|
||||
ail_subtile_uncompressed_mode(enum pipe_format format)
|
||||
{
|
||||
|
|
@ -472,6 +475,21 @@ ail_subtile_uncompressed_mode(enum pipe_format format)
|
|||
/* clang-format on */
|
||||
}
|
||||
|
||||
static inline uint8_t
|
||||
ail_subtile_solid_mode(enum pipe_format format)
|
||||
{
|
||||
/* clang-format off */
|
||||
switch (util_format_get_blocksize(format)) {
|
||||
case 1: return AIL_COMP_SOLID_1;
|
||||
case 2: return AIL_COMP_SOLID_2;
|
||||
case 4: return AIL_COMP_SOLID_4;
|
||||
case 8:
|
||||
case 16: return AIL_COMP_SOLID_8_16;
|
||||
default: unreachable("invalid block size");
|
||||
}
|
||||
/* clang-format on */
|
||||
}
|
||||
|
||||
/*
|
||||
* Compression modes are 8-bit per 8x4 subtile, but grouped into 64-bit for all
|
||||
* modes in a 16x16 tile. This helper replicates a subtile mode to a tile mode
|
||||
|
|
@ -492,6 +510,12 @@ ail_tile_mode_uncompressed(enum pipe_format format)
|
|||
return ail_tile_mode_replicated(ail_subtile_uncompressed_mode(format));
|
||||
}
|
||||
|
||||
static inline uint64_t
|
||||
ail_tile_mode_solid(enum pipe_format format)
|
||||
{
|
||||
return ail_tile_mode_replicated(ail_subtile_solid_mode(format));
|
||||
}
|
||||
|
||||
/*
|
||||
* For compression, compatible formats must have the same number/size/order of
|
||||
* channels, but may differ in data type. For example, R32_SINT is compatible
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue