From: Brian P. <br...@va...> - 2000-11-22 15:31:00
|
Klaus Niederkrueger wrote: > > Again I bore you with an idea to improve the software-rasterizer. This however should be relatively easy implemented (though the speed gain should only be minor, too). It is even so simple that I wonder if I'm getting something wrong: > > In 'src/swrast/s_span.c' there is e.g. the function 'gl_write_texture_span', which in turn calls first > gl_texture_pixels( ctx, 0, n, s, t, u, lambda, rgba, rgba ); > and > _mesa_fog_rgba_pixels( ctx, n, fog, rgba ); > and afterwards it does > gl_scissor_span( ctx, n, x, y, mask ) > and > _mesa_depth_test_span( ctx, n, x, y, z, mask ); > > So if one of the last two functions (there are some other like stipple, alpha etc.), decides that no pixel is visible, then nothing is drawn and a 'return' is used. > > Would changing the order of the first two functions and the rest have any negative effect? In the special case above, this would prevent the calculation of the whole texturing and fog stuff, which in the end is not drawn anyway. Between texture application and the depth test there are a few other pixel operations, namely the alpha test and stencil, which if done out of order, could cause invalid rendering. But in most cases you're right. If only depth testing and texturing are enabled, depth testing could be done first and potentially reduce the number of texture lookups, etc. > As a second step (that requires some more changes) you could also use the 'mask' array to calculate the fog and the texturing only at points that are not being masked, which could give some more speed up, when you use depth and such. > > As always, I don't have time to do the changes myself, but maybe someone wants to try it out. I don't have time to try it either. -Brian |