Restored generic (non-SIMD) code

This commit is contained in:
Brian Harris
2013-05-29 13:12:13 -05:00
parent be311f42e1
commit 9c37079c16
23 changed files with 3328 additions and 24 deletions

View File

@@ -193,6 +193,7 @@ Assumes input is in the range [-1, 1]
ID_INLINE void VertexFloatToByte( const float & x, const float & y, const float & z, byte * bval ) {
assert_4_byte_aligned( bval ); // for __stvebx
#ifdef ID_WIN_X86_SSE2_INTRIN
const __m128 vector_float_one = { 1.0f, 1.0f, 1.0f, 1.0f };
const __m128 vector_float_half = { 0.5f, 0.5f, 0.5f, 0.5f };
@@ -209,6 +210,13 @@ ID_INLINE void VertexFloatToByte( const float & x, const float & y, const float
bval[1] = (byte)_mm_extract_epi16( xyz16, 1 );
bval[2] = (byte)_mm_extract_epi16( xyz16, 2 );
#else
bval[0] = VERTEX_FLOAT_TO_BYTE( x );
bval[1] = VERTEX_FLOAT_TO_BYTE( y );
bval[2] = VERTEX_FLOAT_TO_BYTE( z );
#endif
}
/*
@@ -609,6 +617,7 @@ ID_INLINE void WriteDrawVerts16( idDrawVert * destVerts, const idDrawVert * loca
assert_16_byte_aligned( destVerts );
assert_16_byte_aligned( localVerts );
#ifdef ID_WIN_X86_SSE2_INTRIN
for ( int i = 0; i < numVerts; i++ ) {
__m128i v0 = _mm_load_si128( (const __m128i *)( (byte *)( localVerts + i ) + 0 ) );
@@ -617,6 +626,11 @@ ID_INLINE void WriteDrawVerts16( idDrawVert * destVerts, const idDrawVert * loca
_mm_stream_si128( (__m128i *)( (byte *)( destVerts + i ) + 16 ), v1 );
}
#else
memcpy( destVerts, localVerts, numVerts * sizeof( idDrawVert ) );
#endif
}
/*