Skip to content

A scene's features as FEAT bits: vertex colours, grids, instance colours, unlit, background - #80

Merged
yujiaxu-ops merged 1 commit into
mainfrom
kernel-feat
Nov 14, 2026
Merged

yujiaxu-ops merged 1 commit into
mainfrom
kernel-feat

Conversation

@yujiaxu-ops

@yujiaxu-ops yujiaxu-ops commented Nov 14, 2026 •

Copy link
Copy Markdown
Collaborator

Vertex colours, density grids, instance colours, unlit materials and the background used to be @if flags, so every combination of them produced a different kernel source. They are now bits of FEAT, the pipeline-overridable constant that the other scene features already use.

  • Their bindings and fields are always declared. The Rust side already provided all of them.
  • OBJECT_STRIDE is an override derived from F_TINT. A test runs naga's override processing to check it.
  • Only units still change the source. The kernel now has 10 flags instead of 15.

Checks

  • cargo test --release with the loop guard: 138 passed.

  • render-identity against main, 190 outputs each:

    run byte-identical within run-to-run spread changed
    native + guard 172 18 0
    merged + guard 175 15 0
    uniform tables + guard 171 19 0
    native 172 18 0
  • web-hello in Chrome: pass.

  • Bistro trace time, alternating with main in both orders:

    • native: 8.39–9.14 ms against main's 8.38–9.23 ms;
    • merged: steady prints 48.4–48.5 ms against 48.5–48.8 ms.

🤖 Generated with Claude Code


Note

Medium Risk
Changes how scene capability is compiled and how FEAT/OBJECT_STRIDE are resolved at pipeline creation, but identity/render checks reported unchanged output; mistakes could still affect binding layout or stride for tinted scenes.

Overview
Collapses five scene-specific WESL @if kernel variants into one source by representing vertex colours, density grids, instance colours, unlit materials, and scene.background as new FEAT bits (F_TINT, F_VCOLOR, F_GRID, F_UNLIT, F_BACKGROUND), matching how other optional features already work.

The shader always declares the related bindings and struct fields (grid_tex, Params.background, vcolor/vgrid/obj_tint, etc.) and gates behavior at runtime with has(F_*) instead of stripping declarations per variant. OBJECT_STRIDE is now a pipeline override (select(3u, 4u, … F_TINT)); Rust no longer treats tint/vcolor/grid/unlit/background as KernelVariant::flags or F_SOURCE—only units still changes the compiled source (F_SOURCE = F_UNITS), cutting conditional-translation flags from 15 to 10.

Tests and docs were updated: scene_features_are_feat_bits asserts identical WGSL for those feature bitmasks and validates naga override resolution for OBJECT_STRIDE; ROADMAP.md / RUNTIME.md describe the new model.

Reviewed by Cursor Bugbot for commit 4cd5e2c. Bugbot is set up for automated code reviews on this repo. Configure here.

…urs, unlit, background

They were @if flags, each combination another kernel source. Now they are FEAT bits (the pipeline-overridable
constant the other features use); their bindings and fields are always declared, OBJECT_STRIDE is an override from
F_TINT. Only units still change the source (10 flags, was 15).

Checks: cargo test --release guarded, 138 passed; render-identity against main (native, merged, uniform tables;
guarded and not): 0 of 190 changed; web-hello passes; Bistro's trace the same natively and merged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@yujiaxu-ops
yujiaxu-ops merged commit 10fdc77 into main Nov 14, 2026
9 checks passed
yujiaxu-ops added a commit that referenced this pull request Nov 14, 2026
scene.rs named `tinted_source`, removed by #80. The particle shaders said
their objects never have instance colours; gpu.rs writes a stride of 4 into
them for such scenes.

Co-authored-by: Claude Fable 5.2 <noreply@anthropic.com>
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