From d407e2b1309d8ad63ff4f9326a8b5e7347ba8515 Mon Sep 17 00:00:00 2001 From: Faith Ekstrand Date: Mon, 30 Jan 2023 20:11:56 -0600 Subject: [PATCH] nil: Fix max mip level The MAX_MIP_LEVEL field needs the actual number from the image because it's used to compute the stride between layers. The restrictions on mip level come entirely from the RES_VIEW fields. Part-of: --- src/nouveau/nil/nil_image_tic.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/nouveau/nil/nil_image_tic.c b/src/nouveau/nil/nil_image_tic.c index 187892db2c4..30d4cecf5d7 100644 --- a/src/nouveau/nil/nil_image_tic.c +++ b/src/nouveau/nil/nil_image_tic.c @@ -186,9 +186,7 @@ nil_image_fill_tic(struct nouveau_ws_device *dev, TH_SET_U(th, NVB097, BL, WIDTH_MINUS_ONE, width - 1); TH_SET_U(th, NVB097, BL, HEIGHT_MINUS_ONE, height - 1); TH_SET_U(th, NVB097, BL, DEPTH_MINUS_ONE, depth - 1); - - const uint32_t last_level = view->num_levels + view->base_level - 1; - TH_SET_U(th, NVB097, BL, MAX_MIP_LEVEL, last_level); + TH_SET_U(th, NVB097, BL, MAX_MIP_LEVEL, image->num_levels - 1); TH_SET_U(th, NVB097, BL, TEXTURE_TYPE, nil_to_nvb097_texture_type(view->type)); @@ -206,7 +204,9 @@ nil_image_fill_tic(struct nouveau_ws_device *dev, TH_SET_E(th, NVB097, BL, ANISO_COARSE_SPREAD_FUNC, SPREAD_FUNC_TWO); TH_SET_U(th, NVB097, BL, RES_VIEW_MIN_MIP_LEVEL, view->base_level); - TH_SET_U(th, NVB097, BL, RES_VIEW_MAX_MIP_LEVEL, last_level); + TH_SET_U(th, NVB097, BL, RES_VIEW_MAX_MIP_LEVEL, + view->num_levels + view->base_level - 1); + TH_SET_U(th, NVB097, BL, MULTI_SAMPLE_COUNT, uint_to_nvb097_multi_sample_count(image->num_samples));