build: arm target support

This commit is contained in:
nillerusr
2021-04-25 23:36:09 +03:00
parent e794dbcbb1
commit 50a93ce91a
51 changed files with 8210 additions and 4386 deletions

View File

@@ -1156,6 +1156,9 @@ inline void CVertexBuilder::FastAdvanceNVertices( int n )
//-----------------------------------------------------------------------------
inline void CVertexBuilder::FastVertex( const ModelVertexDX7_t &vertex )
{
#ifdef __arm__
FastVertexSSE( vertex );
#else
Assert( m_CompressionType == VERTEX_COMPRESSION_NONE ); // FIXME: support compressed verts if needed
Assert( m_nCurrentVertex < m_nMaxVertexCount );
@@ -1213,6 +1216,7 @@ inline void CVertexBuilder::FastVertex( const ModelVertexDX7_t &vertex )
m_bWrittenNormal = false;
m_bWrittenUserData = false;
#endif
#endif
}
inline void CVertexBuilder::FastVertexSSE( const ModelVertexDX7_t &vertex )
@@ -1322,6 +1326,9 @@ inline void CVertexBuilder::Fast4VerticesSSE(
inline void CVertexBuilder::FastVertex( const ModelVertexDX8_t &vertex )
{
#ifdef __arm__
FastVertexSSE( vertex );
#else
Assert( m_CompressionType == VERTEX_COMPRESSION_NONE ); // FIXME: support compressed verts if needed
Assert( m_nCurrentVertex < m_nMaxVertexCount );
@@ -1386,8 +1393,10 @@ inline void CVertexBuilder::FastVertex( const ModelVertexDX8_t &vertex )
m_bWrittenNormal = false;
m_bWrittenUserData = false;
#endif
#endif
}
inline void CVertexBuilder::FastVertexSSE( const ModelVertexDX8_t &vertex )
{
Assert( m_CompressionType == VERTEX_COMPRESSION_NONE ); // FIXME: support compressed verts if needed
@@ -1414,7 +1423,8 @@ inline void CVertexBuilder::FastVertexSSE( const ModelVertexDX8_t &vertex )
#elif defined(GNUC)
const void *pRead = &vertex;
void *pCurrPos = m_pCurrPosition;
__asm__ __volatile__ (
/* __asm__ __volatile__ (
"movaps (%0), %%xmm0\n"
"movaps 16(%0), %%xmm1\n"
"movaps 32(%0), %%xmm2\n"
@@ -1422,8 +1432,17 @@ inline void CVertexBuilder::FastVertexSSE( const ModelVertexDX8_t &vertex )
"movntps %%xmm0, (%1)\n"
"movntps %%xmm1, 16(%1)\n"
"movntps %%xmm2, 32(%1)\n"
"movntps %%xmm3, 48(%1)\n"
:: "r" (pRead), "r" (pCurrPos) : "memory");
"movntps %%xmm3, 48(%1)\n"
:: "r" (pRead), "r" (pCurrPos) : "memory"); */
__m128 m1 = _mm_load_ps( (float *)pRead );
__m128 m2 = _mm_load_ps( (float *)(pRead + 16) );
__m128 m3 = _mm_load_ps( (float *)(pRead + 32) );
__m128 m4 = _mm_load_ps( (float *)(pRead + 48) );
_mm_stream_ps( (float *)pCurrPos, m1 );
_mm_stream_ps( (float *)(pCurrPos + 16), m2 );
_mm_stream_ps( (float *)(pCurrPos + 32), m3 );
_mm_stream_ps( (float *)(pCurrPos + 48), m4 );
#else
Error( "Implement CMeshBuilder::FastVertexSSE((dx8)" );
#endif