Subversion Repositories Kolibri OS

Rev

Rev 4358 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 4358 Rev 5063
Line 109... Line 109...
109
   util_dl_proc fetch_2d_texel_rgb_dxt1;
109
   util_dl_proc fetch_2d_texel_rgb_dxt1;
110
   util_dl_proc fetch_2d_texel_rgba_dxt1;
110
   util_dl_proc fetch_2d_texel_rgba_dxt1;
111
   util_dl_proc fetch_2d_texel_rgba_dxt3;
111
   util_dl_proc fetch_2d_texel_rgba_dxt3;
112
   util_dl_proc fetch_2d_texel_rgba_dxt5;
112
   util_dl_proc fetch_2d_texel_rgba_dxt5;
113
   util_dl_proc tx_compress_dxtn;
113
   util_dl_proc tx_compress_dxtn;
-
 
114
   char *force_s3tc_enable;
Line -... Line 115...
-
 
115
    
-
 
116
    return;
114
 
117
#if 0    
115
   if (!first_time)
118
   if (!first_time)
116
      return;
119
      return;
Line 117... Line 120...
117
   first_time = FALSE;
120
   first_time = FALSE;
118
 
121
 
Line 119... Line 122...
119
   if (util_format_s3tc_enabled)
122
   if (util_format_s3tc_enabled)
120
      return;
123
      return;
-
 
124
 
-
 
125
//   library = util_dl_open(DXTN_LIBNAME);
-
 
126
   if (!library) {
-
 
127
      if ((force_s3tc_enable = getenv("force_s3tc_enable")) &&
-
 
128
          !strcmp(force_s3tc_enable, "true")) {
-
 
129
         debug_printf("couldn't open " DXTN_LIBNAME ", enabling DXTn due to "
121
 
130
            "force_s3tc_enable=true environment variable\n");
122
   library = util_dl_open(DXTN_LIBNAME);
131
         util_format_s3tc_enabled = TRUE;
-
 
132
      } else {
123
   if (!library) {
133
         debug_printf("couldn't open " DXTN_LIBNAME ", software DXTn "
124
      debug_printf("couldn't open " DXTN_LIBNAME ", software DXTn "
134
            "compression/decompression unavailable\n");
Line 125... Line 135...
125
                   "compression/decompression unavailable\n");
135
      }
126
      return;
136
      return;
Line 153... Line 163...
153
   util_format_dxt1_rgba_fetch = (util_format_dxtn_fetch_t)fetch_2d_texel_rgba_dxt1;
163
   util_format_dxt1_rgba_fetch = (util_format_dxtn_fetch_t)fetch_2d_texel_rgba_dxt1;
154
   util_format_dxt3_rgba_fetch = (util_format_dxtn_fetch_t)fetch_2d_texel_rgba_dxt3;
164
   util_format_dxt3_rgba_fetch = (util_format_dxtn_fetch_t)fetch_2d_texel_rgba_dxt3;
155
   util_format_dxt5_rgba_fetch = (util_format_dxtn_fetch_t)fetch_2d_texel_rgba_dxt5;
165
   util_format_dxt5_rgba_fetch = (util_format_dxtn_fetch_t)fetch_2d_texel_rgba_dxt5;
156
   util_format_dxtn_pack = (util_format_dxtn_pack_t)tx_compress_dxtn;
166
   util_format_dxtn_pack = (util_format_dxtn_pack_t)tx_compress_dxtn;
157
   util_format_s3tc_enabled = TRUE;
167
   util_format_s3tc_enabled = TRUE;
-
 
168
   #endif
158
}
169
}
Line 159... Line 170...
159
 
170
 
160
 
171
 
Line 238... Line 249...
238
static INLINE void
249
static INLINE void
239
util_format_dxtn_rgb_unpack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride,
250
util_format_dxtn_rgb_unpack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride,
240
                                        const uint8_t *src_row, unsigned src_stride,
251
                                        const uint8_t *src_row, unsigned src_stride,
241
                                        unsigned width, unsigned height,
252
                                        unsigned width, unsigned height,
242
                                        util_format_dxtn_fetch_t fetch,
253
                                        util_format_dxtn_fetch_t fetch,
243
                                        unsigned block_size, boolean srgb)
254
                                        unsigned block_size)
244
{
255
{
245
   const unsigned bw = 4, bh = 4, comps = 4;
256
   const unsigned bw = 4, bh = 4, comps = 4;
246
   unsigned x, y, i, j;
257
   unsigned x, y, i, j;
247
   for(y = 0; y < height; y += bh) {
258
   for(y = 0; y < height; y += bh) {
248
      const uint8_t *src = src_row;
259
      const uint8_t *src = src_row;
249
      for(x = 0; x < width; x += bw) {
260
      for(x = 0; x < width; x += bw) {
250
         for(j = 0; j < bh; ++j) {
261
         for(j = 0; j < bh; ++j) {
251
            for(i = 0; i < bw; ++i) {
262
            for(i = 0; i < bw; ++i) {
252
               uint8_t *dst = dst_row + (y + j)*dst_stride/sizeof(*dst_row) + (x + i)*comps;
263
               uint8_t *dst = dst_row + (y + j)*dst_stride/sizeof(*dst_row) + (x + i)*comps;
253
               fetch(0, src, i, j, dst);
264
               fetch(0, src, i, j, dst);
254
               if (srgb) {
-
 
255
                  dst[0] = util_format_srgb_to_linear_8unorm(dst[0]);
-
 
256
                  dst[1] = util_format_srgb_to_linear_8unorm(dst[1]);
-
 
257
                  dst[2] = util_format_srgb_to_linear_8unorm(dst[2]);
-
 
258
               }
-
 
259
            }
265
            }
260
         }
266
         }
261
         src += block_size;
267
         src += block_size;
262
      }
268
      }
263
      src_row += src_stride;
269
      src_row += src_stride;
Line 270... Line 276...
270
                                        unsigned width, unsigned height)
276
                                        unsigned width, unsigned height)
271
{
277
{
272
   util_format_dxtn_rgb_unpack_rgba_8unorm(dst_row, dst_stride,
278
   util_format_dxtn_rgb_unpack_rgba_8unorm(dst_row, dst_stride,
273
                                           src_row, src_stride,
279
                                           src_row, src_stride,
274
                                           width, height,
280
                                           width, height,
275
                                           util_format_dxt1_rgb_fetch,
281
                                           util_format_dxt1_rgb_fetch, 8);
276
                                           8, FALSE);
-
 
277
}
282
}
Line 278... Line 283...
278
 
283
 
279
void
284
void
280
util_format_dxt1_rgba_unpack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride,
285
util_format_dxt1_rgba_unpack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride,
281
                                         const uint8_t *src_row, unsigned src_stride,
286
                                         const uint8_t *src_row, unsigned src_stride,
282
                                         unsigned width, unsigned height)
287
                                         unsigned width, unsigned height)
