Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed calcNumMips for non-power-of-2 texture dimensions #3219

Merged
merged 1 commit into from
Dec 11, 2023

Conversation

jay3d
Copy link
Contributor

@jay3d jay3d commented Dec 11, 2023

calcNumMips function was calculating often wrong number of mipmaps for textures whose dimensions are not power of 2 such as 96x96; Apparently this is not an issue in Vulkan and probably others(IMHO is bad), but Metal seems to complain about it:

-[MTLTextureDescriptorInternal validateWithDevice:]:1357: failed assertion `Texture Descriptor Validation
MTLTextureDescriptor requests 8 mipmap levels, but the dimensions (96, 96, 1) can only support a maxiumum of 7 levels
'

I introduced floorLog2 function in bx so now this function can use it instead of ceilLog2, which works properly for all texture dimensions.

PS: This PR might fail checks because it might not be using the updated bx: bkaradzic/bx#314

@bkaradzic bkaradzic merged commit f91c6fa into bkaradzic:master Dec 11, 2023
0 of 13 checks passed
@jay3d jay3d deleted the non-power-of-2-calcNumMips branch December 11, 2023 19:56
mipek pushed a commit to mipek/bgfx that referenced this pull request Mar 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants