]> git.wh0rd.org - ICEs.git/blame - 195695/xorg.i.4
initial import
[ICEs.git] / 195695 / xorg.i.4
CommitLineData
45516216 1typedef int GLint;
2typedef unsigned int GLuint;
3typedef float GLfloat;
4static void fxt1_encode(void);
5static void texstore_rgba_fxt1(void)
6{
7 fxt1_encode();
8}
9
10structfoo = {
11texstore_rgba_fxt1};
12typedef unsigned long long Fx64;
13static void fxt1_quantize_ALPHA1(void)
14{
15 GLuint *cc;
16 const GLint n_vect = 3;
17 const GLint n_comp = 4;
18 GLfloat vec[1 + 1 + 1][4];
19 GLint i, j, k;
20 Fx64 hi;
21 GLint j1, j2;
22 GLint v1 = 0, v2 = 0;
23 GLfloat err = 1e9;
24 GLfloat tv[2 * 2][4];
25 for (j1 = 0; j1 < 2; j1++) {
26 for (j2 = 2; j2 < 4; j2++) {
27 GLfloat e = 0.0F;
28 for (i = 0; i < n_comp; i++) {
29 e += (tv[j1][i] - tv[j2][i]) * (tv[j1][i] -
30 tv[j2][i]);
31 }
32 if (e < err) {
33 v1 = j1;
34 }
35 }
36 }
37 for (i = 0; i < n_comp; i++) {
38 vec[0][i] = tv[1 - v1][i];
39 }
40 for (j = n_vect - 1; j >= 0; j--) {
41 for (i = 0; i < n_comp - 1; i++) {
42 hi |= (GLuint) (vec[j][i] / 8.0F);
43 }
44 }
45 ((Fx64 *) cc)[1] = hi;
46}
47static void fxt1_quantize(void)
48{
49 GLint k;
50 for (k = 0; k < 4; k++)
51 fxt1_quantize_ALPHA1();
52}
53static void fxt1_encode(void)
54{
55 fxt1_quantize();
56}