diff --git a/src/amd/vulkan/radv_device.c b/src/amd/vulkan/radv_device.c index 5a4874531b8..53b7dfac90e 100644 --- a/src/amd/vulkan/radv_device.c +++ b/src/amd/vulkan/radv_device.c @@ -3115,8 +3115,8 @@ radv_initialise_color_surface(struct radv_device *device, } if (device->physical_device->rad_info.chip_class >= GFX9) { - uint32_t max_slice = radv_surface_layer_count(iview); - unsigned mip0_depth = iview->base_layer + max_slice - 1; + unsigned mip0_depth = iview->image->type == VK_IMAGE_TYPE_3D ? + (iview->extent.depth - 1) : (iview->image->info.array_size - 1); cb->cb_color_view |= S_028C6C_MIP_LEVEL(iview->base_mip); cb->cb_color_attrib |= S_028C74_MIP0_DEPTH(mip0_depth) |