283
{
288
{
284
   util_format_dxtn_rgb_unpack_rgba_8unorm(dst_row, dst_stride,
289
   util_format_dxtn_rgb_unpack_rgba_8unorm(dst_row, dst_stride,
285
                                           src_row, src_stride,
290
                                           src_row, src_stride,
286
                                           width, height,
291
                                           width, height,
287
                                           util_format_dxt1_rgba_fetch,
-
 
288
                                           8, FALSE);
292
                                           util_format_dxt1_rgba_fetch, 8);
Line 289... Line 293...
289
}
293
}
290
 
294
 
291
void
295
void
292
util_format_dxt3_rgba_unpack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride,
296
util_format_dxt3_rgba_unpack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride,
293
                                         const uint8_t *src_row, unsigned src_stride,
297
                                         const uint8_t *src_row, unsigned src_stride,
294
                                         unsigned width, unsigned height)
298
                                         unsigned width, unsigned height)
295
{
299
{
296
   util_format_dxtn_rgb_unpack_rgba_8unorm(dst_row, dst_stride,
300
   util_format_dxtn_rgb_unpack_rgba_8unorm(dst_row, dst_stride,
297
                                           src_row, src_stride,
301
                                           src_row, src_stride,
298
                                           width, height,
-
 
299
                                           util_format_dxt3_rgba_fetch,
302
                                           width, height,
Line 300... Line 303...
300
                                           16, FALSE);
303
                                           util_format_dxt3_rgba_fetch, 16);
301
}
304
}
302
 
305
 
303
void
306
void
304
util_format_dxt5_rgba_unpack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride,
307
util_format_dxt5_rgba_unpack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride,
305
                                         const uint8_t *src_row, unsigned src_stride,
308
                                         const uint8_t *src_row, unsigned src_stride,
306
                                         unsigned width, unsigned height)
309
                                         unsigned width, unsigned height)
307
{
310
{
308
   util_format_dxtn_rgb_unpack_rgba_8unorm(dst_row, dst_stride,
311
   util_format_dxtn_rgb_unpack_rgba_8unorm(dst_row, dst_stride,
309
                                           src_row, src_stride,
-
 
310
                                           width, height,
312
                                           src_row, src_stride,
Line 311... Line 313...
311
                                           util_format_dxt5_rgba_fetch,
313
                                           width, height,
312
                                           16, FALSE);
314
                                           util_format_dxt5_rgba_fetch, 16);
313
}
315
}
314
 
316
 
315
static INLINE void
317
static INLINE void
316
util_format_dxtn_rgb_unpack_rgba_float(float *dst_row, unsigned dst_stride,
318
util_format_dxtn_rgb_unpack_rgba_float(float *dst_row, unsigned dst_stride,
317
                                       const uint8_t *src_row, unsigned src_stride,
319
                                       const uint8_t *src_row, unsigned src_stride,
318
                                       unsigned width, unsigned height,
320
                                       unsigned width, unsigned height,
319
                                       util_format_dxtn_fetch_t fetch,
321
                                       util_format_dxtn_fetch_t fetch,
320
                                       unsigned block_size, boolean srgb)
322
                                       unsigned block_size)
