{"record":{"id":"894760df188c32e2","repo":"gfx-rs/wgpu","slug":"invalid-mip-level","errorCode":null,"errorMessage":"invalid mip level","messagePattern":"invalid mip level","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"wgpu-types/src/texture.rs","lineNumber":725,"sourceCode":"    }\n\n    /// Computes the render extent of this texture.\n    ///\n    /// This is a low-level helper exported for use by wgpu-core.\n    ///\n    /// <https://gpuweb.github.io/gpuweb/#abstract-opdef-compute-render-extent>\n    ///\n    /// # Panics\n    ///\n    /// If the mip level is out of range.\n    #[doc(hidden)]\n    #[must_use]\n    pub fn compute_render_extent(&self, mip_level: u32, plane: Option<u32>) -> Extent3d {\n        let Extent3d {\n            width,\n            height,\n            depth_or_array_layers: _,\n        } = self.mip_level_size(mip_level).expect(\"invalid mip level\");\n\n        let (w_subsampling, h_subsampling) = self.format.subsampling_factors(plane);\n\n        let width = width / w_subsampling;\n        let height = height / h_subsampling;\n\n        Extent3d {\n            width,\n            height,\n            depth_or_array_layers: 1,\n        }\n    }\n\n    /// Returns the number of array layers.\n    ///\n    /// <https://gpuweb.github.io/gpuweb/#abstract-opdef-array-layer-count>\n    #[must_use]\n    pub fn array_layer_count(&self) -> u32 {","sourceCodeStart":707,"sourceCodeEnd":743,"githubUrl":"https://github.com/gfx-rs/wgpu/blob/3e11ff59bf3f9795d285ecc045014089640d7248/wgpu-types/src/texture.rs#L707-L743","documentation":"A generic guard panic raised by expect() after mip_level_size() returned None: the mip_level passed to compute_render_extent is out of range for this texture, i.e. it is >= the texture's mip_level_count (or the texture was created with mip level count 1 while a larger level was requested). The offending input is the mip_level argument itself.","triggerScenarios":"Thrown at wgpu-types/src/texture.rs:725 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Ensure the mip_level passed to compute_render_extent is less than the texture's mip_level_count as specified at creation (TextureDescriptor.mip_level_count)","If you need the extent of the smallest mip level, use texture.mip_level_count() - 1 or size.mip_level_size(...) helpers to query a valid level","When computing render extents for a view, derive the mip level from the view's base_mip_level, which wgpu-core has already validated against the texture"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"3e11ff59bf3f9795d285ecc045014089640d7248","analyzedAt":"2026-09-03T01:43:21.459Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-10T07:17:11.731Z"}