Skip to content

Android (Adreno 740): uniform tables, kernel switches, an on-disk pipeline cache - #61

Merged
doodlewind merged 1 commit into
mainfrom
adreno
Nov 13, 2026
Merged

doodlewind merged 1 commit into
mainfrom
adreno

Conversation

@doodlewind

Copy link
Copy Markdown
Collaborator

The renderer did not draw correctly on Qualcomm's Adreno 740 (Vulkan ray queries): the kernel read its small read-only storage tables wrongly, so textures came from another table and emissive surfaces were dark.

  • Uniform tables. The four bounded read-only tables (tex_info, objects, instances, media) are bound as uniform copies, synced each frame. On by default on Android, switchable (THREERT_UNIFORM_TABLES, GpuOptions), never with the merged layout. Bounds (64 KiB a table) are said on stderr when a scene passes them.
  • Kernel switches as source patches (gpu::KernelSwitches): a guard on non-finite rays, cheaper cut-outs, direct light on the last bounce, no light sampling of a baked sky. Android defaults; other platforms' kernel sources stay hash-identical.
  • Pipeline cache. With THREERT_PIPELINE_CACHE=<dir> (or GpuOptions::pipeline_cache) compiled pipelines are kept on disk, one sealed file an adapter: a scene opened again starts in seconds instead of half a minute. Helps every Vulkan driver.
  • Dynamic resolution by the clock (THREERT_GOVERN_CLOCK, on by default on Android): a slow GPU reaches its frame rate in seconds, not after hundreds of slow frames.

Checked on a Mac: all 126 offline render tests are byte-identical with and without the uniform tables and the strict kernel; cargo test --release passes. Checked on the device (Snapdragon 8 Gen 2, Adreno 740): pictures match the Mac's (mean difference 0.8 to 3.0 of 255 on four scenes), the cache works, no GPU faults. docs/RUNTIME.md (Android (Adreno)) has the numbers.

🤖 Generated with Claude Code

…rnel switches, an on-disk pipeline cache; dynamic resolution by the clock

On Adreno 740 the kernel read its small read-only storage tables wrongly (textures from another table, dark
emissives). The four bounded ones (tex_info, objects, instances, media) are bound as uniform copies there, synced
each frame; kernel switches (a guard on non-finite rays, cheaper sampling) are source patches chosen by
GpuOptions / THREERT_* variables, on by default on Android only, so other platforms' kernels are unchanged. Compiled
pipelines are kept on disk when the embedder names a directory (THREERT_PIPELINE_CACHE): a scene opened again
starts in seconds. Dynamic resolution can settle by the clock instead of by frame count. docs/RUNTIME.md: Android
(Adreno), with what was measured on the device.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
@doodlewind
doodlewind merged commit b5ef695 into main Nov 13, 2026
8 checks 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.

1 participant