321
{
323
{
322
   unsigned x, y, i, j;
324
   unsigned x, y, i, j;
323
   for(y = 0; y < height; y += 4) {
325
   for(y = 0; y < height; y += 4) {
324
      const uint8_t *src = src_row;
326
      const uint8_t *src = src_row;
325
      for(x = 0; x < width; x += 4) {
327
      for(x = 0; x < width; x += 4) {
326
         for(j = 0; j < 4; ++j) {
328
         for(j = 0; j < 4; ++j) {
327
            for(i = 0; i < 4; ++i) {
-
 
328
               float *dst = dst_row + (y + j)*dst_stride/sizeof(*dst_row) + (x + i)*4;
-
 
329
               uint8_t tmp[4];
-
 
330
               fetch(0, src, i, j, tmp);
-
 
331
               if (srgb) {
-
 
332
                  dst[0] = util_format_srgb_8unorm_to_linear_float(tmp[0]);
-
 
333
                  dst[1] = util_format_srgb_8unorm_to_linear_float(tmp[1]);
329
            for(i = 0; i < 4; ++i) {
334
                  dst[2] = util_format_srgb_8unorm_to_linear_float(tmp[2]);
330
               float *dst = dst_row + (y + j)*dst_stride/sizeof(*dst_row) + (x + i)*4;
335
               }
331
               uint8_t tmp[4];
336
               else {
-
 
337
                  dst[0] = ubyte_to_float(tmp[0]);
332
               fetch(0, src, i, j, tmp);
338
                  dst[1] = ubyte_to_float(tmp[1]);
333
               dst[0] = ubyte_to_float(tmp[0]);
339
                  dst[2] = ubyte_to_float(tmp[2]);
334
               dst[1] = ubyte_to_float(tmp[1]);
340
               }
335
               dst[2] = ubyte_to_float(tmp[2]);
341
               dst[3] = ubyte_to_float(tmp[3]);
336
               dst[3] = ubyte_to_float(tmp[3]);
Line 353... Line 348...
353
                                       unsigned width, unsigned height)
348
                                       unsigned width, unsigned height)
354
{
349
{
355
   util_format_dxtn_rgb_unpack_rgba_float(dst_row, dst_stride,
350
   util_format_dxtn_rgb_unpack_rgba_float(dst_row, dst_stride,
356
                                          src_row, src_stride,
351
                                          src_row, src_stride,
357
                                          width, height,
352
                                          width, height,
358
                                          util_format_dxt1_rgb_fetch,
353
                                          util_format_dxt1_rgb_fetch, 8);
359
                                          8, FALSE);
-
 
360
}
354
}
Line 361... Line 355...
361
 
355
 
362
void
356
void
363
util_format_dxt1_rgba_unpack_rgba_float(float *dst_row, unsigned dst_stride,
357
util_format_dxt1_rgba_unpack_rgba_float(float *dst_row, unsigned dst_stride,
364
                                        const uint8_t *src_row, unsigned src_stride,
358
                                        const uint8_t *src_row, unsigned src_stride,
365
                                        unsigned width, unsigned height)
359
                                        unsigned width, unsigned height)
366
{
360
{
367
   util_format_dxtn_rgb_unpack_rgba_float(dst_row, dst_stride,
361
   util_format_dxtn_rgb_unpack_rgba_float(dst_row, dst_stride,
368
                                          src_row, src_stride,
362
                                          src_row, src_stride,
369
                                          width, height,
363
                                          width, height,
370
                                          util_format_dxt1_rgba_fetch,
-
 
371
                                          8, FALSE);
364
                                          util_format_dxt1_rgba_fetch, 8);
Line 372... Line 365...
372
}
365
}
373
 
366
 
374
void
367
void
375
util_format_dxt3_rgba_unpack_rgba_float(float *dst_row, unsigned dst_stride,
368
util_format_dxt3_rgba_unpack_rgba_float(float *dst_row, unsigned dst_stride,
376
                                        const uint8_t *src_row, unsigned src_stride,
369
                                        const uint8_t *src_row, unsigned src_stride,
377
                                        unsigned width, unsigned height)
370
                                        unsigned width, unsigned height)
378
{
371
{
379
   util_format_dxtn_rgb_unpack_rgba_float(dst_row, dst_stride,
372
   util_format_dxtn_rgb_unpack_rgba_float(dst_row, dst_stride,
380
                                          src_row, src_stride,
373
                                          src_row, src_stride,
381
                                          width, height,
-
 
382
                                          util_format_dxt3_rgba_fetch,
374
                                          width, height,
Line 383... Line 375...
383
                                          16, FALSE);
375
                                          util_format_dxt3_rgba_fetch, 16);
384
}
376
}
385
 
377
 
386
void
378
void
387
util_format_dxt5_rgba_unpack_rgba_float(float *dst_row, unsigned dst_stride,
379
util_format_dxt5_rgba_unpack_rgba_float(float *dst_row, unsigned dst_stride,
388
                                        const uint8_t *src_row, unsigned src_stride,
380
                                        const uint8_t *src_row, unsigned src_stride,
389
                                        unsigned width, unsigned height)
381
                                        unsigned width, unsigned height)
390
{
382
{
391
   util_format_dxtn_rgb_unpack_rgba_float(dst_row, dst_stride,
383
   util_format_dxtn_rgb_unpack_rgba_float(dst_row, dst_stride,
392
                                          src_row, src_stride,
-
 
393
                                          width, height,
384
                                          src_row, src_stride,
Line 394... Line 385...
394
                                          util_format_dxt5_rgba_fetch,
385
                                          width, height,
395
                                          16, FALSE);
386
                                          util_format_dxt5_rgba_fetch, 16);
396
}
387
}
Line 397... Line 388...
397
 
388
 
398
 
389
 
399
/*
390
/*
400
 * Block compression.
391
 * Block compression.
401
 */
-
 
402
 
-
 
403
static INLINE void
392
 */
404
util_format_dxtn_pack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride,
393
 
405
                                  const uint8_t *src, unsigned src_stride,
394
void
406
                                  unsigned width, unsigned height,
395
util_format_dxt1_rgb_pack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride,
407
                                  enum util_format_dxtn format,
396
                                      const uint8_t *src, unsigned src_stride,
408
                                  unsigned block_size, boolean srgb)
397
                                      unsigned width, unsigned height)
409
{
398
{
410
   const unsigned bw = 4, bh = 4, comps = 4;
399
   const unsigned bw = 4, bh = 4, bytes_per_block = 8;
411
   unsigned x, y, i, j, k;
400
   unsigned x, y, i, j, k;
412
   for(y = 0; y < height; y += bh) {
-
 
413
      uint8_t *dst = dst_row;
401
   for(y = 0; y < height; y += bh) {
414
      for(x = 0; x < width; x += bw) {
402
      uint8_t *dst = dst_row;
415
         uint8_t tmp[4][4][4];  /* [bh][bw][comps] */
-
 
416
         for(j = 0; j < bh; ++j) {
-
 
417
            for(i = 0; i < bw; ++i) {
403
      for(x = 0; x < width; x += bw) {
418
               uint8_t src_tmp;
-
 
419
               for(k = 0; k < 3; ++k) {
-
 
420
                  src_tmp = src[(y + j)*src_stride/sizeof(*src) + (x+i)*comps + k];
404
         uint8_t tmp[4][4][3];  /* [bh][bw][comps] */
421
                  if (srgb) {
405
         for(j = 0; j < bh; ++j) {
422
                     tmp[j][i][k] = util_format_linear_to_srgb_8unorm(src_tmp);
-
 
423
                  }
-
 
424
                  else {
-
 
425
                     tmp[j][i][k] = src_tmp;
-
 
426
                  }
-
 
427
               }
406
            for(i = 0; i < bw; ++i) {
428
               /* for sake of simplicity there's an unneeded 4th component for dxt1_rgb */
407
               for(k = 0; k < 3; ++k) {
429
               tmp[j][i][3] = src[(y + j)*src_stride/sizeof(*src) + (x+i)*comps + 3];
408
                  tmp[j][i][k] = src[(y + j)*src_stride/sizeof(*src) + (x + i)*4 + k];
430
            }
409
               }
431
         }
410
            }
432
         /* even for dxt1_rgb have 4 src comps */
-
 
433
         util_format_dxtn_pack(4, 4, 4, &tmp[0][0][0], format, dst, 0);
-
 
434
         dst += block_size;
-
 
435
      }
-
 
436
      dst_row += dst_stride / sizeof(*dst_row);
-
 
437
   }
-
 
438
 
-
 
439
}
-
 
440
 
-
 
441
void
-
 
442
util_format_dxt1_rgb_pack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride,
-
 
443
                                      const uint8_t *src, unsigned src_stride,
411
         }
Line 444... Line 412...
444
                                      unsigned width, unsigned height)
412
         util_format_dxtn_pack(3, 4, 4, &tmp[0][0][0], UTIL_FORMAT_DXT1_RGB, dst, 0);
445
{
413
         dst += bytes_per_block;
446
   util_format_dxtn_pack_rgba_8unorm(dst_row, dst_stride, src, src_stride,
414
      }
447
                                     width, height, UTIL_FORMAT_DXT1_RGB,
415
      dst_row += dst_stride / sizeof(*dst_row);
448
                                     8, FALSE);
416
   }
449
}
417
}
-
 
418
 
-
 
419
void
-
 
420
util_format_dxt1_rgba_pack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride,
-
 
421
                                       const uint8_t *src, unsigned src_stride,
-
 
422
                                       unsigned width, unsigned height)
-
 
423
{
-
 
424
   const unsigned bw = 4, bh = 4, comps = 4, bytes_per_block = 8;
-
 
425
   unsigned x, y, i, j, k;
-
 
426
   for(y = 0; y < height; y += bh) {
-
 
427
      uint8_t *dst = dst_row;
-
 
428
      for(x = 0; x < width; x += bw) {
-
 
429
         uint8_t tmp[4][4][4];  /* [bh][bw][comps] */
450
 
430
         for(j = 0; j < bh; ++j) {
-
 
431
            for(i = 0; i < bw; ++i) {
-
 
432
               for(k = 0; k < comps; ++k) {
451
void
433
                  tmp[j][i][k] = src[(y + j)*src_stride/sizeof(*src) + (x + i)*comps + k];
-
 
434
               }
452
util_format_dxt1_rgba_pack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride,
435
            }
Line 453... Line 436...
453
                                       const uint8_t *src, unsigned src_stride,
436
         }
454
                                       unsigned width, unsigned height)
437
         util_format_dxtn_pack(4, 4, 4, &tmp[0][0][0], UTIL_FORMAT_DXT1_RGBA, dst, 0);
455
{
438
         dst += bytes_per_block;
456
   util_format_dxtn_pack_rgba_8unorm(dst_row, dst_stride, src, src_stride,
439
      }
457
                                     width, height, UTIL_FORMAT_DXT1_RGBA,
440
      dst_row += dst_stride / sizeof(*dst_row);
458
                                     8, FALSE);
441
   }
-
 
442
}
-
 
443
 
-
 
444
void
-
 
445
util_format_dxt3_rgba_pack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride,
-
 
446
                                       const uint8_t *src, unsigned src_stride,
-
 
447
                                       unsigned width, unsigned height)
-
 
448
{
-
 
449
   const unsigned bw = 4, bh = 4, comps = 4, bytes_per_block = 16;
-
 
450
   unsigned x, y, i, j, k;
-
 
451
   for(y = 0; y < height; y += bh) {
-
 
452
      uint8_t *dst = dst_row;
-
 
453
      for(x = 0; x < width; x += bw) {
459
}
454
         uint8_t tmp[4][4][4];  /* [bh][bw][comps] */
-
 
455
         for(j = 0; j < bh; ++j) {
-
 
456
            for(i = 0; i < bw; ++i) {
460
 
457
               for(k = 0; k < comps; ++k) {
-
 
458
                  tmp[j][i][k] = src[(y + j)*src_stride/sizeof(*src) + (x + i)*comps + k];
461
void
459
               }
Line 462... Line 460...
462
util_format_dxt3_rgba_pack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride,
460
            }
463
                                       const uint8_t *src, unsigned src_stride,
461
         }
464
                                       unsigned width, unsigned height)
462
         util_format_dxtn_pack(4, 4, 4, &tmp[0][0][0], UTIL_FORMAT_DXT3_RGBA, dst, 0);
465
{
463
         dst += bytes_per_block;
466
   util_format_dxtn_pack_rgba_8unorm(dst_row, dst_stride, src, src_stride,
464
      }
467
                                     width, height, UTIL_FORMAT_DXT3_RGBA,
465
      dst_row += dst_stride / sizeof(*dst_row);
-
 
466
   }
-
 
467
}
-
 
468
 
-
 
469
void
-
 
470
util_format_dxt5_rgba_pack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride,
-
 
471
                                       const uint8_t *src, unsigned src_stride,
-
 
472
                                       unsigned width, unsigned height)
-
 
473
{
-
 
474
   const unsigned bw = 4, bh = 4, comps = 4, bytes_per_block = 16;
-
 
475
   unsigned x, y, i, j, k;
-
 
476
 
-
 
477
   for(y = 0; y < height; y += bh) {
-
 
478
      uint8_t *dst = dst_row;
468
                                     16, FALSE);
479
      for(x = 0; x < width; x += bw) {
-
 
480
         uint8_t tmp[4][4][4];  /* [bh][bw][comps] */
-
 
481
         for(j = 0; j < bh; ++j) {
469
}
482
            for(i = 0; i < bw; ++i) {
-
 
483
               for(k = 0; k < comps; ++k) {
470
 
484
                  tmp[j][i][k] = src[(y + j)*src_stride/sizeof(*src) + (x + i)*comps + k];
Line 471... Line 485...
471
void
485
               }
472
util_format_dxt5_rgba_pack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride,
486
            }
473
                                       const uint8_t *src, unsigned src_stride,
487
         }
474
                                       unsigned width, unsigned height)
488
         util_format_dxtn_pack(4, 4, 4, &tmp[0][0][0], UTIL_FORMAT_DXT5_RGBA, dst, 0);
475
{
-
 
476
   util_format_dxtn_pack_rgba_8unorm(dst_row, dst_stride, src, src_stride,
-
 
477
                                     width, height, UTIL_FORMAT_DXT5_RGBA,
489
         dst += bytes_per_block;
478
                                     16, FALSE);
490
      }
479
}
491
      dst_row += dst_stride / sizeof(*dst_row);
480
 
492
   }
