rive-app / rive-app/rive-runtime

Metal assert when using texture with no mip maps

Open
#41 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

triage
Dominant language
C++
Stars
1.2k
Forks
121
PR merge metrics
No merged PRs in 30d

Description

This is regarding the metal backend, and when debugging the app, at which point we get an assert in XCode.

We create textures using RenderContextMetalImpl::makeImageTexture() with a mipLevelCount = 1.
This however asserts due to the fact that the TextureMetalImpl::ensureMipmaps() will trigger a metal assert, due to the mip level count is 1:

-[MTLDebugBlitCommandEncoder generateMipmapsForTexture:]:1114: failed assertion `Generate Mipmaps For Texture Validation
[tex mipmapLevelCount](1) must be > 1.

The suggested fix is to check the mip level count before calling [mipEncoder generateMipmapsForTexture:m_texture];

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with RenderContextMetalImpl::makeImageTexture() and TextureMetalImpl::ensureMipmaps() in the Metal backend. Reproduce the path with mipLevelCount = 1 and verify that it no longer triggers the Metal assertion, while textures with multiple mip levels still generate mipmaps as expected.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
computer-graphics
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.