Login
Username:

Password:

Remember me



Lost Password?

Register now!
Sections
Who's Online
95 user(s) are online (76 user(s) are browsing Forums)

Members: 1
Guests: 94

daveyw, more...
Support us!
Recent OS4 Files
OS4Depot.net



« 1 2 3 (4)


Re: type of crash: alignment exeption, how to fix ?
Not too shy to talk
Joined:
2011/6/3 12:49
Posts: 252
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

   Report Go to top

Re: type of crash: alignment exeption, how to fix ?
Home away from home
Joined:
2007/9/11 11:31
From Russia
Posts: 5536
@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!
zerohero's mirror of os4/os3 crosscompiler suites
   Report Go to top

Re: type of crash: alignment exeption, how to fix ?
Just can't stay away
Joined:
2007/2/23 13:49
From Finland, the land of Santa, sauna, sisu and salmiakki
Posts: 1100
@kas1e

It looks fine to me on X1000.

_________________
Rock lobster bit me, so excuse me.
X1000 + AmigaOS 4.1 FE. Be authentic.
"Anyone can build a fast CPU. The trick is to build a fast system." - Seymour Cray
   Report Go to top

Re: type of crash: alignment exeption, how to fix ?
Home away from home
Joined:
2007/9/11 11:31
From Russia
Posts: 5536
@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!
zerohero's mirror of os4/os3 crosscompiler suites
   Report Go to top

Re: type of crash: alignment exeption, how to fix ?
Not too shy to talk
Joined:
2011/6/3 12:49
Posts: 252
Sorry I dont have a recent enough Nova nor GL-ES to test it...

   Report Go to top

Re: type of crash: alignment exeption, how to fix ?
Home away from home
Joined:
2007/9/11 11:31
From Russia
Posts: 5536
@thellier
Latest public versions are fine for this test: nova 1.65 and ogles2.8 fits in (tested)

_________________
Join us to improve dopus5!
zerohero's mirror of os4/os3 crosscompiler suites
   Report Go to top

Re: type of crash: alignment exeption, how to fix ?
Home away from home
Joined:
2007/9/11 11:31
From Russia
Posts: 5536
@Corto,Salas00
Our patch in original's irrlicht trunk now too, yeah !:
https://sourceforge.net/p/irrlicht/code/5948/

_________________
Join us to improve dopus5!
zerohero's mirror of os4/os3 crosscompiler suites
   Report Go to top

Re: type of crash: alignment exeption, how to fix ?
Not too shy to talk
Joined:
2007/3/30 17:39
Posts: 269
@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.

   Report Go to top

Re: type of crash: alignment exeption, how to fix ?
Home away from home
Joined:
2007/9/11 11:31
From Russia
Posts: 5536
@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!
zerohero's mirror of os4/os3 crosscompiler suites
   Report Go to top


« 1 2 3 (4)



[Advanced Search]


Powered by XOOPS 2.0 © 2001-2016 The XOOPS Project