481
static INLINE void
493
}
482
util_format_dxtn_pack_rgba_float(uint8_t *dst_row, unsigned dst_stride,
494
 
483
                                 const float *src, unsigned src_stride,
495
void
484
                                 unsigned width, unsigned height,
496
util_format_dxt1_rgb_pack_rgba_float(uint8_t *dst_row, unsigned dst_stride,
485
                                 enum util_format_dxtn format,
-
 
486
                                 unsigned block_size, boolean srgb)
497
                                     const float *src, unsigned src_stride,
487
{
498
                                     unsigned width, unsigned height)
488
   unsigned x, y, i, j, k;
-
 
489
   for(y = 0; y < height; y += 4) {
-
 
490
      uint8_t *dst = dst_row;
499
{
491
      for(x = 0; x < width; x += 4) {
-
 
492
         uint8_t tmp[4][4][4];
-
 
493
         for(j = 0; j < 4; ++j) {
500
   unsigned x, y, i, j, k;
494
            for(i = 0; i < 4; ++i) {
501
   for(y = 0; y < height; y += 4) {
495
               float src_tmp;
-
 
496
               for(k = 0; k < 3; ++k) {
-
 
497
                  src_tmp = src[(y + j)*src_stride/sizeof(*src) + (x+i)*4 + k];
-
 
498
                  if (srgb) {
-
 
499
                     tmp[j][i][k] = util_format_linear_float_to_srgb_8unorm(src_tmp);
-
 
500
                  }
502
      uint8_t *dst = dst_row;
501
                  else {
503
      for(x = 0; x < width; x += 4) {
502
                     tmp[j][i][k] = float_to_ubyte(src_tmp);
504
         uint8_t tmp[4][4][3];
503
                  }
505
         for(j = 0; j < 4; ++j) {
504
               }
506
            for(i = 0; i < 4; ++i) {
505
               /* for sake of simplicity there's an unneeded 4th component for dxt1_rgb */
507
               for(k = 0; k < 3; ++k) {
Line 506... Line 508...
506
               src_tmp = src[(y + j)*src_stride/sizeof(*src) + (x+i)*4 + 3];
508
                  tmp[j][i][k] = float_to_ubyte(src[(y + j)*src_stride/sizeof(*src) + (x+i)*4 + k]);
507
               tmp[j][i][3] = float_to_ubyte(src_tmp);
-
 
508
            }
-
 
509
         }
-
 
510
         util_format_dxtn_pack(4, 4, 4, &tmp[0][0][0], format, dst, 0);
-
 
511
         dst += block_size;
-
 
512
      }
-
 
513
      dst_row += 4*dst_stride/sizeof(*dst_row);
-
 
514
   }
-
 
515
}
-
 
516
 
-
 
517
void
509
               }
518
util_format_dxt1_rgb_pack_rgba_float(uint8_t *dst_row, unsigned dst_stride,
510
            }
519
                                     const float *src, unsigned src_stride,
511
         }
520
                                     unsigned width, unsigned height)
512
         util_format_dxtn_pack(3, 4, 4, &tmp[0][0][0], UTIL_FORMAT_DXT1_RGB, dst, 0);
-
 
513
         dst += 8;
-
 
514
      }
-
 
515
      dst_row += 4*dst_stride/sizeof(*dst_row);
-
 
516
   }
-
 
517
}
-
 
