Skip to content

TSL: add dFdx and dFdy warnings#30831

Merged
sunag merged 1 commit into
mrdoob:devfrom
sunag:dev-improve-alerts
Mar 31, 2025
Merged

TSL: add dFdx and dFdy warnings#30831
sunag merged 1 commit into
mrdoob:devfrom
sunag:dev-improve-alerts

Conversation

@sunag
Copy link
Copy Markdown
Collaborator

@sunag sunag commented Mar 31, 2025

Description

Improves warning and avoids crashing the renderer if dFdx and dFdy are used in non-fragment shader stage.

@sunag sunag requested a review from Copilot March 31, 2025 15:41
@sunag sunag added this to the r176 milestone Mar 31, 2025
Copy link
Copy Markdown
Contributor

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 pull request adds runtime warnings when dFdx and dFdy are used outside the fragment shader stage, preventing renderer crashes.

  • Introduces a conditional check for non-fragment shader stages
  • Logs a warning message and comments out the method string when dFdx or dFdy is encountered

Comment thread src/nodes/math/MathNode.js
@sunag sunag marked this pull request as ready for review March 31, 2025 15:42
@github-actions
Copy link
Copy Markdown

📦 Bundle size

Full ESM build, minified and gzipped.

Before After Diff
WebGL 336.36
78.34
336.36
78.34
+0 B
+0 B
WebGPU 532.74
148.03
532.9
148.08
+152 B
+49 B
WebGPU Nodes 532.21
147.93
532.36
147.98
+152 B
+50 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 604.38
164
604.53
164.05
+152 B
+51 B
WebGPU Nodes 559.37
153.45
559.52
153.5
+152 B
+49 B

@sunag sunag merged commit f25d5a2 into mrdoob:dev Mar 31, 2025
@sunag sunag deleted the dev-improve-alerts branch March 31, 2025 16:05
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