Fix T62839 object scale changes normal map output in eevee
[blender.git] / source / blender / gpu / intern / gpu_codegen.c
index 99b79d3758c6b26934a5c2581b68b7b3d345cd1e..433f8b909c2ffda71dbb51616cccb2ec83f44540 100644 (file)
@@ -1008,8 +1008,8 @@ static char *code_generate_vertex(ListBase *nodes, const char *vert_code, bool u
                                                input->attr_id, use_geom ? "g" : "", input->attr_id);
                                        /* Normalize only if vector is not null. */
                                        BLI_dynstr_appendf(
-                                               ds, "\tfloat lvar%d = dot(att%d.xyz, att%d.xyz);\n",
-                                               input->attr_id, input->attr_id, input->attr_id);
+                                               ds, "\tfloat lvar%d = dot(var%d%s.xyz, var%d%s.xyz);\n",
+                                               input->attr_id, input->attr_id, use_geom ? "g" : "", input->attr_id, use_geom ? "g" : "");
                                        BLI_dynstr_appendf(
                                                ds, "\tvar%d%s.xyz *= (lvar%d > 0.0) ? inversesqrt(lvar%d) : 1.0;\n",
                                                input->attr_id, use_geom ? "g" : "", input->attr_id, input->attr_id);