Horde3D

Next-Generation Graphics Engine
It is currently 16.05.2024, 08:57

All times are UTC + 1 hour




Post new topic Reply to topic  [ 99 posts ]  Go to page Previous  1, 2, 3, 4, 5, 6, 7  Next
Author Message
 Post subject: Re: NOS PACK
PostPosted: 26.10.2008, 15:51 
Offline

Joined: 21.08.2008, 11:44
Posts: 354
Code:
error C3861: '_mm_cvtss_f32': identifier not found
Only MSVC2008 and GCC/MinGW 4.x are supporting this intrinsic and it isn't included in MSVC2005 and GCC/MinGW 3.x [check out the xmmintrin.h]
We must find an equivalent/macro for this intrinsic, because most of Horde3D guys are using MSVC2005 or GCC/MinGW 3.x and older ones.

Code:
error C2719: 'v': formal parameter with __declspec(align('16')) won't be aligned
error C2719: 'axis': formal parameter with __declspec(align('16')) won't be aligned
We can't use aligned data with functions on MSVC so we must change the following codes :
Code:
    explicit Vec4f( Vec3f v ) : x( v.x ), y( v.y ), z( v.z ), w( 1.0f )
    {
    }

    static Matrix4f RotMat( Vec3f axis, float angle )
    {
        axis = axis * sinf( angle / 2 );
        return Matrix4f( Quaternion( axis.x, axis.y, axis.z, cosf( angle / 2 ) ) );
    }
to this :
Code:
    explicit Vec4f( Vec3f &v ) : x( v.x ), y( v.y ), z( v.z ), w( 1.0f )
    {
    }

    static Matrix4f RotMat( Vec3f &axis, float angle )
    {
        axis = axis * sinf( angle / 2 );
        return Matrix4f( Quaternion( axis.x, axis.y, axis.z, cosf( angle / 2 ) ) );
    }
But I'm not sure that this is a safe way to solve this problem.

Anybody have better ideas ?


Top
 Profile  
Reply with quote  
 Post subject: Re: NOS PACK
PostPosted: 28.10.2008, 18:37 
Offline

Joined: 21.08.2008, 11:44
Posts: 354
Atlast I've found the problem, Matrix4f : determinant() function don't works correctly, I'll fix that and search for other bugz :D

I've placed an incomplete test suite called utmath_tester.zip for utmath, I'll finish that too. I'll be glad if anybody can find any other bugz :wink:

EDIT : determinant function don't works correctly because of using pointers to solve the problems with MSVC :?
Code:
    explicit Vec4f( Vec3f &v ) : x( v.x ), y( v.y ), z( v.z ), w( 1.0f )
    static Matrix4f RotMat( Vec3f &axis, float angle )
I've changed them to this :
Code:
    explicit Vec4f( Vec3f &v ) : x( v.x ), y( v.y ), z( v.z ), w( 1.0f )

    static Matrix4f RotMat( Vec3f &axis, float angle )
    {
        Vec3f newAxis=axis;
        newAxis = newAxis * sinf( angle / 2 );
        return Matrix4f( Quaternion( newAxis.x, newAxis.y, newAxis.z, cosf( angle / 2 ) ) );
    }
But this will produce a lot of problems with engine in MSVC, anybody knows how to avoid this pointers ?


Top
 Profile  
Reply with quote  
 Post subject: Re: NOS PACK
PostPosted: 29.10.2008, 00:22 
Offline

Joined: 22.11.2007, 17:05
Posts: 707
Location: Boston, MA
Siavash wrote:
determinant function don't works correctly because of using pointers to solve the problems with MSVC :?
Code:
    explicit Vec4f( Vec3f &v ) : x( v.x ), y( v.y ), z( v.z ), w( 1.0f )
    static Matrix4f RotMat( Vec3f &axis, float angle )
But this will produce a lot of problems with engine in MSVC, anybody knows how to avoid this pointers ?
There aren't any pointers there. There are references, but for some reason they are not const-correct. Change them like this:
Code:
    explicit Vec4f( const Vec3f &v ) : x( v.x ), y( v.y ), z( v.z ), w( 1.0f )
    static Matrix4f RotMat( const Vec3f &axis, float angle )

