-
Notifications
You must be signed in to change notification settings - Fork 20
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Big Endian PPC 32 bit ( client side - MORPHOS platform ) #332
Comments
See #332 where the lump's offset and length are incorrect on big-endian architectures
… already swapped by R_SwapTerraPatch See #332
Nice. Besides some little issue I posted for the commits, a fix is needed for UnpackTerraPack calling ShaderForShaderNum (as I mentioned ). Don't know if you're on it. The "cheat" parameters don't show anything except showstaticbboxes that works. |
The BSP terra patch is swapped accordingly before being processed: https://github.com/openmoh/openmohaa/blob/main/code/renderer/tr_terrain.c#L1423 |
I know but pPacket->iShader is swapped again in ShaderForShaderNum and crashes. |
In tr_bsp.c/ParseMesh ds->subdivisions needs endian conversion. If not, some maps crawl, render (more) badly and crash. Adding this seems correct:
The problems regarding staticmodels on big-endian, at least on my system, aren't only with them but other models too (non static). I see a lot of culling failures on maps other than "basic training". A detail/clue: |
Good to have new debug options: infoworldtris shows this in "basic training":
Compared to an ouput linux version, a whole bunch of models aren't displayed or have wrong tris number ( see vehicle_gmctruck for example ). |
Hi Is this issue also exists in OpenMoHAA on Linux PowerPC? |
@gbudny No idea about Linux/PPC. I should wrote "Linux LittleEndian/64bit" version vs "Morphos BigEndian/32bit" output. |
So far I managed to make the client side work for ppc 32 and that could help other ports. Still some issues.
First of all R_LoadLump (tr_bsp.c) crashes when called.
My "fix" is right at the beginning of the function:
Next stop/crash is R_LoadTerrain that calls R_UnpackTerraPatch:
UnpackTerraPatch calls ShaderForShaderNum with those parameters.
pUnpacked->shader = ShaderForShaderNum(LittleShort(pPacked->iShader), LittleShort(pPacked->iLightMap));
But ShaderForShaderNum already has endian applied for first parameter -> shaderNum = LittleLong( shaderNum ); .
A possible fix is a ShaderForShaderNum function without LittleLong code and change all functions in tr_bsp.c that calls it with the proper parameters with endian applied.
Note: Actually UnpackTerraPatch "should" call ShaderForShaderNum that way:
pUnpacked->shader = ShaderForShaderNum(LittleUnsignedShort(pPacked->iShader), LittleUnsignedShort(pPacked->iLightMap)); // fix ? Cowcat
Now the issue:
Static models (tents, vegetation, etc ) that aren't displayed on screen: Don't know if R_CopyStaticModel ( called by R_LoadStaticModelDefs ) does its job. Values seem to be correct while endianness is done. If you remove whatever value there it gets the same effect in a X86 binary.
2nd Note: It is weird that UnPackTerraPatch has endianness applied while R_SwapTerraPatch ( all in R_LoadTerrain ) already does it. I have changed UnPackTerraPatch to not do endian code there. Still no staticmodels on display.
The text was updated successfully, but these errors were encountered: