Description
In WGSL, the ! operator works component-wise on boolean vectors, whereas in GLSL, ! on boolean vectors is invalid and not() function must be used instead, which also works component-wise.
In TSL, not() on a boolean vector is first implicitly coerced to bool using all(), and then ! is applied. There doesn't seem to be a built-in TSL function that produces component-wise logical not on boolean vectors.
// WGSL:
// Expected: !( vec4<f32>( 0.0, 0.0, 1.0, 1.0 ) > vec4<f32>( 0.0 ) )
// Actual: !all( ( vec4<f32>( 0.0, 0.0, 1.0, 1.0 ) > vec4<f32>( 0.0 ) ) )
// GLSL:
// Expected: not( greaterThan( vec4( 0.0, 0.0, 1.0, 1.0 ), vec4( 0.0 ) ) )
// Actual: !all( greaterThan( vec4( 0.0, 0.0, 1.0, 1.0 ), vec4( 0.0 ) ) )
vec4(0, 0, 1, 1).greaterThan(0).not()
Solution
Make not() on boolean vectors perform component-wise logical not, because the current behavior does not match either WGSL or GLSL.
Alternatives
Add a separate function for component-wise logical not while keeping the existing behavior of not(). However, I don't think this is ideal.
Additional context
No response
Description
In WGSL, the
!operator works component-wise on boolean vectors, whereas in GLSL,!on boolean vectors is invalid andnot()function must be used instead, which also works component-wise.In TSL,
not()on a boolean vector is first implicitly coerced toboolusingall(), and then!is applied. There doesn't seem to be a built-in TSL function that produces component-wise logical not on boolean vectors.Solution
Make
not()on boolean vectors perform component-wise logical not, because the current behavior does not match either WGSL or GLSL.Alternatives
Add a separate function for component-wise logical not while keeping the existing behavior of
not(). However, I don't think this is ideal.Additional context
No response