i'm currently optimizing my rasterization code. until now i used 16-bits writes everywhere. changing non-z-buffered shading to 32-bits writes gave quite a speedup. for z-buffered shading things are more difficult. i posted below my flat shading inner loop.
32-bit alignment has been checked already.
c,z,cn,zn are all unsigned long.
dstIC & dstIZ are unsigned long*.
runZ & ZStep are fixed point.
i get a fillrate of ~8MPixel/sec with this code. my 16-bits-writes code performs exactly at the same speed. has anybody an idea how to speed up this code?
i thought about using the Intel GPP rasterization routines, but they use 32-bits z-buffer which is a lot slower as i experienced...
thanks,
DANIEL
32-bit alignment has been checked already.
c,z,cn,zn are all unsigned long.
dstIC & dstIZ are unsigned long*.
runZ & ZStep are fixed point.
- Code:
while(w--)
{
int curZ = sgl_cast_int(runZ);
c = *dstIC;
z = *dstIZ;
if(curZ < (z>>16))
{
cn = col<<16;
zn = curZ<<16;
}
else
{
cn = (c&0xffff0000);
zn = (z&0xffff0000);
}
runZ += ZStep;
curZ = sgl_cast_int(runZ);
if(curZ < (z&0xffff))
{
cn |= col;
zn |= curZ;
}
else
{
cn |= (c&0x0000ffff);
zn |= (z&0x0000ffff);
}
*(dstIC++) = cn;
*(dstIZ++) = zn;
runZ += ZStep;
}
i get a fillrate of ~8MPixel/sec with this code. my 16-bits-writes code performs exactly at the same speed. has anybody an idea how to speed up this code?
i thought about using the Intel GPP rasterization routines, but they use 32-bits z-buffer which is a lot slower as i experienced...
thanks,
DANIEL