sezero / uhexen2

Hexen II: Hammer of Thyrion -- A cross-platform port of Hexen II game.
https://sourceforge.net/projects/uhexen2/
76 stars 14 forks source link

amiga: 68k optimized alias functions #44

Closed BSzili closed 2 years ago

BSzili commented 2 years ago

Added R_Alias_clip_left, R_Alias_clip_right, R_Alias_clip_top and R_Alias_clip_bottom asm implementations. R_Alias_clip_left and R_Alias_clip_top has a small issue where they clip most polygons 1 pixel too early, leaving a seam at the edge of the screen. It's not very noticeable except with large models. The Quake port I use as a base has the same issue, but it's even less noticeable due to everything being brown. There's probably a rounding error somewhere, but I couldn't see any obvious problems. I'll look into it later. I also ported over R_AliasTransformVector and R_AliasTransformFinalVert that have slightly better implementation than the compiler output.

sezero commented 2 years ago

This is in. I applied two follow-up patches to it.

sezero commented 1 year ago

@BSzili: I noticed this attached patch in tyrquake, will apply soon: patch.txt It touches the C-only versions and not the x86-asm versions.

If you based your m68k asm on the C-only routines, you may need to revise?

BSzili commented 1 year ago

Yes, a quick fix for 68k version should be something like this:

--- r_aclip68k-old.s    2022-04-15 22:01:12.419783500 +0200
+++ r_aclip68k.s        2023-09-14 17:48:53.283761200 +0200
@@ -59,7 +59,7 @@
                move.l  (a1)+,d0
                move.l  (a1)+,d1
                move.l  REFDEF_ALIASVRECT+VRECT_X(a3),d4
-               cmp.l   d1,d3
+               cmp.l   d0,d2
                blt.b   .cont
                sub.l   d2,d4
                fmove.l d4,fp0
@@ -156,7 +156,7 @@
                move.l  (a1)+,d0
                move.l  (a1)+,d1
                move.l  REFDEF_ALIASVRECTRIGHT(a3),d4
-               cmp.l   d1,d3
+               cmp.l   d0,d2
                blt.b   .cont
                sub.l   d2,d4
                fmove.l d4,fp0
sezero commented 1 year ago

OK, will apply shortly along with the C-only version. Thanks!

sezero commented 1 year ago

Patch is in, along with other things.