518
 
-
 
519
void
-
 
520
util_format_dxt1_rgba_pack_rgba_float(uint8_t *dst_row, unsigned dst_stride,
521
{
521
                                      const float *src, unsigned src_stride,
-
 
522
                                      unsigned width, unsigned height)
-
 
523
{
-
 
524
   unsigned x, y, i, j, k;
522
   util_format_dxtn_pack_rgba_float(dst_row, dst_stride, src, src_stride,
525
   for(y = 0; y < height; y += 4) {
-
 
526
      uint8_t *dst = dst_row;
-
 
527
      for(x = 0; x < width; x += 4) {
523
                                    width, height, UTIL_FORMAT_DXT1_RGB,
528
         uint8_t tmp[4][4][4];
-
 
529
         for(j = 0; j < 4; ++j) {
524
                                    8, FALSE);
530
            for(i = 0; i < 4; ++i) {
Line 525... Line 531...
525
}
531
               for(k = 0; k < 4; ++k) {
526
 
532
                  tmp[j][i][k] = float_to_ubyte(src[(y + j)*src_stride/sizeof(*src) + (x+i)*4 + k]);
527
void
533
               }
528
util_format_dxt1_rgba_pack_rgba_float(uint8_t *dst_row, unsigned dst_stride,
534
            }
529
                                      const float *src, unsigned src_stride,
535
         }
-
 
536
         util_format_dxtn_pack(4, 4, 4, &tmp[0][0][0], UTIL_FORMAT_DXT1_RGBA, dst, 0);
-
 
537
         dst += 8;
-
 
538
      }
-
 
539
      dst_row += 4*dst_stride/sizeof(*dst_row);
-
 
540
   }
-
 
541
}
-
 
542
 
-
 
543
void
530
                                      unsigned width, unsigned height)
544
util_format_dxt3_rgba_pack_rgba_float(uint8_t *dst_row, unsigned dst_stride,
-
 
545
                                      const float *src, unsigned src_stride,
-
 
546
                                      unsigned width, unsigned height)
-
 
