initial import
[ICEs.git] / 195695 / xorg.i.1
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 struct __GLcontextRec GLcontext;
10 enum {
11 VERT_ATTRIB_POS = 0, VERT_ATTRIB_WEIGHT = 1, VERT_ATTRIB_NORMAL =
12 2, VERT_ATTRIB_COLOR0 = 3, VERT_ATTRIB_COLOR1 = 4, VERT_ATTRIB_FOG =
13 5, VERT_ATTRIB_COLOR_INDEX = 6, VERT_ATTRIB_EDGEFLAG =
14 7, VERT_ATTRIB_TEX0 = 8, VERT_ATTRIB_TEX1 = 9, VERT_ATTRIB_TEX2 =
15 10, VERT_ATTRIB_TEX3 = 11, VERT_ATTRIB_TEX4 = 12, VERT_ATTRIB_TEX5 =
16 13, VERT_ATTRIB_TEX6 = 14, VERT_ATTRIB_TEX7 =
17 15, VERT_ATTRIB_GENERIC0 = 16, VERT_ATTRIB_GENERIC1 =
18 17, VERT_ATTRIB_GENERIC2 = 18, VERT_ATTRIB_GENERIC3 =
19 19, VERT_ATTRIB_GENERIC4 = 20, VERT_ATTRIB_GENERIC5 =
20 21, VERT_ATTRIB_GENERIC6 = 22, VERT_ATTRIB_GENERIC7 =
21 23, VERT_ATTRIB_GENERIC8 = 24, VERT_ATTRIB_GENERIC9 =
22 25, VERT_ATTRIB_GENERIC10 = 26, VERT_ATTRIB_GENERIC11 =
23 27, VERT_ATTRIB_GENERIC12 = 28, VERT_ATTRIB_GENERIC13 =
24 29, VERT_ATTRIB_GENERIC14 = 30, VERT_ATTRIB_GENERIC15 =
25 31, VERT_ATTRIB_MAX = 32
26 };
27 struct gl_color_table {
28 };
29 typedef void (*FetchTexelFuncF) (const struct gl_texture_image * texImage,
30 GLint col, GLint row, GLint img,
31 GLfloat * texelOut);
32 typedef void (*StoreTexelFunc) (struct gl_texture_image * texImage, GLint col,
33 GLint row, GLint img, const void *texel);
34 struct gl_texture_format {
35 GLint MesaFormat;
36 GLenum BaseFormat;
37 GLenum DataType;
38 GLubyte RedBits;
39 GLubyte GreenBits;
40 GLubyte BlueBits;
41 GLubyte AlphaBits;
42 GLubyte LuminanceBits;
43 GLubyte IntensityBits;
44 GLubyte IndexBits;
45 GLubyte DepthBits;
46 GLubyte StencilBits;
47 FetchTexelFuncF FetchTexel3Df;
48 StoreTexelFunc StoreTexel;
49 };
50 enum _format {
51 MESA_FORMAT_RGBA8888, MESA_FORMAT_RGBA8888_REV, MESA_FORMAT_ARGB8888,
52 MESA_FORMAT_ARGB8888_REV, MESA_FORMAT_RGB888, MESA_FORMAT_BGR888,
53 MESA_FORMAT_RGB565, MESA_FORMAT_RGB565_REV, MESA_FORMAT_ARGB4444,
54 MESA_FORMAT_ARGB4444_REV, MESA_FORMAT_ARGB1555,
55 MESA_FORMAT_ARGB1555_REV, MESA_FORMAT_AL88, MESA_FORMAT_AL88_REV,
56 MESA_FORMAT_RGB332, MESA_FORMAT_A8, MESA_FORMAT_L8, MESA_FORMAT_I8,
57 MESA_FORMAT_CI8, MESA_FORMAT_YCBCR, MESA_FORMAT_YCBCR_REV,
58 MESA_FORMAT_Z24_S8, MESA_FORMAT_Z16, MESA_FORMAT_Z32,
59 MESA_FORMAT_SRGB8, MESA_FORMAT_SRGBA8, MESA_FORMAT_SL8,
60 MESA_FORMAT_SLA8, MESA_FORMAT_RGB_FXT1, MESA_FORMAT_RGBA_FXT1,
61 MESA_FORMAT_RGB_DXT1, MESA_FORMAT_RGBA_DXT1, MESA_FORMAT_RGBA_DXT3,
62 MESA_FORMAT_RGBA_DXT5, MESA_FORMAT_RGBA, MESA_FORMAT_RGB,
63 MESA_FORMAT_ALPHA, MESA_FORMAT_LUMINANCE,
64 MESA_FORMAT_LUMINANCE_ALPHA, MESA_FORMAT_INTENSITY,
65 MESA_FORMAT_RGBA_FLOAT32, MESA_FORMAT_RGBA_FLOAT16,
66 MESA_FORMAT_RGB_FLOAT32, MESA_FORMAT_RGB_FLOAT16,
67 MESA_FORMAT_ALPHA_FLOAT32, MESA_FORMAT_ALPHA_FLOAT16,
68 MESA_FORMAT_LUMINANCE_FLOAT32, MESA_FORMAT_LUMINANCE_FLOAT16,
69 MESA_FORMAT_LUMINANCE_ALPHA_FLOAT32,
70 MESA_FORMAT_LUMINANCE_ALPHA_FLOAT16, MESA_FORMAT_INTENSITY_FLOAT32,
71 MESA_FORMAT_INTENSITY_FLOAT16
72 };
73 static void fxt1_encode(GLuint width, GLuint height, GLint comps,
74 const void *source, GLint srcRowStride, void *dest,
75 GLint destRowStride);
76 static GLboolean texstore_rgba_fxt1(GLcontext * ctx, GLuint dims,
77 GLenum baseInternalFormat,
78 const struct gl_texture_format *dstFormat,
79 GLvoid * dstAddr, GLint dstXoffset,
80 GLint dstYoffset, GLint dstZoffset,
81 GLint dstRowStride,
82 const GLuint * dstImageOffsets,
83 GLint srcWidth, GLint srcHeight,
84 GLint srcDepth, GLenum srcFormat,
85 GLenum srcType, const GLvoid * srcAddr,
86 const struct gl_pixelstore_attrib
87 *srcPacking)
88 {
89 const GLchan *pixels;
90 GLint srcRowStride;
91 GLubyte *dst;
92 fxt1_encode(srcWidth, srcHeight, 4, pixels, srcRowStride, dst,
93 dstRowStride);
94 }
95 static void fetch_texel_2d_rgba_fxt1(const struct gl_texture_image *texImage,
96 GLint i, GLint j, GLint k, GLchan * texel)
97 {
98 }
99 static void fetch_texel_2d_f_rgba_fxt1(const struct gl_texture_image *texImage,
100 GLint i, GLint j, GLint k,
101 GLfloat * texel)
102 {
103 }
104 const struct gl_texture_format _mesa_texformat_rgba_fxt1 = {
105 MESA_FORMAT_RGBA_FXT1, 0x1908, 0x8C17, 4, 4, 4, 1, 0, 0, 0, 0, 0, 0,
106 texstore_rgba_fxt1, ((void *)0), fetch_texel_2d_rgba_fxt1,
107 ((void *)0), ((void *)0), fetch_texel_2d_f_rgba_fxt1, ((void *)0),
108 ((void *)0)
109 };
110 typedef unsigned long long Fx64;
111 static void fxt1_quantize_CHROMA(GLuint * cc, GLubyte input[32][4])
112 {
113 const GLint n_vect = 4;
114 GLint i, j, k;
115 for (j = n_vect - 1; k >= 32 / 2; k--) {
116 }
117 }
118 static void fxt1_quantize_ALPHA1(GLuint * cc, GLubyte input[32][4])
119 {
120 const GLint n_vect = 3;
121 const GLint n_comp = 4;
122 GLfloat vec[1 + 1 + 1][4];
123 GLint i, j, k;
124 Fx64 hi;
125 {
126 GLint j1, j2;
127 GLint v1 = 0, v2 = 0;
128 GLfloat err = 1e9;
129 GLfloat tv[2 * 2][4];
130 for (i = 0; i < n_comp; i++) {
131 }
132 for (j1 = 0; j1 < 2; j1++) {
133 for (j2 = 2; j2 < 4; j2++) {
134 GLfloat e = 0.0F;
135 for (i = 0; i < n_comp; i++) {
136 e += (tv[j1][i] -
137 tv[j2][i]) * (tv[j1][i] -
138 tv[j2][i]);
139 }
140 if (e < err) {
141 v1 = j1;
142 }
143 }
144 }
145 for (i = 0; i < n_comp; i++) {
146 vec[0][i] = tv[1 - v1][i];
147 }
148 }
149 for (j = n_vect - 1; j >= 0; j--) {
150 for (i = 0; i < n_comp - 1; i++) {
151 hi |= (GLuint) (vec[j][i] / 8.0F);
152 }
153 }
154 ((Fx64 *) cc)[1] = hi;
155 }
156 static void fxt1_quantize(GLuint * cc, const GLubyte * lines[], GLint comps)
157 {
158 GLubyte input[32][4];
159 GLint i, k, l;
160 for (l = 0; l < 4; l++) {
161 for (k = 0; k < 4; k++) {
162 for (i = 0; i < comps; i++) {
163 }
164 }
165 fxt1_quantize_ALPHA1(cc, input);
166 }
167 }
168 static void fxt1_encode(GLuint width, GLuint height, GLint comps,
169 const void *source, GLint srcRowStride, void *dest,
170 GLint destRowStride)
171 {
172 GLuint x, y;
173 GLuint *encoded = (GLuint *) dest;
174 for (y = 0; y < height; y += 4) {
175 for (x = 0; x < width; x += 8) {
176 const GLubyte *lines[4];
177 fxt1_quantize(encoded, lines, comps);
178 }
179 }
180 }