~ubuntu-branches/ubuntu/quantal/mesa/quantal

« back to all changes in this revision

Viewing changes to src/mesa/drivers/dri/r200/r200_tex.c

  • Committer: Bazaar Package Importer
  • Author(s): Sebastien Bacher
  • Date: 2007-02-21 12:44:07 UTC
  • mfrom: (1.2.1 upstream)
  • mto: This revision was merged to the branch mainline in revision 22.
  • Revision ID: james.westby@ubuntu.com-20070221124407-rgcacs32mycrtadl
ImportĀ upstreamĀ versionĀ 6.5.2

Show diffs side-by-side

added added

removed removed

Lines of Context:
115
115
      t->pp_txfilter |= R200_CLAMP_T_CLAMP_LAST;
116
116
      break;
117
117
   case GL_CLAMP_TO_BORDER:
118
 
      t->pp_txfilter |= R200_CLAMP_T_CLAMP_GL | R200_BORDER_MODE_D3D;
 
118
      t->pp_txfilter |= R200_CLAMP_T_CLAMP_GL;
119
119
      is_clamp_to_border = GL_TRUE;
120
120
      break;
121
121
   case GL_MIRRORED_REPEAT:
305
305
   return t;
306
306
}
307
307
 
 
308
/* try to find a format which will only need a memcopy */
 
309
static const struct gl_texture_format *
 
310
r200Choose8888TexFormat( GLenum srcFormat, GLenum srcType )
 
311
{
 
312
   const GLuint ui = 1;
 
313
   const GLubyte littleEndian = *((const GLubyte *) &ui);
 
314
 
 
315
   if ((srcFormat == GL_RGBA && srcType == GL_UNSIGNED_INT_8_8_8_8) ||
 
316
       (srcFormat == GL_RGBA && srcType == GL_UNSIGNED_BYTE && !littleEndian) ||
 
317
       (srcFormat == GL_ABGR_EXT && srcType == GL_UNSIGNED_INT_8_8_8_8_REV) ||
 
318
       (srcFormat == GL_ABGR_EXT && srcType == GL_UNSIGNED_BYTE && littleEndian)) {
 
319
      return &_mesa_texformat_rgba8888;
 
320
   }
 
321
   else if ((srcFormat == GL_RGBA && srcType == GL_UNSIGNED_INT_8_8_8_8_REV) ||
 
322
       (srcFormat == GL_RGBA && srcType == GL_UNSIGNED_BYTE && littleEndian) ||
 
323
       (srcFormat == GL_ABGR_EXT && srcType == GL_UNSIGNED_INT_8_8_8_8) ||
 
324
       (srcFormat == GL_ABGR_EXT && srcType == GL_UNSIGNED_BYTE && !littleEndian)) {
 
325
      return &_mesa_texformat_rgba8888_rev;
 
326
   }
 
327
   else return _dri_texformat_argb8888;
 
328
}
308
329
 
309
330
static const struct gl_texture_format *
310
331
r200ChooseTextureFormat( GLcontext *ctx, GLint internalFormat,
332
353
      case GL_UNSIGNED_SHORT_1_5_5_5_REV:
333
354
         return _dri_texformat_argb1555;
334
355
      default:
335
 
         return do32bpt ? _dri_texformat_rgba8888 : _dri_texformat_argb4444;
 
356
         return do32bpt ?
 
357
            r200Choose8888TexFormat(format, type) : _dri_texformat_argb4444;
336
358
      }
337
359
 
338
360
   case 3:
349
371
      case GL_UNSIGNED_SHORT_5_6_5_REV:
350
372
         return _dri_texformat_rgb565;
351
373
      default:
352
 
         return do32bpt ? _dri_texformat_rgba8888 : _dri_texformat_rgb565;
 
374
         return do32bpt ? _dri_texformat_argb8888 : _dri_texformat_rgb565;
353
375
      }
354
376
 
355
377
   case GL_RGBA8:
357
379
   case GL_RGBA12:
358
380
   case GL_RGBA16:
359
381
      return !force16bpt ?
360
 
          _dri_texformat_rgba8888 : _dri_texformat_argb4444;
 
382
          r200Choose8888TexFormat(format, type) : _dri_texformat_argb4444;
361
383
 
362
384
   case GL_RGBA4:
363
385
   case GL_RGBA2:
370
392
   case GL_RGB10:
371
393
   case GL_RGB12:
372
394
   case GL_RGB16:
373
 
      return !force16bpt ? _dri_texformat_rgba8888 : _dri_texformat_rgb565;
 
395
      return !force16bpt ? _dri_texformat_argb8888 : _dri_texformat_rgb565;
374
396
 
375
397
   case GL_RGB5:
376
398
   case GL_RGB4:
383
405
   case GL_ALPHA12:
384
406
   case GL_ALPHA16:
385
407
   case GL_COMPRESSED_ALPHA:
386
 
      return _dri_texformat_a8;
 
408
   /* can't use a8 format since interpreting hw I8 as a8 would result
 
409
      in wrong rgb values (same as alpha value instead of 0). */
 
410
      return _dri_texformat_al88;
387
411
 
388
412
   case 1:
389
413
   case GL_LUMINANCE:
983
1007
      }
984
1008
      break;
985
1009
   }
986
 
 
 
1010
   case GL_COORD_REPLACE_ARB:
 
1011
      if (ctx->Point.PointSprite) {
 
1012
         R200_STATECHANGE( rmesa, spr );
 
1013
         if ((GLenum)param[0]) {
 
1014
            rmesa->hw.spr.cmd[SPR_POINT_SPRITE_CNTL] |= R200_PS_GEN_TEX_0 << unit;
 
1015
         } else {
 
1016
            rmesa->hw.spr.cmd[SPR_POINT_SPRITE_CNTL] &= ~(R200_PS_GEN_TEX_0 << unit);
 
1017
         }
 
1018
      }
 
1019
      break;
987
1020
   default:
988
1021
      return;
989
1022
   }