summaryrefslogtreecommitdiff
path: root/Source/Core/VideoCommon
diff options
context:
space:
mode:
authorMarkus Wick <markus+github@selfnet.de>2015-01-20 09:40:46 +0100
committerMarkus Wick <markus+github@selfnet.de>2015-01-20 09:40:46 +0100
commit8ff1dc9c8787935a5115ee771cf351f8691db104 (patch)
tree55b2771ca221951c07f51f3bb126e22db9c86aa7 /Source/Core/VideoCommon
parent6f61f90dab4c82afb38b8e3c27e4740671250841 (diff)
parent1dcf49237b81b850d5683887e3608fbab8c54b27 (diff)
Merge pull request #1925 from Tilka/vertex_loader_jit
VertexLoaderX64: fix alpha of indirect 8888 colors
Diffstat (limited to 'Source/Core/VideoCommon')
-rw-r--r--Source/Core/VideoCommon/CPMemory.h2
-rw-r--r--Source/Core/VideoCommon/VertexLoader.cpp26
-rw-r--r--Source/Core/VideoCommon/VertexLoader.h76
-rw-r--r--Source/Core/VideoCommon/VertexLoaderBase.cpp5
-rw-r--r--Source/Core/VideoCommon/VertexLoaderX64.cpp20
-rw-r--r--Source/Core/VideoCommon/VertexLoaderX64.h4
-rw-r--r--Source/Core/VideoCommon/VertexLoader_Color.cpp11
-rw-r--r--Source/Core/VideoCommon/VertexLoader_Normal.cpp130
-rw-r--r--Source/Core/VideoCommon/VertexLoader_Position.cpp70
-rw-r--r--Source/Core/VideoCommon/VertexLoader_TextCoord.cpp58
10 files changed, 23 insertions, 379 deletions
diff --git a/Source/Core/VideoCommon/CPMemory.h b/Source/Core/VideoCommon/CPMemory.h
index 51e1ccc74f..e657464015 100644
--- a/Source/Core/VideoCommon/CPMemory.h
+++ b/Source/Core/VideoCommon/CPMemory.h
@@ -187,7 +187,7 @@ struct TVtxAttr
u8 NormalFormat;
ColorAttr color[2];
TexAttr texCoord[8];
- u8 ByteDequant;
+ bool ByteDequant;
u8 NormalIndex3;
};
diff --git a/Source/Core/VideoCommon/VertexLoader.cpp b/Source/Core/VideoCommon/VertexLoader.cpp
index 1122a04f72..4edb6a89ef 100644
--- a/Source/Core/VideoCommon/VertexLoader.cpp
+++ b/Source/Core/VideoCommon/VertexLoader.cpp
@@ -28,16 +28,6 @@
u8* g_video_buffer_read_ptr;
u8* g_vertex_manager_write_ptr;
-void* VertexLoader::operator new (size_t size)
-{
- return AllocateAlignedMemory(size, 16);
-}
-
-void VertexLoader::operator delete (void *p)
-{
- FreeAlignedMemory(p);
-}
-
static void LOADERDECL PosMtx_ReadDirect_UByte(VertexLoader* loader)
{
u8 posmtx = BoundingBox::posMtxIdx = DataReadU8() & 0x3f;
@@ -66,15 +56,9 @@ static void LOADERDECL TexMtx_Write_Float2(VertexLoader* loader)
static void LOADERDECL TexMtx_Write_Float3(VertexLoader* loader)
{
-#if _M_SSE >= 0x200
- __m128 output = _mm_cvtsi32_ss(_mm_castsi128_ps(_mm_setzero_si128()), loader->m_curtexmtx[loader->m_texmtxwrite++]);
- _mm_storeu_ps((float*)g_vertex_manager_write_ptr, _mm_shuffle_ps(output, output, 0x45 /* 1, 1, 0, 1 */));
- g_vertex_manager_write_ptr += sizeof(float) * 3;
-#else
DataWrite(0.f);
DataWrite(0.f);
DataWrite(float(loader->m_curtexmtx[loader->m_texmtxwrite++]));
-#endif
}
static void LOADERDECL SkipVertex(VertexLoader* loader)
@@ -92,18 +76,13 @@ VertexLoader::VertexLoader(const TVtxDesc &vtx_desc, const VAT &vtx_attr)
: VertexLoaderBase(vtx_desc, vtx_attr)
{
VertexLoader_Normal::Init();
- VertexLoader_Position::Init();
- VertexLoader_TextCoord::Init();
CompileVertexTranslator();
// generate frac factors
- m_posScale[0] = m_posScale[1] = m_posScale[2] = m_posScale[3] = 1.0f / (1U << m_VtxAttr.PosFrac);
+ m_posScale = 1.0f / (1U << m_VtxAttr.PosFrac);
for (int i = 0; i < 8; i++)
- m_tcScale[i][0] = m_tcScale[i][1] = 1.0f / (1U << m_VtxAttr.texCoord[i].Frac);
-
- for (int i = 0; i < 2; i++)
- m_colElements[i] = m_VtxAttr.color[i].Elements;
+ m_tcScale[i] = 1.0f / (1U << m_VtxAttr.texCoord[i].Frac);
}
void VertexLoader::CompileVertexTranslator()
@@ -288,7 +267,6 @@ void VertexLoader::CompileVertexTranslator()
}
else
{
- components |= VB_HAS_UV0 << i; // have to include since using now
m_native_vtx_decl.texcoords[i].components = 3;
nat_offset += 12;
WriteCall(TexMtx_Write_Float3);
diff --git a/Source/Core/VideoCommon/VertexLoader.h b/Source/Core/VideoCommon/VertexLoader.h
index a7acd5dba1..009c1ae006 100644
--- a/Source/Core/VideoCommon/VertexLoader.h
+++ b/Source/Core/VideoCommon/VertexLoader.h
@@ -18,13 +18,6 @@
#include "VideoCommon/VertexLoaderBase.h"
#include "VideoCommon/VertexLoaderUtils.h"
-#if _M_SSE >= 0x401
-#include <smmintrin.h>
-#include <emmintrin.h>
-#elif _M_SSE >= 0x301 && !(defined __GNUC__ && !defined __SSSE3__)
-#include <tmmintrin.h>
-#endif
-
#ifdef WIN32
#define LOADERDECL __cdecl
#else
@@ -37,11 +30,6 @@ typedef void (LOADERDECL *TPipelineFunction)(VertexLoader* loader);
class VertexLoader : public VertexLoaderBase
{
public:
- // This class need a 16 byte alignment. As this is broken on
- // MSVC right now (Dec 2014), we use custom allocation.
- void* operator new (size_t size);
- void operator delete (void *p);
-
VertexLoader(const TVtxDesc &vtx_desc, const VAT &vtx_attr);
int RunVertices(int primitive, int count, DataReader src, DataReader dst) override;
@@ -49,12 +37,10 @@ public:
bool IsInitialized() override { return true; } // This vertex loader supports all formats
// They are used for the communication with the loader functions
- // Duplicated (4x and 2x respectively) and used in SSE code in the vertex loader JIT
- GC_ALIGNED128(float m_posScale[4]);
- GC_ALIGNED64(float m_tcScale[8][2]);
+ float m_posScale;
+ float m_tcScale[8];
int m_tcIndex;
int m_colIndex;
- int m_colElements[2];
// Matrix components are first in GC format but later in PC format - we need to store it temporarily
// when decoding each vertex.
@@ -73,61 +59,3 @@ private:
void WriteCall(TPipelineFunction);
};
-
-#if _M_SSE >= 0x301
-static const __m128i kMaskSwap32_3 = _mm_set_epi32(0xFFFFFFFFL, 0x08090A0BL, 0x04050607L, 0x00010203L);
-static const __m128i kMaskSwap32_2 = _mm_set_epi32(0xFFFFFFFFL, 0xFFFFFFFFL, 0x04050607L, 0x00010203L);
-static const __m128i kMaskSwap16to32l_3 = _mm_set_epi32(0xFFFFFFFFL, 0xFFFF0405L, 0xFFFF0203L, 0xFFFF0001L);
-static const __m128i kMaskSwap16to32l_2 = _mm_set_epi32(0xFFFFFFFFL, 0xFFFFFFFFL, 0xFFFF0203L, 0xFFFF0001L);
-static const __m128i kMaskSwap16to32h_3 = _mm_set_epi32(0xFFFFFFFFL, 0x0405FFFFL, 0x0203FFFFL, 0x0001FFFFL);
-static const __m128i kMaskSwap16to32h_2 = _mm_set_epi32(0xFFFFFFFFL, 0xFFFFFFFFL, 0x0203FFFFL, 0x0001FFFFL);
-static const __m128i kMask8to32l_3 = _mm_set_epi32(0xFFFFFFFFL, 0xFFFFFF02L, 0xFFFFFF01L, 0xFFFFFF00L);
-static const __m128i kMask8to32l_2 = _mm_set_epi32(0xFFFFFFFFL, 0xFFFFFFFFL, 0xFFFFFF01L, 0xFFFFFF00L);
-static const __m128i kMask8to32h_3 = _mm_set_epi32(0xFFFFFFFFL, 0x02FFFFFFL, 0x01FFFFFFL, 0x00FFFFFFL);
-static const __m128i kMask8to32h_2 = _mm_set_epi32(0xFFFFFFFFL, 0xFFFFFFFFL, 0x01FFFFFFL, 0x00FFFFFFL);
-
-template <typename T, bool threeIn, bool threeOut>
-__forceinline void Vertex_Read_SSSE3(const T* pData, __m128 scale)
-{
- __m128i coords, mask;
-
- int loadBytes = sizeof(T) * (2 + threeIn);
- if (loadBytes > 8)
- coords = _mm_loadu_si128((__m128i*)pData);
- else if (loadBytes > 4)
- coords = _mm_loadl_epi64((__m128i*)pData);
- else
- coords = _mm_cvtsi32_si128(*(u32*)pData);
-
- // Float case (no scaling)
- if (sizeof(T) == 4)
- {
- coords = _mm_shuffle_epi8(coords, threeIn ? kMaskSwap32_3 : kMaskSwap32_2);
- if (threeOut)
- _mm_storeu_si128((__m128i*)g_vertex_manager_write_ptr, coords);
- else
- _mm_storel_epi64((__m128i*)g_vertex_manager_write_ptr, coords);
- }
- else
- {
- // Byte swap, unpack, and move to high bytes for sign extend.
- if (std::is_unsigned<T>::value)
- mask = sizeof(T) == 2 ? (threeIn ? kMaskSwap16to32l_3 : kMaskSwap16to32l_2) : (threeIn ? kMask8to32l_3 : kMask8to32l_2);
- else
- mask = sizeof(T) == 2 ? (threeIn ? kMaskSwap16to32h_3 : kMaskSwap16to32h_2) : (threeIn ? kMask8to32h_3 : kMask8to32h_2);
- coords = _mm_shuffle_epi8(coords, mask);
-
- // Sign extend
- if (std::is_signed<T>::value)
- coords = _mm_srai_epi32(coords, 32 - sizeof(T) * 8);
-
- __m128 out = _mm_mul_ps(_mm_cvtepi32_ps(coords), scale);
- if (threeOut)
- _mm_storeu_ps((float*)g_vertex_manager_write_ptr, out);
- else
- _mm_storel_pi((__m64*)g_vertex_manager_write_ptr, out);
- }
-
- g_vertex_manager_write_ptr += sizeof(float) * (2 + threeOut);
-}
-#endif
diff --git a/Source/Core/VideoCommon/VertexLoaderBase.cpp b/Source/Core/VideoCommon/VertexLoaderBase.cpp
index 815e162689..c0e8e533df 100644
--- a/Source/Core/VideoCommon/VertexLoaderBase.cpp
+++ b/Source/Core/VideoCommon/VertexLoaderBase.cpp
@@ -66,11 +66,6 @@ void VertexLoaderBase::SetVAT(const VAT& vat)
m_VtxAttr.texCoord[7].Elements = vat.g2.Tex7CoordElements;
m_VtxAttr.texCoord[7].Format = vat.g2.Tex7CoordFormat;
m_VtxAttr.texCoord[7].Frac = vat.g2.Tex7Frac;
-
- if (!m_VtxAttr.ByteDequant)
- {
- ERROR_LOG(VIDEO, "ByteDequant is set to zero");
- }
};
void VertexLoaderBase::AppendToString(std::string *dest) const
diff --git a/Source/Core/VideoCommon/VertexLoaderX64.cpp b/Source/Core/VideoCommon/VertexLoaderX64.cpp
index c9b435bae3..de3b90b449 100644
--- a/Source/Core/VideoCommon/VertexLoaderX64.cpp
+++ b/Source/Core/VideoCommon/VertexLoaderX64.cpp
@@ -67,7 +67,7 @@ OpArg VertexLoaderX64::GetVertexAddr(int array, u64 attribute)
}
}
-int VertexLoaderX64::ReadVertex(OpArg data, u64 attribute, int format, int count_in, int count_out, u8 scaling_exponent, AttributeFormat* native_format)
+int VertexLoaderX64::ReadVertex(OpArg data, u64 attribute, int format, int count_in, int count_out, bool dequantize, u8 scaling_exponent, AttributeFormat* native_format)
{
static const __m128i shuffle_lut[5][3] = {
{_mm_set_epi32(0xFFFFFFFFL, 0xFFFFFFFFL, 0xFFFFFFFFL, 0xFFFFFF00L), // 1x u8
@@ -120,7 +120,7 @@ int VertexLoaderX64::ReadVertex(OpArg data, u64 attribute, int format, int count
CVTDQ2PS(coords, R(coords));
- if (scaling_exponent)
+ if (dequantize && scaling_exponent)
MULPS(coords, M(&scale_factors[scaling_exponent]));
}
@@ -145,7 +145,7 @@ int VertexLoaderX64::ReadVertex(OpArg data, u64 attribute, int format, int count
return load_bytes;
}
-void VertexLoaderX64::ReadColor(OpArg data, u64 attribute, int format, int elements)
+void VertexLoaderX64::ReadColor(OpArg data, u64 attribute, int format)
{
int load_bytes = 0;
switch (format)
@@ -154,8 +154,7 @@ void VertexLoaderX64::ReadColor(OpArg data, u64 attribute, int format, int eleme
case FORMAT_32B_888x:
case FORMAT_32B_8888:
MOV(32, R(scratch1), data);
- // See VertexLoader_Color.cpp for a comment on this condition.
- if (format != FORMAT_32B_8888 || !elements)
+ if (format != FORMAT_32B_8888)
OR(32, R(scratch1), Imm32(0xFF000000));
MOV(32, MDisp(dst_reg, m_dst_ofs), R(scratch1));
load_bytes = 3 + (format != FORMAT_24B_888);
@@ -334,7 +333,8 @@ void VertexLoaderX64::GenerateVertexLoader()
}
OpArg data = GetVertexAddr(ARRAY_POSITION, m_VtxDesc.Position);
- ReadVertex(data, m_VtxDesc.Position, m_VtxAttr.PosFormat, m_VtxAttr.PosElements + 2, 3, m_VtxAttr.PosFrac, &m_native_vtx_decl.position);
+ ReadVertex(data, m_VtxDesc.Position, m_VtxAttr.PosFormat, m_VtxAttr.PosElements + 2, 3,
+ m_VtxAttr.ByteDequant, m_VtxAttr.PosFrac, &m_native_vtx_decl.position);
if (m_VtxDesc.Normal)
{
@@ -349,7 +349,8 @@ void VertexLoaderX64::GenerateVertexLoader()
int elem_size = 1 << (m_VtxAttr.NormalFormat / 2);
data.offset += i * elem_size * 3;
}
- data.offset += ReadVertex(data, m_VtxDesc.Normal, m_VtxAttr.NormalFormat, 3, 3, scaling_exponent, &m_native_vtx_decl.normals[i]);
+ data.offset += ReadVertex(data, m_VtxDesc.Normal, m_VtxAttr.NormalFormat, 3, 3,
+ true, scaling_exponent, &m_native_vtx_decl.normals[i]);
}
m_native_components |= VB_HAS_NRM0;
@@ -363,7 +364,7 @@ void VertexLoaderX64::GenerateVertexLoader()
if (col[i])
{
data = GetVertexAddr(ARRAY_COLOR + i, col[i]);
- ReadColor(data, col[i], m_VtxAttr.color[i].Comp, m_VtxAttr.color[i].Elements);
+ ReadColor(data, col[i], m_VtxAttr.color[i].Comp);
m_native_components |= VB_HAS_COL0 << i;
m_native_vtx_decl.colors[i].components = 4;
m_native_vtx_decl.colors[i].enable = true;
@@ -385,7 +386,8 @@ void VertexLoaderX64::GenerateVertexLoader()
{
data = GetVertexAddr(ARRAY_TEXCOORD0 + i, tc[i]);
u8 scaling_exponent = m_VtxAttr.texCoord[i].Frac;
- ReadVertex(data, tc[i], m_VtxAttr.texCoord[i].Format, elements, tm[i] ? 2 : elements, scaling_exponent, &m_native_vtx_decl.texcoords[i]);
+ ReadVertex(data, tc[i], m_VtxAttr.texCoord[i].Format, elements, tm[i] ? 2 : elements,
+ m_VtxAttr.ByteDequant, scaling_exponent, &m_native_vtx_decl.texcoords[i]);
m_native_components |= VB_HAS_UV0 << i;
}
if (tm[i])
diff --git a/Source/Core/VideoCommon/VertexLoaderX64.h b/Source/Core/VideoCommon/VertexLoaderX64.h
index 3cf9d7c8ba..da65fb2e34 100644
--- a/Source/Core/VideoCommon/VertexLoaderX64.h
+++ b/Source/Core/VideoCommon/VertexLoaderX64.h
@@ -16,7 +16,7 @@ private:
u32 m_dst_ofs = 0;
Gen::FixupBranch m_skip_vertex;
Gen::OpArg GetVertexAddr(int array, u64 attribute);
- int ReadVertex(Gen::OpArg data, u64 attribute, int format, int count_in, int count_out, u8 scaling_exponent, AttributeFormat* native_format);
- void ReadColor(Gen::OpArg data, u64 attribute, int format, int elements);
+ int ReadVertex(Gen::OpArg data, u64 attribute, int format, int count_in, int count_out, bool dequantize, u8 scaling_exponent, AttributeFormat* native_format);
+ void ReadColor(Gen::OpArg data, u64 attribute, int format);
void GenerateVertexLoader();
};
diff --git a/Source/Core/VideoCommon/VertexLoader_Color.cpp b/Source/Core/VideoCommon/VertexLoader_Color.cpp
index 5f2a8106c7..00255de00a 100644
--- a/Source/Core/VideoCommon/VertexLoader_Color.cpp
+++ b/Source/Core/VideoCommon/VertexLoader_Color.cpp
@@ -92,18 +92,9 @@ void LOADERDECL Color_ReadDirect_24b_6666(VertexLoader* loader)
_SetCol6666(loader, Common::swap32(DataGetPosition() - 1));
DataSkip(3);
}
-// F|RES: i am not 100 percent sure, but the colElements seems to be important for rendering only
-// at least it fixes mario party 4
void LOADERDECL Color_ReadDirect_32b_8888(VertexLoader* loader)
{
- // TODO (mb2): check this
- u32 col = DataReadU32Unswapped();
-
- // "kill" the alpha
- if (!loader->m_colElements[loader->m_colIndex])
- col |= AMASK;
-
- _SetCol(loader, col);
+ _SetCol(loader, DataReadU32Unswapped());
}
template <typename I>
diff --git a/Source/Core/VideoCommon/VertexLoader_Normal.cpp b/Source/Core/VideoCommon/VertexLoader_Normal.cpp
index 0d794d9944..298d01ed01 100644
--- a/Source/Core/VideoCommon/VertexLoader_Normal.cpp
+++ b/Source/Core/VideoCommon/VertexLoader_Normal.cpp
@@ -6,8 +6,6 @@
#include <type_traits>
#include "Common/CommonTypes.h"
-#include "Common/CPUDetect.h"
-
#include "VideoCommon/VertexLoader.h"
#include "VideoCommon/VertexLoader_Normal.h"
#include "VideoCommon/VertexManagerBase.h"
@@ -102,63 +100,6 @@ struct Normal_Index_Indices3
static const int size = sizeof(I) * 3;
};
-#if _M_SSE >= 0x301
-template <typename T, int N>
-struct Normal_Direct_SSSE3
-{
- static void LOADERDECL function(VertexLoader* loader)
- {
- const T* pData = reinterpret_cast<const T*>(DataGetPosition());
- const float frac = 1. / float(1u << (sizeof(T) * 8 - std::is_signed<T>::value - 1));
- const __m128 scale = _mm_set_ps1(frac);
- for (int i = 0; i < N; i++, pData += 3)
- Vertex_Read_SSSE3<T, true, true>(pData, scale);
- DataSkip<N * 3 * sizeof(T)>();
- }
-
- static const int size = sizeof(T) * N * 3;
-};
-
-template <typename I, typename T, int N, int Offset>
-__forceinline void Normal_Index_Offset_SSSE3()
-{
- static_assert(std::is_unsigned<I>::value, "Only unsigned I is sane!");
-
- auto const index = DataRead<I>();
- const T* pData = (const T*)(cached_arraybases[ARRAY_NORMAL]
- + (index * g_main_cp_state.array_strides[ARRAY_NORMAL]) + sizeof(T) * 3 * Offset);
- const float frac = 1. / float(1u << (sizeof(T) * 8 - std::is_signed<T>::value - 1));
- const __m128 scale = _mm_set_ps1(frac);
- for (int i = 0; i < N; i++, pData += 3)
- Vertex_Read_SSSE3<T, true, true>(pData, scale);
-}
-
-template <typename I, typename T, int N>
-struct Normal_Index_SSSE3
-{
- static void LOADERDECL function(VertexLoader* loader)
- {
- Normal_Index_Offset_SSSE3<I, T, N, 0>();
- }
-
- static const int size = sizeof(I);
-};
-
-template <typename I, typename T>
-struct Normal_Index_Indices3_SSSE3
-{
- static void LOADERDECL function(VertexLoader* loader)
- {
- Normal_Index_Offset_SSSE3<I, T, 1, 0>();
- Normal_Index_Offset_SSSE3<I, T, 1, 1>();
- Normal_Index_Offset_SSSE3<I, T, 1, 2>();
- }
-
- static const int size = sizeof(I) * 3;
-};
-
-#endif
-
}
void VertexLoader_Normal::Init()
@@ -231,77 +172,6 @@ void VertexLoader_Normal::Init()
m_Table[NRM_INDEX16][NRM_INDICES3][NRM_NBT3][FORMAT_USHORT] = Normal_Index_Indices3<u16, u16>();
m_Table[NRM_INDEX16][NRM_INDICES3][NRM_NBT3][FORMAT_SHORT] = Normal_Index_Indices3<u16, s16>();
m_Table[NRM_INDEX16][NRM_INDICES3][NRM_NBT3][FORMAT_FLOAT] = Normal_Index_Indices3<u16, float>();
-
-#if _M_SSE >= 0x301
- if (cpu_info.bSSSE3)
- {
- m_Table[NRM_DIRECT][NRM_INDICES1][NRM_NBT][FORMAT_UBYTE] = Normal_Direct_SSSE3<u8, 1>();
- m_Table[NRM_DIRECT][NRM_INDICES1][NRM_NBT][FORMAT_BYTE] = Normal_Direct_SSSE3<s8, 1>();
- m_Table[NRM_DIRECT][NRM_INDICES1][NRM_NBT][FORMAT_USHORT] = Normal_Direct_SSSE3<u16, 1>();
- m_Table[NRM_DIRECT][NRM_INDICES1][NRM_NBT][FORMAT_SHORT] = Normal_Direct_SSSE3<s16, 1>();
- m_Table[NRM_DIRECT][NRM_INDICES1][NRM_NBT][FORMAT_FLOAT] = Normal_Direct_SSSE3<float, 1>();
- m_Table[NRM_DIRECT][NRM_INDICES1][NRM_NBT3][FORMAT_UBYTE] = Normal_Direct_SSSE3<u8, 3>();
- m_Table[NRM_DIRECT][NRM_INDICES1][NRM_NBT3][FORMAT_BYTE] = Normal_Direct_SSSE3<s8, 3>();
- m_Table[NRM_DIRECT][NRM_INDICES1][NRM_NBT3][FORMAT_USHORT] = Normal_Direct_SSSE3<u16, 3>();
- m_Table[NRM_DIRECT][NRM_INDICES1][NRM_NBT3][FORMAT_SHORT] = Normal_Direct_SSSE3<s16, 3>();
- m_Table[NRM_DIRECT][NRM_INDICES1][NRM_NBT3][FORMAT_FLOAT] = Normal_Direct_SSSE3<float, 3>();
-
- m_Table[NRM_DIRECT][NRM_INDICES3][NRM_NBT][FORMAT_UBYTE] = Normal_Direct_SSSE3<u8, 1>();
- m_Table[NRM_DIRECT][NRM_INDICES3][NRM_NBT][FORMAT_BYTE] = Normal_Direct_SSSE3<s8, 1>();
- m_Table[NRM_DIRECT][NRM_INDICES3][NRM_NBT][FORMAT_USHORT] = Normal_Direct_SSSE3<u16, 1>();
- m_Table[NRM_DIRECT][NRM_INDICES3][NRM_NBT][FORMAT_SHORT] = Normal_Direct_SSSE3<s16, 1>();
- m_Table[NRM_DIRECT][NRM_INDICES3][NRM_NBT][FORMAT_FLOAT] = Normal_Direct_SSSE3<float, 1>();
- m_Table[NRM_DIRECT][NRM_INDICES3][NRM_NBT3][FORMAT_UBYTE] = Normal_Direct_SSSE3<u8, 3>();
- m_Table[NRM_DIRECT][NRM_INDICES3][NRM_NBT3][FORMAT_BYTE] = Normal_Direct_SSSE3<s8, 3>();
- m_Table[NRM_DIRECT][NRM_INDICES3][NRM_NBT3][FORMAT_USHORT] = Normal_Direct_SSSE3<u16, 3>();
- m_Table[NRM_DIRECT][NRM_INDICES3][NRM_NBT3][FORMAT_SHORT] = Normal_Direct_SSSE3<s16, 3>();
- m_Table[NRM_DIRECT][NRM_INDICES3][NRM_NBT3][FORMAT_FLOAT] = Normal_Direct_SSSE3<float, 3>();
-
- m_Table[NRM_INDEX8][NRM_INDICES1][NRM_NBT][FORMAT_UBYTE] = Normal_Index_SSSE3<u8, u8, 1>();
- m_Table[NRM_INDEX8][NRM_INDICES1][NRM_NBT][FORMAT_BYTE] = Normal_Index_SSSE3<u8, s8, 1>();
- m_Table[NRM_INDEX8][NRM_INDICES1][NRM_NBT][FORMAT_USHORT] = Normal_Index_SSSE3<u8, u16, 1>();
- m_Table[NRM_INDEX8][NRM_INDICES1][NRM_NBT][FORMAT_SHORT] = Normal_Index_SSSE3<u8, s16, 1>();
- m_Table[NRM_INDEX8][NRM_INDICES1][NRM_NBT][FORMAT_FLOAT] = Normal_Index_SSSE3<u8, float, 1>();
- m_Table[NRM_INDEX8][NRM_INDICES1][NRM_NBT3][FORMAT_UBYTE] = Normal_Index_SSSE3<u8, u8, 3>();
- m_Table[NRM_INDEX8][NRM_INDICES1][NRM_NBT3][FORMAT_BYTE] = Normal_Index_SSSE3<u8, s8, 3>();
- m_Table[NRM_INDEX8][NRM_INDICES1][NRM_NBT3][FORMAT_USHORT] = Normal_Index_SSSE3<u8, u16, 3>();
- m_Table[NRM_INDEX8][NRM_INDICES1][NRM_NBT3][FORMAT_SHORT] = Normal_Index_SSSE3<u8, s16, 3>();
- m_Table[NRM_INDEX8][NRM_INDICES1][NRM_NBT3][FORMAT_FLOAT] = Normal_Index_SSSE3<u8, float, 3>();
-
- m_Table[NRM_INDEX8][NRM_INDICES3][NRM_NBT][FORMAT_UBYTE] = Normal_Index_SSSE3<u8, u8, 1>();
- m_Table[NRM_INDEX8][NRM_INDICES3][NRM_NBT][FORMAT_BYTE] = Normal_Index_SSSE3<u8, s8, 1>();
- m_Table[NRM_INDEX8][NRM_INDICES3][NRM_NBT][FORMAT_USHORT] = Normal_Index_SSSE3<u8, u16, 1>();
- m_Table[NRM_INDEX8][NRM_INDICES3][NRM_NBT][FORMAT_SHORT] = Normal_Index_SSSE3<u8, s16, 1>();
- m_Table[NRM_INDEX8][NRM_INDICES3][NRM_NBT][FORMAT_FLOAT] = Normal_Index_SSSE3<u8, float, 1>();
- m_Table[NRM_INDEX8][NRM_INDICES3][NRM_NBT3][FORMAT_UBYTE] = Normal_Index_Indices3_SSSE3<u8, u8>();
- m_Table[NRM_INDEX8][NRM_INDICES3][NRM_NBT3][FORMAT_BYTE] = Normal_Index_Indices3_SSSE3<u8, s8>();
- m_Table[NRM_INDEX8][NRM_INDICES3][NRM_NBT3][FORMAT_USHORT] = Normal_Index_Indices3_SSSE3<u8, u16>();
- m_Table[NRM_INDEX8][NRM_INDICES3][NRM_NBT3][FORMAT_SHORT] = Normal_Index_Indices3_SSSE3<u8, s16>();
- m_Table[NRM_INDEX8][NRM_INDICES3][NRM_NBT3][FORMAT_FLOAT] = Normal_Index_Indices3_SSSE3<u8, float>();
-
- m_Table[NRM_INDEX16][NRM_INDICES1][NRM_NBT][FORMAT_UBYTE] = Normal_Index_SSSE3<u16, u8, 1>();
- m_Table[NRM_INDEX16][NRM_INDICES1][NRM_NBT][FORMAT_BYTE] = Normal_Index_SSSE3<u16, s8, 1>();
- m_Table[NRM_INDEX16][NRM_INDICES1][NRM_NBT][FORMAT_USHORT] = Normal_Index_SSSE3<u16, u16, 1>();
- m_Table[NRM_INDEX16][NRM_INDICES1][NRM_NBT][FORMAT_SHORT] = Normal_Index_SSSE3<u16, s16, 1>();
- m_Table[NRM_INDEX16][NRM_INDICES1][NRM_NBT][FORMAT_FLOAT] = Normal_Index_SSSE3<u16, float, 1>();
- m_Table[NRM_INDEX16][NRM_INDICES1][NRM_NBT3][FORMAT_UBYTE] = Normal_Index_SSSE3<u16, u8, 3>();
- m_Table[NRM_INDEX16][NRM_INDICES1][NRM_NBT3][FORMAT_BYTE] = Normal_Index_SSSE3<u16, s8, 3>();
- m_Table[NRM_INDEX16][NRM_INDICES1][NRM_NBT3][FORMAT_USHORT] = Normal_Index_SSSE3<u16, u16, 3>();
- m_Table[NRM_INDEX16][NRM_INDICES1][NRM_NBT3][FORMAT_SHORT] = Normal_Index_SSSE3<u16, s16, 3>();
- m_Table[NRM_INDEX16][NRM_INDICES1][NRM_NBT3][FORMAT_FLOAT] = Normal_Index_SSSE3<u16, float, 3>();
-
- m_Table[NRM_INDEX16][NRM_INDICES3][NRM_NBT][FORMAT_UBYTE] = Normal_Index_SSSE3<u16, u8, 1>();
- m_Table[NRM_INDEX16][NRM_INDICES3][NRM_NBT][FORMAT_BYTE] = Normal_Index_SSSE3<u16, s8, 1>();
- m_Table[NRM_INDEX16][NRM_INDICES3][NRM_NBT][FORMAT_USHORT] = Normal_Index_SSSE3<u16, u16, 1>();
- m_Table[NRM_INDEX16][NRM_INDICES3][NRM_NBT][FORMAT_SHORT] = Normal_Index_SSSE3<u16, s16, 1>();
- m_Table[NRM_INDEX16][NRM_INDICES3][NRM_NBT][FORMAT_FLOAT] = Normal_Index_SSSE3<u16, float, 1>();
- m_Table[NRM_INDEX16][NRM_INDICES3][NRM_NBT3][FORMAT_UBYTE] = Normal_Index_Indices3_SSSE3<u16, u8>();
- m_Table[NRM_INDEX16][NRM_INDICES3][NRM_NBT3][FORMAT_BYTE] = Normal_Index_Indices3_SSSE3<u16, s8>();
- m_Table[NRM_INDEX16][NRM_INDICES3][NRM_NBT3][FORMAT_USHORT] = Normal_Index_Indices3_SSSE3<u16, u16>();
- m_Table[NRM_INDEX16][NRM_INDICES3][NRM_NBT3][FORMAT_SHORT] = Normal_Index_Indices3_SSSE3<u16, s16>();
- m_Table[NRM_INDEX16][NRM_INDICES3][NRM_NBT3][FORMAT_FLOAT] = Normal_Index_Indices3_SSSE3<u16, float>();
- }
-#endif
}
unsigned int VertexLoader_Normal::GetSize(u64 _type,
diff --git a/Source/Core/VideoCommon/VertexLoader_Position.cpp b/Source/Core/VideoCommon/VertexLoader_Position.cpp
index 43e56119ea..3dac5a55b1 100644
--- a/Source/Core/VideoCommon/VertexLoader_Position.cpp
+++ b/Source/Core/VideoCommon/VertexLoader_Position.cpp
@@ -5,8 +5,6 @@
#include <type_traits>
#include "Common/CommonTypes.h"
-#include "Common/CPUDetect.h"
-
#include "VideoCommon/VertexLoader.h"
#include "VideoCommon/VertexLoader_Position.h"
#include "VideoCommon/VertexManagerBase.h"
@@ -28,7 +26,7 @@ template <typename T, int N>
void LOADERDECL Pos_ReadDirect(VertexLoader* loader)
{
static_assert(N <= 3, "N > 3 is not sane!");
- auto const scale = loader->m_posScale[0];;
+ auto const scale = loader->m_posScale;
DataReader dst(g_vertex_manager_write_ptr, nullptr);
DataReader src(g_video_buffer_read_ptr, nullptr);
@@ -49,7 +47,7 @@ void LOADERDECL Pos_ReadIndex(VertexLoader* loader)
auto const index = DataRead<I>();
loader->m_vertexSkip = index == std::numeric_limits<I>::max();
auto const data = reinterpret_cast<const T*>(cached_arraybases[ARRAY_POSITION] + (index * g_main_cp_state.array_strides[ARRAY_POSITION]));
- auto const scale = loader->m_posScale[0];
+ auto const scale = loader->m_posScale;
DataReader dst(g_vertex_manager_write_ptr, nullptr);
for (int i = 0; i < 3; ++i)
@@ -59,28 +57,6 @@ void LOADERDECL Pos_ReadIndex(VertexLoader* loader)
LOG_VTX();
}
-#if _M_SSE >= 0x301
-template <typename T, bool three>
-void LOADERDECL Pos_ReadDirect_SSSE3(VertexLoader* loader)
-{
- const T* pData = reinterpret_cast<const T*>(DataGetPosition());
- Vertex_Read_SSSE3<T, three, true>(pData, *(__m128*)loader->m_posScale);
- DataSkip<(2 + three) * sizeof(T)>();
- LOG_VTX();
-}
-
-template <typename I, typename T, bool three>
-void LOADERDECL Pos_ReadIndex_SSSE3(VertexLoader* loader)
-{
- static_assert(std::is_unsigned<I>::value, "Only unsigned I is sane!");
- auto const index = DataRead<I>();
- loader->m_vertexSkip = index == std::numeric_limits<I>::max();
- const T* pData = (const T*)(cached_arraybases[ARRAY_POSITION] + (index * g_main_cp_state.array_strides[ARRAY_POSITION]));
- Vertex_Read_SSSE3<T, three, true>(pData, *(__m128*)loader->m_posScale);
- LOG_VTX();
-}
-#endif
-
static TPipelineFunction tableReadPosition[4][8][2] = {
{
{nullptr, nullptr,},
@@ -127,48 +103,6 @@ static int tableReadPositionVertexSize[4][8][2] = {
},
};
-
-void VertexLoader_Position::Init()
-{
-
-#if _M_SSE >= 0x301
- if (cpu_info.bSSSE3)
- {
- tableReadPosition[1][0][0] = Pos_ReadDirect_SSSE3<u8, false>;
- tableReadPosition[1][0][1] = Pos_ReadDirect_SSSE3<u8, true>;
- tableReadPosition[1][1][0] = Pos_ReadDirect_SSSE3<s8, false>;
- tableReadPosition[1][1][1] = Pos_ReadDirect_SSSE3<s8, true>;
- tableReadPosition[1][2][0] = Pos_ReadDirect_SSSE3<u16, false>;
- tableReadPosition[1][2][1] = Pos_ReadDirect_SSSE3<u16, true>;
- tableReadPosition[1][3][0] = Pos_ReadDirect_SSSE3<s16, false>;
- tableReadPosition[1][3][1] = Pos_ReadDirect_SSSE3<s16, true>;
- tableReadPosition[1][4][0] = Pos_ReadDirect_SSSE3<float, false>;
- tableReadPosition[1][4][1] = Pos_ReadDirect_SSSE3<float, true>;
- tableReadPosition[2][0][0] = Pos_ReadIndex_SSSE3<u8, u8, false>;
- tableReadPosition[2][0][1] = Pos_ReadIndex_SSSE3<u8, u8, true>;
- tableReadPosition[3][0][0] = Pos_ReadIndex_SSSE3<u16, u8, false>;
- tableReadPosition[3][0][1] = Pos_ReadIndex_SSSE3<u16, u8, true>;
- tableReadPosition[2][1][0] = Pos_ReadIndex_SSSE3<u8, s8, false>;
- tableReadPosition[2][1][1] = Pos_ReadIndex_SSSE3<u8, s8, true>;
- tableReadPosition[3][1][0] = Pos_ReadIndex_SSSE3<u16, s8, false>;
- tableReadPosition[3][1][1] = Pos_ReadIndex_SSSE3<u16, s8, true>;
- tableReadPosition[2][2][0] = Pos_ReadIndex_SSSE3<u8, u16, false>;
- tableReadPosition[2][2][1] = Pos_ReadIndex_SSSE3<u8, u16, true>;
- tableReadPosition[3][2][0] = Pos_ReadIndex_SSSE3<u16, u16, false>;
- tableReadPosition[3][2][1] = Pos_ReadIndex_SSSE3<u16, u16, true>;
- tableReadPosition[2][3][0] = Pos_ReadIndex_SSSE3<u8, s16, false>;
- tableReadPosition[2][3][1] = Pos_ReadIndex_SSSE3<u8, s16, true>;
- tableReadPosition[3][3][0] = Pos_ReadIndex_SSSE3<u16, s16, false>;
- tableReadPosition[3][3][1] = Pos_ReadIndex_SSSE3<u16, s16, true>;
- tableReadPosition[2][4][0] = Pos_ReadIndex_SSSE3<u8, float, false>;
- tableReadPosition[2][4][1] = Pos_ReadIndex_SSSE3<u8, float, true>;
- tableReadPosition[3][4][0] = Pos_ReadIndex_SSSE3<u16, float, false>;
- tableReadPosition[3][4][1] = Pos_ReadIndex_SSSE3<u16, float, true>;
- }
-#endif
-
-}
-
unsigned int VertexLoader_Position::GetSize(u64 _type, unsigned int _format, unsigned int _elements)
{
return tableReadPositionVertexSize[_type][_format][_elements];
diff --git a/Source/Core/VideoCommon/VertexLoader_TextCoord.cpp b/Source/Core/VideoCommon/VertexLoader_TextCoord.cpp
index 6e807a46e8..69e8ca155e 100644
--- a/Source/Core/VideoCommon/VertexLoader_TextCoord.cpp
+++ b/Source/Core/VideoCommon/VertexLoader_TextCoord.cpp
@@ -5,8 +5,6 @@
#include <type_traits>
#include "Common/CommonTypes.h"
-#include "Common/CPUDetect.h"
-
#include "VideoCommon/VertexLoader.h"
#include "VideoCommon/VertexLoader_TextCoord.h"
#include "VideoCommon/VertexManagerBase.h"
@@ -49,7 +47,7 @@ float TCScale(float val, float scale)
template <typename T, int N>
void LOADERDECL TexCoord_ReadDirect(VertexLoader* loader)
{
- auto const scale = loader->m_tcScale[loader->m_tcIndex][0];
+ auto const scale = loader->m_tcScale[loader->m_tcIndex];
DataReader dst(g_vertex_manager_write_ptr, nullptr);
DataReader src(g_video_buffer_read_ptr, nullptr);
@@ -71,7 +69,7 @@ void LOADERDECL TexCoord_ReadIndex(VertexLoader* loader)
auto const index = DataRead<I>();
auto const data = reinterpret_cast<const T*>(cached_arraybases[ARRAY_TEXCOORD0 + loader->m_tcIndex]
+ (index * g_main_cp_state.array_strides[ARRAY_TEXCOORD0 + loader->m_tcIndex]));
- auto const scale = loader->m_tcScale[loader->m_tcIndex][0];
+ auto const scale = loader->m_tcScale[loader->m_tcIndex];
DataReader dst(g_vertex_manager_write_ptr, nullptr);
for (int i = 0; i != N; ++i)
@@ -82,32 +80,6 @@ void LOADERDECL TexCoord_ReadIndex(VertexLoader* loader)
++loader->m_tcIndex;
}
-#if _M_SSE >= 0x301
-template <typename T>
-void LOADERDECL TexCoord_ReadDirect2_SSSE3(VertexLoader* loader)
-{
- const T* pData = reinterpret_cast<const T*>(DataGetPosition());
- __m128 scale = _mm_castsi128_ps(_mm_loadl_epi64((__m128i*)loader->m_tcScale[loader->m_tcIndex]));
- Vertex_Read_SSSE3<T, false, false>(pData, scale);
- DataSkip<2 * sizeof(T)>();
- LOG_TEX<2>();
- loader->m_tcIndex++;
-}
-
-template <typename I, typename T>
-void LOADERDECL TexCoord_ReadIndex2_SSSE3(VertexLoader* loader)
-{
- static_assert(std::is_unsigned<I>::value, "Only unsigned I is sane!");
-
- auto const index = DataRead<I>();
- const T* pData = (const T*)(cached_arraybases[ARRAY_TEXCOORD0 + loader->m_tcIndex] + (index * g_main_cp_state.array_strides[ARRAY_TEXCOORD0 + loader->m_tcIndex]));
- __m128 scale = _mm_castsi128_ps(_mm_loadl_epi64((__m128i*)loader->m_tcScale[loader->m_tcIndex]));
- Vertex_Read_SSSE3<T, false, false>(pData, scale);
- LOG_TEX<2>();
- loader->m_tcIndex++;
-}
-#endif
-
static TPipelineFunction tableReadTexCoord[4][8][2] = {
{
{nullptr, nullptr,},
@@ -154,32 +126,6 @@ static int tableReadTexCoordVertexSize[4][8][2] = {
},
};
-void VertexLoader_TextCoord::Init()
-{
-
-#if _M_SSE >= 0x301
- if (cpu_info.bSSSE3)
- {
- tableReadTexCoord[1][0][1] = TexCoord_ReadDirect2_SSSE3<u8>;
- tableReadTexCoord[1][1][1] = TexCoord_ReadDirect2_SSSE3<s8>;
- tableReadTexCoord[1][2][1] = TexCoord_ReadDirect2_SSSE3<u16>;
- tableReadTexCoord[1][3][1] = TexCoord_ReadDirect2_SSSE3<s16>;
- tableReadTexCoord[1][4][1] = TexCoord_ReadDirect2_SSSE3<float>;
- tableReadTexCoord[2][0][1] = TexCoord_ReadIndex2_SSSE3<u8, u8>;
- tableReadTexCoord[2][1][1] = TexCoord_ReadIndex2_SSSE3<u8, s8>;
- tableReadTexCoord[2][2][1] = TexCoord_ReadIndex2_SSSE3<u8, u16>;
- tableReadTexCoord[2][3][1] = TexCoord_ReadIndex2_SSSE3<u8, s16>;
- tableReadTexCoord[2][4][1] = TexCoord_ReadIndex2_SSSE3<u8, float>;
- tableReadTexCoord[3][0][1] = TexCoord_ReadIndex2_SSSE3<u16, u8>;
- tableReadTexCoord[3][1][1] = TexCoord_ReadIndex2_SSSE3<u16, s8>;
- tableReadTexCoord[3][2][1] = TexCoord_ReadIndex2_SSSE3<u16, u16>;
- tableReadTexCoord[3][3][1] = TexCoord_ReadIndex2_SSSE3<u16, s16>;
- tableReadTexCoord[3][4][1] = TexCoord_ReadIndex2_SSSE3<u16, float>;
- }
-#endif
-
-}
-
unsigned int VertexLoader_TextCoord::GetSize(u64 _type, unsigned int _format, unsigned int _elements)
{
return tableReadTexCoordVertexSize[_type][_format][_elements];