gpu.js icon indicating copy to clipboard operation
gpu.js copied to clipboard

Please this dev is right but product incorrect

Open mei2015 opened this issue 5 years ago • 6 comments

Error: Error compiling fragment shader: ERROR: 0:404: '!' : wrong operand type - no operation '!' exists that takes an operand of type lowp int (or there is no acceptable conversion) ERROR: 0:404: '&&' : wrong operand types - no operation '&&' exists that takes a left-hand operand of type 'bool' and a right operand of type 'void' (or there is no acceptable conversion)

mei2015 avatar Mar 23 '20 12:03 mei2015

Error: Error compiling fragment shader: ERROR: 0:404: ’!‘ : wrong operand type - no operation ’!‘ exists that takes an operand of type lowp int (or there is no acceptable conversion) ERROR: 0:404: ’&&‘ : wrong operand types - no operation ’&&‘ exists that takes a left-hand operand of type ’bool‘ and a right operand of type ’void‘ (or there is no acceptable conversion)

mei2015 avatar Mar 23 '20 12:03 mei2015

only a little code

If (len > this. Ouput. Y - this. Thread. Y)

mei2015 avatar Mar 23 '20 12:03 mei2015

I got the same problem....

Jame6292 avatar Jun 07 '20 08:06 Jame6292

@mei2015 could you provide the code that uses the ! operator and the && operator? It seems like you are comparing non-Boolean values with Boolean operators.

FarazzShaikh avatar Aug 11 '20 06:08 FarazzShaikh

We'll need a more extensive example to solve this issue.

robertleeplummerjr avatar Aug 11 '20 12:08 robertleeplummerjr

I have experienced this as a result of Angular's JS optimizer converting true into 1.0 for the release build but not the dev build. Ditto the && issue, as if(expr1) { expr2; } is optimized to expr1 && expr2 (if expr1 evaluates to false, then expr2 won't evaluate.

This is not a problem with GPU.js per se, since it is behaving properly given the code, but it took me a day and a half to track down the root cause, and it seems common enough that it should be documented.

The workaround for the ! issue is to encode booleans as 0-1 ints, and NOT x as (1-x).

evanakm avatar Feb 03 '21 00:02 evanakm