Bug 1768094 - Add even more vecN_scalar friend operators to avoid some implicit conversions. r=gfx-reviewers,bradwerth

There are a few more cases we need to cover of the float OP vecN_scalar variety that are still left.

Differential Revision: https://phabricator.services.mozilla.com/D145932
This commit is contained in:
Lee Salzman 2022-05-10 06:28:28 +00:00
Родитель f2a9df286a
Коммит 5a10d44c18
1 изменённых файлов: 6 добавлений и 0 удалений

Просмотреть файл

@ -405,6 +405,9 @@ struct vec2_scalar {
friend vec2_scalar operator-(vec2_scalar a, float b) {
return vec2_scalar(a.x - b, a.y - b);
}
friend vec2_scalar operator-(float a, vec2_scalar b) {
return vec2_scalar(a - b.x, a - b.y);
}
friend vec2_scalar operator+(vec2_scalar a, vec2_scalar b) {
return vec2_scalar(a.x + b.x, a.y + b.y);
}
@ -1742,6 +1745,9 @@ struct vec4_scalar {
friend vec4_scalar operator*(vec4_scalar a, float b) {
return vec4_scalar{a.x * b, a.y * b, a.z * b, a.w * b};
}
friend vec4_scalar operator*(float a, vec4_scalar b) {
return vec4_scalar{a * b.x, a * b.y, a * b.z, a * b.w};
}
vec4_scalar& operator*=(float a) {
x *= a;
y *= a;