Giovanni Mascellani (@giomasce) commented about libs/vkd3d-shader/hlsl.y:
if (!(arg = intrinsic_float_convert_arg(ctx, params, arg, loc))) return false;
- if (!(c = hlsl_new_constant(ctx, hlsl_get_vector_type(ctx, HLSL_TYPE_FLOAT, 4), loc))) - return false; - c->value[0].f = 255.001953f; - c->value[1].f = 255.001953f; - c->value[2].f = 255.001953f; - c->value[3].f = 255.001953f; - list_add_tail(params->instrs, &c->node.entry); + if (arg_type->class == HLSL_CLASS_SCALAR) + { + if (!(c = hlsl_new_float_constant(ctx, 255.001953f, loc))) + return false; + list_add_tail(params->instrs, &c->node.entry);
Notice that you don't need to create two different constants in the two `if` branches. If you always create a scalar, `add_binary_arithmetic_expr()` will swizzle it for you. It's not wrong as it is now, though. -- https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/161#note_30338