metal: no-op texture_generate_mipmaps for non-mipmapped textures#637
Open
benface wants to merge 1 commit into
Open
metal: no-op texture_generate_mipmaps for non-mipmapped textures#637benface wants to merge 1 commit into
texture_generate_mipmaps for non-mipmapped textures#637benface wants to merge 1 commit into
Conversation
The trait method's doc comment already promises:
Metal-specific note: if texture was created without
`params.generate_mipmaps`, `generate_mipmaps` will do nothing.
But the Metal implementation unconditionally calls
`generateMipmapsForTexture:`, which Metal validation rejects when the
texture has `mipmapLevelCount == 1`:
-[MTLDebugBlitCommandEncoder generateMipmapsForTexture:]:1105:
failed assertion `Generate Mipmaps For Texture Validation
[tex mipmapLevelCount](1) must be > 1.`
Honour the documented contract — early-return when
`params.allocate_mipmaps` is false. Matches the OpenGL backend's
behaviour and the docstring.
c0678b5 to
14e7f18
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
RenderingBackend::texture_generate_mipmaps's doc comment already promises:But the Metal implementation in
graphics/metal.rsunconditionally callsgenerateMipmapsForTexture:without checking the texture'sallocate_mipmapsflag. With Metal validation on, the call fails on any texture that hasmipmapLevelCount == 1:Fix
Early-return when
texture.params.allocate_mipmapsis false. Honours the documented contract and matches the OpenGL backend's behaviour.Tested on
iPhone 17 simulator on iOS 27 beta — assert gone for macroquad apps that call
set_filter(which routes throughtexture_generate_mipmapsfor the mipmap filter mode) on non-mipmapped textures.