# Invalid arguments for built-in function: mat2(vec4)

Hi,

I'm trying to convert a function (glsl) for a Godot shader.

In this code statement I get this compiling error which i can't understand:

`dot(mat2(fract(sin(vec4(0.0, 1.0, 113.0, 114.0) + dot(i, vec2(1.0, 113.0)))*43758.5453))*vec2(1. - p.y, p.y), vec2(1. - p.x, p.x) );`

Any suggestions?

Thanks in advance.

-j

## Comments

2,884AdminI don't think you can plug a matrix into a dot product. It takes a vector type as input and outputs a scalar value.

https://docs.godotengine.org/en/stable/tutorials/shading/shading_reference/shading_language.html#built-in-functions

12MemberMaybe I'm wrong, but the instruction is formally correct, in fact:

"dot" needs two vectors as arguments, and in the statement there is:

`dot(mat2(...)*vec2, vec2)`

but mat2*vec2 is a vector.

am I right?

757ModeratorCan you give us the error message that pops up, if there is any?

Edit: no wait, that's the title. :P

2,884AdminHmm, yes I missed it, that should afaik be correct but on closer inspection you also have a

`1.`

in there that might be causing an issue. And same again in the second vector at the end.edit: the documentation says:

Thus I guess it would need to be a

`mat4`

to plug a`vec4`

into it. You can always swizzle to get the specific components you need out of it. Then again I'd expect the fract and the sine to output scalars so I'm as confused as you, I guess.I recon it's worth trying to fix those

`1.`

scalars first.757ModeratorLooking back at the docs, It looks to me you should construct the mat2 with two vec2's instead of a vec4.

EDIT: I meant a mat2, not mat4. The above post has been corrected.

12MemberThanks, I had already tried some of your suggestions, but without luck.

I don't understand why this example works perfectly (see line 209):

http://glslsandbox.com/e#51994.0

757ModeratorI don't know what you mean, but using vec2's instead did the trick for me.