_________________
Tristam MacDonald - [swiftcoding]


Top
 Profile  
Reply with quote  
 Post subject: Re: NOS PACK
PostPosted: 29.10.2008, 06:36 
Offline

Joined: 21.08.2008, 11:44
Posts: 354
I've placed a new update to the utMath_rc6 [utMath_rc6.2]. That includes some fixes for MSVC and older compilers.

changes :
-_mm_cvtss_f32 replaced by _mm_cvtss_si32 : but results won't be too accurate because _mm_cvtss_si32 returns int instead of float.
-swiftcoder tips
Code:
    explicit Vec4f( const Vec3f &v ) : x( v.x ), y( v.y ), z( v.z ), w( 1.0f )
    static Matrix4f RotMat( const Vec3f &axis, float angle )
But this will produce a lot of errors when compiling the engine using MSVC :
Code:
formal parameter with __declspec(align('16')) won't be aligned


It's too interesting for me that GCC/MinGW 4.x don't produces any errors at all and MSVC 2005 [Pro] is suffering me. I'll continue to find problems with calculations in utMath_rc6. Please report me if you see any bugz or exceptions.


Top
 Profile  
Reply with quote  
 Post subject: Re: NOS PACK
PostPosted: 29.10.2008, 07:09 
Offline

Joined: 08.11.2006, 03:10
Posts: 384
Location: Australia
Siavash wrote:
Code:
    explicit Vec4f( const Vec3f &v ) : x( v.x ), y( v.y ), z( v.z ), w( 1.0f )

Could you do something like this instead?
Code:
    explicit Vec4f( const Vec3f &v ) : m128( v.m128 ), w( 1.0f )


Top
 Profile  
Reply with quote  
 Post subject: Re: NOS PACK
PostPosted: 29.10.2008, 11:53 
Offline

Joined: 21.08.2008, 11:44
Posts: 354
DarkAngel wrote:
Siavash wrote:
Code:
    explicit Vec4f( const Vec3f &v ) : x( v.x ), y( v.y ), z( v.z ), w( 1.0f )

Could you do something like this instead?
Code:
    explicit Vec4f( const Vec3f &v ) : m128( v.m128 ), w( 1.0f )
No, MSVC reports 196 errors again. Depending on MSDN we can't use aligned data in functions
MSDN wrote:
Compiler Error C2719

Error Message
'parameter': formal parameter with __declspec(align('#')) won't be aligned

The align __declspec modifier is not permitted on function parameters.

The following sample generates C2719:
Code:
// C2719.cpp
void func(int __declspec(align(32)) i);   // C2719
// try the following line instead
// void func(int i);
IMHO we can't solve the problems with MSVC compiler using pointers/references, we must find another way to don't use __declspec in functions.


Top
 Profile  
Reply with quote  
 Post subject: Re: NOS PACK
PostPosted: 29.10.2008, 12:36 
Offline

Joined: 21.08.2008, 11:44
Posts: 354
I know that this is the silliest way to solve this problem but we can add another temporary union and eliminate the Vec3f (__m128 myvec) and other similar constructors. By this way there wouldn't be any problems with aligned data, I'll have a try with this :idea:


Top
 Profile  
Reply with quote  
 Post subject: Re: NOS PACK
PostPosted: 07.11.2008, 20:22 
Offline

