Login
Username:

Password:

Remember me



Lost Password?

Register now!

Sections

Who's Online
54 user(s) are online (47 user(s) are browsing Forums)

Members: 0
Guests: 54

more...

Support us!

Headlines

 
  Register To Post  

« 1 2 3 (4)
Re: type of crash: alignment exeption, how to fix ?
Not too shy to talk
Not too shy to talk


See User information
sorry for not answering but I was a little sick and feverish those days and I did not have the courage to read code

Certainly there are some typos in my code

> in the same place
Yes we should better use an aligned structure as destination
something like
[...]
struct AlignedTriangle *tri2=triangles2;
[...]
tri2->VertexIndices[j] = GetWord(&(tri->VertexIndices[j]));

tri2->VertexNormals[j][0] = GetFloat(&(tri->VertexNormals[j][0]));
[...]
tri2++;

>GetWord
is also used for reordering the u16 values

Go to top
Re: type of crash: alignment exeption, how to fix ?
Home away from home
Home away from home


See User information
@All
If anyone in interst Corto fix whole loader to works on big_endian with -O3. Through it works only with latest Salas00 version of get_unaligned_le_float:

static inline float get_unaligned_le_float(const u8 *ptr)
{
    
union {
        
u8 u[4];
        
float f;
    } 
tmp;
#ifdef __BIG_ENDIAN__
    
tmp.u[0] = ptr[3];
    
tmp.u[1] = ptr[2];
    
tmp.u[2] = ptr[1];
    
tmp.u[3] = ptr[0];
#else
    
tmp.= *(float*)ptr;
#endif
    
return tmp.f;
}


Because once we just use only "union" version in the middle of the code, seems compiler optimize it wrongly anyway. So we had to move it at top (where structures placed) as well.

So, there is final version with Corto's added padding and some code modifications to make it all works, and Salas00's get_unaligned_le_float():

http://kas1e.mikendezign.com/aos4/irr ... DMeshFileLoader_fixed.cpp

(see pad[] things in structures at top, etc)

Also there is some test compiled to try it out on x1000 or sam on on other x5000, to be sure that all works fine on any big-endian machine, plz try it:

http://kas1e.mikendezign.com/aos4/irrlicht/ms3dtest.lha

Unpack it to any place, run form shell, it will give list of drivers to choice , choice "a" (opengl).

Then in the test itself, choice in menu via mouse "File / Open Model & Texture". There choice from directory "ms3d" any model you want to test: zombie, farma2 or gun. In that directory you need to choice ".ms3d" file to load, so it will load mesh and associated images with (for sake of fun in "gun" one, you can also choice to load "hud.x").

If someone can test if all works on x1000 and on sam460 and on tabor, that will mean that big-endian changes are fine.

Thanks !


Edited by kas1e on 2019/11/17 12:34:03
Join us to improve dopus5!
AmigaOS4 on youtube
Go to top
Re: type of crash: alignment exeption, how to fix ?
Just can't stay away
Just can't stay away


See User information
@kas1e

It looks fine to me on X1000.

Rock lobster bit me - so I'm here forever
X1000 + AmigaOS 4.1 FE
"Anyone can build a fast CPU. The trick is to build a fast system." - Seymour Cray
Go to top
Re: type of crash: alignment exeption, how to fix ?
Home away from home
Home away from home


See User information
@TSK
Seems that our kernel have that "alignemnt exeption emulator", but as we foind, it didn't enabled for x5000 by some reassons, but did enabled for x1000.

So, even if something wrong, it still will works on x1000 then.. Will be interesting if someone can check it on SAM as well ..

Join us to improve dopus5!
AmigaOS4 on youtube
Go to top
Re: type of crash: alignment exeption, how to fix ?
Not too shy to talk
Not too shy to talk


See User information
Sorry I dont have a recent enough Nova nor GL-ES to test it...

Go to top
Re: type of crash: alignment exeption, how to fix ?
Home away from home
Home away from home


See User information
@thellier
Latest public versions are fine for this test: nova 1.65 and ogles2.8 fits in (tested)

Join us to improve dopus5!
AmigaOS4 on youtube
Go to top
Re: type of crash: alignment exeption, how to fix ?
Home away from home
Home away from home


See User information
@Corto,Salas00
Our patch in original's irrlicht trunk now too, yeah !:
https://sourceforge.net/p/irrlicht/code/5948/

Join us to improve dopus5!
AmigaOS4 on youtube
Go to top
Re: type of crash: alignment exeption, how to fix ?
Not too shy to talk
Not too shy to talk


See User information
@kas1e Great! Thank you for that. And I am sorry for not having answered to you and sent the diff. So you did it. I was not sure at all they will accept the patch, as any systems emulate the alignment exception on float accesses.

A comment above the structures could have been added to explain the reason for padding but that good enough.

I hope this engine will allow to provide new software.

Go to top
Re: type of crash: alignment exeption, how to fix ?
Home away from home
Home away from home


See User information
@Corto
Quote:

I hope this engine will allow to provide new software.


Sure it will, i have already some titles to be released soon :) And i already spend a year on this engine so to have most of amigaos4 changes and big-endian fixes in irrlicht's repo (not only for opengl renderer, but aslo for software ones, for SDL, etc).

@All

Btw, there is another mesh loader (i think its the last one from whole irrlicht), which miss not only alignment but in whole endian ifdefs. That is HalfLife mesh loader (.mdl).

There is:

https://sourceforge.net/p/irrlicht/cod ... CAnimatedMeshHalfLife.cpp
https://sourceforge.net/p/irrlicht/cod ... t/CAnimatedMeshHalfLife.h

I started firstly with big-endian ifdefs, so at moment have only that:

http://kas1e.mikendezign.com/aos4/irr ... CAnimatedMeshHalfLife.cpp

Not sure if it enough, but as far as i can see from .h file, there is some structures which again will be in needs to be aligned ? At least, if in the .cpp file we read it like we read it with ms3d loader.

Join us to improve dopus5!
AmigaOS4 on youtube
Go to top

  Register To Post
« 1 2 3 (4)

 




Currently Active Users Viewing This Thread: 1 ( 0 members and 1 Anonymous Users )




Powered by XOOPS 2.0 © 2001-2024 The XOOPS Project