Open costructuralist opened 3 years ago
Hi. Array uniforms are not supported in the elm compiler. This is not a bug, but a missing feature. The supported shader types are listed in the package docs: Int, Float, Texture and Vec2, Vec3, Vec4, Mat4 from the linear-algebra package.
This bit in the compiler derives the type signature for shaders https://github.com/elm/compiler/blob/master/compiler/src/Parse/Shader.hs#L170
Maybe you could use a few Mat4 uniforms to pass the same amount of data.
Or a texture image, if the data is constant
I have the following Elm type for uniforms:
type alias Uniforms = { cellColors : List Vec3 }
In a vertex shader I have the following declaration for an array of vec3 uniform:
uniform vec3 cellColors[9];
The GLSL parser, however, is inferring/parsing the type of the
cellColors
variable to beVec3
, and notArray Vec3
.It seems as if this is a bug in the underlying GLSL parsing library: https://github.com/noteed/language-glsl/issues/19
Is there a way to work around this bug?