547
{
531
{
548
   unsigned x, y, i, j, k;
-
 
549
   for(y = 0; y < height; y += 4) {
-
 
550
      uint8_t *dst = dst_row;
532
   util_format_dxtn_pack_rgba_float(dst_row, dst_stride, src, src_stride,
551
      for(x = 0; x < width; x += 4) {
-
 
552
         uint8_t tmp[4][4][4];
533
                                    width, height, UTIL_FORMAT_DXT1_RGBA,
553
         for(j = 0; j < 4; ++j) {
Line 534... Line 554...
534
                                    8, FALSE);
554
            for(i = 0; i < 4; ++i) {
535
}
555
               for(k = 0; k < 4; ++k) {
536
 
556
                  tmp[j][i][k] = float_to_ubyte(src[(y + j)*src_stride/sizeof(*src) + (x+i)*4 + k]);
537
void
557
               }
538
util_format_dxt3_rgba_pack_rgba_float(uint8_t *dst_row, unsigned dst_stride,
558
            }
-
 
559
         }
-
 
560
         util_format_dxtn_pack(4, 4, 4, &tmp[0][0][0], UTIL_FORMAT_DXT3_RGBA, dst, 0);
-
 
561
         dst += 16;
-
 
562
      }
-
 
563
      dst_row += 4*dst_stride/sizeof(*dst_row);
-
 
564
   }
-
 
565
}
-
 
566
 
539
                                      const float *src, unsigned src_stride,
567
void
-
 
568
util_format_dxt5_rgba_pack_rgba_float(uint8_t *dst_row, unsigned dst_stride,
-
 
569
                                      const float *src, unsigned src_stride,
-
 
570
                                      unsigned width, unsigned height)
540
                                      unsigned width, unsigned height)
571
{
-
 
572
   unsigned x, y, i, j, k;
-
 
573
   for(y = 0; y < height; y += 4) {
541
{
574
      uint8_t *dst = dst_row;
-
 
575
      for(x = 0; x < width; x += 4) {
542
   util_format_dxtn_pack_rgba_float(dst_row, dst_stride, src, src_stride,
576
         uint8_t tmp[4][4][4];
Line 543... Line 577...
543
                                    width, height, UTIL_FORMAT_DXT3_RGBA,
577
         for(j = 0; j < 4; ++j) {
544
                                    16, FALSE);
578
            for(i = 0; i < 4; ++i) {
-
 
579
               for(k = 0; k < 4; ++k) {
-
 
580
                  tmp[j][i][k] = float_to_ubyte(src[(y + j)*src_stride/sizeof(*src) + (x+i)*4 + k]);
545
}
581
               }
Line 546... Line 582...
546
 
582
            }
547
void
583
         }
548
util_format_dxt5_rgba_pack_rgba_float(uint8_t *dst_row, unsigned dst_stride,
584
         util_format_dxtn_pack(4, 4, 4, &tmp[0][0][0], UTIL_FORMAT_DXT5_RGBA, dst, 0);
549
                                      const float *src, unsigned src_stride,
-
 
550
                                      unsigned width, unsigned height)
585
         dst += 16;
551
{
-
 
552
   util_format_dxtn_pack_rgba_float(dst_row, dst_stride, src, src_stride,
-
 
553
                                    width, height, UTIL_FORMAT_DXT5_RGBA,
-
 
554
                                    16, FALSE);
-
 
555
}
586
      }
Line 556... Line 587...
556
 
587
      dst_row += 4*dst_stride/sizeof(*dst_row);
557
 
588
   }
558
/*
589
}
559
 * SRGB variants.
-
 
560
 */
590
 
561
 
-
 
562
void
-
 
563
util_format_dxt1_srgb_fetch_rgba_8unorm(uint8_t *dst, const uint8_t *src, unsigned i, unsigned j)
-
 
564
{
-
 
565
   uint8_t tmp[4];
591
 
Line 566... Line 592...
566
   util_format_dxt1_rgb_fetch(0, src, i, j, tmp);
592
/*
567
   dst[0] = util_format_srgb_to_linear_8unorm(tmp[0]);
593
 * SRGB variants.
568
   dst[1] = util_format_srgb_to_linear_8unorm(tmp[1]);
594
 *
569
   dst[2] = util_format_srgb_to_linear_8unorm(tmp[2]);
-
 
570
   dst[3] = 255;
595
 * FIXME: shunts to RGB for now
571
}
-
 
572
 
-
 
573
void
-
 
574
util_format_dxt1_srgba_fetch_rgba_8unorm(uint8_t *dst, const uint8_t *src, unsigned i, unsigned j)
-
 
575
{
596
 */
Line 576... Line 597...
576
   uint8_t tmp[4];
597
 
577
   util_format_dxt1_rgba_fetch(0, src, i, j, tmp);
598
void
578
   dst[0] = util_format_srgb_to_linear_8unorm(tmp[0]);
599
util_format_dxt1_srgb_unpack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height)
579
   dst[1] = util_format_srgb_to_linear_8unorm(tmp[1]);
-
 
580
   dst[2] = util_format_srgb_to_linear_8unorm(tmp[2]);
600
{
581
   dst[3] = tmp[3];
-
 
582
}
-
 
583
 
-
 
584
void
-
 
585
util_format_dxt3_srgba_fetch_rgba_8unorm(uint8_t *dst, const uint8_t *src, unsigned i, unsigned j)
601
   util_format_dxt1_rgb_unpack_rgba_8unorm(dst_row, dst_stride, src_row, src_stride, width, height);
Line 586... Line 602...
586
{
602
}
587
   uint8_t tmp[4];
603
 
588
   util_format_dxt3_rgba_fetch(0, src, i, j, tmp);
604
void
589
   dst[0] = util_format_srgb_to_linear_8unorm(tmp[0]);
-
 
590
   dst[1] = util_format_srgb_to_linear_8unorm(tmp[1]);
605
util_format_dxt1_srgb_pack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height)
591
   dst[2] = util_format_srgb_to_linear_8unorm(tmp[2]);
-
 
592
   dst[3] = tmp[3];
-
 
593
}
-
 
594
 
-
 
