mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2024-11-23 18:24:13 +08:00
intel/isl: Add some sanity checks for compressed surfaces
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
This commit is contained in:
parent
5de4209f91
commit
628bfaf1c6
@ -254,6 +254,24 @@ isl_genX(surf_fill_state_s)(const struct isl_device *dev, void *state,
|
||||
if (info->surf->dim == ISL_SURF_DIM_1D)
|
||||
assert(!isl_format_is_compressed(info->view->format));
|
||||
|
||||
if (isl_format_is_compressed(info->surf->format)) {
|
||||
/* You're not allowed to make a view of a compressed format with any
|
||||
* format other than the surface format. None of the userspace APIs
|
||||
* allow for this directly and doing so would mess up a number of
|
||||
* surface parameters such as Width, Height, and alignments. Ideally,
|
||||
* we'd like to assert that the two formats match. However, we have an
|
||||
* S3TC workaround that requires us to do reinterpretation. So assert
|
||||
* that they're at least the same bpb and block size.
|
||||
*/
|
||||
MAYBE_UNUSED const struct isl_format_layout *surf_fmtl =
|
||||
isl_format_get_layout(info->surf->format);
|
||||
MAYBE_UNUSED const struct isl_format_layout *view_fmtl =
|
||||
isl_format_get_layout(info->surf->format);
|
||||
assert(surf_fmtl->bpb == view_fmtl->bpb);
|
||||
assert(surf_fmtl->bw == view_fmtl->bw);
|
||||
assert(surf_fmtl->bh == view_fmtl->bh);
|
||||
}
|
||||
|
||||
s.SurfaceFormat = info->view->format;
|
||||
|
||||
#if GEN_GEN <= 5
|
||||
|
Loading…
Reference in New Issue
Block a user