Kevin Day wrote:
> 
> In osmesa.c:
> 
> --- osmesa.c       Mon Apr  3 05:47:32 2000
> +++ osmesa.c    Mon Apr  3 05:46:29 2000
> @@ -252,6 +252,7 @@
>                                              indexBits,
>                                              8, 8, 8, alphaBits );
>        if (!osmesa->gl_visual) {
> +         FREE(osmesa);
>           return NULL;
>        }
> 
> 
> 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 */
> 
> --- depth.c.old Mon Apr  3 05:50:21 2000
> +++ depth.c     Mon Apr  3 05:11:32 2000
> @@ -861,9 +861,14 @@
>     else {
>        /* clear whole buffer */
>        if (sizeof(GLdepth)==2 && (clear_value&0xff)==(clear_value>>8)) {
> +         if (clear_value == 0) {
> +                bzero( ctx->Buffer->Depth, 
>2*ctx->Buffer->Width*ctx->Buffer->Height);
> +         }
> +         else {
>           /* lower and upper bytes of clear_value are same, use MEMSET */
> -         MEMSET( ctx->Buffer->Depth, clear_value&0xff,
> -                 2*ctx->Buffer->Width*ctx->Buffer->Height);
> +                MEMSET( ctx->Buffer->Depth, clear_value&0xff,
> +                        2*ctx->Buffer->Width*ctx->Buffer->Height);
> +         }
>        }
>        else {
>           GLdepth *d = ctx->Buffer->Depth;
> 
> I'm not sure what the rules are for using bzero, something may probably have
> to be added to configure to support/not support this. (bzero is much faster
> than memset on freebsd)
> 
> Please let me know if you have any comments or suggestions.

I'm not 100% sure bzero() is as common as memset().  So, I'm adding
a BZERO() macro which evaluates to bzero() on FreeBSD but evaluates
to memset() on everything else.

Thanks for the patches, I'll apply them soon to Mesa 3.2 and 3.3.

-Brian


_______________________________________________
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