mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-06 05:08:08 +02:00
ail: add is_level_compressed query
Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/26963>
This commit is contained in:
parent
2728995f12
commit
67d92e0bb6
1 changed files with 24 additions and 6 deletions
|
|
@ -202,12 +202,6 @@ ail_get_linear_pixel_B(struct ail_layout *layout, ASSERTED unsigned level,
|
|||
(x_px * util_format_get_blocksize(layout->format));
|
||||
}
|
||||
|
||||
static inline bool
|
||||
ail_is_compressed(struct ail_layout *layout)
|
||||
{
|
||||
return layout->tiling == AIL_TILING_TWIDDLED_COMPRESSED;
|
||||
}
|
||||
|
||||
static inline unsigned
|
||||
ail_effective_width_sa(unsigned width_px, unsigned sample_count_sa)
|
||||
{
|
||||
|
|
@ -230,6 +224,30 @@ ail_can_compress(unsigned w_px, unsigned h_px, unsigned sample_count_sa)
|
|||
ail_effective_height_sa(h_px, sample_count_sa) >= 16;
|
||||
}
|
||||
|
||||
static inline bool
|
||||
ail_is_compressed(struct ail_layout *layout)
|
||||
{
|
||||
return layout->tiling == AIL_TILING_TWIDDLED_COMPRESSED;
|
||||
}
|
||||
|
||||
/*
|
||||
* Even when the base mip level is compressed, high levels of the miptree
|
||||
* (smaller than 16 pixels on either axis) are not compressed as it would be
|
||||
* pointless. This queries this case.
|
||||
*/
|
||||
static inline bool
|
||||
ail_is_level_compressed(struct ail_layout *layout, unsigned level)
|
||||
{
|
||||
unsigned width_sa = ALIGN(
|
||||
ail_effective_width_sa(layout->width_px, layout->sample_count_sa), 16);
|
||||
|
||||
unsigned height_sa = ALIGN(
|
||||
ail_effective_height_sa(layout->height_px, layout->sample_count_sa), 16);
|
||||
|
||||
return ail_is_compressed(layout) &&
|
||||
u_minify(MAX2(width_sa, height_sa), level) >= 16;
|
||||
}
|
||||
|
||||
void ail_make_miptree(struct ail_layout *layout);
|
||||
|
||||
void ail_detile(void *_tiled, void *_linear, struct ail_layout *tiled_layout,
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue