st_gen_mipmap.h File Reference

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

void st_init_generate_mipmap (struct st_context *st)
 one-time init for generate mipmap XXX Note: there may be other times we need no-op/simple state like this.
void st_destroy_generate_mipmap (struct st_context *st)
void st_generate_mipmap (GLcontext *ctx, GLenum target, struct gl_texture_object *texObj)


Function Documentation

void st_destroy_generate_mipmap ( struct st_context st  ) 

Definition at line 65 of file st_gen_mipmap.c.

References st_context::gen_mipmap, and util_destroy_gen_mipmap().

00066 {
00067    util_destroy_gen_mipmap(st->gen_mipmap);
00068    st->gen_mipmap = NULL;
00069 }

void st_generate_mipmap ( GLcontext *  ctx,
GLenum  target,
struct gl_texture_object *  texObj 
)

Definition at line 157 of file st_gen_mipmap.c.

References pipe_texture::depth, fallback_generate_mipmap(), pipe_texture::height, pipe_texture::last_level, pipe_texture_reference(), st_texture_image::pt, st_get_texobj_texture(), st_render_mipmap(), and pipe_texture::width.

00159 {
00160    struct st_context *st = ctx->st;
00161    struct pipe_texture *pt = st_get_texobj_texture(texObj);
00162    const uint baseLevel = texObj->BaseLevel;
00163    const uint lastLevel = pt->last_level;
00164    uint dstLevel;
00165 
00166    if (!st_render_mipmap(st, target, pt, baseLevel, lastLevel)) {
00167       fallback_generate_mipmap(ctx, target, texObj);
00168    }
00169 
00170    /* Fill in the Mesa gl_texture_image fields */
00171    for (dstLevel = baseLevel + 1; dstLevel <= lastLevel; dstLevel++) {
00172       const uint srcLevel = dstLevel - 1;
00173       const struct gl_texture_image *srcImage
00174          = _mesa_get_tex_image(ctx, texObj, target, srcLevel);
00175       struct gl_texture_image *dstImage;
00176       struct st_texture_image *stImage;
00177       uint dstWidth = pt->width[dstLevel];
00178       uint dstHeight = pt->height[dstLevel];
00179       uint dstDepth = pt->depth[dstLevel];
00180       uint border = srcImage->Border;
00181 
00182       dstImage = _mesa_get_tex_image(ctx, texObj, target, dstLevel);
00183       if (!dstImage) {
00184          _mesa_error(ctx, GL_OUT_OF_MEMORY, "generating mipmaps");
00185          return;
00186       }
00187 
00188       if (dstImage->ImageOffsets)
00189          _mesa_free(dstImage->ImageOffsets);
00190 
00191       /* Free old image data */
00192       if (dstImage->Data)
00193          ctx->Driver.FreeTexImageData(ctx, dstImage);
00194 
00195       /* initialize new image */
00196       _mesa_init_teximage_fields(ctx, target, dstImage, dstWidth, dstHeight,
00197                                  dstDepth, border, srcImage->InternalFormat);
00198 
00199       dstImage->TexFormat = srcImage->TexFormat;
00200 
00201       stImage = (struct st_texture_image *) dstImage;
00202       pipe_texture_reference(&stImage->pt, pt);
00203    }
00204 }

void st_init_generate_mipmap ( struct st_context st  ) 

one-time init for generate mipmap XXX Note: there may be other times we need no-op/simple state like this.

In that case, some code refactoring would be good.

Definition at line 58 of file st_gen_mipmap.c.

References st_context::cso_context, st_context::gen_mipmap, st_context::pipe, and util_create_gen_mipmap().

00059 {
00060    st->gen_mipmap = util_create_gen_mipmap(st->pipe, st->cso_context);
00061 }


Generated on Tue Sep 29 06:25:54 2009 for Gallium3D by  doxygen 1.5.4