3 /*{{{*/const GLubyte
*glGetString(GLenum name
)
6 struct thd_data_t
*self_data
;
9 TRACE("0x%x(%s)", name
, getstring_str(name
));
10 if (!glx_extension_enabled
) {
11 TRACE("glx extension not initialized");
15 self_data
= self_data_get();
16 if (self_data
->ctx
== 0) {
17 TRACE("self thread has no current context");
26 r
= "mini 2D libgl(glx) compatibility profile for the 32bits part of the steam runtime";
33 r
= ""; /* only in compatibility profile */
35 case GL_SHADING_LANGUAGE_VERSION
:
47 /*{{{*/void glDeleteTextures(GLsizei n
, const GLuint
*textures
)
49 struct thd_data_t
*self_data
;
54 TRACE("n=%d:textures=%p", n
, textures
);
55 if (!glx_extension_enabled
) {
56 TRACE("glx extension not initialized");
59 self_data
= self_data_get();
60 if (self_data
->ctx
== 0) {
61 TRACE("the calling thread has no current context");
69 /* the name of a texture - 1 is its index in texs array */
70 if ((textures
[i
] != 0) && ((textures
[i
] - 1) < ctx
->texs
.n
)) {
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];
82 tex
->write_to_client
.align
= 4;
83 tex
->read_from_client
.align
= 4;
84 tex
->read_from_client
.row_pixels_n
= 0;
91 /*{{{*/void glGenTextures(GLsizei n
, GLuint
*textures
)
93 struct thd_data_t
*self_data
;
102 TRACE("n=%d:textures=%p", n
, textures
);
103 if (!glx_extension_enabled
) {
104 TRACE("glx extension not initialized");
109 self_data
= self_data_get();
110 if (self_data
->ctx
== 0) {
111 TRACE("the calling thread has no current context");
114 ctx
= self_data
->ctx
;
116 texs_n
= ctx
->texs
.n
;
119 loop
{ /* reuse as many as we can */
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
]);
133 ctx
->texs
.a
= realloc(ctx
->texs
.a
, sizeof(*(ctx
->texs
.a
)) * (texs_n
138 if (j
== (texs_n
+ (n
- reused_n
)))
140 texs
[j
].bound
= false;
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
]);
154 ctx
->texs
.n
+= n
- reused_n
;
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
;
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");
175 self_data
= self_data_get();
176 if (self_data
->ctx
== 0) {
177 TRACE("the calling thread has no current context");
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
);
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
));
191 TRACE("ctx=%p:rebinding texture 0x%x to same target 0x%x(%s)", self_data
->ctx
, texture
, target
, tex_target_str(target
));
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
;
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
;
226 u32 dst_width_pixs_n
;
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");
240 self_data
= self_data_get();
241 if (self_data
->ctx
== 0) {
242 TRACE("the calling thread has no current context");
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
));
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
);
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
);
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
);
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
;
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
);
286 if (tex
->read_from_client
.row_pixels_n
== 0)
287 memcpy(tex
->pixels
, pixels
, tex_bytes_n
);
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);
315 tex
->height
= height
;
316 tex
->format
= format
;
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
;
331 u32 dst_width_pixs_n
;
338 GLuint dst_line_bytes_n
;
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");
355 self_data
= self_data_get();
356 if (self_data
->ctx
== 0) {
357 TRACE("the calling thread has no current context");
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
));
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
));
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
);
377 if (pixels
== 0 || tex
->pixels
== 0 || width
== 0 || height
== 0)
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
;
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
);
393 src_pixels
= (u8
*)pixels
;
394 dst_pixels
= tex
->pixels
;
395 if (pixels
== 0 || tex
->pixels
== 0 || width
== 0 || height
== 0)
397 dst_line_bytes_n
= tex
->width
<< 2;
400 TRACE("texture2d=0x%x dst_line_bytes_n=%u", texture2d
, dst_line_bytes_n
);
402 if (dst_y
== yoffset
+ height
)
410 if (dst_x
== xoffset
+ width
)
412 dst_pix
= dst_pixels
+ dst_y
* dst_line_bytes_n
414 if (tex
->read_from_client
.row_pixels_n
== 0)
415 src_pix
= src_pixels
+ ((src_y
* width
+ src_x
) << 2);
417 src_pix
= src_pixels
+ ((src_y
* tex
->read_from_client
.row_pixels_n
+ src_x
) << 2);
418 memcpy(dst_pix
, src_pix
, 4);
429 /*{{{*/void glEnable(GLenum cap
)
431 struct thd_data_t
*self_data
;
435 TRACE("cap=0x%x(%s)", cap
, disable_enable_cap_str(cap
));
436 if (!glx_extension_enabled
) {
437 TRACE("glx extension not initialized");
440 self_data
= self_data_get();
441 if (self_data
->ctx
== 0) {
442 TRACE("the calling thread has no current context");
445 ctx
= self_data
->ctx
;
447 ctx
->blending_enabled
= true;
451 /*{{{*/void glMatrixMode(GLenum mode
)
453 struct thd_data_t
*self_data
;
456 TRACE("mode=0x%x(%s)", mode
, matrixmode_mode_str(mode
));
457 if (!glx_extension_enabled
) {
458 TRACE("glx extension not initialized");
461 self_data
= self_data_get();
462 if (self_data
->ctx
== 0) {
463 TRACE("the calling thread has no current context");
466 self_data
->ctx
->mtxs
.current
= mode
;
470 /*{{{*/void glLoadIdentity(void)
472 struct thd_data_t
*self_data
;
479 if (!glx_extension_enabled
) {
480 TRACE("glx extension not initialized");
483 self_data
= self_data_get();
484 if (self_data
->ctx
== 0) {
485 TRACE("the calling thread has no current context");
488 switch(self_data
->ctx
->mtxs
.current
) {
490 mtx
= self_data
->ctx
->mtxs
.mv
;
493 mtx
= self_data
->ctx
->mtxs
.proj
;
496 mtx
= self_data
->ctx
->mtxs
.tex
;
499 mtx
= self_data
->ctx
->mtxs
.col
;
502 LOG("WARNING:unknown matrix 0x%x in context %p", self_data
->ctx
->mtxs
.current
, self_data
->ctx
);
524 /*{{{*/void glOrtho(GLdouble left
, GLdouble right
, GLdouble bottom
, GLdouble top
, GLdouble near_val
, GLdouble far_val
)
526 struct thd_data_t
*self_data
;
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");
535 self_data
= self_data_get();
536 if (self_data
->ctx
== 0) {
537 TRACE("the calling thread has no current context");
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");
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
;
554 /*{{{*/void glTranslatef(GLfloat x
, GLfloat y
, GLfloat z
)
556 struct thd_data_t
*self_data
;
560 TRACE("x=%f:y=%f:z=%f", x
, y
, z
);
561 if (!glx_extension_enabled
) {
562 TRACE("glx extension not initialized");
565 self_data
= self_data_get();
566 if (self_data
->ctx
== 0) {
567 TRACE("the calling thread has no current context");
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");
575 ctx
->mtxs
.mv_translate
.x
= x
;
576 ctx
->mtxs
.mv_translate
.y
= y
;
577 ctx
->mtxs
.mv_translate
.z
= z
;
581 /*{{{*/void glDisableClientState(GLenum cap
)
583 struct thd_data_t
*self_data
;
586 TRACE("cap=0x%x(%s)", cap
, disable_enable_cap_str(cap
));
587 if (!glx_extension_enabled
) {
588 TRACE("glx extension not initialized");
591 self_data
= self_data_get();
592 if (self_data
->ctx
== 0) {
593 TRACE("the calling thread has no current context");
600 /*{{{*/void glTexEnvf(GLenum target
, GLenum pname
, GLfloat param
)
602 struct thd_data_t
*self_data
;
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");
611 self_data
= self_data_get();
612 if (self_data
->ctx
== 0) {
613 TRACE("the calling thread has no current context");
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
);
622 /*{{{*/void glColor4f(GLfloat red
, GLfloat green
, GLfloat blue
, GLfloat alpha
)
624 struct thd_data_t
*self_data
;
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");
632 self_data
= self_data_get();
633 if (self_data
->ctx
== 0) {
634 TRACE("the calling thread has no current context");
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
;
644 /*{{{*/void glReadBuffer(GLenum mode
)
647 TRACE("mode=%d", mode
);
648 if (!glx_extension_enabled
) {
649 TRACE("glx extension not initialized");
652 // XXX: does forget the texture alignment
656 /*{{{*/void glPixelStorei(GLenum pname
, GLint param
)
658 struct thd_data_t
*self_data
;
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");
667 self_data
= self_data_get();
668 if (self_data
->ctx
== 0) {
669 TRACE("the calling thread has no current context");
672 ctx
= self_data
->ctx
;
674 case GL_UNPACK_ALIGNMENT
:
675 if (ctx
->texs
.texture2d
!= 0) {
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
);
683 case GL_UNPACK_ROW_LENGTH
:
684 if (ctx
->texs
.texture2d
!= 0) {
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
);
692 case GL_PACK_ALIGNMENT
:
693 if (ctx
->texs
.texture2d
!= 0) {
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
);
702 TRACE("WARNING:unhandled storage parameter");
708 /*{{{*/void glTexParameteri(GLenum target
, GLenum pname
, GLint param
)
710 struct thd_data_t
*self_data
;
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");
718 self_data
= self_data_get();
719 if (self_data
->ctx
== 0) {
720 TRACE("the calling thread has no current context");
726 /*{{{*/void glReadPixels(GLint x
, GLint y
, GLsizei width
, GLsizei height
, GLenum format
, GLenum type
, GLvoid
*pixels
)
728 struct thd_data_t
*self_data
;
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");
736 self_data
= self_data_get();
737 if (self_data
->ctx
== 0) {
738 TRACE("the calling thread has no current context");
744 /*{{{*/void glViewport(GLint x
, GLint y
, GLsizei width
, GLsizei height
)
746 struct thd_data_t
*self_data
;
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");
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");
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
;
766 /*{{{*/void glBegin(GLenum mode
)
768 struct thd_data_t
*self_data
;
771 TRACE("mode=0x%x(%s)", mode
, begin_mode(mode
));
772 if (!glx_extension_enabled
) {
773 TRACE("glx extension not initialized");
776 self_data
= self_data_get();
777 if (self_data
->ctx
== 0) {
778 TRACE("the calling thread has no current context");
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;
787 /*{{{*/void glEnd( void )
789 struct thd_data_t
*self_data
;
793 if (!glx_extension_enabled
) {
794 TRACE("glx extension not initialized");
797 self_data
= self_data_get();
798 if (self_data
->ctx
== 0) {
799 TRACE("the calling thread has no current context");
802 render_in_shm(self_data
->ctx
);
803 self_data
->ctx
->begin_end_blk
.recording
= false;
807 /*{{{*/void glTexCoord2f( GLfloat s
, GLfloat t
)
809 struct thd_data_t
*self_data
;
813 TRACE("s=%f:t=%f", s
, t
);
814 if (!glx_extension_enabled
) {
815 TRACE("glx extension not initialized");
818 self_data
= self_data_get();
819 if (self_data
->ctx
== 0) {
820 TRACE("the calling thread has no current context");
823 ctx
= self_data
->ctx
;
824 if (!ctx
->begin_end_blk
.recording
) {
825 LOG("WARNING:outside of a glBegin/glEnd block, ignoring");
828 if (ctx
->begin_end_blk
.quad
.i
> 4) {
829 LOG("WARNING:out of storage, ignoring");
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
;
837 /*{{{*/void glVertex2f(GLfloat x
, GLfloat y
)
839 struct thd_data_t
*self_data
;
843 TRACE("x=%f:y=%f", x
, y
);
844 if (!glx_extension_enabled
) {
845 TRACE("glx extension not initialized");
848 self_data
= self_data_get();
849 if (self_data
->ctx
== 0) {
850 TRACE("the calling thread has no current context");
853 ctx
= self_data
->ctx
;
854 if (!ctx
->begin_end_blk
.recording
) {
855 LOG("WARNING:outside of a glBegin/glEnd block, ignoring");
858 if (ctx
->begin_end_blk
.quad
.i
> 4) {
859 LOG("WARNING:out of storage, ignoring");
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
=
866 ctx
->begin_end_blk
.quad
.vs
[ctx
->begin_end_blk
.quad
.i
].color
.green
=
868 ctx
->begin_end_blk
.quad
.vs
[ctx
->begin_end_blk
.quad
.i
].color
.blue
=
870 ctx
->begin_end_blk
.quad
.vs
[ctx
->begin_end_blk
.quad
.i
].color
.alpha
=
872 ++(ctx
->begin_end_blk
.quad
.i
); /* vertex coords, then advance */
876 /*{{{*/void glColor4ub(GLubyte red
, GLubyte green
, GLubyte blue
, GLubyte alpha
)
878 struct thd_data_t
*self_data
;
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");
886 self_data
= self_data_get();
887 if (self_data
->ctx
== 0) {
888 TRACE("the calling thread has no current context");
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.;
898 /*{{{*/void glClearColor(GLclampf red
, GLclampf green
, GLclampf blue
, GLclampf alpha
)
900 struct thd_data_t
*self_data
;
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");
908 self_data
= self_data_get();
909 if (self_data
->ctx
== 0) {
910 TRACE("the calling thread has no current context");
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
;
920 /*{{{*/void glClear(GLbitfield mask
)
922 struct thd_data_t
*self_data
;
925 TRACE("mask=0x%x", mask
);
926 if (!glx_extension_enabled
) {
927 TRACE("glx extension not initialized");
930 self_data
= self_data_get();
931 if (self_data
->ctx
== 0) {
932 TRACE("the calling thread has no current context");
935 if ((mask
& GL_COLOR_BUFFER_BIT
) != 0)
936 color_buffer_clear(self_data
->ctx
);
940 /*{{{*/GLenum
glGetError(void)
946 if (!glx_extension_enabled
) {
947 TRACE("glx extension not initialized");
956 /*{{{*/void glGetIntegerv(GLenum pname
, GLint
*params
)
958 struct thd_data_t
*self_data
;
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");
966 self_data
= self_data_get();
967 if (self_data
->ctx
== 0) {
968 TRACE("the calling thread has no current context");
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]);
981 case GL_NUM_EXTENSIONS
:
982 params
[0] = 0; /* no extensions */
990 /*{{{*/void glBlendFunc(GLenum sfactor
, GLenum dfactor
)
992 struct thd_data_t
*self_data
;
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");
1000 self_data
= self_data_get();
1001 if (self_data
->ctx
== 0) {
1002 TRACE("the calling thread has no current context");
1005 if (sfactor
!= GL_SRC_ALPHA
|| dfactor
!= GL_ONE_MINUS_SRC_ALPHA
)
1006 LOG("ctx=%p:ERROR: blendind function not supported", self_data
->ctx
);
1010 /*{{{*/GLint
glRenderMode(GLenum mode
)
1013 struct thd_data_t
*self_data
;
1016 TRACE("mode=0x%x(%s)", mode
, rendermode_str(mode
));
1017 if (!glx_extension_enabled
) {
1018 TRACE("glx extension not initialized");
1022 self_data
= self_data_get();
1023 if (self_data
->ctx
== 0) {
1024 TRACE("the calling thread has no current context");
1033 /*{{{*/void glDisable(GLenum cap
)
1035 struct thd_data_t
*self_data
;
1038 TRACE("cap=0x%x(%s)", cap
, disable_enable_cap_str(cap
));
1039 if (!glx_extension_enabled
) {
1040 TRACE("glx extension not initialized");
1043 self_data
= self_data_get();
1044 if (self_data
->ctx
== 0) {
1045 TRACE("the calling thread has no current context");
1052 /*{{{*/void glShadeModel(GLenum mode
)
1054 struct thd_data_t
*self_data
;
1057 TRACE("mode=0x%x(%s)", mode
, shademodel_mode_str(mode
));
1058 if (!glx_extension_enabled
) {
1059 TRACE("glx extension not initialized");
1062 self_data
= self_data_get();
1063 if (self_data
->ctx
== 0) {
1064 TRACE("the calling thread has no current context");
1071 /*{{{*/GLboolean
glIsTexture(GLuint texture
)
1073 /* XXX: a texture has a name AND is bound */
1074 struct thd_data_t
*self_data
;
1078 TRACE("name=0x%x", texture
);
1079 if (!glx_extension_enabled
) {
1080 TRACE("glx extension not initialized");
1084 self_data
= self_data_get();
1085 if (self_data
->ctx
== 0) {
1086 TRACE("the calling thread has no current context");
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 */
1100 if (self_data
->ctx
->texs
.a
[texture
- 1].bound
) {
1106 TRACE("ctx=%p:0x%x is %sa texture", self_data
->ctx
, texture
, (r
== GL_FALSE
) ? "not " : "");
1110 /*{{{*/void glTexParameterf(GLenum target
, GLenum pname
, GLfloat param
)
1112 struct thd_data_t
*self_data
;
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");
1120 self_data
= self_data_get();
1121 if (self_data
->ctx
== 0) {
1122 TRACE("the calling thread has no current context");
1129 /*{{{*/void glColor4fv(const GLfloat
*v
)
1131 struct thd_data_t
*self_data
;
1136 TRACE("v=%p:red=%f:green=%f:blue=%f:alpha=%f", v
, v
[0], v
[1], v
[2], v
[3]);
1141 if (!glx_extension_enabled
) {
1142 TRACE("glx extension not initialized");
1145 self_data
= self_data_get();
1146 if (self_data
->ctx
== 0) {
1147 TRACE("the calling thread has no current context");
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];
1157 /*{{{*/void glLineWidth(GLfloat width
)
1159 struct thd_data_t
*self_data
;
1162 TRACE("width=%f", width
);
1163 if (!glx_extension_enabled
) {
1164 TRACE("glx extension not initialized");
1167 self_data
= self_data_get();
1168 if (self_data
->ctx
== 0) {
1169 TRACE("the calling thread has no current context");
1176 /*{{{*/GLboolean
glIsEnabled(GLenum cap
)
1178 struct thd_data_t
*self_data
;
1181 TRACE("cap=0x%x(%s)", cap
, disable_enable_cap_str(cap
));
1182 if (!glx_extension_enabled
) {
1183 TRACE("glx extension not initialized");
1186 self_data
= self_data_get();
1187 if (self_data
->ctx
== 0) {
1188 TRACE("the calling thread has no current context");
1196 /*{{{*/void GLAPIENTRY
glGetBooleanv(GLenum pname
, GLboolean
*params
)
1198 struct thd_data_t
*self_data
;
1201 TRACE("cap=0x%x", pname
);
1202 if (!glx_extension_enabled
) {
1203 TRACE("glx extension not initialized");
1206 self_data
= self_data_get();
1207 if (self_data
->ctx
== 0) {
1208 TRACE("the calling thread has no current context");
1216 /*{{{*/void glColorMask(GLboolean red
, GLboolean green
, GLboolean blue
, GLboolean alpha
)
1218 struct thd_data_t
*self_data
;
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");
1226 self_data
= self_data_get();
1227 if (self_data
->ctx
== 0) {
1228 TRACE("the calling thread has no current context");
1235 /*{{{*/void GLAPIENTRY
glDrawArrays(GLenum mode
, GLint first
, GLsizei count
)
1237 struct thd_data_t
*self_data
;
1240 TRACE("mode=0x%x first=%d count=%d", mode
, first
, count
);
1241 if (!glx_extension_enabled
) {
1242 TRACE("glx extension not initialized");
1245 self_data
= self_data_get();
1246 if (self_data
->ctx
== 0) {
1247 TRACE("the calling thread has no current context");
1254 /*{{{*/void glTexCoord2i(GLint s
, GLint t
)
1256 struct thd_data_t
*self_data
;
1259 TRACE("s=%d t=%d", s
, t
);
1260 if (!glx_extension_enabled
) {
1261 TRACE("glx extension not initialized");
1264 self_data
= self_data_get();
1265 if (self_data
->ctx
== 0) {
1266 TRACE("the calling thread has no current context");
1273 /*{{{*/void glDrawElements(GLenum mode
, GLsizei count
, GLenum type
,
1274 const GLvoid
*indices
)
1276 struct thd_data_t
*self_data
;
1279 TRACE("mode=0x%x count=%d type=0x%x indices=%p", mode
, count
, type
,
1281 if (!glx_extension_enabled
) {
1282 TRACE("glx extension not initialized");
1285 self_data
= self_data_get();
1286 if (self_data
->ctx
== 0) {
1287 TRACE("the calling thread has no current context");
1294 /*{{{*/void glTexCoord2d(GLdouble s
, GLdouble t
)
1296 struct thd_data_t
*self_data
;
1299 TRACE("s=%f t=%f", s
, t
);
1300 if (!glx_extension_enabled
) {
1301 TRACE("glx extension not initialized");
1304 self_data
= self_data_get();
1305 if (self_data
->ctx
== 0) {
1306 TRACE("the calling thread has no current context");
1313 /*{{{*/void glVertex3f(GLfloat x
, GLfloat y
, GLfloat z
)
1315 struct thd_data_t
*self_data
;
1318 TRACE("x=%f y=%f z=%f", x
, y
, z
);
1319 if (!glx_extension_enabled
) {
1320 TRACE("glx extension not initialized");
1323 self_data
= self_data_get();
1324 if (self_data
->ctx
== 0) {
1325 TRACE("the calling thread has no current context");
1332 /*{{{*/void glDepthRange(GLclampd near_val
, GLclampd far_val
)
1334 struct thd_data_t
*self_data
;
1337 TRACE("near_val=%f far_val=%f", near_val
, far_val
);
1338 if (!glx_extension_enabled
) {
1339 TRACE("glx extension not initialized");
1342 self_data
= self_data_get();
1343 if (self_data
->ctx
== 0) {
1344 TRACE("the calling thread has no current context");
1351 /*{{{*/void glDepthMask(GLboolean flag
)
1353 struct thd_data_t
*self_data
;
1356 TRACE("flag=%u", flag
);
1357 if (!glx_extension_enabled
) {
1358 TRACE("glx extension not initialized");
1361 self_data
= self_data_get();
1362 if (self_data
->ctx
== 0) {
1363 TRACE("the calling thread has no current context");
1370 /*{{{*/void glPolygonMode(GLenum face
, GLenum mode
)
1372 struct thd_data_t
*self_data
;
1375 TRACE("face=0x%x mode=0x%x", face
, mode
);
1376 if (!glx_extension_enabled
) {
1377 TRACE("glx extension not initialized");
1380 self_data
= self_data_get();
1381 if (self_data
->ctx
== 0) {
1382 TRACE("the calling thread has no current context");
1389 /*{{{*/void glPopClientAttrib(void)
1391 struct thd_data_t
*self_data
;
1395 if (!glx_extension_enabled
) {
1396 TRACE("glx extension not initialized");
1399 self_data
= self_data_get();
1400 if (self_data
->ctx
== 0) {
1401 TRACE("the calling thread has no current context");
1408 /*{{{*/void glPopAttrib(void)
1410 struct thd_data_t
*self_data
;
1414 if (!glx_extension_enabled
) {
1415 TRACE("glx extension not initialized");
1418 self_data
= self_data_get();
1419 if (self_data
->ctx
== 0) {
1420 TRACE("the calling thread has no current context");
1427 /*{{{*/void glLoadMatrixf(const GLfloat
*m
)
1429 struct thd_data_t
*self_data
;
1433 if (!glx_extension_enabled
) {
1434 TRACE("glx extension not initialized");
1437 self_data
= self_data_get();
1438 if (self_data
->ctx
== 0) {
1439 TRACE("the calling thread has no current context");
1446 /*{{{*/void glPushAttrib(GLbitfield mask
)
1448 struct thd_data_t
*self_data
;
1451 TRACE("masx=0x%x", mask
);
1452 if (!glx_extension_enabled
) {
1453 TRACE("glx extension not initialized");
1456 self_data
= self_data_get();
1457 if (self_data
->ctx
== 0) {
1458 TRACE("the calling thread has no current context");
1465 /*{{{*/void glPushClientAttrib(GLbitfield mask
)
1467 struct thd_data_t
*self_data
;
1470 TRACE("masx=0x%x", mask
);
1471 if (!glx_extension_enabled
) {
1472 TRACE("glx extension not initialized");
1475 self_data
= self_data_get();
1476 if (self_data
->ctx
== 0) {
1477 TRACE("the calling thread has no current context");
1484 /*{{{*/void glPixelZoom(GLfloat xfactor
, GLfloat yfactor
)
1486 struct thd_data_t
*self_data
;
1489 TRACE("xfactor=%f yfactor=%f", xfactor
, yfactor
);
1490 if (!glx_extension_enabled
) {
1491 TRACE("glx extension not initialized");
1494 self_data
= self_data_get();
1495 if (self_data
->ctx
== 0) {
1496 TRACE("the calling thread has no current context");
1503 /*{{{*/void glGetDoublev(GLenum pname
, GLdouble
*params
)
1505 struct thd_data_t
*self_data
;
1508 TRACE("pname=0x%x params=%p", pname
, params
);
1509 if (!glx_extension_enabled
) {
1510 TRACE("glx extension not initialized");
1513 self_data
= self_data_get();
1514 if (self_data
->ctx
== 0) {
1515 TRACE("the calling thread has no current context");
1523 /*{{{*/void glGetFloatv(GLenum pname
, GLfloat
*params
)
1525 struct thd_data_t
*self_data
;
1528 TRACE("pname=0x%x params=%p", pname
, params
);
1529 if (!glx_extension_enabled
) {
1530 TRACE("glx extension not initialized");
1533 self_data
= self_data_get();
1534 if (self_data
->ctx
== 0) {
1535 TRACE("the calling thread has no current context");
1543 /*{{{*/void glScalef(GLfloat x
, GLfloat y
, GLfloat z
)
1545 struct thd_data_t
*self_data
;
1548 TRACE("x=%f y=%f z=%f", x
, y
, z
);
1549 if (!glx_extension_enabled
) {
1550 TRACE("glx extension not initialized");
1553 self_data
= self_data_get();
1554 if (self_data
->ctx
== 0) {
1555 TRACE("the calling thread has no current context");