mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-05 11:48:06 +02:00
nil: Force smallest block size for images meant for Vulkan Video
Reviewed-by: Faith Ekstrand <None> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/33453>
This commit is contained in:
parent
54fed0536d
commit
7d21d17b01
2 changed files with 26 additions and 0 deletions
|
|
@ -40,6 +40,7 @@ renaming_overrides_prefixing = true
|
|||
"IMAGE_USAGE_2D_VIEW_BIT" = "NIL_IMAGE_USAGE_2D_VIEW_BIT"
|
||||
"IMAGE_USAGE_LINEAR_BIT" = "NIL_IMAGE_USAGE_LINEAR_BIT"
|
||||
"IMAGE_USAGE_SPARSE_RESIDENCY_BIT" = "NIL_IMAGE_USAGE_SPARSE_RESIDENCY_BIT"
|
||||
"IMAGE_USAGE_VIDEO_BIT" = "NIL_IMAGE_USAGE_VIDEO_BIT"
|
||||
|
||||
[macro_expansion]
|
||||
bitflags = true # We need this for the bitflags crate
|
||||
|
|
|
|||
|
|
@ -16,6 +16,7 @@ pub type ImageUsageFlags = u8;
|
|||
pub const IMAGE_USAGE_2D_VIEW_BIT: ImageUsageFlags = 1 << 0;
|
||||
pub const IMAGE_USAGE_LINEAR_BIT: ImageUsageFlags = 1 << 1;
|
||||
pub const IMAGE_USAGE_SPARSE_RESIDENCY_BIT: ImageUsageFlags = 1 << 2;
|
||||
pub const IMAGE_USAGE_VIDEO_BIT: ImageUsageFlags = 1 << 3;
|
||||
|
||||
#[derive(Clone, Debug, Copy, PartialEq, Default)]
|
||||
#[repr(u8)]
|
||||
|
|
@ -245,7 +246,31 @@ impl Image {
|
|||
.clamp(info.extent_px.to_B(info.format, sample_layout))
|
||||
}
|
||||
} else if (info.usage & IMAGE_USAGE_SPARSE_RESIDENCY_BIT) != 0 {
|
||||
assert!((info.usage & IMAGE_USAGE_VIDEO_BIT) == 0);
|
||||
Tiling::sparse(info.format, info.dim)
|
||||
} else if (info.usage & IMAGE_USAGE_VIDEO_BIT) != 0 {
|
||||
assert!((info.usage & IMAGE_USAGE_SPARSE_RESIDENCY_BIT) == 0);
|
||||
let mut min_tiling = Tiling::choose(
|
||||
info.extent_px,
|
||||
info.format,
|
||||
sample_layout,
|
||||
info.usage,
|
||||
);
|
||||
for p in 0..infos.len() {
|
||||
let plane_tiling = Tiling::choose(
|
||||
infos[p].extent_px,
|
||||
infos[p].format,
|
||||
sample_layout,
|
||||
infos[p].usage,
|
||||
);
|
||||
min_tiling.x_log2 =
|
||||
std::cmp::min(min_tiling.x_log2, plane_tiling.x_log2);
|
||||
min_tiling.y_log2 =
|
||||
std::cmp::min(min_tiling.y_log2, plane_tiling.y_log2);
|
||||
min_tiling.z_log2 =
|
||||
std::cmp::min(min_tiling.z_log2, plane_tiling.z_log2);
|
||||
}
|
||||
min_tiling
|
||||
} else {
|
||||
Tiling::choose(
|
||||
info.extent_px,
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue