[Mesa-dev] [PATCH 2/3] mesa: move gl_texture_image::Width/Height/DepthScale fields to swrast

Eric Anholt eric at anholt.net
Thu Sep 22 14:13:59 PDT 2011


On Wed, 21 Sep 2011 18:56:53 -0600, Brian Paul <brian.e.paul at gmail.com> wrote:
> From: Brian Paul <brianp at vmware.com>
> 
> These fields were only used for swrast so move them into
> swrast_texture_image.
> diff --git a/src/mesa/swrast/s_texture.c b/src/mesa/swrast/s_texture.c
> index 14ee0eb..1dcb08c 100644
> --- a/src/mesa/swrast/s_texture.c
> +++ b/src/mesa/swrast/s_texture.c
> @@ -85,6 +85,19 @@ _swrast_alloc_texture_image_buffer(struct gl_context *ctx,
>     else
>        swImg->_IsPowerOfTwo = GL_FALSE;
>  
> +   /* Compute Width/Height/DepthScale for mipmap lod computation */
> +   if (texImage->TexObject->Target == GL_TEXTURE_RECTANGLE_NV) {
> +      /* scale = 1.0 since texture coords directly map to texels */
> +      swImg->WidthScale = 1.0;
> +      swImg->HeightScale = 1.0;
> +      swImg->DepthScale = 1.0;
> +   }
> +   else {
> +      swImg->WidthScale = (GLfloat) texImage->Width;
> +      swImg->HeightScale = (GLfloat) texImage->Height;
> +      swImg->DepthScale = (GLfloat) texImage->Depth;
> +   }
> +
>     return texImage->Data != NULL;
>  }

So, what I've been confused about with these patches is: what guarantees
that this has been called on a hardware driver that might sometimes fall
back to software?  Several paths use AllocTextureImageBuffer, but
notably TexImage2D doesn't.

On the other hand, unless I just failed at testing, I couldn't detect
any regressions, even with no_rast=true.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/mesa-dev/attachments/20110922/bac2aad1/attachment.pgp>


More information about the mesa-dev mailing list