overkill 32 bits avx2 assembly code
[mini2dgl.git] / gl.c
blob606f0accd3bf1155ffbaa0298a49149ab1f0fe0f
1 #ifndef GL_C
2 #define GL_C
3 /*{{{*/const GLubyte *glGetString(GLenum name)
5 void *r;
6 struct thd_data_t *self_data;
8 ONCE_AND_ENTER;
9 TRACE("0x%x(%s)", name, getstring_str(name));
10 if (!glx_extension_enabled) {
11 TRACE("glx extension not initialized");
12 r = 0;
13 goto leave;
15 self_data = self_data_get();
16 if (self_data->ctx == 0) {
17 TRACE("self thread has no current context");
18 r = 0;
19 goto leave;
21 switch(name) {
22 case GL_VENDOR:
23 r = "nyan";
24 break;
25 case GL_RENDERER:
26 r = "mini 2D libgl(glx) compatibility profile for the 32bits part of the steam runtime";
27 break;
28 case GL_VERSION:
29 /* r = "4.6"; */
30 r = "1.5";
31 break;
32 case GL_EXTENSIONS:
33 r = ""; /* only in compatibility profile */
34 break;
35 case GL_SHADING_LANGUAGE_VERSION:
36 /* r = "4.60"; */
37 r = 0;
38 break;
39 default:
40 r = 0;
41 break;
43 leave:
44 LEAVE;
45 return r;
46 }/*}}}*/
47 /*{{{*/void glDeleteTextures(GLsizei n, const GLuint *textures)
49 struct thd_data_t *self_data;
50 struct ctx_t *ctx;
51 GLsizei i;
53 ONCE_AND_ENTER;
54 TRACE("n=%d:textures=%p", n, textures);
55 if (!glx_extension_enabled) {
56 TRACE("glx extension not initialized");
57 goto leave;
59 self_data = self_data_get();
60 if (self_data->ctx == 0) {
61 TRACE("the calling thread has no current context");
62 goto leave;
64 ctx = self_data->ctx;
65 i = 0;
66 loop {
67 if (i == n)
68 break;
69 /* the name of a texture - 1 is its index in texs array */
70 if ((textures[i] != 0) && ((textures[i] - 1) < ctx->texs.n)) {
71 struct tex_t *tex;
73 TRACE("ctx=%p:deleting texture 0x%x", ctx, textures[i]);
74 ctx->texs.texture2d = 0; /* reset to default */
75 tex = &self_data->ctx->texs.a[textures[i] - 1];
76 tex->bound = false;
77 free(tex->pixels);
78 tex->pixels = 0;
79 tex->width = 0;
80 tex->height = 0;
81 tex->format = 0;
82 tex->write_to_client.align = 4;
83 tex->read_from_client.align = 4;
84 tex->read_from_client.row_pixels_n = 0;
86 ++i;
88 leave:
89 LEAVE;
90 }/*}}}*/
91 /*{{{*/void glGenTextures(GLsizei n, GLuint *textures)
93 struct thd_data_t *self_data;
94 struct ctx_t *ctx;
95 struct tex_t *texs;
96 GLsizei texs_n;
97 GLsizei i;
98 GLsizei j;
99 GLsizei reused_n;
101 ONCE_AND_ENTER;
102 TRACE("n=%d:textures=%p", n, textures);
103 if (!glx_extension_enabled) {
104 TRACE("glx extension not initialized");
105 goto leave;
107 if (n == 0)
108 goto leave;
109 self_data = self_data_get();
110 if (self_data->ctx == 0) {
111 TRACE("the calling thread has no current context");
112 goto leave;
114 ctx = self_data->ctx;
115 texs = ctx->texs.a;
116 texs_n = ctx->texs.n;
117 i = 0;
118 j = 0;
119 loop { /* reuse as many as we can */
120 if (j == texs_n)
121 break;
122 if (!texs[j].bound) {
123 textures[i] = j + 1; /* the name is the index + 1 */
124 TRACE("ctx=%p:name=0x%x", ctx, textures[i]);
125 ++i;
126 if (i == n)
127 goto leave;
129 ++j;
131 /* brand new ones */
132 reused_n = i;
133 ctx->texs.a = realloc(ctx->texs.a, sizeof(*(ctx->texs.a)) * (texs_n
134 + (n - reused_n)));
135 texs = ctx->texs.a;
136 j = texs_n;
137 loop {
138 if (j == (texs_n + (n - reused_n)))
139 break;
140 texs[j].bound = false;
141 texs[j].target = 0;
142 texs[j].pixels = 0;
143 texs[j].width = 0;
144 texs[j].height = 0;
145 texs[j].format = 0;
146 texs[j].write_to_client.align = 4;
147 texs[j].read_from_client.align = 4;
148 texs[j].read_from_client.row_pixels_n = 0;
149 textures[i] = j + 1; /* the name is the index + 1 */
150 TRACE("ctx=%p:name=0x%x", self_data->ctx, textures[i]);
151 ++j;
152 ++i;
154 ctx->texs.n += n - reused_n;
155 leave:
156 LEAVE;
157 }/*}}}*/
158 /*{{{void glBindTexture(GLenum target, GLuint texture)*/
160 * The type of a texture is defined by the target while being bound for the
161 * first time. Then the type cannot be changed and the texture can be re-bound
162 * only to the same target (or compatible?).
163 * Texture names are local to the current context.
165 void glBindTexture(GLenum target, GLuint texture)
167 struct thd_data_t *self_data;
169 ONCE_AND_ENTER;
170 TRACE("target=0x%x(%s):texture=0x%x", target, tex_target_str(target), texture);
171 if (!glx_extension_enabled) {
172 TRACE("glx extension not initialized");
173 goto leave;
175 self_data = self_data_get();
176 if (self_data->ctx == 0) {
177 TRACE("the calling thread has no current context");
178 goto leave;
180 /* the texture name - 1 is the index in the texs array */
181 if ((texture - 1) > self_data->ctx->texs.n) {
182 TRACE("WARNING:ctx=%p:texture name 0x%x was not generated", self_data->ctx, texture);
183 goto leave;
185 /* here, the texture name was already instanciated */
186 if (self_data->ctx->texs.a[texture - 1].bound) {
187 if (self_data->ctx->texs.a[texture - 1].target != target) {
188 LOG("ERROR:ctx=%p:texture 0x%x was already bound to target 0x%x(%s) which is different to the new target 0x%x(%s), ignoring", self_data->ctx, texture, self_data->ctx->texs.a[texture - 1].target, tex_target_str(self_data->ctx->texs.a[texture - 1].target), target, tex_target_str(target));
189 goto leave;
190 } else
191 TRACE("ctx=%p:rebinding texture 0x%x to same target 0x%x(%s)", self_data->ctx, texture, target, tex_target_str(target));
192 } else
193 TRACE("ctx=%p:binding texture 0x%x to target 0x%x(%s)", self_data->ctx, texture, target, tex_target_str(target));
194 self_data->ctx->texs.a[texture - 1].bound = true;
195 self_data->ctx->texs.a[texture - 1].target = target;
196 if (target == GL_TEXTURE_2D)
197 self_data->ctx->texs.texture2d = texture;
198 leave:
199 LEAVE;
200 }/*}}}*/
201 /*{{{void glTexImage2D(GLenum target, GLint level, GLint internalFormat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid *pixels)*/
203 * It will load a texture target of the active texture unit from some data.
204 * The data is decribed by format/type parameters, and the loading process
205 * will select/convert from this data to the internal format.
206 * The data pointer can be 0, they only texture memory allocation is done.
208 void glTexImage2D(GLenum target, GLint level,
209 GLint internalFormat,
210 GLsizei width, GLsizei height,
211 GLint border, GLenum format, GLenum type,
212 const GLvoid *pixels)
214 struct thd_data_t *self_data;
215 Bool ret;
216 GC gc;
217 struct ctx_t *ctx;
218 struct tex_t *tex;
219 GLuint texture2d;
220 size_t tex_bytes_n;
221 #ifdef AVX2_32BITS
222 struct {
223 void *dst;
224 u32 dst_x_offset;
225 u32 dst_y_offset;
226 u32 dst_width_pixs_n;
227 u32 dst_line_pixs_n;
228 void *src;
229 u32 src_line_pixs_n;
230 u32 height_lines_n;
231 } avx2_input;
232 #endif
234 ONCE_AND_ENTER;
235 TRACE("target=0x%x(%s):level=%d:internalFormat=0x%x(%s):width=%d:height=%d:border=%d:format=0x%x(%s):type=0x%x(%s):pixels=%p", target, tex_target_str(target), level, internalFormat, tex_format_str(internalFormat), width, height, border, format, tex_format_str(format), type, pixel_data_format_str(type), pixels);
236 if (!glx_extension_enabled) {
237 TRACE("glx extension not initialized");
238 goto leave;
240 self_data = self_data_get();
241 if (self_data->ctx == 0) {
242 TRACE("the calling thread has no current context");
243 goto leave;
245 ctx = self_data->ctx;
246 texture2d = ctx->texs.texture2d;
247 tex = &ctx->texs.a[texture2d - 1];
248 if (format != GL_BGRA && format != GL_RGBA) {
249 LOG("ERROR:ctx=%p:texture=0x%x:we don't support texture format 0x%x(%s)", ctx, texture2d, format, tex_format_str(format));
250 goto leave;
252 /* for the above pixel formats, alignment of 1 of 4 are the same */
253 if (tex->read_from_client.align != 1
254 && tex->read_from_client.align != 4) {
255 LOG("ERROR:ctx=%p:texture=0x%x:we don't support reading from client memory with an alignement of %u bytes", ctx, texture2d, tex->read_from_client.align);
256 goto leave;
259 * there may be no data, then only allocation occurs, and loading
260 * would happen using subtexture loads
262 if (tex->pixels != 0) {/* rebinding? */
263 TRACE("WARNING:ctx=%p:texture=0x%x:have data already, freeing", ctx, texture2d);
264 free(tex->pixels);
265 tex->pixels = 0;
267 /* here, format is GL_BGRA or GL_RGBA with an alignment of 1 */
268 tex_bytes_n = width * height * 4;
269 tex->pixels = malloc(tex_bytes_n);
271 if (pixels != 0) {
272 #ifdef AVX2_32BITS
273 avx2_input.dst = tex->pixels;
274 avx2_input.dst_x_offset = 0;
275 avx2_input.dst_y_offset = 0;
276 avx2_input.dst_width_pixs_n = width;
277 avx2_input.dst_line_pixs_n = width;
278 avx2_input.src = (void*)pixels;
279 if (tex->read_from_client.row_pixels_n == 0)
280 avx2_input.src_line_pixs_n = width;
281 else
282 avx2_input.src_line_pixs_n = tex->read_from_client.row_pixels_n;
283 avx2_input.height_lines_n = height;
284 glTexXImage2D_avx2(&avx2_input);
285 #else
286 if (tex->read_from_client.row_pixels_n == 0)
287 memcpy(tex->pixels, pixels, tex_bytes_n);
288 else {
289 GLsizei x;
290 GLsizei y;
292 y = 0;
293 loop {
294 if (y == height)
295 break;
296 x = 0;
297 loop {
298 u8 *psrc;
299 u8 *pdst;
301 if (x == width)
302 break;
303 psrc = (u8*)pixels;
304 psrc += (y * tex->read_from_client.row_pixels_n + x) << 2;
305 pdst = tex->pixels + ((y * width + x) << 2);
306 memcpy(pdst, psrc, 4);
307 ++x;
309 ++y;
312 #endif
314 tex->width = width;
315 tex->height = height;
316 tex->format = format;
317 leave:
318 LEAVE;
319 }/*}}}*/
320 /*{{{*/void glTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels)
322 struct thd_data_t *self_data;
323 struct ctx_t *ctx;
324 GLuint texture2d;
325 struct tex_t *tex;
326 #ifdef AVX2_32BITS
327 struct {
328 void *dst;
329 u32 dst_x_offset;
330 u32 dst_y_offset;
331 u32 dst_width_pixs_n;
332 u32 dst_line_pixs_n;
333 void *src;
334 u32 src_line_pixs_n;
335 u32 height_lines_n;
336 } avx2_input;
337 #else
338 GLuint dst_line_bytes_n;
339 u8 *src_pixels;
340 u8 *dst_pixels;
341 GLuint src_x;
342 GLuint src_y;
343 GLuint dst_x;
344 GLuint dst_y;
345 #endif
347 ONCE_AND_ENTER;
348 TRACE("target=0x%x(%s):level=%d:xoffset=%d:yoffset=%d:width=%d:height=%d:format=0x%x(%s):type=0x%x(%s):pixels=%p", target, tex_target_str(target), level, xoffset, yoffset, width, height, format, tex_format_str(format), type, pixel_data_format_str(type), pixels);
349 if (!glx_extension_enabled) {
350 TRACE("glx extension not initialized");
351 goto leave;
353 if (pixels == 0)
354 goto leave;
355 self_data = self_data_get();
356 if (self_data->ctx == 0) {
357 TRACE("the calling thread has no current context");
358 goto leave;
360 ctx = self_data->ctx;
361 texture2d = ctx->texs.texture2d;
362 tex = &ctx->texs.a[texture2d - 1];
363 if (format != tex->format) {
364 LOG("ERROR:ctx=%p:texture=0x%x:the texture has format 0x%x(%s) but the update data has format 0x%x(%s)", ctx, texture2d - 1, tex->format, tex_format_str(tex->format), format, tex_format_str(format));
365 goto leave;
367 if (format != GL_BGRA && format != GL_RGBA) {
368 LOG("ERROR:ctx=%p:texture=0x%x:we don't support texture format 0x%x(%s)", ctx, texture2d - 1, format, tex_format_str(format));
369 goto leave;
371 /* for the above pixel formats, alignment of 1 of 4 are the same */
372 if (tex->read_from_client.align != 1
373 && tex->read_from_client.align != 4) {
374 LOG("ERROR:ctx=%p:texture=0x%x:we don't support reading from client memory with an alignement of %u bytes", ctx, texture2d - 1, tex->read_from_client.align);
375 goto leave;
377 if (pixels == 0 || tex->pixels == 0 || width == 0 || height == 0)
378 goto leave;
379 #ifdef AVX2_32BITS
380 avx2_input.dst = tex->pixels;
381 avx2_input.dst_x_offset = xoffset;
382 avx2_input.dst_y_offset = yoffset;
383 avx2_input.dst_width_pixs_n = width;
384 avx2_input.dst_line_pixs_n = tex->width;
385 avx2_input.src = (void*)pixels;
386 if (tex->read_from_client.row_pixels_n == 0)
387 avx2_input.src_line_pixs_n = width;
388 else
389 avx2_input.src_line_pixs_n = tex->read_from_client.row_pixels_n;
390 avx2_input.height_lines_n = height;
391 glTexXImage2D_avx2(&avx2_input);
392 #else
393 src_pixels = (u8*)pixels;
394 dst_pixels = tex->pixels;
395 if (pixels == 0 || tex->pixels == 0 || width == 0 || height == 0)
396 goto leave;
397 dst_line_bytes_n = tex->width << 2;
398 dst_y = yoffset;
399 src_y = 0;
400 TRACE("texture2d=0x%x dst_line_bytes_n=%u", texture2d, dst_line_bytes_n);
401 loop {
402 if (dst_y == yoffset + height)
403 break;
404 dst_x = xoffset;
405 src_x = 0;
406 loop {
407 u8 *dst_pix;
408 u8 *src_pix;
410 if (dst_x == xoffset + width)
411 break;
412 dst_pix = dst_pixels + dst_y * dst_line_bytes_n
413 + (dst_x << 2);
414 if (tex->read_from_client.row_pixels_n == 0)
415 src_pix = src_pixels + ((src_y * width + src_x) << 2);
416 else
417 src_pix = src_pixels + ((src_y * tex->read_from_client.row_pixels_n + src_x) << 2);
418 memcpy(dst_pix, src_pix, 4);
419 ++dst_x;
420 ++src_x;
422 ++dst_y;
423 ++src_y;
425 #endif
426 leave:
427 LEAVE;
428 }/*}}}*/
429 /*{{{*/void glEnable(GLenum cap)
431 struct thd_data_t *self_data;
432 struct ctx_t *ctx;
434 ONCE_AND_ENTER;
435 TRACE("cap=0x%x(%s)", cap, disable_enable_cap_str(cap));
436 if (!glx_extension_enabled) {
437 TRACE("glx extension not initialized");
438 goto leave;
440 self_data = self_data_get();
441 if (self_data->ctx == 0) {
442 TRACE("the calling thread has no current context");
443 goto leave;
445 ctx = self_data->ctx;
446 if (cap == GL_BLEND)
447 ctx->blending_enabled = true;
448 leave:
449 LEAVE;
450 }/*}}}*/
451 /*{{{*/void glMatrixMode(GLenum mode)
453 struct thd_data_t *self_data;
455 ONCE_AND_ENTER;
456 TRACE("mode=0x%x(%s)", mode, matrixmode_mode_str(mode));
457 if (!glx_extension_enabled) {
458 TRACE("glx extension not initialized");
459 goto leave;
461 self_data = self_data_get();
462 if (self_data->ctx == 0) {
463 TRACE("the calling thread has no current context");
464 goto leave;
466 self_data->ctx->mtxs.current = mode;
467 leave:
468 LEAVE;
469 }/*}}}*/
470 /*{{{*/void glLoadIdentity(void)
472 struct thd_data_t *self_data;
473 double *mtx;
474 unsigned int i;
475 unsigned int j;
477 ONCE_AND_ENTER;
478 TRACE("void");
479 if (!glx_extension_enabled) {
480 TRACE("glx extension not initialized");
481 goto leave;
483 self_data = self_data_get();
484 if (self_data->ctx == 0) {
485 TRACE("the calling thread has no current context");
486 goto leave;
488 switch(self_data->ctx->mtxs.current) {
489 case GL_MODELVIEW:
490 mtx = self_data->ctx->mtxs.mv;
491 break;
492 case GL_PROJECTION:
493 mtx = self_data->ctx->mtxs.proj;
494 break;
495 case GL_TEXTURE:
496 mtx = self_data->ctx->mtxs.tex;
497 break;
498 case GL_COLOR:
499 mtx = self_data->ctx->mtxs.col;
500 break;
501 default:
502 LOG("WARNING:unknown matrix 0x%x in context %p", self_data->ctx->mtxs.current, self_data->ctx);
503 goto leave;
505 i = 0;
506 loop {
507 if (i == 4)
508 break;
509 j = 0;
510 loop {
511 if (j == 4)
512 break;
513 if (j != i)
514 mtx[i * 4 + j] = 0.;
515 else
516 mtx[i * 4 + j] = 1.;
517 ++j;
519 ++i;
521 leave:
522 LEAVE;
523 }/*}}}*/
524 /*{{{*/void glOrtho(GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble near_val, GLdouble far_val)
526 struct thd_data_t *self_data;
527 struct ctx_t *ctx;
529 ONCE_AND_ENTER;
530 TRACE("left=%f:right=%f:bottom=%f:top=%f:near=%f:far=%f", left, right, bottom, top, near_val, far_val);
531 if (!glx_extension_enabled) {
532 TRACE("glx extension not initialized");
533 goto leave;
535 self_data = self_data_get();
536 if (self_data->ctx == 0) {
537 TRACE("the calling thread has no current context");
538 goto leave;
540 ctx = self_data->ctx;
541 if (ctx->mtxs.current != GL_PROJECTION) {
542 LOG("WARNING:orthogonal project matrix applied to not projection matrix, not recording");
543 goto leave;
545 ctx->mtxs.proj_ortho.left = left;
546 ctx->mtxs.proj_ortho.right = right;
547 ctx->mtxs.proj_ortho.bottom = bottom;
548 ctx->mtxs.proj_ortho.top = top;
549 ctx->mtxs.proj_ortho.near = near_val;
550 ctx->mtxs.proj_ortho.far = far_val;
551 leave:
552 LEAVE;
553 }/*}}}*/
554 /*{{{*/void glTranslatef(GLfloat x, GLfloat y, GLfloat z)
556 struct thd_data_t *self_data;
557 struct ctx_t *ctx;
559 ONCE_AND_ENTER;
560 TRACE("x=%f:y=%f:z=%f", x, y, z);
561 if (!glx_extension_enabled) {
562 TRACE("glx extension not initialized");
563 goto leave;
565 self_data = self_data_get();
566 if (self_data->ctx == 0) {
567 TRACE("the calling thread has no current context");
568 goto leave;
570 ctx = self_data->ctx;
571 if (ctx->mtxs.current != GL_MODELVIEW) {
572 LOG("WARNING:translation matrix applied to not model view matrix, not recording");
573 goto leave;
575 ctx->mtxs.mv_translate.x = x;
576 ctx->mtxs.mv_translate.y = y;
577 ctx->mtxs.mv_translate.z = z;
578 leave:
579 LEAVE;
580 }/*}}}*/
581 /*{{{*/void glDisableClientState(GLenum cap)
583 struct thd_data_t *self_data;
585 ONCE_AND_ENTER;
586 TRACE("cap=0x%x(%s)", cap, disable_enable_cap_str(cap));
587 if (!glx_extension_enabled) {
588 TRACE("glx extension not initialized");
589 goto leave;
591 self_data = self_data_get();
592 if (self_data->ctx == 0) {
593 TRACE("the calling thread has no current context");
594 goto leave;
596 /* yaya */
597 leave:
598 LEAVE;
599 }/*}}}*/
600 /*{{{*/void glTexEnvf(GLenum target, GLenum pname, GLfloat param)
602 struct thd_data_t *self_data;
603 struct ctx_t *ctx;
605 ONCE_AND_ENTER;
606 TRACE("target=0x%x(%s):pname=0x%x(%s):param=%f(%s)", target, texenv_target_str(target), pname, texenv_pname_str(pname), param, texenv_param_str(pname, param));
607 if (!glx_extension_enabled) {
608 TRACE("glx extension not initialized");
609 goto leave;
611 self_data = self_data_get();
612 if (self_data->ctx == 0) {
613 TRACE("the calling thread has no current context");
614 goto leave;
616 ctx = self_data->ctx;
617 if (pname == GL_TEXTURE_ENV_MODE && param != (GLfloat)GL_MODULATE)
618 LOG("ctx=%p:ERROR:we don't support anything else than GL_MODULATE", ctx);
619 leave:
620 LEAVE;
621 }/*}}}*/
622 /*{{{*/void glColor4f(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha)
624 struct thd_data_t *self_data;
626 ONCE_AND_ENTER;
627 TRACE("red=%f:green=%f:blue=%f:alpha=%f", red, green, blue, alpha);
628 if (!glx_extension_enabled) {
629 TRACE("glx extension not initialized");
630 goto leave;
632 self_data = self_data_get();
633 if (self_data->ctx == 0) {
634 TRACE("the calling thread has no current context");
635 goto leave;
637 self_data->ctx->color.red = red;
638 self_data->ctx->color.green = green;
639 self_data->ctx->color.blue = blue;
640 self_data->ctx->color.alpha = alpha;
641 leave:
642 LEAVE;
643 }/*}}}*/
644 /*{{{*/void glReadBuffer(GLenum mode)
646 ONCE_AND_ENTER;
647 TRACE("mode=%d", mode);
648 if (!glx_extension_enabled) {
649 TRACE("glx extension not initialized");
650 goto leave;
652 // XXX: does forget the texture alignment
653 leave:
654 LEAVE;
655 }/*}}}*/
656 /*{{{*/void glPixelStorei(GLenum pname, GLint param)
658 struct thd_data_t *self_data;
659 struct ctx_t *ctx;
661 ONCE_AND_ENTER;
662 TRACE("pname=0x%x(%s):param=0x%x", pname, pixelstore_pname_str(pname), param);
663 if (!glx_extension_enabled) {
664 TRACE("glx extension not initialized");
665 goto leave;
667 self_data = self_data_get();
668 if (self_data->ctx == 0) {
669 TRACE("the calling thread has no current context");
670 goto leave;
672 ctx = self_data->ctx;
673 switch(pname) {
674 case GL_UNPACK_ALIGNMENT:
675 if (ctx->texs.texture2d != 0) {
676 struct tex_t *tex;
678 tex = &ctx->texs.a[ctx->texs.texture2d - 1];
679 tex->read_from_client.align = param;
680 TRACE("ctx=%p:texture2d bound texture name 0x%x, setting read from client alignment to %u bytes", ctx, ctx->texs.texture2d - 1, param);
682 break;
683 case GL_UNPACK_ROW_LENGTH:
684 if (ctx->texs.texture2d != 0) {
685 struct tex_t *tex;
687 tex = &ctx->texs.a[ctx->texs.texture2d - 1];
688 tex->read_from_client.row_pixels_n = param;
689 TRACE("ctx=%p:texture2d bound texture name 0x%x, setting read from client row lenght to %u pixels", ctx, ctx->texs.texture2d - 1, param);
691 break;
692 case GL_PACK_ALIGNMENT:
693 if (ctx->texs.texture2d != 0) {
694 struct tex_t *tex;
696 tex = &ctx->texs.a[ctx->texs.texture2d - 1];
697 tex->write_to_client.align = param;
698 TRACE("ctx=%p:texture2d bound texture name 0x%x, setting write to client alignment to %u bytes", ctx, ctx->texs.texture2d - 1, param);
700 break;
701 default:
702 TRACE("WARNING:unhandled storage parameter");
703 break;
705 leave:
706 LEAVE;
707 }/*}}}*/
708 /*{{{*/void glTexParameteri(GLenum target, GLenum pname, GLint param)
710 struct thd_data_t *self_data;
712 ONCE_AND_ENTER;
713 TRACE("target=0x%x(%s):pname=0x%x:param=0x%x", target, tex_target_str(target), pname, param);
714 if (!glx_extension_enabled) {
715 TRACE("glx extension not initialized");
716 goto leave;
718 self_data = self_data_get();
719 if (self_data->ctx == 0) {
720 TRACE("the calling thread has no current context");
721 goto leave;
723 leave:
724 LEAVE;
725 }/*}}}*/
726 /*{{{*/void glReadPixels(GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLvoid *pixels)
728 struct thd_data_t *self_data;
730 ONCE_AND_ENTER;
731 TRACE("x=%d:y=%d:width=%d:height=%d:format=%d:type=%d:pixels=%p", x, y, width, height, format, type, pixels);
732 if (!glx_extension_enabled) {
733 TRACE("glx extension not initialized");
734 goto leave;
736 self_data = self_data_get();
737 if (self_data->ctx == 0) {
738 TRACE("the calling thread has no current context");
739 goto leave;
741 leave:
742 LEAVE;
743 }/*}}}*/
744 /*{{{*/void glViewport(GLint x, GLint y, GLsizei width, GLsizei height)
746 struct thd_data_t *self_data;
748 ONCE_AND_ENTER;
749 TRACE("x=%d:y=%d:width=%d:height=%d", x, y, width, height);
750 if (!glx_extension_enabled) {
751 TRACE("glx extension not initialized");
752 goto leave;
754 self_data = self_data_get();
755 if (self_data->ctx == 0) {
756 LOG("WARNING:the self thread has no current context, ignoring and continuing");
757 goto leave;
759 self_data->ctx->vp.x = x;
760 self_data->ctx->vp.y = y;
761 self_data->ctx->vp.width = width;
762 self_data->ctx->vp.height = height;
763 leave:
764 LEAVE;
765 }/*}}}*/
766 /*{{{*/void glBegin(GLenum mode)
768 struct thd_data_t *self_data;
770 ONCE_AND_ENTER;
771 TRACE("mode=0x%x(%s)", mode, begin_mode(mode));
772 if (!glx_extension_enabled) {
773 TRACE("glx extension not initialized");
774 goto leave;
776 self_data = self_data_get();
777 if (self_data->ctx == 0) {
778 TRACE("the calling thread has no current context");
779 goto leave;
781 memset(&self_data->ctx->begin_end_blk.quad, 0,
782 sizeof(self_data->ctx->begin_end_blk.quad));
783 self_data->ctx->begin_end_blk.recording = true;
784 leave:
785 LEAVE;
786 }/*}}}*/
787 /*{{{*/void glEnd( void )
789 struct thd_data_t *self_data;
791 ONCE_AND_ENTER;
792 TRACE("void");
793 if (!glx_extension_enabled) {
794 TRACE("glx extension not initialized");
795 goto leave;
797 self_data = self_data_get();
798 if (self_data->ctx == 0) {
799 TRACE("the calling thread has no current context");
800 goto leave;
802 render_in_shm(self_data->ctx);
803 self_data->ctx->begin_end_blk.recording = false;
804 leave:
805 LEAVE;
806 }/*}}}*/
807 /*{{{*/void glTexCoord2f( GLfloat s, GLfloat t )
809 struct thd_data_t *self_data;
810 struct ctx_t *ctx;
812 ONCE_AND_ENTER;
813 TRACE("s=%f:t=%f", s, t);
814 if (!glx_extension_enabled) {
815 TRACE("glx extension not initialized");
816 goto leave;
818 self_data = self_data_get();
819 if (self_data->ctx == 0) {
820 TRACE("the calling thread has no current context");
821 goto leave;
823 ctx = self_data->ctx;
824 if (!ctx->begin_end_blk.recording) {
825 LOG("WARNING:outside of a glBegin/glEnd block, ignoring");
826 goto leave;
828 if (ctx->begin_end_blk.quad.i > 4) {
829 LOG("WARNING:out of storage, ignoring");
830 goto leave;
832 ctx->begin_end_blk.quad.vs[ctx->begin_end_blk.quad.i].tex.s = s;
833 ctx->begin_end_blk.quad.vs[ctx->begin_end_blk.quad.i].tex.t = t;
834 leave:
835 LEAVE;
836 }/*}}}*/
837 /*{{{*/void glVertex2f(GLfloat x, GLfloat y)
839 struct thd_data_t *self_data;
840 struct ctx_t *ctx;
842 ONCE_AND_ENTER;
843 TRACE("x=%f:y=%f", x, y);
844 if (!glx_extension_enabled) {
845 TRACE("glx extension not initialized");
846 goto leave;
848 self_data = self_data_get();
849 if (self_data->ctx == 0) {
850 TRACE("the calling thread has no current context");
851 goto leave;
853 ctx = self_data->ctx;
854 if (!ctx->begin_end_blk.recording) {
855 LOG("WARNING:outside of a glBegin/glEnd block, ignoring");
856 goto leave;
858 if (ctx->begin_end_blk.quad.i > 4) {
859 LOG("WARNING:out of storage, ignoring");
860 goto leave;
862 ctx->begin_end_blk.quad.vs[ctx->begin_end_blk.quad.i].plane.x = x;
863 ctx->begin_end_blk.quad.vs[ctx->begin_end_blk.quad.i].plane.y = y;
864 ctx->begin_end_blk.quad.vs[ctx->begin_end_blk.quad.i].color.red =
865 ctx->color.red;
866 ctx->begin_end_blk.quad.vs[ctx->begin_end_blk.quad.i].color.green =
867 ctx->color.green;
868 ctx->begin_end_blk.quad.vs[ctx->begin_end_blk.quad.i].color.blue =
869 ctx->color.blue;
870 ctx->begin_end_blk.quad.vs[ctx->begin_end_blk.quad.i].color.alpha =
871 ctx->color.alpha;
872 ++(ctx->begin_end_blk.quad.i); /* vertex coords, then advance */
873 leave:
874 LEAVE;
875 }/*}}}*/
876 /*{{{*/void glColor4ub(GLubyte red, GLubyte green, GLubyte blue, GLubyte alpha)
878 struct thd_data_t *self_data;
880 ONCE_AND_ENTER;
881 TRACE("red=0x%02x:green=0x%02x:blue=0x%02x:alpha=0x%02x", red, green, blue, alpha);
882 if (!glx_extension_enabled) {
883 TRACE("glx extension not initialized");
884 goto leave;
886 self_data = self_data_get();
887 if (self_data->ctx == 0) {
888 TRACE("the calling thread has no current context");
889 goto leave;
891 self_data->ctx->color.red = (float)red / 255.;
892 self_data->ctx->color.green = (float)green / 255.;
893 self_data->ctx->color.blue = (float)blue / 255.;
894 self_data->ctx->color.alpha = (float)alpha / 255.;
895 leave:
896 LEAVE;
897 }/*}}}*/
898 /*{{{*/void glClearColor(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha)
900 struct thd_data_t *self_data;
902 ONCE_AND_ENTER;
903 TRACE("red=%f:green=%f:blue=%f:alpha=%f", red, green, blue, alpha);
904 if (!glx_extension_enabled) {
905 TRACE("glx extension not initialized");
906 goto leave;
908 self_data = self_data_get();
909 if (self_data->ctx == 0) {
910 TRACE("the calling thread has no current context");
911 goto leave;
913 self_data->ctx->clear_color.red = red;
914 self_data->ctx->clear_color.green = green;
915 self_data->ctx->clear_color.blue = blue;
916 self_data->ctx->clear_color.alpha = alpha;
917 leave:
918 LEAVE;
919 }/*}}}*/
920 /*{{{*/void glClear(GLbitfield mask)
922 struct thd_data_t *self_data;
924 ONCE_AND_ENTER;
925 TRACE("mask=0x%x", mask);
926 if (!glx_extension_enabled) {
927 TRACE("glx extension not initialized");
928 goto leave;
930 self_data = self_data_get();
931 if (self_data->ctx == 0) {
932 TRACE("the calling thread has no current context");
933 goto leave;
935 if ((mask & GL_COLOR_BUFFER_BIT) != 0)
936 color_buffer_clear(self_data->ctx);
937 leave:
938 LEAVE;
939 }/*}}}*/
940 /*{{{*/GLenum glGetError(void)
942 int r;
944 ONCE_AND_ENTER;
945 TRACE("void");
946 if (!glx_extension_enabled) {
947 TRACE("glx extension not initialized");
948 r = 0;
949 goto leave;
951 r = 0;
952 leave:
953 LEAVE;
954 return 0;
955 }/*}}}*/
956 /*{{{*/void glGetIntegerv(GLenum pname, GLint *params)
958 struct thd_data_t *self_data;
960 ONCE_AND_ENTER;
961 TRACE("pname=0x%x(%s):params=%p", pname, getinteger_pname_str(pname), params);
962 if (!glx_extension_enabled) {
963 TRACE("glx extension not initialized");
964 goto leave;
966 self_data = self_data_get();
967 if (self_data->ctx == 0) {
968 TRACE("the calling thread has no current context");
969 goto leave;
971 if (params == 0)
972 goto leave;
973 switch(pname) {
974 case GL_VIEWPORT:
975 params[0] = self_data->ctx->vp.x;
976 params[1] = self_data->ctx->vp.y;
977 params[2] = self_data->ctx->vp.width;
978 params[3] = self_data->ctx->vp.height;
979 TRACE("viewport:x=%d:y=%d:width=%d:height=%d", params[0], params[1], params[2], params[3]);
980 break;
981 case GL_NUM_EXTENSIONS:
982 params[0] = 0; /* no extensions */
983 break;
984 default:
985 break;
987 leave:
988 LEAVE;
989 }/*}}}*/
990 /*{{{*/void glBlendFunc(GLenum sfactor, GLenum dfactor)
992 struct thd_data_t *self_data;
994 ONCE_AND_ENTER;
995 TRACE("sfactor=0x%x(%s):dfactor=0x%x(%s)", sfactor, blendfunc_factor_str(sfactor), dfactor, blendfunc_factor_str(dfactor));
996 if (!glx_extension_enabled) {
997 TRACE("glx extension not initialized");
998 goto leave;
1000 self_data = self_data_get();
1001 if (self_data->ctx == 0) {
1002 TRACE("the calling thread has no current context");
1003 goto leave;
1005 if (sfactor != GL_SRC_ALPHA || dfactor != GL_ONE_MINUS_SRC_ALPHA)
1006 LOG("ctx=%p:ERROR: blendind function not supported", self_data->ctx);
1007 leave:
1008 LEAVE;
1009 }/*}}}*/
1010 /*{{{*/GLint glRenderMode(GLenum mode)
1012 int r;
1013 struct thd_data_t *self_data;
1015 ONCE_AND_ENTER;
1016 TRACE("mode=0x%x(%s)", mode, rendermode_str(mode));
1017 if (!glx_extension_enabled) {
1018 TRACE("glx extension not initialized");
1019 r = 0;
1020 goto leave;
1022 self_data = self_data_get();
1023 if (self_data->ctx == 0) {
1024 TRACE("the calling thread has no current context");
1025 r = 0;
1026 goto leave;
1028 r = 0;
1029 leave:
1030 LEAVE;
1031 return r;
1032 }/*}}}*/
1033 /*{{{*/void glDisable(GLenum cap)
1035 struct thd_data_t *self_data;
1037 ONCE_AND_ENTER;
1038 TRACE("cap=0x%x(%s)", cap, disable_enable_cap_str(cap));
1039 if (!glx_extension_enabled) {
1040 TRACE("glx extension not initialized");
1041 goto leave;
1043 self_data = self_data_get();
1044 if (self_data->ctx == 0) {
1045 TRACE("the calling thread has no current context");
1046 goto leave;
1048 /* yayayaya */
1049 leave:
1050 LEAVE;
1051 }/*}}}*/
1052 /*{{{*/void glShadeModel(GLenum mode)
1054 struct thd_data_t *self_data;
1056 ONCE_AND_ENTER;
1057 TRACE("mode=0x%x(%s)", mode, shademodel_mode_str(mode));
1058 if (!glx_extension_enabled) {
1059 TRACE("glx extension not initialized");
1060 goto leave;
1062 self_data = self_data_get();
1063 if (self_data->ctx == 0) {
1064 TRACE("the calling thread has no current context");
1065 goto leave;
1067 /* yayayaya */
1068 leave:
1069 LEAVE;
1070 }/*}}}*/
1071 /*{{{*/GLboolean glIsTexture(GLuint texture)
1073 /* XXX: a texture has a name AND is bound */
1074 struct thd_data_t *self_data;
1075 GLboolean r;
1077 ONCE_AND_ENTER;
1078 TRACE("name=0x%x", texture);
1079 if (!glx_extension_enabled) {
1080 TRACE("glx extension not initialized");
1081 r = GL_FALSE;
1082 goto leave;
1084 self_data = self_data_get();
1085 if (self_data->ctx == 0) {
1086 TRACE("the calling thread has no current context");
1087 r = GL_FALSE;
1088 goto leave;
1090 if (texture == 0) {
1091 r = GL_FALSE;
1092 goto leave;
1094 /* texture - 1 is the index in the texs array */
1095 if ((texture - 1) >= self_data->ctx->texs.n) {
1096 /* this name was not instanciated */
1097 r = GL_FALSE;
1098 goto leave;
1100 if (self_data->ctx->texs.a[texture - 1].bound) {
1101 r = GL_TRUE;
1102 goto leave;
1104 r = GL_FALSE;
1105 leave:
1106 TRACE("ctx=%p:0x%x is %sa texture", self_data->ctx, texture, (r == GL_FALSE) ? "not " : "");
1107 LEAVE;
1108 return r;
1109 }/*}}}*/
1110 /*{{{*/void glTexParameterf(GLenum target, GLenum pname, GLfloat param)
1112 struct thd_data_t *self_data;
1114 ONCE_AND_ENTER;
1115 TRACE("target=0x%x(%s):pname=0x%x(%s):param=%f(%s)", target, tex_target_str(target), pname, texparameter_pname_str(pname), param, texparameterf_param_str(pname, param));
1116 if (!glx_extension_enabled) {
1117 TRACE("glx extension not initialized");
1118 goto leave;
1120 self_data = self_data_get();
1121 if (self_data->ctx == 0) {
1122 TRACE("the calling thread has no current context");
1123 goto leave;
1125 /* muh? */
1126 leave:
1127 LEAVE;
1128 }/*}}}*/
1129 /*{{{*/void glColor4fv(const GLfloat *v)
1131 struct thd_data_t *self_data;
1133 ONCE_AND_ENTER;
1134 #ifdef TRACE_ON
1135 if (v != 0) {
1136 TRACE("v=%p:red=%f:green=%f:blue=%f:alpha=%f", v, v[0], v[1], v[2], v[3]);
1137 } else {
1138 TRACE("v=0x%p",v);
1140 #endif
1141 if (!glx_extension_enabled) {
1142 TRACE("glx extension not initialized");
1143 goto leave;
1145 self_data = self_data_get();
1146 if (self_data->ctx == 0) {
1147 TRACE("the calling thread has no current context");
1148 goto leave;
1150 self_data->ctx->color.red = v[0];
1151 self_data->ctx->color.green = v[1];
1152 self_data->ctx->color.blue = v[2];
1153 self_data->ctx->color.alpha = v[3];
1154 leave:
1155 LEAVE;
1156 }/*}}}*/
1157 /*{{{*/void glLineWidth(GLfloat width)
1159 struct thd_data_t *self_data;
1161 ONCE_AND_ENTER;
1162 TRACE("width=%f", width);
1163 if (!glx_extension_enabled) {
1164 TRACE("glx extension not initialized");
1165 goto leave;
1167 self_data = self_data_get();
1168 if (self_data->ctx == 0) {
1169 TRACE("the calling thread has no current context");
1170 goto leave;
1172 /* muh? */
1173 leave:
1174 LEAVE;
1175 }/*}}}*/
1176 /*{{{*/GLboolean glIsEnabled(GLenum cap)
1178 struct thd_data_t *self_data;
1180 ONCE_AND_ENTER;
1181 TRACE("cap=0x%x(%s)", cap, disable_enable_cap_str(cap));
1182 if (!glx_extension_enabled) {
1183 TRACE("glx extension not initialized");
1184 goto leave;
1186 self_data = self_data_get();
1187 if (self_data->ctx == 0) {
1188 TRACE("the calling thread has no current context");
1189 goto leave;
1191 /* muh? */
1192 leave:
1193 LEAVE;
1194 return GL_FALSE;
1195 }/*}}}*/
1196 /*{{{*/void GLAPIENTRY glGetBooleanv(GLenum pname, GLboolean *params)
1198 struct thd_data_t *self_data;
1200 ONCE_AND_ENTER;
1201 TRACE("cap=0x%x", pname);
1202 if (!glx_extension_enabled) {
1203 TRACE("glx extension not initialized");
1204 goto leave;
1206 self_data = self_data_get();
1207 if (self_data->ctx == 0) {
1208 TRACE("the calling thread has no current context");
1209 goto leave;
1211 /* muh? */
1212 *params = GL_FALSE;
1213 leave:
1214 LEAVE;
1215 }/*}}}*/
1216 /*{{{*/void glColorMask(GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha)
1218 struct thd_data_t *self_data;
1220 ONCE_AND_ENTER;
1221 TRACE("red=%d green=%d blue=%d alpha=%d", red, green, blue, alpha);
1222 if (!glx_extension_enabled) {
1223 TRACE("glx extension not initialized");
1224 goto leave;
1226 self_data = self_data_get();
1227 if (self_data->ctx == 0) {
1228 TRACE("the calling thread has no current context");
1229 goto leave;
1231 /* muh? */
1232 leave:
1233 LEAVE;
1234 }/*}}}*/
1235 /*{{{*/void GLAPIENTRY glDrawArrays(GLenum mode, GLint first, GLsizei count)
1237 struct thd_data_t *self_data;
1239 ONCE_AND_ENTER;
1240 TRACE("mode=0x%x first=%d count=%d", mode, first, count);
1241 if (!glx_extension_enabled) {
1242 TRACE("glx extension not initialized");
1243 goto leave;
1245 self_data = self_data_get();
1246 if (self_data->ctx == 0) {
1247 TRACE("the calling thread has no current context");
1248 goto leave;
1250 /* muh? */
1251 leave:
1252 LEAVE;
1253 }/*}}}*/
1254 /*{{{*/void glTexCoord2i(GLint s, GLint t)
1256 struct thd_data_t *self_data;
1258 ONCE_AND_ENTER;
1259 TRACE("s=%d t=%d", s, t);
1260 if (!glx_extension_enabled) {
1261 TRACE("glx extension not initialized");
1262 goto leave;
1264 self_data = self_data_get();
1265 if (self_data->ctx == 0) {
1266 TRACE("the calling thread has no current context");
1267 goto leave;
1269 /* muh? */
1270 leave:
1271 LEAVE;
1272 }/*}}}*/
1273 /*{{{*/void glDrawElements(GLenum mode, GLsizei count, GLenum type,
1274 const GLvoid *indices)
1276 struct thd_data_t *self_data;
1278 ONCE_AND_ENTER;
1279 TRACE("mode=0x%x count=%d type=0x%x indices=%p", mode, count, type,
1280 indices);
1281 if (!glx_extension_enabled) {
1282 TRACE("glx extension not initialized");
1283 goto leave;
1285 self_data = self_data_get();
1286 if (self_data->ctx == 0) {
1287 TRACE("the calling thread has no current context");
1288 goto leave;
1290 /* muh? */
1291 leave:
1292 LEAVE;
1293 }/*}}}*/
1294 /*{{{*/void glTexCoord2d(GLdouble s, GLdouble t)
1296 struct thd_data_t *self_data;
1298 ONCE_AND_ENTER;
1299 TRACE("s=%f t=%f", s, t);
1300 if (!glx_extension_enabled) {
1301 TRACE("glx extension not initialized");
1302 goto leave;
1304 self_data = self_data_get();
1305 if (self_data->ctx == 0) {
1306 TRACE("the calling thread has no current context");
1307 goto leave;
1309 /* muh? */
1310 leave:
1311 LEAVE;
1312 }/*}}}*/
1313 /*{{{*/void glVertex3f(GLfloat x, GLfloat y, GLfloat z)
1315 struct thd_data_t *self_data;
1317 ONCE_AND_ENTER;
1318 TRACE("x=%f y=%f z=%f", x, y, z);
1319 if (!glx_extension_enabled) {
1320 TRACE("glx extension not initialized");
1321 goto leave;
1323 self_data = self_data_get();
1324 if (self_data->ctx == 0) {
1325 TRACE("the calling thread has no current context");
1326 goto leave;
1328 /* muh? */
1329 leave:
1330 LEAVE;
1331 }/*}}}*/
1332 /*{{{*/void glDepthRange(GLclampd near_val, GLclampd far_val)
1334 struct thd_data_t *self_data;
1336 ONCE_AND_ENTER;
1337 TRACE("near_val=%f far_val=%f", near_val, far_val);
1338 if (!glx_extension_enabled) {
1339 TRACE("glx extension not initialized");
1340 goto leave;
1342 self_data = self_data_get();
1343 if (self_data->ctx == 0) {
1344 TRACE("the calling thread has no current context");
1345 goto leave;
1347 /* muh? */
1348 leave:
1349 LEAVE;
1350 }/*}}}*/
1351 /*{{{*/void glDepthMask(GLboolean flag)
1353 struct thd_data_t *self_data;
1355 ONCE_AND_ENTER;
1356 TRACE("flag=%u", flag);
1357 if (!glx_extension_enabled) {
1358 TRACE("glx extension not initialized");
1359 goto leave;
1361 self_data = self_data_get();
1362 if (self_data->ctx == 0) {
1363 TRACE("the calling thread has no current context");
1364 goto leave;
1366 /* muh? */
1367 leave:
1368 LEAVE;
1369 }/*}}}*/
1370 /*{{{*/void glPolygonMode(GLenum face, GLenum mode)
1372 struct thd_data_t *self_data;
1374 ONCE_AND_ENTER;
1375 TRACE("face=0x%x mode=0x%x", face, mode);
1376 if (!glx_extension_enabled) {
1377 TRACE("glx extension not initialized");
1378 goto leave;
1380 self_data = self_data_get();
1381 if (self_data->ctx == 0) {
1382 TRACE("the calling thread has no current context");
1383 goto leave;
1385 /* muh? */
1386 leave:
1387 LEAVE;
1388 }/*}}}*/
1389 /*{{{*/void glPopClientAttrib(void)
1391 struct thd_data_t *self_data;
1393 ONCE_AND_ENTER;
1394 TRACE("void");
1395 if (!glx_extension_enabled) {
1396 TRACE("glx extension not initialized");
1397 goto leave;
1399 self_data = self_data_get();
1400 if (self_data->ctx == 0) {
1401 TRACE("the calling thread has no current context");
1402 goto leave;
1404 /* muh? */
1405 leave:
1406 LEAVE;
1407 }/*}}}*/
1408 /*{{{*/void glPopAttrib(void)
1410 struct thd_data_t *self_data;
1412 ONCE_AND_ENTER;
1413 TRACE("void");
1414 if (!glx_extension_enabled) {
1415 TRACE("glx extension not initialized");
1416 goto leave;
1418 self_data = self_data_get();
1419 if (self_data->ctx == 0) {
1420 TRACE("the calling thread has no current context");
1421 goto leave;
1423 /* muh? */
1424 leave:
1425 LEAVE;
1426 }/*}}}*/
1427 /*{{{*/void glLoadMatrixf(const GLfloat *m)
1429 struct thd_data_t *self_data;
1431 ONCE_AND_ENTER;
1432 TRACE("m=%p", m);
1433 if (!glx_extension_enabled) {
1434 TRACE("glx extension not initialized");
1435 goto leave;
1437 self_data = self_data_get();
1438 if (self_data->ctx == 0) {
1439 TRACE("the calling thread has no current context");
1440 goto leave;
1442 /* muh? */
1443 leave:
1444 LEAVE;
1445 }/*}}}*/
1446 /*{{{*/void glPushAttrib(GLbitfield mask)
1448 struct thd_data_t *self_data;
1450 ONCE_AND_ENTER;
1451 TRACE("masx=0x%x", mask);
1452 if (!glx_extension_enabled) {
1453 TRACE("glx extension not initialized");
1454 goto leave;
1456 self_data = self_data_get();
1457 if (self_data->ctx == 0) {
1458 TRACE("the calling thread has no current context");
1459 goto leave;
1461 /* muh? */
1462 leave:
1463 LEAVE;
1464 }/*}}}*/
1465 /*{{{*/void glPushClientAttrib(GLbitfield mask)
1467 struct thd_data_t *self_data;
1469 ONCE_AND_ENTER;
1470 TRACE("masx=0x%x", mask);
1471 if (!glx_extension_enabled) {
1472 TRACE("glx extension not initialized");
1473 goto leave;
1475 self_data = self_data_get();
1476 if (self_data->ctx == 0) {
1477 TRACE("the calling thread has no current context");
1478 goto leave;
1480 /* muh? */
1481 leave:
1482 LEAVE;
1483 }/*}}}*/
1484 /*{{{*/void glPixelZoom(GLfloat xfactor, GLfloat yfactor)
1486 struct thd_data_t *self_data;
1488 ONCE_AND_ENTER;
1489 TRACE("xfactor=%f yfactor=%f", xfactor, yfactor);
1490 if (!glx_extension_enabled) {
1491 TRACE("glx extension not initialized");
1492 goto leave;
1494 self_data = self_data_get();
1495 if (self_data->ctx == 0) {
1496 TRACE("the calling thread has no current context");
1497 goto leave;
1499 /* muh? */
1500 leave:
1501 LEAVE;
1502 }/*}}}*/
1503 /*{{{*/void glGetDoublev(GLenum pname, GLdouble *params)
1505 struct thd_data_t *self_data;
1507 ONCE_AND_ENTER;
1508 TRACE("pname=0x%x params=%p", pname, params);
1509 if (!glx_extension_enabled) {
1510 TRACE("glx extension not initialized");
1511 goto leave;
1513 self_data = self_data_get();
1514 if (self_data->ctx == 0) {
1515 TRACE("the calling thread has no current context");
1516 goto leave;
1518 /* muh? */
1519 *params = 0.;
1520 leave:
1521 LEAVE;
1522 }/*}}}*/
1523 /*{{{*/void glGetFloatv(GLenum pname, GLfloat *params)
1525 struct thd_data_t *self_data;
1527 ONCE_AND_ENTER;
1528 TRACE("pname=0x%x params=%p", pname, params);
1529 if (!glx_extension_enabled) {
1530 TRACE("glx extension not initialized");
1531 goto leave;
1533 self_data = self_data_get();
1534 if (self_data->ctx == 0) {
1535 TRACE("the calling thread has no current context");
1536 goto leave;
1538 /* muh? */
1539 *params = 0.;
1540 leave:
1541 LEAVE;
1542 }/*}}}*/
1543 /*{{{*/void glScalef(GLfloat x, GLfloat y, GLfloat z)
1545 struct thd_data_t *self_data;
1547 ONCE_AND_ENTER;
1548 TRACE("x=%f y=%f z=%f", x, y, z);
1549 if (!glx_extension_enabled) {
1550 TRACE("glx extension not initialized");
1551 goto leave;
1553 self_data = self_data_get();
1554 if (self_data->ctx == 0) {
1555 TRACE("the calling thread has no current context");
1556 goto leave;
1558 leave:
1559 LEAVE;
1560 }/*}}}*/
1561 #endif