PocketMatrix forums

A read-only archive of the PocketMatrix forums (2001–2014). Posting and accounts are closed.

Texturemapping in ARM assembler

I'm looking for one simple function, a texture mapping function that maps a texture onto the screen.
Input for function : (x,y,u,v) values for each point of the triangle, and a pointer to the texture (which can be fixed size, 128x128 or something), and a pointer to the rendering buffer.

Can someone help me with this ?

Is it realy worth it to use a assembler function instead of a C one ?

I don't want to spend money on PocketGL just to get the source of one function.

Thanks.
You could try using the Intel Graphics Performance Primitives.

See this thread.

Dan East
I'd say pocketGL wouldn't really help you - the textured triagle draw implementation is in C, and is pretty much the same as any other efficient texture mapper out there. OK it's a reasonable amount of code, but it's not that complex - a good GX book or website should be able to help you.
Additionally, PocketGL has an unusal but clever optimisation for its z buffer which would probably get in your way.
Intel GPP looks like it uses scanline functions, which is not that i'm looking for. I can make use of the scanline functions, but don't think it will give me that much speed increase.

I know exactly how to do texture mapping, and have a C routine working. But want to know if ARM assembler is going to boost the speed or not.

How much triangles ( Plainly texture mapped, no perspective correction, no Zbuffer ) should I try for in a second ?
Lets say the size of a triangle is about 70 x 70
pixels on the screen.

1000 ? 5000 ? 10000 ?
jcronje wrote:
Intel GPP looks like it uses scanline functions, which is not that i'm looking for. I can make use of the scanline functions, but don't think it will give me that much speed increase.

I know exactly how to do texture mapping, and have a C routine working. But want to know if ARM assembler is going to boost the speed or not.

How much triangles ( Plainly texture mapped, no perspective correction, no Zbuffer ) should I try for in a second ?
Lets say the size of a triangle is about 70 x 70
pixels on the screen.

1000 ? 5000 ? 10000 ?


With an all-C system I had a 2000poly model, and a low-poly skydome rotating at around 20fps. No lighting, affine mapping, bucket-sorting, back-face culling and per-span clipping. The skydome covered the screen, and the high-model only covered about 25% of pixels

(that was on an iPaq 3870, 200Mhz StrongARM)

One of the best optimizations on an ARM CPU is to eliminate divides by using a reciprocal table. Another useful optimization is to render quads, not just triangles , as you'll probably find the rasterizer outer loop and clipping tests is taking almost as much time as the inner loops (span filling/texturing) (especially when you've got lots of small-ish polys)

My approach was to completely separate the rasterizing and span filling - rasterize one poly to a 'span table', and then call a function to fill the spans in the table. This makes the code nicer when you've got multiple inner loops (with/without transparency, different texure widths, etc)

At some point I'll put at least my span filling code in ARM and release some sort of game/demo with it... but I'm working on a 2D game at the moment
Yep, quads really help eliminate the setup overhead. If you know your models, then try and shoot for more than just quads. One of the nice features of a 'two pass' rendering system, ie; building a span list and the rendering the list, is that you can combine multiple small tris. I got the last little bit of speed I needed for our game by adding logic to the span list builder that allowed the span rendering function to do more work.
wher do you get all this info from