595
void
606
{
Line 596... Line 607...
596
util_format_dxt5_srgba_fetch_rgba_8unorm(uint8_t *dst, const uint8_t *src, unsigned i, unsigned j)
607
   util_format_dxt1_rgb_pack_rgba_8unorm(dst_row, dst_stride, src_row, src_stride, width, height);
597
{
608
}
598
   uint8_t tmp[4];
609
 
599
   util_format_dxt5_rgba_fetch(0, src, i, j, tmp);
-
 
600
   dst[0] = util_format_srgb_to_linear_8unorm(tmp[0]);
610
void
601
   dst[1] = util_format_srgb_to_linear_8unorm(tmp[1]);
-
 
602
   dst[2] = util_format_srgb_to_linear_8unorm(tmp[2]);
-
 
603
   dst[3] = tmp[3];
-
 
604
}
-
 
605
 
611
util_format_dxt1_srgb_fetch_rgba_8unorm(uint8_t *dst, const uint8_t *src, unsigned i, unsigned j)
Line 606... Line 612...
606
void
612
{
607
util_format_dxt1_srgb_fetch_rgba_float(float *dst, const uint8_t *src, unsigned i, unsigned j)
613
   util_format_dxt1_rgb_fetch_rgba_8unorm(dst, src, i, j);
608
{
614
}
609
   uint8_t tmp[4];
-
 
610
   util_format_dxt1_rgb_fetch(0, src, i, j, tmp);
615
 
611
   dst[0] = util_format_srgb_8unorm_to_linear_float(tmp[0]);
-
 
612
   dst[1] = util_format_srgb_8unorm_to_linear_float(tmp[1]);
-
 
613
   dst[2] = util_format_srgb_8unorm_to_linear_float(tmp[2]);
-
 
614
   dst[3] = 1.0f;
-
 
615
}
616
void
Line 616... Line 617...
616
 
617
util_format_dxt1_srgba_unpack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height)
617
void
618
{
618
util_format_dxt1_srgba_fetch_rgba_float(float *dst, const uint8_t *src, unsigned i, unsigned j)
619
   util_format_dxt1_rgba_unpack_rgba_8unorm(dst_row, dst_stride, src_row, src_stride, width, height);
619
{
-
 
620
   uint8_t tmp[4];
620
}
621
   util_format_dxt1_rgba_fetch(0, src, i, j, tmp);
-
 
622
   dst[0] = util_format_srgb_8unorm_to_linear_float(tmp[0]);
-
 
623
   dst[1] = util_format_srgb_8unorm_to_linear_float(tmp[1]);
-
 
624
   dst[2] = util_format_srgb_8unorm_to_linear_float(tmp[2]);
-
 
625
   dst[3] = ubyte_to_float(tmp[3]);
621
 
Line 626... Line 622...
626
}
622
void
627
 
623
util_format_dxt1_srgba_pack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height)
628
void
624
{
629
util_format_dxt3_srgba_fetch_rgba_float(float *dst, const uint8_t *src, unsigned i, unsigned j)
625
   util_format_dxt1_rgba_pack_rgba_8unorm(dst_row, dst_stride, src_row, src_stride, width, height);
630
{
-
 
631
   uint8_t tmp[4];
-
 
632
   util_format_dxt3_rgba_fetch(0, src, i, j, tmp);
-
 
633
   dst[0] = util_format_srgb_8unorm_to_linear_float(tmp[0]);
-
 
634
   dst[1] = util_format_srgb_8unorm_to_linear_float(tmp[1]);
626
}
Line 635... Line 627...
635
   dst[2] = util_format_srgb_8unorm_to_linear_float(tmp[2]);
627
 
636
   dst[3] = ubyte_to_float(tmp[3]);
628
void
637
}
629
util_format_dxt1_srgba_fetch_rgba_8unorm(uint8_t *dst, const uint8_t *src, unsigned i, unsigned j)
638
 
630
{
639
void
-
 
640
util_format_dxt5_srgba_fetch_rgba_float(float *dst, const uint8_t *src, unsigned i, unsigned j)
-
 
641
{
-
 
642
   uint8_t tmp[4];
-
 
643
   util_format_dxt5_rgba_fetch(0, src, i, j, tmp);
631
   util_format_dxt1_rgba_fetch_rgba_8unorm(dst, src, i, j);
Line 644... Line 632...
644
   dst[0] = util_format_srgb_8unorm_to_linear_float(tmp[0]);
632
}
645
   dst[1] = util_format_srgb_8unorm_to_linear_float(tmp[1]);
633
 
646
   dst[2] = util_format_srgb_8unorm_to_linear_float(tmp[2]);
634
void
647
   dst[3] = ubyte_to_float(tmp[3]);
635
util_format_dxt3_srgba_unpack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height)
648
}
-
 
649
 
-
 
650
void
-
 
651
util_format_dxt1_srgb_unpack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height)
-
 
652
{
636
{
Line 653... Line 637...
653
   util_format_dxtn_rgb_unpack_rgba_8unorm(dst_row, dst_stride,
637
   util_format_dxt3_rgba_unpack_rgba_8unorm(dst_row, dst_stride, src_row, src_stride, width, height);
654
                                           src_row, src_stride,
638
}
655
                                           width, height,
639
 
656
                                           util_format_dxt1_rgb_fetch,
640
void
657
                                           8, TRUE);
-
 
658
}
-
 
659
 
-
 
660
void
-
 
661
util_format_dxt1_srgba_unpack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height)
641
util_format_dxt3_srgba_pack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height)
Line 662... Line 642...
662
{
642
{
663
   util_format_dxtn_rgb_unpack_rgba_8unorm(dst_row, dst_stride,
643
   util_format_dxt3_rgba_pack_rgba_8unorm(dst_row, dst_stride, src_row, src_stride, width, height);
664
                                           src_row, src_stride,
644
}
665
                                           width, height,
645
 
666
                                           util_format_dxt1_rgba_fetch,
-
 
667
                                           8, TRUE);
-
 
668
}
-
 
669
 
-
 
