Skip to content

fix: WebGPU memory alignment and aesthetic pass - #421

Merged
ford442 merged 2 commits into
mainfrom
fix-webgpu-memory-alignment-17774929731782567112
Jul 13, 2026
Merged

fix: WebGPU memory alignment and aesthetic pass#421
ford442 merged 2 commits into
mainfrom
fix-webgpu-memory-alignment-17774929731782567112

Conversation

@ford442

@ford442 ford442 commented Jul 13, 2026

Copy link
Copy Markdown
Owner

Fixed the WebGPU uniform buffer layout mismatch causing rendering artifacts by adjusting memory writing offsets in src/webgpu/viewUniforms.ts and src/webgpu/viewMaterials.ts to properly align the mapping with the FragmentUniforms struct in pbrBlocks.ts. Addressed shader function signature mismatch applyMaterialParticleInteraction. Removed duplicate properties in effects.ts. Properly configure the block texture inside the imageSampled theme instantiation logic and adjusted the fragment shader to use correct base alpha mapping.


PR created automatically by Jules for task 17774929731782567112 started by @ford442

Summary by CodeRabbit

  • New Features

    • Enhanced block rendering with richer materials, including glass, metal, subsurface, clearcoat, hologram, lava, and glow effects.
    • Added improved texture-based material masking and more detailed lighting, shadows, and environmental effects.
    • Added stronger visual feedback for hard drops.
  • Bug Fixes

    • Improved reliability of hard-drop effect triggering.
    • Refined visual effect timing for smoother saturation transitions.

…tifacts

Co-authored-by: ford442 <9397845+ford442@users.noreply.github.com>
@google-labs-jules

Copy link
Copy Markdown

👋 Jules, reporting for duty! I'm here to lend a hand with this pull request.

When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down.

I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job!

For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!

New to Jules? Learn more at jules.google/docs.


For security, I will only act on instructions from the user who triggered this task.

@coderabbitai

coderabbitai Bot commented Jul 13, 2026

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

@ford442, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 58 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: ef5a0e25-9710-458a-9d82-b78e7fe45de0

📥 Commits

Reviewing files that changed from the base of the PR and between cc14ac6 and f84aee4.

📒 Files selected for processing (5)
  • index.ts
  • src/game.ts
  • src/webgpu/effects.ts
  • src/webgpu/shaders/pbrBlocks.ts
  • src/webgpu/viewMaterials.ts
📝 Walkthrough

Walkthrough

The change expands block PBR shader generation and material uniform wiring, configures authored block textures, updates saturation decay, and synchronizes hard-drop effect flags on both synchronous and asynchronous paths.

Changes

Block rendering and effects

Layer / File(s) Summary
Runtime effect and texture inputs
index.ts, src/game.ts, src/webgpu/effects.ts
Texture configuration and metal thresholds are initialized, hard drops set the instance effect flag, and saturation decay uses rational attenuation.
Shader and uniform contract
src/webgpu/shaders/pbrBlocks.ts, src/webgpu/viewMaterials.ts
Local PBR helpers and shader builders replace re-exports, while fragment uniform writes use the expanded material layout.
Fragment material rendering
src/webgpu/shaders/pbrBlocks.ts
The fragment shader adds authored-mask handling, ghost and hologram paths, PBR material branches, particle interactions, lighting overlays, board effects, dissolve glow, and premultiplied output.

Estimated code review effort: 4 (Complex) | ~60 minutes

Sequence Diagram(s)

sequenceDiagram
  participant Game
  participant updateMaterialUniforms
  participant PBRBlockShaders
  participant GPUResources
  Game->>Game: Set effectFlag on hard drop
  updateMaterialUniforms->>PBRBlockShaders: Write material-type and fragment uniforms
  GPUResources->>PBRBlockShaders: Provide texture and dissolve-field data
  PBRBlockShaders-->>GPUResources: Produce shaded premultiplied block output
Loading

Possibly related PRs

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix-webgpu-memory-alignment-17774929731782567112

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.

@ford442
ford442 marked this pull request as ready for review July 13, 2026 05:21
@ford442
ford442 merged commit 104751c into main Jul 13, 2026
0 of 4 checks passed
@ford442
ford442 deleted the fix-webgpu-memory-alignment-17774929731782567112 branch July 13, 2026 05:21
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