kwin: remove unused WindowQuadList::makeInterleavedArrays() method

Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
This commit is contained in:
Ivailo Monev 2022-05-29 18:30:09 +03:00
parent b7b0bbaf93
commit 725db84b9e
2 changed files with 7 additions and 164 deletions

View file

@ -48,17 +48,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include <xcb/xfixes.h>
#endif
#if defined(__SSE2__)
# define HAVE_SSE2
#else
# warning no SSE2 support
#endif
#ifdef HAVE_SSE2
# include <emmintrin.h>
#endif
namespace KWin
{
@ -1072,137 +1061,6 @@ WindowQuadList WindowQuadList::makeRegularGrid(int xSubdivisions, int ySubdivisi
return ret;
}
#ifndef GL_TRIANGLES
# define GL_TRIANGLES 0x0004
#endif
#ifndef GL_QUADS
# define GL_QUADS 0x0007
#endif
void WindowQuadList::makeInterleavedArrays(unsigned int type, GLVertex2D *vertices, const QMatrix4x4 &textureMatrix) const
{
// Since we know that the texture matrix just scales and translates
// we can use this information to optimize the transformation
const QVector2D coeff(textureMatrix(0, 0), textureMatrix(1, 1));
const QVector2D offset(textureMatrix(0, 3), textureMatrix(1, 3));
GLVertex2D *vertex = vertices;
assert(type == GL_QUADS || type == GL_TRIANGLES);
switch (type)
{
case GL_QUADS:
#ifdef HAVE_SSE2
if (!(intptr_t(vertex) & 0xf)) {
for (int i = 0; i < count(); i++) {
const WindowQuad &quad = at(i);
Q_DECL_ALIGN(16) GLVertex2D v[4];
for (int j = 0; j < 4; j++) {
const WindowVertex &wv = quad[j];
v[j].position = QVector2D(wv.x(), wv.y());
v[j].texcoord = QVector2D(wv.u(), wv.v()) * coeff + offset;
}
const __m128i *srcP = (const __m128i *) &v;
__m128i *dstP = (__m128i *) vertex;
_mm_stream_si128(&dstP[0], _mm_load_si128(&srcP[0])); // Top-left
_mm_stream_si128(&dstP[1], _mm_load_si128(&srcP[1])); // Top-right
_mm_stream_si128(&dstP[2], _mm_load_si128(&srcP[2])); // Bottom-right
_mm_stream_si128(&dstP[3], _mm_load_si128(&srcP[3])); // Bottom-left
vertex += 4;
}
} else
#endif // HAVE_SSE2
{
for (int i = 0; i < count(); i++) {
const WindowQuad &quad = at(i);
for (int j = 0; j < 4; j++) {
const WindowVertex &wv = quad[j];
GLVertex2D v;
v.position = QVector2D(wv.x(), wv.y());
v.texcoord = QVector2D(wv.u(), wv.v()) * coeff + offset;
*(vertex++) = v;
}
}
}
break;
case GL_TRIANGLES:
#ifdef HAVE_SSE2
if (!(intptr_t(vertex) & 0xf)) {
for (int i = 0; i < count(); i++) {
const WindowQuad &quad = at(i);
Q_DECL_ALIGN(16) GLVertex2D v[4];
for (int j = 0; j < 4; j++) {
const WindowVertex &wv = quad[j];
v[j].position = QVector2D(wv.x(), wv.y());
v[j].texcoord = QVector2D(wv.u(), wv.v()) * coeff + offset;
}
const __m128i *srcP = (const __m128i *) &v;
__m128i *dstP = (__m128i *) vertex;
__m128i src[4];
src[0] = _mm_load_si128(&srcP[0]); // Top-left
src[1] = _mm_load_si128(&srcP[1]); // Top-right
src[2] = _mm_load_si128(&srcP[2]); // Bottom-right
src[3] = _mm_load_si128(&srcP[3]); // Bottom-left
// First triangle
_mm_stream_si128(&dstP[0], src[1]); // Top-right
_mm_stream_si128(&dstP[1], src[0]); // Top-left
_mm_stream_si128(&dstP[2], src[3]); // Bottom-left
// Second triangle
_mm_stream_si128(&dstP[3], src[3]); // Bottom-left
_mm_stream_si128(&dstP[4], src[2]); // Bottom-right
_mm_stream_si128(&dstP[5], src[1]); // Top-right
vertex += 6;
}
} else
#endif // HAVE_SSE2
{
for (int i = 0; i < count(); i++) {
const WindowQuad &quad = at(i);
GLVertex2D v[4]; // Four unique vertices / quad
for (int j = 0; j < 4; j++) {
const WindowVertex &wv = quad[j];
v[j].position = QVector2D(wv.x(), wv.y());
v[j].texcoord = QVector2D(wv.u(), wv.v()) * coeff + offset;
}
// First triangle
*(vertex++) = v[1]; // Top-right
*(vertex++) = v[0]; // Top-left
*(vertex++) = v[3]; // Bottom-left
// Second triangle
*(vertex++) = v[3]; // Bottom-left
*(vertex++) = v[2]; // Bottom-right
*(vertex++) = v[1]; // Top-right
}
}
break;
default:
break;
}
}
void WindowQuadList::makeArrays(float **vertices, float **texcoords, const QSizeF &size, bool yInverted) const
{
*vertices = new float[count() * 6 * 2];

View file

@ -28,10 +28,13 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include <QPair>
#include <QSet>
#include <QRect>
#include <QtGui/QRegion>
#include <QtGui/QVector2D>
#include <QtGui/QVector3D>
#include <QRegion>
#include <QVector2D>
#include <QVector3D>
#include <QFont>
#include <QGraphicsScale>
#include <QKeyEvent>
#include <QMatrix4x4>
#include <QVector>
#include <QList>
#include <QHash>
@ -46,10 +49,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
class KConfigGroup;
class KActionCollection;
#include <QFont>
#include <QGraphicsScale>
#include <QKeyEvent>
#include <QMatrix4x4>
namespace KWin
{
@ -1641,19 +1640,6 @@ public:
};
struct GLVertex2D
{
QVector2D position;
QVector2D texcoord;
};
struct GLVertex3D
{
QVector3D position;
QVector2D texcoord;
};
/**
* @short Vertex class
*
@ -1731,7 +1717,6 @@ public:
WindowQuadList select(WindowQuadType type) const;
WindowQuadList filterOut(WindowQuadType type) const;
bool smoothNeeded() const;
void makeInterleavedArrays(unsigned int type, GLVertex2D *vertices, const QMatrix4x4 &matrix) const;
void makeArrays(float** vertices, float** texcoords, const QSizeF &size, bool yInverted) const;
bool isTransformed() const;
};