|
|
Atari demoscene BBS
Doom floor texturing |
Posted by: dml
|
Jan,21.2013-18:47
|
[code query alert]
I have a second, possibly final broad request for advice, for the aid of Doom on Atari F030. While I love to do this stuff myself, it's probably better that I involve as many cool people as I can - I don't always come up with the best solution despite trying.
Long ago I came up with this sequence for texture UV step+index generation in the floor/ceiling renderer (030 code). It's assumed to be i-cached pretty much always. The texture is always 64x64 (making them much bigger costs a lot of RAM so while I looked at it briefly, it's not appealing to inflate all the textures for a small gain, and may hurt the d-cache which is also relied on to a degree, but I'm not ruling it out if a big enough gain is on the table).
; move.l d3,d0 ; 2
; move.w d1,d0 ; 2
; lsr.l #6,d0 ; 4
; lsr.w #4,d0 ; 4
; add.l d7,d3 ; 2
; add.w d4,d1 ; 2 (16)
The u/v and du/dv are stored in d1/d3 in this format (CAPS = integer/texture indexing part, lowercase = fraction)
; 00000000:00VVVVVV:vvvvvvvv:vvvvvvvv
; 00000000:00000000:UUUUUUuu:uuuuuuuu
The final u:v indexing value (after the code above) is:
; xxxxxxxx:xxxxxxxx:0000VVVV:VVUUUUUU
...another 'theoretical' variant I came up with looks a bit like this, using cascading carry (X) flags for u/v, with the integers already in position for masking together in the low words:
; and.w mu,u ; 2
; move.w v,t ; 2
; and.w vu,t ; 2
; or.w u,t ; 2
; addx.l uu,u ; 2
; addx.l vv,v ; 2 (12)
The u/v and du/dv are stored in this format:
; vvvvvvvv:vvvvvvvv:00000000:00UUUUUU u
; uuuuuuuu:uuuuuuuu:0000VVVV:VVvvvvvv v
...and the initial carry needs kicked off before the first pixel. I didn't get this one to work for some reason but I did it in a bit of a hurry between jobs and didn't spend long diagnosing it so could have been a simple coding mistake or it might be flawed. The setup time for this one is MUCH bigger than the old method with shifts, because the fields need swapped,eor'd and shifted to get stuff into position - makes the code bigger and affects cache hits in the outer drawing loop a bit. i.e. short runs are not faster.
So... after digesting the long code spam above, can anyone think of any nifty advice for improving on this method on an 030? It's the sort of thing that might have been solved in demos in the past or there might be a near match for it. Let me know if you come up with something so I can make this Atari Doom engine a bit faster :)
Notes:
I looked briefly at indexing 2 tex positions at once, using a single address generation step, preserving the fraction and indexing twice off the same fraction with an index baked before the drawing loop. It's a bit of a nightmare to do though and still save instructions. If you drop the fraction while indexing the 2nd texture offset the result looks pretty horrible.
The wall renderer is much simpler since du is always 0 by implication. A single addx cascading carry has the integer v always ready to index the texture, and u/v are exchanged - texture is rotated - to help the d-cache with v indexing. It might be possible to improve this too but much less likely unless the whole approach is changed in some way. I now plan to store 2 versions of the floor tex, in order to pick the right one for du/dv to keep the d-cache happy more often.
[/rant]
|
[All messages in this thread] [Start new thread]
Topic
|
Posted by
|
Date
|
Doom floor texturing
|
dml
|
Jan,21.2013-18:47
|
Re: Doom floor texturing
|
dml
|
Jan,21.2013-18:48
|
Re: Doom floor texturing
|
dml
|
Jan,21.2013-21:33
|
Re: Doom floor texturing
|
Defjam
|
Jan,21.2013-21:44
|
Re: Doom floor texturing
|
dml
|
Jan,21.2013-22:38
|
Re: Doom floor texturing
|
dml
|
Jan,22.2013-10:48
|
Re: Doom floor texturing
|
mikro
|
Jan,22.2013-11:03
|
Re: Doom floor texturing
|
dml
|
Jan,22.2013-11:43
|
Re: Doom floor texturing
|
mikro
|
Jan,22.2013-13:30
|
Re: Doom floor texturing
|
mikro
|
Jan,22.2013-13:36
|
Re: Doom floor texturing
|
mikro
|
Jan,22.2013-13:37
|
Re: Doom floor texturing
|
dml
|
Jan,22.2013-15:18
|
Re: Doom floor texturing
|
mikro
|
Jan,22.2013-16:22
|
Re: Doom floor texturing
|
dml
|
Jan,23.2013-00:55
|
Re: Doom floor texturing
|
mikro
|
Jan,23.2013-10:12
|
Re: Doom floor texturing
|
dml
|
Jan,23.2013-13:00
|
Re: Doom floor texturing
|
Calimero
|
Jan,24.2013-03:14
|
Re: Doom floor texturing
|
ggn
|
Jan,22.2013-16:41
|
Re: Doom floor texturing
|
ggn
|
Jan,22.2013-16:42
|
Re: Doom floor texturing
|
dml
|
Jan,23.2013-01:07
|
Re: Doom floor texturing
|
dml
|
Feb,03.2013-20:23
|
Re: Doom floor texturing
|
mikro
|
Feb,03.2013-22:07
|
Re: Doom floor texturing
|
dml
|
Jan,23.2013-18:01
|
Re: Doom floor texturing
|
mikro
|
Jan,23.2013-23:39
|
What's the anti-troll code? That's your personal code to be able to add comments and messages on the dhs.nu site.
Don't have a code or forgot it? Fix it here.
|
|
|