Joined: 21.08.2008, 11:44
Posts: 354
Hi guys, I've checked the utmath_rc6 and there isn't any problems in calculations [I couldn't find any exceptions] and max diff between returned values of original utmath and utmath_rc6 is ~3.0; Perhaps the problem is anything else and I don't have time to find other problems and fix them :?

I'm going to focus on Direct3D 9 :wink:


Top
 Profile  
Reply with quote  
 Post subject: Re: NOS PACK
PostPosted: 18.11.2008, 06:46 
Offline

Joined: 21.08.2008, 11:44
Posts: 354
This is a little offtopic but CPU makers are going to really boost their CPUs. IMHO it's better for us to focus on multithreading and vectorizing our engine using SSE [IntelAVX] more than before !!!

Check out the new Core i7 : Wikipedia, HotHardware, CNET

[Don't worry I'll release the first NOS PACK rc as soon as possible after some house cleaning]


Top
 Profile  
Reply with quote  
 Post subject: Re: NOS PACK
PostPosted: 03.12.2008, 13:19 
Offline

Joined: 21.08.2008, 11:44
Posts: 354
Please help to debug the utMath_rc6.x and optimize the engine. utMath_rc6.x.zip includes utMath_rc6.0, utMath_rc6.1 and utMath_tester [You need the latest compiler in order to compile the rc6.0]


Top
 Profile  
Reply with quote  
 Post subject: Re: NOS PACK
PostPosted: 24.12.2008, 17:15 
Offline

Joined: 21.08.2008, 11:44
Posts: 354
utMath_rc6.2 is available, perhaps this is the final RC version. I've performed some tweaks on the code: the code is a bit faster and results are more accurate than before and there isn't any problems with MSVC [I think].

I'll have a test with utMath_rc6.2 tomorrow, don't forget to use the latest compiler [MinGW/GCC4.x or MSVC2008]

Have fun with engine :wink:

Siavash.


Top
 Profile  
Reply with quote  
 Post subject: Re: NOS PACK
PostPosted: 05.01.2009, 08:21 
Offline

Joined: 21.08.2008, 11:44
Posts: 354
swiftcoder wrote:
Siavash wrote:
determinant function don't works correctly because of using pointers to solve the problems with MSVC :?
Code:
    explicit Vec4f( Vec3f &v ) : x( v.x ), y( v.y ), z( v.z ), w( 1.0f )
    static Matrix4f RotMat( Vec3f &axis, float angle )
But this will produce a lot of problems with engine in MSVC, anybody knows how to avoid this pointers ?
There aren't any pointers there. There are references, but for some reason they are not const-correct. Change them like this:
Code:
    explicit Vec4f( const Vec3f &v ) : x( v.x ), y( v.y ), z( v.z ), w( 1.0f )
    static Matrix4f RotMat( const Vec3f &axis, float angle )
First of all HAPPY NEW YEAR ! Excuse me dear swiftcoder, I must do something like the tip that you said. We must use references to solve the Error C2719 with MSVC. [and we need to change some parts of engine][Currently I'm BZ with final exams]

Everybody have a good year :wink:


Top
 Profile  
Reply with quote  
 Post subject: Re: NOS PACK
PostPosted: 05.01.2009, 10:57 
Offline

Joined: 21.08.2008, 11:44
Posts: 354
There is a helpful topic on ompf.org about how to solve the problem with aligned data and vector header [std::vector] by using btAlignedObjectArray in Bullet physics library.


Top
 Profile  
Reply with quote  
 Post subject: Re: NOS PACK
PostPosted: 05.01.2009, 11:31 
Offline
Tool Developer

Joined: 13.11.2007, 11:07
Posts: 1150
Location: Germany
Indeed an interesting discussion.


Top
 Profile  
Reply with quote  
 Post subject: Re: NOS PACK
PostPosted: 16.01.2009, 07:13 
Offline

Joined: 21.08.2008, 11:44
Posts: 354
There is a small problem with utMath_rc6.x :
Change this piece of code:
Code:
    Matrix4f( const float *floatArray16 )
    {
      int ix4;

      for( unsigned int i = 0; i < 4; ++i )
      {
         ix4 = i * 4;
         c[i][0] = ix4 + 0;
         c[i][1] = ix4 + 1;
         c[i][2] = ix4 + 2;
         c[i][3] = ix4 + 3;
      }
    }
to this :
Code:
    Matrix4f( const float *floatArray16 )
    {
      int ix4;

      for( unsigned int i = 0; i < 4; ++i )
      {
         ix4 = i * 4;
         c[i][0] = floatArray16[ix4 + 0];
         c[i][1] = floatArray16[ix4 + 1];
         c[i][2] = floatArray16[ix4 + 2];
         c[i][3] = floatArray16[ix4 + 3];
      }
    }


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 99 posts ]  Go to page Previous  1, 2, 3, 4, 5, 6, 7  Next

All times are UTC + 1 hour


Who is online

Users browsing this forum: No registered users and 4 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB® Forum Software © phpBB Group