This site is no longer active and is available for archival purposes only. Registration and login is disabled.

Polygon Drawing Algorithm


fixdiv

Postby PDAFantast » Jan 30, 2002 @ 6:53am

PDAFantast.
PDAFantast
pm Member
 
Posts: 244
Joined: Jun 27, 2001 @ 4:00pm
Location: Malmö, Sweden


Postby Digby » Jan 30, 2002 @ 8:16am

Digby
pm Insider
 
Posts: 1011
Joined: Apr 29, 2001 @ 1:53pm


Postby Phantom » Jan 30, 2002 @ 9:08am

Give me some good data and
I will give you the world
User avatar
Phantom
pm Insider
 
Posts: 913
Joined: Feb 21, 2001 @ 8:14am
Location: Houten, Netherlands


Postby simonjacobs » Jan 30, 2002 @ 12:01pm

You could use a lookup table for divides :)
User avatar
simonjacobs
pm Insider
 
Posts: 311
Joined: Nov 27, 2001 @ 4:51pm
Location: London, UK


Postby Phantom » Jan 30, 2002 @ 4:29pm

Ehm yes, I always do that on my PC, but on the iPaq, a lookup table for all 32bit numbers is slightly too large. ;)
Give me some good data and
I will give you the world
User avatar
Phantom
pm Insider
 
Posts: 913
Joined: Feb 21, 2001 @ 8:14am
Location: Houten, Netherlands


Postby simonjacobs » Jan 30, 2002 @ 4:38pm

I use a table for divides up to 256, I get a lot of them in my rendering code.

I also wonder if you can use a 256-entry lookup table to simulate a full 16.16 / 16.16 operation.

1/(a+b) = 1/[a(1+b/a)] = 1/a * 1/(1+b/a)

Say you are dividing by 534 = 256*2 + 22 and set a=22. Then you have:

x/534 = x/22 + x/(1+512/22)

or something. That might be rubbish, but it might work :)

I'm sure you should be able to get really fast 16.16 division with just a 256 entry lookup table and multiplications.
User avatar
simonjacobs
pm Insider
 
Posts: 311
Joined: Nov 27, 2001 @ 4:51pm
Location: London, UK


Postby PDAFantast » Jan 30, 2002 @ 9:49pm

PDAFantast.
PDAFantast
pm Member
 
Posts: 244
Joined: Jun 27, 2001 @ 4:00pm
Location: Malmö, Sweden


fixdiv and fixmul.

Postby PDAFantast » Jan 30, 2002 @ 10:40pm

PDAFantast.
PDAFantast
pm Member
 
Posts: 244
Joined: Jun 27, 2001 @ 4:00pm
Location: Malmö, Sweden


Postby Digby » Jan 31, 2002 @ 12:00am

Oh I completely agree if you are working only in screen space you don't need to perform the divide along the edge.

You do have to do this if you are having to move from screen space to camera space and that is what I was referring to in my original post about caching the edge values so you don't have to do the divide twice.

Since I've had time to think about it, it's not the perf-win that I had originally imagined because the rasterizer doesn't draw the same pixel twice along abutting edges. The top-left fill convention guarantees that the right edge won't be drawn twice, hence there's not much being computed for one triangle that can be cached. I need to think about it some more before I write this off, but it's looking that way for now.
Digby
pm Insider
 
Posts: 1011
Joined: Apr 29, 2001 @ 1:53pm


Postby PDAFantast » Jan 31, 2002 @ 2:24am

PDAFantast.
PDAFantast
pm Member
 
Posts: 244
Joined: Jun 27, 2001 @ 4:00pm
Location: Malmö, Sweden


Postby refractor » Feb 1, 2002 @ 2:22pm

refractor
 


Postby Digby » Feb 1, 2002 @ 5:45pm

Digby
pm Insider
 
Posts: 1011
Joined: Apr 29, 2001 @ 1:53pm


Postby PDAFantast » Feb 1, 2002 @ 10:00pm

Cool stuff Refractor...

I liked the rsbmi replacement a lot, why haven't I thought of that one... :roll:

Unfortunately on GBA r12 is not temporary and I can't use it. And it's called both from Thumb and ARM assembly code.


Digby,
I think, you're not saving a a cycle at all, :( since you got
to save lr on stack to be able to pop it up on exit, so the memory write/reads takes out the gain in exterminating mov pc,lr.

I might be wrong, but the ARM7TDMI fetching timing of the GBA won't give you this advantage.
PDAFantast.
PDAFantast
pm Member
 
Posts: 244
Joined: Jun 27, 2001 @ 4:00pm
Location: Malmö, Sweden


Postby Digby » Feb 1, 2002 @ 11:34pm

Digby
pm Insider
 
Posts: 1011
Joined: Apr 29, 2001 @ 1:53pm


Previous

Return to Windows Mobile


Sort


Forum Description

A discussion forum for mobile device developers on the Windows Mobile platform. Any platform specific topics are welcome.

Moderators:

Dan East, sponge, Digby, David Horn, Kevin Gelso, RICoder

Forum permissions

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum