You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I wrote an explanation of the bug in the parent issue. Essentially, GLSL has built in functions for common operations, some of which have various overloads for different datatypes. In cases where a float or a vector of floats could be used, GLSL calls this genType in the documentation. There are also genIType, genBType, etc for vectors of types apart from float - see the spec here on page 146 for more details if curious.
Currently, here, p5.strands wrongly allows genType to be inferred as a type int, when only valid types should be float, vec2, vec3, vec4. This causes a misleading error message to print, but even if it didn't it would cause a GLSL error down the line.
Uh oh!
There was an error while loading. Please reload this page.
Most appropriate sub-area of p5.js?
p5.js version
2.0
Steps to reproduce this
Steps:
Use a GLSL function such as
mix(x, y, z)
with a mix of floats and integer types.Snippet:
Broken version of @davepagurek's original sketch which uncovered the issue
I wrote an explanation of the bug in the parent issue. Essentially, GLSL has built in functions for common operations, some of which have various overloads for different datatypes. In cases where a float or a vector of floats could be used, GLSL calls this
genType
in the documentation. There are also genIType, genBType, etc for vectors of types apart from float - see the spec here on page 146 for more details if curious.Currently, here, p5.strands wrongly allows
genType
to be inferred as a typeint
, when only valid types should befloat
,vec2
,vec3
,vec4
. This causes a misleading error message to print, but even if it didn't it would cause a GLSL error down the line.If
genType
is deduced to be an integer, theFunctionCallNode
will then later try to convert all of the arguments which aren't integers to be them, which is not good.The fix should be to stop
genType
ever being inferred to beint
. This is the only place where code needs to be updated.The text was updated successfully, but these errors were encountered: