On Mon, 3 Apr 2000, Kevin Day wrote:

> Also, two performance enhancements that sped our code up by approximately 30%:
> 
> @@ -631,9 +660,14 @@
>              GLuint i, n, *ptr4;
>              n = osmesa->rowlength * osmesa->height;
>              ptr4 = (GLuint *) osmesa->buffer;
> -            for (i=0;i<n;i++) {
> -               *ptr4++ = osmesa->clearpixel;
> -            }
> +            if (osmesa->clearpixel) {
> +                   for (i=0;i<n;i++) {
> +                      *ptr4++ = osmesa->clearpixel;
> +                   }
> +            }
> +            else {
> +                   bzero(ptr4, n * sizeof(GLuint));
> +            }
>           }
>           else {
>              /* Clear part of RGBA buffer */
 
I bet memset is faster than that 'for' loop.  If so, then it might
be worth testing to see if the three bytes of the clear colour
are identical (ie a shade of grey) and calling memset in that case.
I guess that would speed up the fairly common case of a white
background...at any event, it wouldn't hurt.

Somewhere, someone should be collecting notes on these
conditional optimisations.

eg:

  "In software Mesa, you can dramatically speed up screen clear
   by clearing to black - or (to a lesser extent) to white or
   a shade of grey."

These notes would be of inestimable value to us poor developers
since it's hard to guess otherwise why your program might (for
example) run faster when it's nighttime in the virtual world
(because the 'sky' (and hence the clear colour) is black).

Steve Baker                      (817)619-2657 (Vox/Vox-Mail)
L3Com/Link Simulation & Training (817)619-2466 (Fax)
Work: [EMAIL PROTECTED]            http://www.hti.com
Home: [EMAIL PROTECTED]       http://web2.airmail.net/sjbaker1



_______________________________________________
Mesa-bug maillist  -  [EMAIL PROTECTED]
http://lists.mesa3d.org/mailman/listinfo/mesa-bug


_______________________________________________
Mesa-dev maillist  -  [EMAIL PROTECTED]
http://lists.mesa3d.org/mailman/listinfo/mesa-dev

Reply via email to