st_atom_texture.c File Reference

Include dependency graph for st_atom_texture.c:

Go to the source code of this file.

Functions

static void update_textures (struct st_context *st)
static void finalize_textures (struct st_context *st)

Variables

struct st_tracked_state st_update_texture
struct st_tracked_state st_finalize_textures


Function Documentation

static void finalize_textures ( struct st_context st  )  [static]

Definition at line 111 of file st_atom_texture.c.

References st_context::ctx, st_context::dirty, st_context::missing_textures, st_context::pipe, st_state_flags::st, st_finalize_texture(), ST_NEW_FRAGMENT_PROGRAM, st_texture_object(), st_texture_object::teximage_realloc, and TRUE.

00112 {
00113    struct gl_fragment_program *fprog = st->ctx->FragmentProgram._Current;
00114    const GLboolean prev_missing_textures = st->missing_textures;
00115    GLuint su;
00116 
00117    st->missing_textures = GL_FALSE;
00118 
00119    for (su = 0; su < st->ctx->Const.MaxTextureCoordUnits; su++) {
00120       if (fprog->Base.SamplersUsed & (1 << su)) {
00121          const GLuint texUnit = fprog->Base.SamplerUnits[su];
00122          struct gl_texture_object *texObj
00123             = st->ctx->Texture.Unit[texUnit]._Current;
00124          struct st_texture_object *stObj = st_texture_object(texObj);
00125 
00126          if (texObj) {
00127             GLboolean flush, retval;
00128 
00129             retval = st_finalize_texture(st->ctx, st->pipe, texObj, &flush);
00130             if (!retval) {
00131                /* out of mem */
00132                st->missing_textures = GL_TRUE;
00133                continue;
00134             }
00135 
00136             stObj->teximage_realloc = TRUE;
00137          }
00138       }
00139    }
00140 
00141    if (prev_missing_textures != st->missing_textures)
00142       st->dirty.st |= ST_NEW_FRAGMENT_PROGRAM;
00143 }

static void update_textures ( struct st_context st  )  [static]

Definition at line 45 of file st_atom_texture.c.

References st_context::cso_context, cso_set_sampler_textures(), st_context::ctx, st_context::num_textures, st_context::pipe, pipe_texture_reference(), st_context::sampler_texture, st_finalize_texture(), st_get_default_texture(), st_get_stobj_texture(), st_texture_object(), and st_context::state.

00046 {
00047    struct gl_fragment_program *fprog = st->ctx->FragmentProgram._Current;
00048    GLuint su;
00049 
00050    st->state.num_textures = 0;
00051 
00052    /*printf("%s samplers used = 0x%x\n", __FUNCTION__, fprog->Base.SamplersUsed);*/
00053 
00054    for (su = 0; su < st->ctx->Const.MaxTextureCoordUnits; su++) {
00055       struct pipe_texture *pt = NULL;
00056 
00057       if (fprog->Base.SamplersUsed & (1 << su)) {
00058          const GLuint texUnit = fprog->Base.SamplerUnits[su];
00059          struct gl_texture_object *texObj
00060             = st->ctx->Texture.Unit[texUnit]._Current;
00061          struct st_texture_object *stObj;
00062          GLboolean flush, retval;
00063 
00064          if (!texObj) {
00065             texObj = st_get_default_texture(st);
00066          }
00067          stObj = st_texture_object(texObj);
00068 
00069          retval = st_finalize_texture(st->ctx, st->pipe, texObj, &flush);
00070          if (!retval) {
00071             /* out of mem */
00072             continue;
00073          }
00074 
00075          st->state.num_textures = su + 1;
00076 
00077          pt = st_get_stobj_texture(stObj);
00078       }
00079 
00080       /*
00081       if (pt) {
00082          printf("%s su=%u non-null\n", __FUNCTION__, su);
00083       }
00084       else {
00085          printf("%s su=%u null\n", __FUNCTION__, su);
00086       }
00087       */
00088 
00089       pipe_texture_reference(&st->state.sampler_texture[su], pt);
00090    }
00091 
00092    cso_set_sampler_textures(st->cso_context,
00093                             st->state.num_textures,
00094                             st->state.sampler_texture);
00095 }


Variable Documentation

struct st_tracked_state st_finalize_textures

Initial value:

 {
   "st_finalize_textures",              
   {                                    
      _NEW_TEXTURE,                     
      0,                                
   },
   finalize_textures                    
}

Definition at line 147 of file st_atom_texture.c.

struct st_tracked_state st_update_texture

Initial value:

 {
   "st_update_texture",                                 
   {                                                    
      _NEW_TEXTURE,                                     
       0x2 ,                            
   },
   update_textures                                      
}

Definition at line 98 of file st_atom_texture.c.


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