From faa51a10edbd92cc3f9cf2c5766360f759edeea2 Mon Sep 17 00:00:00 2001 From: Jason Ekstrand Date: Mon, 30 May 2022 09:52:10 -0500 Subject: [PATCH] isl: Add some asserts about multisampled surfaces This isn't really necessary because the API doesn't allow MSAA and mipmapping at the same time but people forget that pretty often so it's good to have it as documentation if nothing else. Part-of: --- src/intel/isl/isl_surface_state.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/intel/isl/isl_surface_state.c b/src/intel/isl/isl_surface_state.c index 4cbcd64d28e..914889d8a90 100644 --- a/src/intel/isl/isl_surface_state.c +++ b/src/intel/isl/isl_surface_state.c @@ -439,6 +439,19 @@ isl_genX(surf_fill_state_s)(const struct isl_device *dev, void *state, s.CubeFaceEnableNegativeX = 1; #if GFX_VER >= 6 + /* From the Broadwell PRM for "Number of Multisamples": + * + * "If this field is any value other than MULTISAMPLECOUNT_1, Surface + * Min LOD, Mip Count / LOD, and Resource Min LOD must be set to zero." + * + * This is fine because no 3D API allows multisampling and mipmapping at + * the same time. + */ + if (info->surf->samples > 1) { + assert(info->view->min_lod_clamp == 0); + assert(info->view->base_level == 0); + assert(info->view->levels == 1); + } s.NumberofMultisamples = ffs(info->surf->samples) - 1; #if GFX_VER >= 7 s.MultisampledSurfaceStorageFormat =