Skip to content

fix(shadertools): repair WebGPU glTF material shader compilation - #3003

Open
ibgreen-openai wants to merge 2 commits into
masterfrom
codex/gltf-webgpu-shader-compilation
Open

fix(shadertools): repair WebGPU glTF material shader compilation#3003
ibgreen-openai wants to merge 2 commits into
masterfrom
codex/gltf-webgpu-shader-compilation

Conversation

@ibgreen-openai

Copy link
Copy Markdown
Collaborator

Goals

  • Restore real WebGPU rendering for glTF assets that combine textured base-color and transmission materials.
  • Make shader-module binding allocation stable across independently specialized material permutations.
  • Preserve valid WGSL derivative and uniform-control-flow semantics for diffuse-transmission image-based lighting.

Changes

  • Keep automatically assigned module bindings globally unique within each WebGPU bind group, including bindings registered by previously compiled but currently inactive shader permutations.
  • Preserve stable existing assignments, explicit/application bindings, cross-group isolation, and paired texture/sampler allocations.
  • Sample diffuse irradiance cubemaps with explicit mip level zero in both shared-scene and standalone glTF environment paths, eliminating implicit derivatives inside data-dependent transmission branches.
  • Add regression coverage for transmission-only, base-color-only, and combined shader permutations.
  • Add WGSL source and available-device compilation regressions for textured transmission with both environment configurations.

Root causes

  1. The persistent WGSL binding registry allocated the same group-3 binding to separate optional texture bindings when those bindings first appeared in disjoint shader permutations; a later combined material then failed during binding reservation.
  2. Diffuse-transmission IBL sampled an environment cubemap with implicit derivatives after branching on a texture-derived factor, which violates WGSL uniform control-flow requirements.

Verification

  • 36 focused shader-assembly and PBR regression tests pass.
  • Strict cross-package ANARI/glTF/shadertools TypeScript project-reference build passes.
  • All four changed files pass Biome formatting and git diff checks.
  • Verified directly in the live WebGPU Animation Studio: Physical Transmission renders successfully, switching to the 86-joint animated robot and back succeeds, and no application shader errors are emitted.

Scope

  • Four shadertools files only.
  • Based directly on current master; no unpublished showcase, resource-lifecycle, or animation-instance changes.

@ibgreen-openai
ibgreen-openai marked this pull request as ready for review August 6, 2026 20:02

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 0d4dff661f

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread modules/shadertools/src/lib/shader-assembly/assemble-shaders.ts
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.

2 participants