gsdx: Defer vector initialisation to GS/GPUinit

It can cause PCSX2 to crash if the instructions aren't supported.
This commit is contained in:
Jonathan Li committed 2016-07-27 23:34:14 +01:00
1 parent d726d4d4aa
commit e5ea4cc5d4
24 files changed
+502 -274

No files matched your search

+32 -20
View File
@@ -23,32 +23,44 @@
#include "GSSetupPrimCodeGenerator.h"
#if _M_SSE >= 0x501
GSVector8 GSSetupPrimCodeGenerator::m_shift[9];
#else
GSVector4 GSSetupPrimCodeGenerator::m_shift[5];
#endif
const GSVector8 GSSetupPrimCodeGenerator::m_shift[9] =
void GSSetupPrimCodeGenerator::InitVectors()
{
GSVector8(8.0f, 8.0f, 8.0f, 8.0f, 8.0f, 8.0f, 8.0f, 8.0f),
GSVector8(0.0f, 1.0f, 2.0f, 3.0f, 4.0f, 5.0f, 6.0f, 7.0f),
GSVector8(-1.0f, 0.0f, 1.0f, 2.0f, 3.0f, 4.0f, 5.0f, 6.0f),
GSVector8(-2.0f, -1.0f, 0.0f, 1.0f, 2.0f, 3.0f, 4.0f, 5.0f),
GSVector8(-3.0f, -2.0f, -1.0f, 0.0f, 1.0f, 2.0f, 3.0f, 4.0f),
GSVector8(-4.0f, -3.0f, -2.0f, -1.0f, 0.0f, 1.0f, 2.0f, 3.0f),
GSVector8(-5.0f, -4.0f, -3.0f, -2.0f, -1.0f, 0.0f, 1.0f, 2.0f),
GSVector8(-6.0f, -5.0f, -4.0f, -3.0f, -2.0f, -1.0f, 0.0f, 1.0f),
GSVector8(-7.0f, -6.0f, -5.0f, -4.0f, -3.0f, -2.0f, -1.0f, 0.0f),
};
#if _M_SSE >= 0x501
GSVector8 shift[9] =
{
GSVector8(8.0f, 8.0f, 8.0f, 8.0f, 8.0f, 8.0f, 8.0f, 8.0f),
GSVector8(0.0f, 1.0f, 2.0f, 3.0f, 4.0f, 5.0f, 6.0f, 7.0f),
GSVector8(-1.0f, 0.0f, 1.0f, 2.0f, 3.0f, 4.0f, 5.0f, 6.0f),
GSVector8(-2.0f, -1.0f, 0.0f, 1.0f, 2.0f, 3.0f, 4.0f, 5.0f),
GSVector8(-3.0f, -2.0f, -1.0f, 0.0f, 1.0f, 2.0f, 3.0f, 4.0f),
GSVector8(-4.0f, -3.0f, -2.0f, -1.0f, 0.0f, 1.0f, 2.0f, 3.0f),
GSVector8(-5.0f, -4.0f, -3.0f, -2.0f, -1.0f, 0.0f, 1.0f, 2.0f),
GSVector8(-6.0f, -5.0f, -4.0f, -3.0f, -2.0f, -1.0f, 0.0f, 1.0f),
GSVector8(-7.0f, -6.0f, -5.0f, -4.0f, -3.0f, -2.0f, -1.0f, 0.0f),
};
for (size_t n = 0; n < countof(shift); ++n)
m_shift[n] = shift[n];
#else
GSVector4 shift[5] =
{
GSVector4(4.0f, 4.0f, 4.0f, 4.0f),
GSVector4(0.0f, 1.0f, 2.0f, 3.0f),
GSVector4(-1.0f, 0.0f, 1.0f, 2.0f),
GSVector4(-2.0f, -1.0f, 0.0f, 1.0f),
GSVector4(-3.0f, -2.0f, -1.0f, 0.0f),
};
const GSVector4 GSSetupPrimCodeGenerator::m_shift[5] =
{
GSVector4(4.0f, 4.0f, 4.0f, 4.0f),
GSVector4(0.0f, 1.0f, 2.0f, 3.0f),
GSVector4(-1.0f, 0.0f, 1.0f, 2.0f),
GSVector4(-2.0f, -1.0f, 0.0f, 1.0f),
GSVector4(-3.0f, -2.0f, -1.0f, 0.0f),
};
for (size_t n = 0; n < countof(shift); ++n)
m_shift[n] = shift[n];
#endif
}
GSSetupPrimCodeGenerator::GSSetupPrimCodeGenerator(void* param, uint64 key, void* code, size_t maxsize)
: GSCodeGenerator(code, maxsize)