5 * Copyright (C) 2004 Daniel Borca All Rights Reserved.
7 * this is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2, or (at your option)
12 * this is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with GNU Make; see the file COPYING. If not, write to
19 * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
30 #define GL_COMPRESSED_RGB_S3TC_DXT1_EXT 0x83F0
31 #define GL_COMPRESSED_RGBA_S3TC_DXT1_EXT 0x83F1
32 #define GL_COMPRESSED_RGBA_S3TC_DXT3_EXT 0x83F2
33 #define GL_COMPRESSED_RGBA_S3TC_DXT5_EXT 0x83F3
37 fetch_2d_texel_rgb_dxt1 (int texImage_RowStride
,
38 const byte
*texImage_Data
,
42 dxt1_rgb_decode_1(texImage_Data
, texImage_RowStride
, i
, j
, texel
);
47 fetch_2d_texel_rgba_dxt1 (int texImage_RowStride
,
48 const byte
*texImage_Data
,
52 dxt1_rgba_decode_1(texImage_Data
, texImage_RowStride
, i
, j
, texel
);
57 fetch_2d_texel_rgba_dxt3 (int texImage_RowStride
,
58 const byte
*texImage_Data
,
62 dxt3_rgba_decode_1(texImage_Data
, texImage_RowStride
, i
, j
, texel
);
67 fetch_2d_texel_rgba_dxt5 (int texImage_RowStride
,
68 const byte
*texImage_Data
,
72 dxt5_rgba_decode_1(texImage_Data
, texImage_RowStride
, i
, j
, texel
);
77 tx_compress_dxtn (int srccomps
, int width
, int height
,
78 const byte
*source
, int destformat
, byte
*dest
,
81 int srcRowStride
= width
* srccomps
;
85 case GL_COMPRESSED_RGB_S3TC_DXT1_EXT
:
86 rv
= dxt1_rgb_encode(width
, height
, srccomps
,
90 case GL_COMPRESSED_RGBA_S3TC_DXT1_EXT
:
91 rv
= dxt1_rgba_encode(width
, height
, srccomps
,
95 case GL_COMPRESSED_RGBA_S3TC_DXT3_EXT
:
96 rv
= dxt3_rgba_encode(width
, height
, srccomps
,
100 case GL_COMPRESSED_RGBA_S3TC_DXT5_EXT
:
101 rv
= dxt5_rgba_encode(width
, height
, srccomps
,
102 source
, srcRowStride
,
103 dest
, destRowStride
);