Submitted By: Bruce Dubbs Date: 2022-05-09 Initial Package Version: 91.9.0 Upstream Status: Unknown Origin: fedora Description: Allows firefox and thunderbird to build with gcc-12. diff --git a/gfx/wr/swgl/src/glsl.h b/gfx/wr/swgl/src/glsl.h --- a/gfx/wr/swgl/src/glsl.h +++ b/gfx/wr/swgl/src/glsl.h @@ -2296,30 +2296,22 @@ struct mat4; struct mat2 { vec2 data[2]; vec2& operator[](int index) { return data[index]; } const vec2& operator[](int index) const { return data[index]; } mat2() = default; - IMPLICIT mat2(Float a) { - data[0] = vec2(a); - data[1] = vec2(a); - } - - mat2(vec2 a, vec2 b) { - data[0] = a; - data[1] = b; - } + IMPLICIT constexpr mat2(Float a) : data{vec2(a), vec2(a)} {} + + constexpr mat2(vec2 a, vec2 b) : data{a, b} {} IMPLICIT mat2(const mat4& mat); - IMPLICIT constexpr mat2(mat2_scalar s) { - data[0] = vec2(s.data[0]); - data[1] = vec2(s.data[1]); - } + IMPLICIT constexpr mat2(mat2_scalar s) + : data{vec2(s.data[0]), vec2(s.data[1])} {} friend vec2 operator*(mat2 m, vec2 v) { vec2 u; u.x = m[0].x * v.x + m[1].x * v.y; u.y = m[0].y * v.x + m[1].y * v.y; return u; } friend mat2 operator*(mat2 m, Float f) { @@ -2399,40 +2391,29 @@ struct mat3_scalar { }; struct mat3 { vec3 data[3]; vec3& operator[](int index) { return data[index]; } const vec3& operator[](int index) const { return data[index]; } mat3() = default; - mat3(vec3 a, vec3 b, vec3 c) { - data[0] = a; - data[1] = b; - data[2] = c; - } - - IMPLICIT constexpr mat3(mat3_scalar s) { - data[0] = vec3(s.data[0]); - data[1] = vec3(s.data[1]); - data[2] = vec3(s.data[2]); - } - constexpr mat3(mat3_scalar s0, mat3_scalar s1, mat3_scalar s2, - mat3_scalar s3) { - data[0] = vec3(s0.data[0], s1.data[0], s2.data[0], s3.data[0]); - data[1] = vec3(s0.data[1], s1.data[1], s2.data[1], s3.data[1]); - data[2] = vec3(s0.data[2], s1.data[2], s2.data[2], s3.data[2]); - } + constexpr mat3(vec3 a, vec3 b, vec3 c) : data{a, b, c} {} + + IMPLICIT constexpr mat3(mat3_scalar s) + : data{vec3(s.data[0]), vec3(s.data[1]), vec3(s.data[2])} {} + + constexpr mat3(mat3_scalar s0, mat3_scalar s1, mat3_scalar s2, mat3_scalar s3) + : data{vec3(s0.data[0], s1.data[0], s2.data[0], s3.data[0]), + vec3(s0.data[1], s1.data[1], s2.data[1], s3.data[1]), + vec3(s0.data[2], s1.data[2], s2.data[2], s3.data[2])} {} constexpr mat3(Float d1, Float d2, Float d3, Float d4, Float d5, Float d6, - Float d7, Float d8, Float d9) { - data[0] = vec3(d1, d2, d3); - data[1] = vec3(d4, d5, d6); - data[2] = vec3(d7, d8, d9); - } + Float d7, Float d8, Float d9) + : data{vec3(d1, d2, d3), vec3(d4, d5, d6), vec3(d7, d8, d9)} {} IMPLICIT mat3(const mat4& mat); friend vec3 operator*(mat3 m, vec3 v) { vec3 u; u.x = m[0].x * v.x + m[1].x * v.y + m[2].x * v.z; u.y = m[0].y * v.x + m[1].y * v.y + m[2].y * v.z; u.z = m[0].z * v.x + m[1].z * v.y + m[2].z * v.z; @@ -2592,29 +2573,21 @@ struct mat4_scalar { return u; } }; struct mat4 { vec4 data[4]; mat4() = default; - IMPLICIT constexpr mat4(mat4_scalar s) { - data[0] = vec4(s.data[0]); - data[1] = vec4(s.data[1]); - data[2] = vec4(s.data[2]); - data[3] = vec4(s.data[3]); - } - - mat4(vec4 a, vec4 b, vec4 c, vec4 d) { - data[0] = a; - data[1] = b; - data[2] = c; - data[3] = d; - } + IMPLICIT constexpr mat4(mat4_scalar s) + : data{vec4(s.data[0]), vec4(s.data[1]), vec4(s.data[2]), + vec4(s.data[3])} {} + + constexpr mat4(vec4 a, vec4 b, vec4 c, vec4 d) : data{a, b, c, d} {} vec4& operator[](int index) { return data[index]; } const vec4& operator[](int index) const { return data[index]; } friend vec4 operator*(mat4 m, vec4 v) { vec4 u; u.x = m[0].x * v.x + m[1].x * v.y + m[2].x * v.z + m[3].x * v.w; u.y = m[0].y * v.x + m[1].y * v.y + m[2].y * v.z + m[3].y * v.w;