-
-
Notifications
You must be signed in to change notification settings - Fork 36.1k
Closed
Labels
Milestone
Description
Description
When a TSL code contains select(...,remap,remap) the generated shader code uses null as a type of one of the variables. This fails the shader compilation.
The issue does not appear if:
- only one
remapis used - or both
remap-s are used outsideselect - or the second
remapis wrapped infloat(select(...)).
The error message (when WebGL2 is used) is:
THREE.WebGLProgram: Shader Error 0 - VALIDATE_STATUS false
Program Info Log: Must have a compiled fragment shader attached:
SHADER_INFO_LOG:
ERROR: 0:48: 'null' : undeclared identifier
ERROR: 0:48: 'nodeVar1' : syntax error
FRAGMENT
ERROR: 0:48: 'null' : undeclared identifier
ERROR: 0:48: 'nodeVar1' : syntax error
43:
44: void main() {
45:
46: // vars
47: vec4 DiffuseColor;
> 48: null nodeVar1;
49: vec4 Output;
50: vec4 nodeVar3;
51:
52: // flow
53: // code
54:
For WebGPU the error is conceptually the same, but explained with different words.
Reproduction steps
- See the live example at https://codepen.io/boytchev/pen/vEBJaLa?editors=0011
- Run it with opened console
- It should show the error
- Instead of
remap(0, 0, 0, 0, 0)in line 21 usefloat(remap(0, 0, 0, 0, 0)) - The shader now compiles
Note: the demo program is not meaningful. It is only to demonstrate the compilation error.
Code
var test = Fn(() => {
var k = select(
0,
remap(0, 0, 0, 0, 0),
remap(0, 0, 0, 0, 0) // wrap it in float(...) and it will work
);
return vec3(k, 0, 0);
});Live example
https://codepen.io/boytchev/pen/vEBJaLa?editors=0011
Screenshots
Version
r171
Device
Desktop
Browser
Chrome
OS
Windows
mrdoob
