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: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>
This commit is contained in:
Faith Ekstrand
2023-01-30 20:11:56 -06:00
committed by Marge Bot
parent 89591214a3
commit d407e2b130
+4 -4
View File
@@ -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));