Skip to content

[BUG FIX] Derive BatchRenderer texture descriptor capacity from scene textures - #56

Merged
duburcqa merged 2 commits into
Genesis-Embodied-AI:mainfrom
NoahLinckeScout:noah-dynamic-texture-capacity
Jul 22, 2026
Merged

[BUG FIX] Derive BatchRenderer texture descriptor capacity from scene textures#56
duburcqa merged 2 commits into
Genesis-Embodied-AI:mainfrom
NoahLinckeScout:noah-dynamic-texture-capacity

Conversation

@NoahLinckeScout

Copy link
Copy Markdown
Contributor

Description

Replace the fixed 128-texture descriptor capacity with a per-scene capacity
derived from GSModel.numTextures before RenderContext creates pipelines or
descriptor sets.

The change:

  • adds maxTextures to RenderManager::Config and initializes it from the
    loaded scene, with a minimum capacity of one;
  • applies that capacity to the regular draw path, BatchRenderer draw path,
    viewer voxel path, descriptor pool, and descriptor-set layout;
  • validates the requested capacity against Vulkan sampled-image limits before
    pipeline construction; and
  • makes loadObjects fail with an actionable error if a later load exceeds the
    configured capacity.

There is no Python API change. Existing scenes retain the same behavior; scenes
with more than 128 textures now use valid descriptor layouts when supported by
the device.

Related Issue

Resolves #55

Motivation and Context

loadObjects previously wrote one sampled-image descriptor for every source
texture into a binding created with capacity 128. Vulkan requires that the
descriptor write fit the binding. Exceeding that limit produced missing textured
geometry and native allocator aborts.

How Has This Been / Can This Be Tested?

The issue's linked repro.py is self-contained: it generates a 256-texture
GLB and runs in a clean uv environment using the released public packages.

uv run repro.py

Before this change, the script reports 152/256 visible textured quads and the
child renderer aborts. With this change, the same script reports 256/256 and
the renderer exits zero.

The patch was also checked against the current main revision
754c5aa7b4214e70152db56ef012305d5fb27f2e.

Screenshots (if appropriate)

The issue repro generates synthetic unpatched and patched images containing
only colored-quad fixture geometry.

Checklist:

  • I read the CONTRIBUTING document.
  • I followed the Submitting Code Changes section of CONTRIBUTING.
  • I tagged the title correctly (including BUG FIX/FEATURE/MISC/BREAKING).
  • I updated the documentation accordingly or no change is needed.
  • I tested my changes and added instructions on how to test them for reviewers.
  • I have added tests to cover my changes.
  • All new and existing tests passed.

@NoahLinckeScout
NoahLinckeScout marked this pull request as ready for review July 13, 2026 22:45
@NoahLinckeScout
NoahLinckeScout force-pushed the noah-dynamic-texture-capacity branch from 2ece7dd to 5ec74b6 Compare July 15, 2026 18:38
NoahLinckeScout and others added 2 commits July 22, 2026 18:03
Follow-up to deriving the texture descriptor capacity from the scene:

- expose an optional `max_textures` construction argument (default 0 =
  derive from scene) so callers can reserve descriptor headroom for
  scenes loaded later, instead of the capacity being pinned to the
  initial scene's texture count;
- centralize the capacity computation (scene count, minimum of one,
  user-requested floor) in initRenderManager rather than an inline
  ternary;
- in validateTextureCapacity, name the BatchRenderer two-array factor
  and report the actual supported maximum for the device on failure;
- make the loadObjects overflow error actionable by pointing at the
  max_textures knob.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@duburcqa
duburcqa force-pushed the noah-dynamic-texture-capacity branch from 5336bf5 to 765217f Compare July 22, 2026 16:06
@duburcqa
duburcqa merged commit 0f29f6a into Genesis-Embodied-AI:main Jul 22, 2026
1 check passed
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.

[Bug]: BatchRenderer corrupts textured scenes above its descriptor capacity

2 participants