Skip to content

Commit f25d5a2

Browse files
authored
TSL: add dFdx and dFdy warnings (#30831)
1 parent 541455a commit f25d5a2

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

src/nodes/math/MathNode.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -260,6 +260,14 @@ class MathNode extends TempNode {
260260

261261
}
262262

263+
if ( builder.shaderStage !== 'fragment' && ( method === MathNode.DFDX || method === MathNode.DFDY ) ) {
264+
265+
console.warn( `THREE.TSL: '${ method }' is not supported in the ${ builder.shaderStage } stage.` );
266+
267+
method = '/*' + method + '*/';
268+
269+
}
270+
263271
params.push( a.build( builder, inputType ) );
264272
if ( b !== null ) params.push( b.build( builder, inputType ) );
265273
if ( c !== null ) params.push( c.build( builder, inputType ) );

0 commit comments

Comments
 (0)