Skip to content

Commit

Permalink
GCC 4.8, happy to see you're still around, causing problems.
Browse files Browse the repository at this point in the history
  • Loading branch information
mosra committed Feb 2, 2020
1 parent e1c3c2a commit 8c0503e
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 16 deletions.
8 changes: 6 additions & 2 deletions src/Magnum/Math/Test/PackingBatchTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -336,7 +336,9 @@ template<class T> void PackingBatchTest::castUnsigned() {
{{13, 255}, {}}
};

constexpr Vector2 expectedFloat[] {
/* GCC 4.8 doesn't like constexpr here (cannot initialize aggregate of type
‘const Vector2 [3]’ with a compound literal), wtf */
const Vector2 expectedFloat[] {
{0.0f, 89.0f},
{149.0f, 22.0f},
{13.0f, 255.0f}
Expand Down Expand Up @@ -374,7 +376,9 @@ template<class T> void PackingBatchTest::castSigned() {
{{13, 127}, {}}
};

constexpr Vector2 expectedFloat[] {
/* GCC 4.8 doesn't like constexpr here (cannot initialize aggregate of type
‘const Vector2 [3]’ with a compound literal), wtf */
const Vector2 expectedFloat[] {
{0.0f, -89.0f},
{-119.0f, 22.0f},
{13.0f, 127.0f}
Expand Down
15 changes: 9 additions & 6 deletions src/Magnum/Primitives/Implementation/Spheroid.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -229,17 +229,20 @@ Trade::MeshData Spheroid::finalize() {

auto typedVertices = reinterpret_cast<VertexTextureCoords*>(_vertexData.data());
Trade::MeshAttributeData positions{Trade::MeshAttributeName::Position,
Containers::stridedArrayView(_vertexData, &typedVertices[0].position,
size, stride)};
/* GCC 4.8 needs the arrayView() */
Containers::stridedArrayView(Containers::arrayView(_vertexData),
&typedVertices[0].position, size, stride)};
Trade::MeshAttributeData normals{Trade::MeshAttributeName::Normal,
Containers::stridedArrayView(_vertexData, &typedVertices[0].normal,
size, stride)};
/* GCC 4.8 needs the arrayView() */
Containers::stridedArrayView(Containers::arrayView(_vertexData),
&typedVertices[0].normal, size, stride)};

Containers::Array<Trade::MeshAttributeData> attributes;
if(_textureCoords == TextureCoords::Generate) {
Trade::MeshAttributeData textureCoords{Trade::MeshAttributeName::TextureCoordinates,
Containers::stridedArrayView(_vertexData, &typedVertices[0].textureCoords,
size, stride)};
/* GCC 4.8 needs the arrayView() */
Containers::stridedArrayView(Containers::arrayView(_vertexData),
&typedVertices[0].textureCoords, size, stride)};
attributes = Containers::Array<Trade::MeshAttributeData>{Containers::InPlaceInit, {positions, normals, textureCoords}};
} else {
attributes = Containers::Array<Trade::MeshAttributeData>{Containers::InPlaceInit, {positions, normals}};
Expand Down
12 changes: 8 additions & 4 deletions src/Magnum/Trade/Test/MeshData2DTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,9 @@ struct {
{{0xff98ab_rgbf, 0xff3366_rgbf}},
&State}},
{"from MeshData",
MeshData{MeshPrimitive::Lines, {}, Indices, MeshIndexData{Indices}, {}, Vertices, {
/* GCC 4.8 needs the explicit MeshData3D conversion otherwise it tries
to use a deleted copy constructor */
MeshData2D{MeshData{MeshPrimitive::Lines, {}, Indices, MeshIndexData{Indices}, {}, Vertices, {
MeshAttributeData{MeshAttributeName::Position,
Containers::StridedArrayView1D<const Vector2>{Vertices, &Vertices[0].position1, 2, sizeof(Vertex)}},
MeshAttributeData{MeshAttributeName::Position,
Expand All @@ -97,15 +99,17 @@ struct {
Containers::StridedArrayView1D<const Vector2>{Vertices, &Vertices[0].textureCoords3, 2, sizeof(Vertex)}},
MeshAttributeData{MeshAttributeName::Color,
Containers::StridedArrayView1D<const Color4>{Vertices, &Vertices[0].color, 2, sizeof(Vertex)}},
}, &State},
MeshData{MeshPrimitive::Lines, {}, Vertices, {
}, &State}},
/* GCC 4.8 needs the explicit MeshData3D conversion otherwise it tries
to use a deleted copy constructor */
MeshData2D{MeshData{MeshPrimitive::Lines, {}, Vertices, {
MeshAttributeData{MeshAttributeName::Position,
Containers::StridedArrayView1D<const Vector2>{Vertices, &Vertices[0].position1, 2, sizeof(Vertex)}},
MeshAttributeData{MeshAttributeName::TextureCoordinates,
Containers::StridedArrayView1D<const Vector2>{Vertices, &Vertices[0].textureCoords1, 2, sizeof(Vertex)}},
MeshAttributeData{MeshAttributeName::Color,
Containers::StridedArrayView1D<const Color4>{Vertices, &Vertices[0].color, 2, sizeof(Vertex)}},
}, &State}
}, &State}}
}
};
CORRADE_IGNORE_DEPRECATED_POP
Expand Down
12 changes: 8 additions & 4 deletions src/Magnum/Trade/Test/MeshData3DTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,9 @@ struct {
{{0xff98ab_rgbf, 0xff3366_rgbf}},
&State}},
{"from MeshData",
MeshData{MeshPrimitive::Lines, {}, Indices, MeshIndexData{Indices}, {}, Vertices, {
/* GCC 4.8 needs the explicit MeshData3D conversion otherwise it tries
to use a deleted copy constructor */
MeshData3D{MeshData{MeshPrimitive::Lines, {}, Indices, MeshIndexData{Indices}, {}, Vertices, {
MeshAttributeData{MeshAttributeName::Position,
Containers::StridedArrayView1D<const Vector3>{Vertices, &Vertices[0].position1, 2, sizeof(Vertex)}},
MeshAttributeData{MeshAttributeName::Position,
Expand All @@ -105,8 +107,10 @@ struct {
Containers::StridedArrayView1D<const Vector2>{Vertices, &Vertices[0].textureCoords3, 2, sizeof(Vertex)}},
MeshAttributeData{MeshAttributeName::Color,
Containers::StridedArrayView1D<const Color4>{Vertices, &Vertices[0].color, 2, sizeof(Vertex)}},
}, &State},
MeshData{MeshPrimitive::Lines, {}, Vertices, {
}, &State}},
/* GCC 4.8 needs the explicit MeshData3D conversion otherwise it tries
to use a deleted copy constructor */
MeshData3D{MeshData{MeshPrimitive::Lines, {}, Vertices, {
MeshAttributeData{MeshAttributeName::Position,
Containers::StridedArrayView1D<const Vector3>{Vertices, &Vertices[0].position1, 2, sizeof(Vertex)}},
MeshAttributeData{MeshAttributeName::Normal,
Expand All @@ -115,7 +119,7 @@ struct {
Containers::StridedArrayView1D<const Vector2>{Vertices, &Vertices[0].textureCoords1, 2, sizeof(Vertex)}},
MeshAttributeData{MeshAttributeName::Color,
Containers::StridedArrayView1D<const Color4>{Vertices, &Vertices[0].color, 2, sizeof(Vertex)}},
}, &State}
}, &State}}
}
};
CORRADE_IGNORE_DEPRECATED_POP
Expand Down

0 comments on commit 8c0503e

Please sign in to comment.