aras-p / hlsl2glslfork

HLSL to GLSL language translator based on ATI's HLSL2GLSL. Used in Unity.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

float mul(vec3, vec3)

GregorGullwi opened this issue · comments

The library converts all mul() calls to regular multiplication operations, but there's a special case that doesn't work and that's when it's assigned to a scalar and not a vector.

The example I have is:
float3 aVector = float3(1, 2, 3);
float a = mul(aVector, aVector);

it currently converts to:
float a = ( aVector * aVector );

which doesn't compile... it should be a dot product instead:
float a = dot(aVector, aVector);