Skip to content

Conversation

sunag
Copy link
Collaborator

@sunag sunag commented Apr 3, 2025

Related issue: #30725

Description

Introduce WebGPU Compatibility Mode, this is the first of other complementary PRs that are in development. After the implementation of PMREM we were still generating mipmaps in CubeMaps, which is unnecessary since PMREM already does this in a 2d texture, this should save gpu memory and should help especially on mobile devices.

@sunag sunag added this to the r176 milestone Apr 3, 2025
@sunag sunag requested a review from Copilot April 3, 2025 16:04
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR introduces a WebGPU Compatibility Mode for the renderer and improves texture handling by eliminating unnecessary mipmap generation for CubeMaps. Key changes include:

  • Adding an optional compatibilityMode parameter in the WebGPUBackend.
  • Updating the texture creation logic in WebGPUTextureUtils to correctly handle cube textures.
  • Removing the environment texture check from mipmap generation in the Textures module.

Reviewed Changes

Copilot reviewed 3 out of 4 changed files in this pull request and generated no comments.

File Description
src/renderers/webgpu/utils/WebGPUTextureUtils.js Adds a condition for cube textures, setting the textureBindingViewDimension appropriately.
src/renderers/webgpu/WebGPUBackend.js Introduces the compatibilityMode parameter and passes a featureLevel option to the adapter.
src/renderers/common/Textures.js Removes the environment texture check from the mipmap generation logic as PMREM now handles it.
Files not reviewed (1)
  • examples/webgpu_loader_gltf.html: Language not supported

Copy link

github-actions bot commented Apr 3, 2025

📦 Bundle size

Full ESM build, minified and gzipped.

Before After Diff
WebGL 336.39
78.35
336.39
78.35
+0 B
+0 B
WebGPU 540.64
149.78
540.78
149.8
+142 B
+19 B
WebGPU Nodes 540.1
149.68
540.25
149.7
+142 B
+20 B

🌳 Bundle size after tree-shaking

Minimal build including a renderer, camera, empty scene, and dependencies.

Before After Diff
WebGL 465.37
112.21
465.37
112.21
+0 B
+0 B
WebGPU 613.53
165.84
613.67
165.87
+142 B
+28 B
WebGPU Nodes 568.52
155.25
568.66
155.28
+142 B
+25 B

@sunag sunag marked this pull request as ready for review April 3, 2025 16:52
@sunag sunag merged commit 468f47a into mrdoob:dev Apr 3, 2025
12 checks passed
@sunag sunag deleted the dev-compatible-mode2 branch April 3, 2025 17:48
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