static GLboolean i915UpdateTexUnit( GLcontext *ctx, GLuint unit )
{
   struct gl_texture_unit *texUnit = &ctx->Texture.Unit[unit];

   if (texUnit->_ReallyEnabled &&
       INTEL_CONTEXT(ctx)->intelScreen->tex.size < 2048 * 1024)
      return GL_FALSE;

   switch (texUnit->_ReallyEnabled) {
   case TEXTURE_1D_BIT:
   case TEXTURE_2D_BIT:
      return (enable_tex_2d( ctx, unit ) &&
	      enable_tex_common( ctx, unit ));
   case TEXTURE_RECT_BIT:
      return (enable_tex_rect( ctx, unit ) &&
	      enable_tex_common( ctx, unit ));
   case TEXTURE_CUBE_BIT:
      return (enable_tex_cube( ctx, unit ) &&
	      enable_tex_common( ctx, unit ));
   case TEXTURE_3D_BIT:
       return (enable_tex_2d( ctx, unit ) && 
	       enable_tex_common( ctx, unit ) &&
	       enable_tex_3d( ctx, unit)); 
   case 0:
      return disable_tex( ctx, unit );
   default:
      return GL_FALSE;
   }
}
/**
 * Update hardware state for a texture unit.
 *
 * \todo
 * 1D textures should be supported!  Just use a 2D texture with the second
 * texture coordinate value fixed at 0.0.
 */
static void i810UpdateTexUnit( struct gl_context *ctx, GLuint unit, 
			      int * next_color_stage, int * next_alpha_stage )
{
   i810ContextPtr imesa = I810_CONTEXT(ctx);
   struct gl_texture_unit *texUnit = &ctx->Texture.Unit[unit];
   GLboolean ret;
   
   switch(texUnit->_ReallyEnabled) {
   case TEXTURE_2D_BIT:
     ret = enable_tex_common( ctx, unit);
     ret &= enable_tex_2d(ctx, unit);
     if (ret == GL_FALSE) {
       FALLBACK( imesa, I810_FALLBACK_TEXTURE, GL_TRUE );
     }
     break;
   case TEXTURE_RECT_BIT:
     ret = enable_tex_common( ctx, unit);
     ret &= enable_tex_rect(ctx, unit);
     if (ret == GL_FALSE) {
       FALLBACK( imesa, I810_FALLBACK_TEXTURE, GL_TRUE );
     }
     break;
   case 0:
     disable_tex(ctx, unit);
     break;
   }


   if (!i810UpdateTexEnvCombine( ctx, unit, 
				 next_color_stage, next_alpha_stage )) {
     FALLBACK( imesa, I810_FALLBACK_TEXTURE, GL_TRUE );
   }

   return;
}
Exemple #3
0
static GLboolean updateTextureUnit( GLcontext *ctx, int unit )
{
   r128ContextPtr rmesa = R128_CONTEXT(ctx);
   const int source = rmesa->tmu_source[unit];
   const struct gl_texture_unit *texUnit = &ctx->Texture.Unit[source];


   if (texUnit->_ReallyEnabled & (TEXTURE_1D_BIT | TEXTURE_2D_BIT)) {
      return (enable_tex_2d( ctx, unit ) &&
	      update_tex_common( ctx, unit ));
   }
   else if ( texUnit->_ReallyEnabled ) {
      return GL_FALSE;
   }
   else {
      disable_tex( ctx, unit );
      return GL_TRUE;
   }
}
Exemple #4
0
static GLboolean r200UpdateTextureUnit( GLcontext *ctx, int unit )
{
   struct gl_texture_unit *texUnit = &ctx->Texture.Unit[unit];

   if ( texUnit->_ReallyEnabled & (TEXTURE0_RECT) ) {
      return (enable_tex_rect( ctx, unit ) &&
	      update_tex_common( ctx, unit ));
   }
   else if ( texUnit->_ReallyEnabled & (TEXTURE0_1D|TEXTURE0_2D) ) {
      return (enable_tex_2d( ctx, unit ) &&
	      update_tex_common( ctx, unit ));
   }
   else if ( texUnit->_ReallyEnabled ) {
      return GL_FALSE;
   }
   else {
      disable_tex( ctx, unit );
      return GL_TRUE;
   }
}