Ejemplo n.º 1
0
/**
 * Make sure we have texture image data for all the textures we may need
 * for subsequent rendering.
 */
static void
_swrast_validate_texture_images(GLcontext *ctx)
{
   SWcontext *swrast = SWRAST_CONTEXT(ctx);
   GLuint u;

   if (!swrast->ValidateTextureImage || !ctx->Texture._EnabledUnits) {
      /* no textures enabled, or no way to validate images! */
      return;
   }

   for (u = 0; u < ctx->Const.MaxTextureImageUnits; u++) {
      if (ctx->Texture.Unit[u]._ReallyEnabled) {
         struct gl_texture_object *texObj = ctx->Texture.Unit[u]._Current;
         ASSERT(texObj);
         if (texObj) {
            GLuint numFaces = (texObj->Target == GL_TEXTURE_CUBE_MAP) ? 6 : 1;
            GLuint face;
            for (face = 0; face < numFaces; face++) {
               GLint lvl;
               for (lvl = texObj->BaseLevel; lvl <= texObj->_MaxLevel; lvl++) {
                  struct gl_texture_image *texImg = texObj->Image[face][lvl];
                  if (texImg && !texImg->Data) {
                     swrast->ValidateTextureImage(ctx, texObj, face, lvl);
                     ASSERT(texObj->Image[face][lvl]->Data);
                  }
               }
            }
         }
      }
   }
}