Add unroll hint to inner loop in WindowQuads::makeInterleavedArrays

The inner loop here has a fixed size and unrolling it allows better
vectorization. Both GCC and clang recognise the `#pragma GCC unroll`
directive.
This commit is contained in:
Arjen Hiemstra 2022-07-05 11:56:12 +02:00
parent a95b556868
commit 5287422f46

View file

@ -1053,6 +1053,7 @@ void WindowQuadList::makeInterleavedArrays(unsigned int type, GLVertex2D *vertic
switch (type) {
case GL_QUADS: {
for (const WindowQuad &quad : *this) {
#pragma GCC unroll 4
for (int j = 0; j < 4; j++) {
const WindowVertex &wv = quad[j];
@ -1068,6 +1069,7 @@ void WindowQuadList::makeInterleavedArrays(unsigned int type, GLVertex2D *vertic
for (const WindowQuad &quad : *this) {
GLVertex2D v[4]; // Four unique vertices / quad
#pragma GCC unroll 4
for (int j = 0; j < 4; j++) {
const WindowVertex &wv = quad[j];