Skip to content

render: guard generateImpostor against degenerate fov/aspect - #392

Open
Quinn-Elara wants to merge 1 commit into
AlchemyViewer:developfrom
Quinn-Elara:imposter-crash
Open

Quinn-Elara wants to merge 1 commit into
AlchemyViewer:developfrom
Quinn-Elara:imposter-crash

Conversation

@Quinn-Elara

Copy link
Copy Markdown
Contributor

Description

When an avatar's spatial extents project to zero in the camera's up axis (collapsed bounding box, extreme distance, or a lookAt singularity when the avatar is directly above or below the camera), tdim.mV[1] is zero. This produces fov=0 and aspect=NaN, which assert-crash inside glm::perspectiveRH_NO before the perspective matrix is written.

Add a finite/positive check on fov and aspect before the GL matrix push. On failure, restore pushRenderTypeMask, sUseOcclusion, sShadowRender and sImpostorRender and return early. Move the MM_PROJECTION pushMatrix to after the guard so no pop is needed on the early-out path and the normal path has exactly one push.

Fixes a reproducible crash when impostoring a distant avatar (>3km) while the viewer window is in the background.

Related Issues

  • Please link to a relevant GitHub issue for additional context.
    • Bug Fix: Link to an issue that includes reproduction steps and testing guidance.
    • Feature/Enhancement: Link to an issue with a write-up, rationale, and requirements.

Issue Link:


Checklist

Please ensure the following before requesting review:

  • I have provided a clear title and detailed description for this pull request.
  • If useful, I have included media such as screenshots and video to show off my changes.
  • I have tested the changes locally and verified they work as intended.
  • All new and existing tests pass.
  • Code follows the project's style guidelines.
  • Documentation has been updated if needed.
  • Any dependent changes have been merged and published in downstream modules
  • I have reviewed the contributing guidelines.

Additional Notes

When an avatar's spatial extents project to zero in the camera's up axis
(collapsed bounding box, extreme distance, or a lookAt singularity when
the avatar is directly above or below the camera), tdim.mV[1] is zero.
This produces fov=0 and aspect=NaN, which assert-crash inside
glm::perspectiveRH_NO before the perspective matrix is written.

Add a finite/positive check on fov and aspect before the GL matrix push.
On failure, restore pushRenderTypeMask, sUseOcclusion, sShadowRender and
sImpostorRender and return early. Move the MM_PROJECTION pushMatrix to
after the guard so no pop is needed on the early-out path and the normal
path has exactly one push.

Fixes a reproducible crash when impostoring a distant avatar (>3km) while
the viewer window is in the background.
@coderabbitai

coderabbitai Bot commented Sep 5, 2026

Copy link
Copy Markdown
Contributor

Warning

Review limit reached

Next included review available in 40 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Learn how review limits work.

Review configuration:

⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Team

Run ID: c3ab18e5-c7a0-47a4-84ed-ece0199db708

📥 Commits

Reviewing files that changed from the base of the PR and between 3c8cb82 and 836e726.

📒 Files selected for processing (1)
  • indra/newview/pipeline.cpp

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant