]>
Commit | Line | Data |
---|---|---|
45516216 | 1 | typedef unsigned int GLenum; |
2 | typedef unsigned char GLboolean; | |
3 | typedef void GLvoid; | |
4 | typedef int GLint; | |
5 | typedef unsigned char GLubyte; | |
6 | typedef unsigned int GLuint; | |
7 | typedef float GLfloat; | |
8 | typedef GLubyte GLchan; | |
9 | typedef void (*FetchTexelFuncF) (const struct gl_texture_image * texImage, | |
10 | GLint col, GLint row, GLint img, | |
11 | GLfloat * texelOut); | |
12 | typedef void (*StoreTexelFunc) (struct gl_texture_image * texImage, GLint col, | |
13 | GLint row, GLint img, const void *texel); | |
14 | struct gl_texture_format { | |
15 | GLint MesaFormat; | |
16 | GLenum BaseFormat; | |
17 | GLenum DataType; | |
18 | GLubyte RedBits; | |
19 | GLubyte GreenBits; | |
20 | GLubyte BlueBits; | |
21 | GLubyte AlphaBits; | |
22 | GLubyte LuminanceBits; | |
23 | GLubyte IntensityBits; | |
24 | GLubyte IndexBits; | |
25 | GLubyte DepthBits; | |
26 | GLubyte StencilBits; | |
27 | FetchTexelFuncF FetchTexel3Df; | |
28 | StoreTexelFunc StoreTexel; | |
29 | }; | |
30 | static void fxt1_encode(void); | |
31 | static GLboolean texstore_rgba_fxt1(GLuint dims, | |
32 | GLenum baseInternalFormat, | |
33 | const struct gl_texture_format *dstFormat, | |
34 | GLvoid * dstAddr, GLint dstXoffset, | |
35 | GLint dstYoffset, GLint dstZoffset, | |
36 | GLint dstRowStride, | |
37 | const GLuint * dstImageOffsets, | |
38 | GLint srcWidth, GLint srcHeight, | |
39 | GLint srcDepth, GLenum srcFormat, | |
40 | GLenum srcType, const GLvoid * srcAddr, | |
41 | const struct gl_pixelstore_attrib | |
42 | *srcPacking) | |
43 | { | |
44 | fxt1_encode(); | |
45 | } | |
46 | static void fetch_texel_2d_rgba_fxt1(const struct gl_texture_image *texImage, | |
47 | GLint i, GLint j, GLint k, GLchan * texel) | |
48 | { | |
49 | } | |
50 | static void fetch_texel_2d_f_rgba_fxt1(const struct gl_texture_image *texImage, | |
51 | GLint i, GLint j, GLint k, | |
52 | GLfloat * texel) | |
53 | { | |
54 | } | |
55 | const struct gl_texture_format _mesa_texformat_rgba_fxt1 = { | |
56 | 0, 0x1908, 0x8C17, 4, 4, 4, 1, 0, 0, 0, 0, 0, 0, | |
57 | texstore_rgba_fxt1, 0, fetch_texel_2d_rgba_fxt1, | |
58 | 0, 0, fetch_texel_2d_f_rgba_fxt1, 0, | |
59 | 0 | |
60 | }; | |
61 | typedef unsigned long long Fx64; | |
62 | static void fxt1_quantize_CHROMA(GLuint * cc, GLubyte input[32][4]) | |
63 | { | |
64 | const GLint n_vect = 4; | |
65 | GLint i, j, k; | |
66 | for (j = n_vect - 1; k >= 32 / 2; k--) { | |
67 | } | |
68 | } | |
69 | static void fxt1_quantize_ALPHA1(GLuint * cc, GLubyte input[32][4]) | |
70 | { | |
71 | const GLint n_vect = 3; | |
72 | const GLint n_comp = 4; | |
73 | GLfloat vec[1 + 1 + 1][4]; | |
74 | GLint i, j, k; | |
75 | Fx64 hi; | |
76 | GLint j1, j2; | |
77 | GLint v1 = 0, v2 = 0; | |
78 | GLfloat err = 1e9; | |
79 | GLfloat tv[2 * 2][4]; | |
80 | for (i = 0; i < n_comp; i++) { | |
81 | } | |
82 | for (j1 = 0; j1 < 2; j1++) { | |
83 | for (j2 = 2; j2 < 4; j2++) { | |
84 | GLfloat e = 0.0F; | |
85 | for (i = 0; i < n_comp; i++) { | |
86 | e += (tv[j1][i] - | |
87 | tv[j2][i]) * (tv[j1][i] - | |
88 | tv[j2][i]); | |
89 | } | |
90 | if (e < err) { | |
91 | v1 = j1; | |
92 | } | |
93 | } | |
94 | } | |
95 | for (i = 0; i < n_comp; i++) { | |
96 | vec[0][i] = tv[1 - v1][i]; | |
97 | } | |
98 | for (j = n_vect - 1; j >= 0; j--) { | |
99 | for (i = 0; i < n_comp - 1; i++) { | |
100 | hi |= (GLuint) (vec[j][i] / 8.0F); | |
101 | } | |
102 | } | |
103 | ((Fx64 *) cc)[1] = hi; | |
104 | } | |
105 | static void fxt1_quantize(GLuint * cc, const GLubyte * lines[], GLint comps) | |
106 | { | |
107 | GLubyte input[32][4]; | |
108 | GLint i; | |
109 | GLint k; | |
110 | GLint l; | |
111 | for (l = 0; l < 4; l++) { | |
112 | for (k = 0; k < 4; k++) { | |
113 | for (i = 0; i < comps; i++) { | |
114 | } | |
115 | } | |
116 | fxt1_quantize_ALPHA1(cc, input); | |
117 | } | |
118 | } | |
119 | static void fxt1_encode(void) | |
120 | { | |
121 | fxt1_quantize(0, 0, 0); | |
122 | } |