Simd_Generic.h 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138
  1. /*
  2. ===========================================================================
  3. Doom 3 GPL Source Code
  4. Copyright (C) 1999-2011 id Software LLC, a ZeniMax Media company.
  5. This file is part of the Doom 3 GPL Source Code (?Doom 3 Source Code?).
  6. Doom 3 Source Code is free software: you can redistribute it and/or modify
  7. it under the terms of the GNU General Public License as published by
  8. the Free Software Foundation, either version 3 of the License, or
  9. (at your option) any later version.
  10. Doom 3 Source Code is distributed in the hope that it will be useful,
  11. but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. GNU General Public License for more details.
  14. You should have received a copy of the GNU General Public License
  15. along with Doom 3 Source Code. If not, see <http://www.gnu.org/licenses/>.
  16. In addition, the Doom 3 Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 Source Code. If not, please request a copy in writing from id Software at the address below.
  17. If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.
  18. ===========================================================================
  19. */
  20. #ifndef __MATH_SIMD_GENERIC_H__
  21. #define __MATH_SIMD_GENERIC_H__
  22. /*
  23. ===============================================================================
  24. Generic implementation of idSIMDProcessor
  25. ===============================================================================
  26. */
  27. class idSIMD_Generic : public idSIMDProcessor {
  28. public:
  29. virtual const char * VPCALL GetName( void ) const;
  30. virtual void VPCALL Add( float *dst, const float constant, const float *src, const int count );
  31. virtual void VPCALL Add( float *dst, const float *src0, const float *src1, const int count );
  32. virtual void VPCALL Sub( float *dst, const float constant, const float *src, const int count );
  33. virtual void VPCALL Sub( float *dst, const float *src0, const float *src1, const int count );
  34. virtual void VPCALL Mul( float *dst, const float constant, const float *src, const int count );
  35. virtual void VPCALL Mul( float *dst, const float *src0, const float *src1, const int count );
  36. virtual void VPCALL Div( float *dst, const float constant, const float *src, const int count );
  37. virtual void VPCALL Div( float *dst, const float *src0, const float *src1, const int count );
  38. virtual void VPCALL MulAdd( float *dst, const float constant, const float *src, const int count );
  39. virtual void VPCALL MulAdd( float *dst, const float *src0, const float *src1, const int count );
  40. virtual void VPCALL MulSub( float *dst, const float constant, const float *src, const int count );
  41. virtual void VPCALL MulSub( float *dst, const float *src0, const float *src1, const int count );
  42. virtual void VPCALL Dot( float *dst, const idVec3 &constant, const idVec3 *src, const int count );
  43. virtual void VPCALL Dot( float *dst, const idVec3 &constant, const idPlane *src, const int count );
  44. virtual void VPCALL Dot( float *dst, const idVec3 &constant, const idDrawVert *src, const int count );
  45. virtual void VPCALL Dot( float *dst, const idPlane &constant,const idVec3 *src, const int count );
  46. virtual void VPCALL Dot( float *dst, const idPlane &constant,const idPlane *src, const int count );
  47. virtual void VPCALL Dot( float *dst, const idPlane &constant,const idDrawVert *src, const int count );
  48. virtual void VPCALL Dot( float *dst, const idVec3 *src0, const idVec3 *src1, const int count );
  49. virtual void VPCALL Dot( float &dot, const float *src1, const float *src2, const int count );
  50. virtual void VPCALL CmpGT( byte *dst, const float *src0, const float constant, const int count );
  51. virtual void VPCALL CmpGT( byte *dst, const byte bitNum, const float *src0, const float constant, const int count );
  52. virtual void VPCALL CmpGE( byte *dst, const float *src0, const float constant, const int count );
  53. virtual void VPCALL CmpGE( byte *dst, const byte bitNum, const float *src0, const float constant, const int count );
  54. virtual void VPCALL CmpLT( byte *dst, const float *src0, const float constant, const int count );
  55. virtual void VPCALL CmpLT( byte *dst, const byte bitNum, const float *src0, const float constant, const int count );
  56. virtual void VPCALL CmpLE( byte *dst, const float *src0, const float constant, const int count );
  57. virtual void VPCALL CmpLE( byte *dst, const byte bitNum, const float *src0, const float constant, const int count );
  58. virtual void VPCALL MinMax( float &min, float &max, const float *src, const int count );
  59. virtual void VPCALL MinMax( idVec2 &min, idVec2 &max, const idVec2 *src, const int count );
  60. virtual void VPCALL MinMax( idVec3 &min, idVec3 &max, const idVec3 *src, const int count );
  61. virtual void VPCALL MinMax( idVec3 &min, idVec3 &max, const idDrawVert *src, const int count );
  62. virtual void VPCALL MinMax( idVec3 &min, idVec3 &max, const idDrawVert *src, const int *indexes, const int count );
  63. virtual void VPCALL Clamp( float *dst, const float *src, const float min, const float max, const int count );
  64. virtual void VPCALL ClampMin( float *dst, const float *src, const float min, const int count );
  65. virtual void VPCALL ClampMax( float *dst, const float *src, const float max, const int count );
  66. virtual void VPCALL Memcpy( void *dst, const void *src, const int count );
  67. virtual void VPCALL Memset( void *dst, const int val, const int count );
  68. virtual void VPCALL Zero16( float *dst, const int count );
  69. virtual void VPCALL Negate16( float *dst, const int count );
  70. virtual void VPCALL Copy16( float *dst, const float *src, const int count );
  71. virtual void VPCALL Add16( float *dst, const float *src1, const float *src2, const int count );
  72. virtual void VPCALL Sub16( float *dst, const float *src1, const float *src2, const int count );
  73. virtual void VPCALL Mul16( float *dst, const float *src1, const float constant, const int count );
  74. virtual void VPCALL AddAssign16( float *dst, const float *src, const int count );
  75. virtual void VPCALL SubAssign16( float *dst, const float *src, const int count );
  76. virtual void VPCALL MulAssign16( float *dst, const float constant, const int count );
  77. virtual void VPCALL MatX_MultiplyVecX( idVecX &dst, const idMatX &mat, const idVecX &vec );
  78. virtual void VPCALL MatX_MultiplyAddVecX( idVecX &dst, const idMatX &mat, const idVecX &vec );
  79. virtual void VPCALL MatX_MultiplySubVecX( idVecX &dst, const idMatX &mat, const idVecX &vec );
  80. virtual void VPCALL MatX_TransposeMultiplyVecX( idVecX &dst, const idMatX &mat, const idVecX &vec );
  81. virtual void VPCALL MatX_TransposeMultiplyAddVecX( idVecX &dst, const idMatX &mat, const idVecX &vec );
  82. virtual void VPCALL MatX_TransposeMultiplySubVecX( idVecX &dst, const idMatX &mat, const idVecX &vec );
  83. virtual void VPCALL MatX_MultiplyMatX( idMatX &dst, const idMatX &m1, const idMatX &m2 );
  84. virtual void VPCALL MatX_TransposeMultiplyMatX( idMatX &dst, const idMatX &m1, const idMatX &m2 );
  85. virtual void VPCALL MatX_LowerTriangularSolve( const idMatX &L, float *x, const float *b, const int n, int skip = 0 );
  86. virtual void VPCALL MatX_LowerTriangularSolveTranspose( const idMatX &L, float *x, const float *b, const int n );
  87. virtual bool VPCALL MatX_LDLTFactor( idMatX &mat, idVecX &invDiag, const int n );
  88. virtual void VPCALL BlendJoints( idJointQuat *joints, const idJointQuat *blendJoints, const float lerp, const int *index, const int numJoints );
  89. virtual void VPCALL ConvertJointQuatsToJointMats( idJointMat *jointMats, const idJointQuat *jointQuats, const int numJoints );
  90. virtual void VPCALL ConvertJointMatsToJointQuats( idJointQuat *jointQuats, const idJointMat *jointMats, const int numJoints );
  91. virtual void VPCALL TransformJoints( idJointMat *jointMats, const int *parents, const int firstJoint, const int lastJoint );
  92. virtual void VPCALL UntransformJoints( idJointMat *jointMats, const int *parents, const int firstJoint, const int lastJoint );
  93. virtual void VPCALL TransformVerts( idDrawVert *verts, const int numVerts, const idJointMat *joints, const idVec4 *weights, const int *index, const int numWeights );
  94. virtual void VPCALL TracePointCull( byte *cullBits, byte &totalOr, const float radius, const idPlane *planes, const idDrawVert *verts, const int numVerts );
  95. virtual void VPCALL DecalPointCull( byte *cullBits, const idPlane *planes, const idDrawVert *verts, const int numVerts );
  96. virtual void VPCALL OverlayPointCull( byte *cullBits, idVec2 *texCoords, const idPlane *planes, const idDrawVert *verts, const int numVerts );
  97. virtual void VPCALL DeriveTriPlanes( idPlane *planes, const idDrawVert *verts, const int numVerts, const int *indexes, const int numIndexes );
  98. virtual void VPCALL DeriveTangents( idPlane *planes, idDrawVert *verts, const int numVerts, const int *indexes, const int numIndexes );
  99. virtual void VPCALL DeriveUnsmoothedTangents( idDrawVert *verts, const dominantTri_s *dominantTris, const int numVerts );
  100. virtual void VPCALL NormalizeTangents( idDrawVert *verts, const int numVerts );
  101. virtual void VPCALL CreateTextureSpaceLightVectors( idVec3 *lightVectors, const idVec3 &lightOrigin, const idDrawVert *verts, const int numVerts, const int *indexes, const int numIndexes );
  102. virtual void VPCALL CreateSpecularTextureCoords( idVec4 *texCoords, const idVec3 &lightOrigin, const idVec3 &viewOrigin, const idDrawVert *verts, const int numVerts, const int *indexes, const int numIndexes );
  103. virtual int VPCALL CreateShadowCache( idVec4 *vertexCache, int *vertRemap, const idVec3 &lightOrigin, const idDrawVert *verts, const int numVerts );
  104. virtual int VPCALL CreateVertexProgramShadowCache( idVec4 *vertexCache, const idDrawVert *verts, const int numVerts );
  105. virtual void VPCALL UpSamplePCMTo44kHz( float *dest, const short *pcm, const int numSamples, const int kHz, const int numChannels );
  106. virtual void VPCALL UpSampleOGGTo44kHz( float *dest, const float * const *ogg, const int numSamples, const int kHz, const int numChannels );
  107. virtual void VPCALL MixSoundTwoSpeakerMono( float *mixBuffer, const float *samples, const int numSamples, const float lastV[2], const float currentV[2] );
  108. virtual void VPCALL MixSoundTwoSpeakerStereo( float *mixBuffer, const float *samples, const int numSamples, const float lastV[2], const float currentV[2] );
  109. virtual void VPCALL MixSoundSixSpeakerMono( float *mixBuffer, const float *samples, const int numSamples, const float lastV[6], const float currentV[6] );
  110. virtual void VPCALL MixSoundSixSpeakerStereo( float *mixBuffer, const float *samples, const int numSamples, const float lastV[6], const float currentV[6] );
  111. virtual void VPCALL MixedSoundToSamples( short *samples, const float *mixBuffer, const int numSamples );
  112. };
  113. #endif /* !__MATH_SIMD_GENERIC_H__ */