670
void
646
void
Line 671... Line 647...
671
util_format_dxt3_srgba_unpack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height)
647
util_format_dxt3_srgba_fetch_rgba_8unorm(uint8_t *dst, const uint8_t *src, unsigned i, unsigned j)
672
{
648
{
673
   util_format_dxtn_rgb_unpack_rgba_8unorm(dst_row, dst_stride,
649
   util_format_dxt3_rgba_fetch_rgba_8unorm(dst, src, i, j);
674
                                           src_row, src_stride,
650
}
675
                                           width, height,
-
 
676
                                           util_format_dxt3_rgba_fetch,
-
 
677
                                           16, TRUE);
-
 
678
}
-
 
679
 
651
 
Line 680... Line 652...
680
void
652
void
681
util_format_dxt5_srgba_unpack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height)
653
util_format_dxt5_srgba_unpack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height)
682
{
654
{
683
   util_format_dxtn_rgb_unpack_rgba_8unorm(dst_row, dst_stride,
655
   util_format_dxt5_rgba_unpack_rgba_8unorm(dst_row, dst_stride, src_row, src_stride, width, height);
684
                                           src_row, src_stride,
-
 
685
                                           width, height,
-
 
686
                                           util_format_dxt5_rgba_fetch,
-
 
687
                                           16, TRUE);
-
 
688
}
656
}
Line 689... Line 657...
689
 
657
 
690
void
658
void
691
util_format_dxt1_srgb_unpack_rgba_float(float *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height)
659
util_format_dxt5_srgba_pack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height)
692
{
660
{
693
   util_format_dxtn_rgb_unpack_rgba_float(dst_row, dst_stride,
-
 
694
                                          src_row, src_stride,
-
 
695
                                          width, height,
-
 
696
                                          util_format_dxt1_rgb_fetch,
-
 
697
                                          8, TRUE);
661
   util_format_dxt5_rgba_pack_rgba_8unorm(dst_row, dst_stride, src_row, src_stride, width, height);
Line 698... Line 662...
698
}
662
}
699
 
663
 
700
void
664
void
701
util_format_dxt1_srgba_unpack_rgba_float(float *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height)
665
util_format_dxt5_srgba_fetch_rgba_8unorm(uint8_t *dst, const uint8_t *src, unsigned i, unsigned j)
702
{
-
 
703
   util_format_dxtn_rgb_unpack_rgba_float(dst_row, dst_stride,
-
 
704
                                          src_row, src_stride,
666
{
Line 705... Line 667...
705
                                          width, height,
667
   util_format_dxt5_rgba_fetch_rgba_8unorm(dst, src, i, j);
706
                                          util_format_dxt1_rgba_fetch,
668
}
707
                                          8, TRUE);
669
 
708
}
670
void
709
 
-
 
710
void
-
 
711
util_format_dxt3_srgba_unpack_rgba_float(float *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height)
671
util_format_dxt1_srgb_unpack_rgba_float(float *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height)
Line 712... Line 672...
712
{
672
{
713
   util_format_dxtn_rgb_unpack_rgba_float(dst_row, dst_stride,
673
   util_format_dxt1_rgb_unpack_rgba_float(dst_row, dst_stride, src_row, src_stride, width, height);
714
                                          src_row, src_stride,
674
}
715
                                          width, height,
675
 
716
                                          util_format_dxt3_rgba_fetch,
-
 
717
                                          16, TRUE);
-
 
718
}
676
void
Line 719... Line 677...
719
 
677
util_format_dxt1_srgb_pack_rgba_float(uint8_t *dst_row, unsigned dst_stride, const float *src_row, unsigned src_stride, unsigned width, unsigned height)
720
void
678
{
721
util_format_dxt5_srgba_unpack_rgba_float(float *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height)
679
   util_format_dxt1_rgb_pack_rgba_float(dst_row, dst_stride, src_row, src_stride, width, height);
722
{
680
}
723
   util_format_dxtn_rgb_unpack_rgba_float(dst_row, dst_stride,
-
 
724
                                          src_row, src_stride,
-
 
725
                                          width, height,
681
 
Line 726... Line 682...
726
                                          util_format_dxt5_rgba_fetch,
682
void
727
                                          16, TRUE);
683
util_format_dxt1_srgb_fetch_rgba_float(float *dst, const uint8_t *src, unsigned i, unsigned j)
728
}
684
{
729
 
685
   util_format_dxt1_rgb_fetch_rgba_float(dst, src, i, j);
730
void
-
 
731
util_format_dxt1_srgb_pack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height)
-
 
732
{
686
}
Line 733... Line 687...
733
   util_format_dxtn_pack_rgba_8unorm(dst_row, dst_stride, src_row, src_stride,
687
 
734
                                     width, height, UTIL_FORMAT_DXT1_RGB,
688
void
735
                                     8, TRUE);
689
util_format_dxt1_srgba_unpack_rgba_float(float *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height)
736
}
690
{
737
 
-
 
738
void
-
 
739
util_format_dxt1_srgba_pack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height)
691
   util_format_dxt1_rgba_unpack_rgba_float(dst_row, dst_stride, src_row, src_stride, width, height);
Line 740... Line 692...
740
{
692
}
741
   util_format_dxtn_pack_rgba_8unorm(dst_row, dst_stride, src_row, src_stride,
693
 
742
                                     width, height, UTIL_FORMAT_DXT1_RGBA,
694
void
743
                                     8, TRUE);
695
util_format_dxt1_srgba_pack_rgba_float(uint8_t *dst_row, unsigned dst_stride, const float *src_row, unsigned src_stride, unsigned width, unsigned height)
744
}
-
 
745
 
-
 
746
void
696
{
Line 747... Line 697...
747
util_format_dxt3_srgba_pack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height)
697
   util_format_dxt1_rgba_pack_rgba_float(dst_row, dst_stride, src_row, src_stride, width, height);
748
{
698
}
749
   util_format_dxtn_pack_rgba_8unorm(dst_row, dst_stride, src_row, src_stride,
699
 
750
                                     width, height, UTIL_FORMAT_DXT3_RGBA,
700
void
751
                                     16, TRUE);
-
 
752
}
-
 
753
 
701
util_format_dxt1_srgba_fetch_rgba_float(float *dst, const uint8_t *src, unsigned i, unsigned j)