1 #include "coregl_fastpath.h"
11 #include <sys/syscall.h>
13 #define CURR_STATE_COMPARE(curr_state, state ) \
14 if ((current_ctx->curr_state[0]) != (state))
16 #define STATE_PROC_WITH_CHECK(gl_state, flagid, flagbit) \
17 if (current_ctx->gl_state##_used == 1) \
19 STATE_PROC(gl_state, flagid, flagbit) \
22 _set_gl_error(GL_INVALID_ENUM);
24 #define IF_GL_SUCCESS(orig_gl_func) \
27 if (_get_gl_error() == GL_NO_ERROR)
29 #define DEFINE_FASTPAH_GL_FUNC() \
30 MY_MODULE_TSTATE *tstate = NULL; \
31 GLGlueContext *current_ctx = NULL;
33 #define INIT_FASTPATH_GL_FUNC() \
34 GET_MY_TSTATE(tstate, get_current_thread_state()); \
35 if (tstate == NULL || tstate->cstate == NULL) \
37 COREGL_WRN("\E[40;31;1m'%s' called when GLES context is not binded (Check MakeCurrent)!\E[0m\n", __func__); \
40 current_ctx = (GLGlueContext *)tstate->cstate->data; \
41 AST(current_ctx != NULL);
43 #define GET_REAL_OBJ(type, glue_handle, real_handle) \
44 _get_real_obj(¤t_ctx->ostate, type, glue_handle, real_handle)
45 #define GET_GLUE_OBJ(type, real_handle, glue_handle) \
46 _get_glue_obj(¤t_ctx->ostate, type, real_handle, glue_handle)
49 _get_real_obj(GL_Object_State *ostate, GL_Object_Type type, GLuint glue_handle,
52 if (glue_handle == 0) {
56 *real_handle = fastpath_ostate_get_object(ostate, type, glue_handle);
57 if (*real_handle == 0)
64 _get_glue_obj(GL_Object_State *ostate, GL_Object_Type type, GLuint real_handle,
67 if (real_handle == 0) {
71 *glue_handle = fastpath_ostate_find_object(ostate, type, real_handle);
72 if (*glue_handle == 0)
81 GLenum glerror = GL_NONE;
82 DEFINE_FASTPAH_GL_FUNC();
83 INIT_FASTPATH_GL_FUNC();
85 glerror = _orig_fastpath_glGetError();
87 if (current_ctx->gl_error == GL_NO_ERROR && glerror != GL_NO_ERROR) {
88 current_ctx->gl_error = glerror;
97 _set_gl_error(GLenum error)
99 DEFINE_FASTPAH_GL_FUNC();
100 INIT_FASTPATH_GL_FUNC();
104 if (current_ctx->gl_error == GL_NO_ERROR && error != GL_NO_ERROR) {
105 current_ctx->gl_error = error;
114 GLsizei shader_count;
117 } Program_object_attached_tag;
120 _create_program_object(GL_Object_State *ostate, int is_program,
127 real_obj = _orig_fastpath_glCreateProgram();
129 real_obj = _orig_fastpath_glCreateShader(shader_type);
132 ret = fastpath_ostate_create_object(ostate, GL_OBJECT_TYPE_PROGRAM, real_obj);
133 Program_object_attached_tag *poat = NULL;
135 if (ret != _COREGL_INT_INIT_VALUE) {
136 poat = (Program_object_attached_tag *)calloc(1,
137 sizeof(Program_object_attached_tag));
140 fastpath_ostate_remove_object(ostate, GL_OBJECT_TYPE_PROGRAM, ret);
142 poat->is_deleting = 0;
143 poat->shader_count = 0;
145 fastpath_ostate_set_object_tag(ostate, GL_OBJECT_TYPE_PROGRAM, ret, poat);
153 _update_program_attach_info(GL_Object_State *ostate, GLuint program)
155 Program_object_attached_tag *poat = NULL;
156 GLuint real_program = _COREGL_INT_INIT_VALUE;
158 poat = (Program_object_attached_tag *)fastpath_ostate_get_object_tag(ostate,
159 GL_OBJECT_TYPE_PROGRAM, program);
162 real_program = fastpath_ostate_get_object(ostate, GL_OBJECT_TYPE_PROGRAM,
164 AST(real_program > 0);
166 _orig_fastpath_glGetAttachedShaders(real_program, 10, &poat->shader_count,
171 _attach_program_object(GL_Object_State *ostate, GLuint object)
174 fastpath_ostate_use_object(ostate, GL_OBJECT_TYPE_PROGRAM, object);
179 _is_deleted_program_object(GL_Object_State *ostate, GLuint glue_object)
181 Program_object_attached_tag *poat = NULL;
182 poat = (Program_object_attached_tag *)fastpath_ostate_get_object_tag(ostate,
183 GL_OBJECT_TYPE_PROGRAM, glue_object);
185 return poat->is_deleting;
189 _detach_program_object(GL_Object_State *ostate, GLuint real_object,
190 int is_program, int is_deleting)
192 if (real_object != 0) {
193 GLuint object = _COREGL_INT_INIT_VALUE;
194 Program_object_attached_tag *poat = NULL;
196 object = fastpath_ostate_find_object(ostate, GL_OBJECT_TYPE_PROGRAM,
200 poat = (Program_object_attached_tag *)fastpath_ostate_get_object_tag(ostate,
201 GL_OBJECT_TYPE_PROGRAM, object);
204 if (is_deleting == 1) {
205 if (poat->is_deleting == 0) {
206 poat->is_deleting = 1;
207 /* Ref count increased when glCreateProgram/initial attach */
208 fastpath_ostate_remove_object(ostate, GL_OBJECT_TYPE_PROGRAM, object);
209 /* Ref count increased when glCreateProgram/create object */
210 /* So, we have to call the under function twice.*/
211 fastpath_ostate_remove_object(ostate, GL_OBJECT_TYPE_PROGRAM, object);
214 fastpath_ostate_remove_object(ostate, GL_OBJECT_TYPE_PROGRAM, object);
217 if (fastpath_ostate_get_object(ostate, GL_OBJECT_TYPE_PROGRAM, object) == 0) {
218 // Is completely removed. De-referencing attached shader objects
220 for (i = 0; i < poat->shader_count; i++) {
221 AST(is_program == 1);
222 _detach_program_object(ostate, poat->shaders[i], 0, 0);
229 _orig_fastpath_glDeleteProgram(real_object);
231 _orig_fastpath_glDeleteShader(real_object);
238 fastpath_release_gl_context(GLGlueContext *gctx)
241 if (gctx->gl_current_program[0] != 0) {
242 _detach_program_object(&gctx->ostate, gctx->gl_current_program[0], 1, 0);
243 gctx->gl_current_program[0] = 0;
253 int vlen = _COREGL_INT_INIT_VALUE;
254 int i = _COREGL_INT_INIT_VALUE;
255 char vret_tmp[80 + 1] = { 0 };
256 IF_GL_SUCCESS(vret = (const char *)_orig_fastpath_glGetString(GL_VERSION)) {
257 vlen = (int)strlen(vret);
258 if (!strncmp(vret, "OpenGL ES", 9) && vlen >= 11) {
260 if (vret[9] == '-') {
261 if (vlen < 14) return 0.0f;
265 for (i = stp; ; i++) {
266 if (vret[i] == ' ' || vret[i] == 0x00 || i >= 80) {
267 strncpy(vret_tmp, &vret[stp], i - stp);
268 vret_tmp[i - stp] = 0x00;
272 if (vret_tmp[0] != 0x00)
273 GLver = atof(vret_tmp);
280 Mutex extension_check_mutex = MUTEX_INITIALIZER;
281 char string_extensions[16384] = { 0x00 };
282 char string_each_extensions[128][64];
283 int gl_extension_count = 0;
287 _valid_extension_string()
289 char string_tmpbuf[2048];
290 const char *res = NULL;
292 AST(mutex_lock(&extension_check_mutex) == 1);
294 if (gl_extension_count == 0) {
295 IF_GL_SUCCESS(res = (const char *)_orig_fastpath_glGetString(GL_EXTENSIONS)) {
296 if (string_extensions[0] == 0x00) {
297 double GLver = _get_gl_version();
299 strcpy(string_tmpbuf, res);
300 char *fstr = &string_tmpbuf[0], *estr = NULL;
301 for (estr = fstr; ; estr++) {
302 if (*estr == 0x00) break;
306 #define _COREGL_SYMBOL(RET_TYPE, FUNC_NAME, PARAM_LIST)
307 #define _COREGL_FASTPATH_SUPPORTED_EXTENSION(NAME, MINVER, MAXVER) \
308 if (!strcmp(fstr, NAME) && (MINVER < 0 || GLver >= MINVER) && (MAXVER < 0 || GLver <= MAXVER)) \
310 strcpy(string_each_extensions[gl_extension_count], fstr); \
311 strcat(string_extensions, fstr); \
312 strcat(string_extensions, " "); \
313 gl_extension_count++; \
316 # include "../../headers/sym_gl.h"
318 #undef _COREGL_FASTPATH_SUPPORTED_EXTENSION
319 #undef _COREGL_SYMBOL
328 AST(mutex_unlock(&extension_check_mutex) == 1);
333 fastpath_glGetError(void)
335 GLenum ret = GL_NONE;
337 DEFINE_FASTPAH_GL_FUNC();
338 _COREGL_FASTPATH_FUNC_BEGIN();
339 INIT_FASTPATH_GL_FUNC();
341 if (current_ctx->gl_error != GL_NO_ERROR) {
342 ret = current_ctx->gl_error;
343 current_ctx->gl_error = GL_NO_ERROR;
344 _orig_fastpath_glGetError();
346 ret = _orig_fastpath_glGetError();
351 _COREGL_FASTPATH_FUNC_END();
357 fastpath_glGetString(GLenum name)
359 const char *ret = NULL;
360 static const char *string_gles20 = "OpenGL ES 2.0";
361 static const char *string_gles30 = "OpenGL ES 3.0";
363 DEFINE_FASTPAH_GL_FUNC();
364 _COREGL_FASTPATH_FUNC_BEGIN();
365 INIT_FASTPATH_GL_FUNC();
369 IF_GL_SUCCESS(ret = (const char *)_orig_fastpath_glGetString(name)) {
370 double GLver = _get_gl_version();
372 COREGL_WRN("\E[40;31;1mFastpath can't support %s (Fixed to %s)\E[0m\n", ret,
377 COREGL_WRN("\E[40;31;1mFastpath can't support %s (Fixed to %s)\E[0m\n", ret,
384 _valid_extension_string();
385 ret = string_extensions;
388 IF_GL_SUCCESS(ret = (const char *)_orig_fastpath_glGetString(name)) {
399 _COREGL_FASTPATH_FUNC_END();
400 return (const GLubyte *)ret;
403 ////////////////////////////////////////////////////////////////////////
406 fastpath_glActiveTexture(GLenum texture)
408 DEFINE_FASTPAH_GL_FUNC();
409 _COREGL_FASTPATH_FUNC_BEGIN();
410 INIT_FASTPATH_GL_FUNC();
412 CURR_STATE_COMPARE(gl_active_texture, texture) {
413 IF_GL_SUCCESS(_orig_fastpath_glActiveTexture(texture)) {
414 current_ctx->_tex_flag1 |= _TEX_FLAG1_BIT_gl_active_texture;
415 current_ctx->gl_active_texture[0] = texture;
421 _COREGL_FASTPATH_FUNC_END();
426 fastpath_glGenTextures(GLsizei n, GLuint *textures)
429 GLuint *objid_array = NULL;
431 DEFINE_FASTPAH_GL_FUNC();
432 _COREGL_FASTPATH_FUNC_BEGIN();
433 INIT_FASTPATH_GL_FUNC();
436 _set_gl_error(GL_INVALID_VALUE);
439 if (n == 0) goto finish;
440 if (textures == NULL) goto finish;
442 AST(current_ctx->ostate.shared != NULL);
444 objid_array = (GLuint *)calloc(1, sizeof(GLuint) * n);
446 IF_GL_SUCCESS(_orig_fastpath_glGenTextures(n, objid_array)) {
447 for (i = 0; i < n; i++) {
448 textures[i] = fastpath_ostate_create_object(¤t_ctx->ostate,
449 GL_OBJECT_TYPE_TEXTURE, objid_array[i]);
456 if (objid_array != NULL) {
460 _COREGL_FASTPATH_FUNC_END();
465 fastpath_glBindTexture(GLenum target, GLuint texture)
470 DEFINE_FASTPAH_GL_FUNC();
471 _COREGL_FASTPATH_FUNC_BEGIN();
472 INIT_FASTPATH_GL_FUNC();
474 active_idx = current_ctx->gl_active_texture[0] - GL_TEXTURE0;
476 if (GET_REAL_OBJ(GL_OBJECT_TYPE_TEXTURE, texture, &real_obj) != 1) {
477 _set_gl_error(GL_OUT_OF_MEMORY);
482 #define STATE_PROC(gl_state, flagid, flagbit) \
483 if (current_ctx->gl_state[active_idx] != real_obj) \
485 IF_GL_SUCCESS(_orig_fastpath_glBindTexture(target, real_obj)) \
487 current_ctx->flagid |= flagbit##_##gl_state; \
488 current_ctx->gl_state[active_idx] = real_obj; \
494 STATE_PROC(gl_tex_2d_state, _tex_flag1, _TEX_FLAG1_BIT);
497 STATE_PROC_WITH_CHECK(gl_tex_3d_state, _tex_flag1, _TEX_FLAG1_BIT);
499 case GL_TEXTURE_2D_ARRAY:
500 STATE_PROC_WITH_CHECK(gl_tex_2d_array_state, _tex_flag1, _TEX_FLAG1_BIT);
502 case GL_TEXTURE_CUBE_MAP:
503 STATE_PROC(gl_tex_cube_state, _tex_flag1, _TEX_FLAG1_BIT);
505 case GL_TEXTURE_EXTERNAL_OES:
506 STATE_PROC(gl_tex_external_oes_state, _tex_flag1, _TEX_FLAG1_BIT);
509 _set_gl_error(GL_INVALID_ENUM);
519 _COREGL_FASTPATH_FUNC_END();
524 fastpath_glFramebufferTexture2D(GLenum target, GLenum attachment,
525 GLenum textarget, GLuint texture, GLint level)
529 DEFINE_FASTPAH_GL_FUNC();
530 _COREGL_FASTPATH_FUNC_BEGIN();
531 INIT_FASTPATH_GL_FUNC();
533 if (GET_REAL_OBJ(GL_OBJECT_TYPE_TEXTURE, texture, &real_obj) != 1) {
534 _set_gl_error(GL_OUT_OF_MEMORY);
538 _orig_fastpath_glFramebufferTexture2D(target, attachment, textarget, real_obj,
544 _COREGL_FASTPATH_FUNC_END();
549 fastpath_glFramebufferTexture3DOES(GLenum target, GLenum attachment,
550 GLenum textarget, GLuint texture, GLint level, GLint zoffset)
554 DEFINE_FASTPAH_GL_FUNC();
555 _COREGL_FASTPATH_FUNC_BEGIN();
556 INIT_FASTPATH_GL_FUNC();
558 if (GET_REAL_OBJ(GL_OBJECT_TYPE_TEXTURE, texture, &real_obj) != 1) {
559 _set_gl_error(GL_OUT_OF_MEMORY);
563 _orig_fastpath_glFramebufferTexture3DOES(target, attachment, textarget,
564 real_obj, level, zoffset);
569 _COREGL_FASTPATH_FUNC_END();
574 fastpath_glFramebufferTexture2DMultisampleEXT(GLenum target, GLenum attachment,
575 GLenum textarget, GLuint texture, GLint level, GLsizei samples)
579 DEFINE_FASTPAH_GL_FUNC();
580 _COREGL_FASTPATH_FUNC_BEGIN();
581 INIT_FASTPATH_GL_FUNC();
583 if (GET_REAL_OBJ(GL_OBJECT_TYPE_TEXTURE, texture, &real_obj) != 1) {
584 _set_gl_error(GL_OUT_OF_MEMORY);
588 _orig_fastpath_glFramebufferTexture2DMultisampleEXT(target, attachment,
589 textarget, real_obj, level, samples);
594 _COREGL_FASTPATH_FUNC_END();
599 fastpath_glGetFramebufferAttachmentParameteriv(GLenum target, GLenum attachment,
600 GLenum pname, GLint *params)
602 GLint real_obj, fa_type;
604 DEFINE_FASTPAH_GL_FUNC();
605 _COREGL_FASTPATH_FUNC_BEGIN();
606 INIT_FASTPATH_GL_FUNC();
609 case GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME:
611 _orig_fastpath_glGetFramebufferAttachmentParameteriv(target, attachment, pname,
613 _orig_fastpath_glGetFramebufferAttachmentParameteriv(target, attachment,
614 GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE, &fa_type);
617 if (GET_GLUE_OBJ(GL_OBJECT_TYPE_TEXTURE, real_obj, (GLuint *)params) != 1) {
622 case GL_RENDERBUFFER:
623 if (GET_GLUE_OBJ(GL_OBJECT_TYPE_RENDERBUFFER, real_obj,
624 (GLuint *)params) != 1) {
632 _orig_fastpath_glGetFramebufferAttachmentParameteriv(target, attachment, pname,
640 _COREGL_FASTPATH_FUNC_END();
645 fastpath_glIsTexture(GLuint texture)
647 GLboolean ret = GL_FALSE;
650 DEFINE_FASTPAH_GL_FUNC();
651 _COREGL_FASTPATH_FUNC_BEGIN();
652 INIT_FASTPATH_GL_FUNC();
654 if (GET_REAL_OBJ(GL_OBJECT_TYPE_TEXTURE, texture, &real_obj) != 1) {
659 ret = _orig_fastpath_glIsTexture(real_obj);
664 _COREGL_FASTPATH_FUNC_END();
670 fastpath_glDeleteTextures(GLsizei n, const GLuint *textures)
673 GLuint *objid_array = NULL;
675 DEFINE_FASTPAH_GL_FUNC();
676 _COREGL_FASTPATH_FUNC_BEGIN();
677 INIT_FASTPATH_GL_FUNC();
680 _set_gl_error(GL_INVALID_VALUE);
683 if (n == 0) goto finish;
684 if (textures == NULL) goto finish;
686 AST(current_ctx->ostate.shared != NULL);
688 objid_array = (GLuint *)calloc(1, sizeof(GLuint) * n);
692 for (i = 0; i < n; i++) {
693 int real_objid = _COREGL_INT_INIT_VALUE;
694 if (textures[i] == 0) continue;
696 real_objid = fastpath_ostate_get_object(¤t_ctx->ostate,
697 GL_OBJECT_TYPE_TEXTURE, textures[i]);
698 if (real_objid == 0) continue;
700 AST(fastpath_ostate_remove_object(¤t_ctx->ostate, GL_OBJECT_TYPE_TEXTURE,
702 objid_array[real_n++] = real_objid;
705 IF_GL_SUCCESS(_orig_fastpath_glDeleteTextures(real_n, objid_array)) {
706 for (i = 0; i < real_n; i++) {
707 General_Trace_List *current = NULL;
708 current = current_ctx->ostate.shared->using_gctxs;
710 while (current != NULL) {
711 GLGlueContext *cur_gctx = (GLGlueContext *)current->value;
713 for (j = 0; j < cur_gctx->gl_num_tex_units[0]; j++) {
714 if (cur_gctx->gl_tex_2d_state[j] == objid_array[i])
715 cur_gctx->gl_tex_2d_state[j] = 0;
716 if (cur_gctx->gl_tex_3d_state[j] == objid_array[i])
717 cur_gctx->gl_tex_3d_state[j] = 0;
718 if (cur_gctx->gl_tex_2d_array_state[j] == objid_array[i])
719 cur_gctx->gl_tex_2d_array_state[j] = 0;
720 if (cur_gctx->gl_tex_cube_state[j] == objid_array[i])
721 cur_gctx->gl_tex_cube_state[j] = 0;
722 if (cur_gctx->gl_tex_external_oes_state[j] == objid_array[i])
723 cur_gctx->gl_tex_external_oes_state[j] = 0;
726 current = current->next;
735 if (objid_array != NULL) {
739 _COREGL_FASTPATH_FUNC_END();
742 ////////////////////////////////////////////////////////////////////////
745 fastpath_glGenBuffers(GLsizei n, GLuint *buffers)
748 GLuint *objid_array = NULL;
750 DEFINE_FASTPAH_GL_FUNC();
751 _COREGL_FASTPATH_FUNC_BEGIN();
752 INIT_FASTPATH_GL_FUNC();
755 _set_gl_error(GL_INVALID_VALUE);
758 if (n == 0) goto finish;
759 if (buffers == NULL) goto finish;
761 AST(current_ctx->ostate.shared != NULL);
763 objid_array = (GLuint *)calloc(1, sizeof(GLuint) * n);
765 IF_GL_SUCCESS(_orig_fastpath_glGenBuffers(n, objid_array)) {
766 for (i = 0; i < n; i++) {
767 buffers[i] = fastpath_ostate_create_object(¤t_ctx->ostate,
768 GL_OBJECT_TYPE_BUFFER, objid_array[i]);
775 if (objid_array != NULL) {
779 _COREGL_FASTPATH_FUNC_END();
784 fastpath_glBindBuffer(GLenum target, GLuint buffer)
788 DEFINE_FASTPAH_GL_FUNC();
789 _COREGL_FASTPATH_FUNC_BEGIN();
790 INIT_FASTPATH_GL_FUNC();
792 if (GET_REAL_OBJ(GL_OBJECT_TYPE_BUFFER, buffer, &real_obj) != 1) {
793 _set_gl_error(GL_OUT_OF_MEMORY);
798 #define STATE_PROC(gl_state, flagid, flagbit) \
799 CURR_STATE_COMPARE(gl_state, real_obj) \
801 IF_GL_SUCCESS(_orig_fastpath_glBindBuffer(target, real_obj)) \
804 current_ctx->flagid &= (~flagbit##_##gl_state); \
806 current_ctx->flagid |= flagbit##_##gl_state; \
808 current_ctx->gl_state[0] = real_obj; \
814 case GL_ARRAY_BUFFER:
815 STATE_PROC(gl_array_buffer_binding, _bind_flag1, _BIND_FLAG1_BIT);
817 case GL_COPY_READ_BUFFER:
818 STATE_PROC_WITH_CHECK(gl_copy_read_buffer_binding, _bind_flag2,
821 case GL_COPY_WRITE_BUFFER:
822 STATE_PROC_WITH_CHECK(gl_copy_write_buffer_binding, _bind_flag2,
825 case GL_ELEMENT_ARRAY_BUFFER:
826 STATE_PROC(gl_element_array_buffer_binding, _bind_flag1, _BIND_FLAG1_BIT);
828 case GL_PIXEL_PACK_BUFFER:
829 STATE_PROC_WITH_CHECK(gl_pixel_pack_buffer_binding, _bind_flag2,
832 case GL_PIXEL_UNPACK_BUFFER:
833 STATE_PROC_WITH_CHECK(gl_pixel_unpack_buffer_binding, _bind_flag2,
836 case GL_TRANSFORM_FEEDBACK_BUFFER:
837 STATE_PROC_WITH_CHECK(gl_transform_feedback_buffer_binding, _bind_flag2,
840 case GL_UNIFORM_BUFFER:
841 STATE_PROC_WITH_CHECK(gl_uniform_buffer_binding, _bind_flag2, _BIND_FLAG2_BIT);
844 _set_gl_error(GL_INVALID_ENUM);
854 _COREGL_FASTPATH_FUNC_END();
859 fastpath_glIsBuffer(GLuint buffer)
861 GLboolean ret = GL_FALSE;
864 DEFINE_FASTPAH_GL_FUNC();
865 _COREGL_FASTPATH_FUNC_BEGIN();
866 INIT_FASTPATH_GL_FUNC();
868 if (GET_REAL_OBJ(GL_OBJECT_TYPE_BUFFER, buffer, &real_obj) != 1) {
873 ret = _orig_fastpath_glIsBuffer(real_obj);
878 _COREGL_FASTPATH_FUNC_END();
884 fastpath_glDeleteBuffers(GLsizei n, const GLuint *buffers)
887 GLuint *objid_array = NULL;
889 DEFINE_FASTPAH_GL_FUNC();
890 _COREGL_FASTPATH_FUNC_BEGIN();
891 INIT_FASTPATH_GL_FUNC();
894 _set_gl_error(GL_INVALID_VALUE);
897 if (n == 0) goto finish;
898 if (buffers == NULL) goto finish;
900 AST(current_ctx->ostate.shared != NULL);
902 objid_array = (GLuint *)calloc(1, sizeof(GLuint) * n);
906 for (i = 0; i < n; i++) {
907 int real_objid = _COREGL_INT_INIT_VALUE;
908 if (buffers[i] == 0) continue;
910 real_objid = fastpath_ostate_get_object(¤t_ctx->ostate,
911 GL_OBJECT_TYPE_BUFFER, buffers[i]);
912 if (real_objid == 0) continue;
914 AST(fastpath_ostate_remove_object(¤t_ctx->ostate, GL_OBJECT_TYPE_BUFFER,
916 objid_array[real_n++] = real_objid;
919 IF_GL_SUCCESS(_orig_fastpath_glDeleteBuffers(real_n, objid_array)) {
920 for (i = 0; i < real_n; i++) {
921 General_Trace_List *current = NULL;
922 current = current_ctx->ostate.shared->using_gctxs;
924 while (current != NULL) {
925 GLGlueContext *cur_gctx = (GLGlueContext *)current->value;
927 if (cur_gctx->gl_array_buffer_binding[0] == objid_array[i]) {
928 cur_gctx->_bind_flag1 &= (~_BIND_FLAG1_BIT_gl_array_buffer_binding);
929 cur_gctx->gl_array_buffer_binding[0] = 0;
931 if (cur_gctx->gl_copy_read_buffer_binding[0] == objid_array[i]) {
932 cur_gctx->_bind_flag2 &= (~_BIND_FLAG2_BIT_gl_copy_read_buffer_binding);
933 cur_gctx->gl_copy_read_buffer_binding[0] = 0;
935 if (cur_gctx->gl_copy_write_buffer_binding[0] == objid_array[i]) {
936 cur_gctx->_bind_flag2 &= (~_BIND_FLAG2_BIT_gl_copy_write_buffer_binding);
937 cur_gctx->gl_copy_write_buffer_binding[0] = 0;
939 if (cur_gctx->gl_element_array_buffer_binding[0] == objid_array[i]) {
940 cur_gctx->_bind_flag1 &= (~_BIND_FLAG1_BIT_gl_element_array_buffer_binding);
941 cur_gctx->gl_element_array_buffer_binding[0] = 0;
943 if (cur_gctx->gl_pixel_pack_buffer_binding[0] == objid_array[i]) {
944 cur_gctx->_bind_flag2 &= (~_BIND_FLAG2_BIT_gl_pixel_pack_buffer_binding);
945 cur_gctx->gl_pixel_pack_buffer_binding[0] = 0;
947 if (cur_gctx->gl_pixel_unpack_buffer_binding[0] == objid_array[i]) {
948 cur_gctx->_bind_flag2 &= (~_BIND_FLAG2_BIT_gl_pixel_unpack_buffer_binding);
949 cur_gctx->gl_pixel_unpack_buffer_binding[0] = 0;
951 if (cur_gctx->gl_transform_feedback_buffer_binding[0] == objid_array[i]) {
952 cur_gctx->_bind_flag2 &=
953 (~_BIND_FLAG2_BIT_gl_transform_feedback_buffer_binding);
954 cur_gctx->gl_transform_feedback_buffer_binding[0] = 0;
956 if (cur_gctx->gl_uniform_buffer_binding[0] == objid_array[i]) {
957 cur_gctx->_bind_flag2 &= (~_BIND_FLAG2_BIT_gl_uniform_buffer_binding);
958 cur_gctx->gl_uniform_buffer_binding[0] = 0;
961 current = current->next;
970 if (objid_array != NULL) {
974 _COREGL_FASTPATH_FUNC_END();
977 //////////////////////////////////////////////////////////////////////////////////
980 fastpath_glGenFramebuffers(GLsizei n, GLuint *framebuffers)
983 GLuint *objid_array = NULL;
985 DEFINE_FASTPAH_GL_FUNC();
986 _COREGL_FASTPATH_FUNC_BEGIN();
987 INIT_FASTPATH_GL_FUNC();
990 _set_gl_error(GL_INVALID_VALUE);
993 if (n == 0) goto finish;
994 if (framebuffers == NULL) goto finish;
996 AST(current_ctx->ostate.shared != NULL);
998 objid_array = (GLuint *)calloc(1, sizeof(GLuint) * n);
1000 IF_GL_SUCCESS(_orig_fastpath_glGenFramebuffers(n, objid_array)) {
1001 for (i = 0; i < n; i++) {
1002 framebuffers[i] = fastpath_ostate_create_object(¤t_ctx->ostate,
1003 GL_OBJECT_TYPE_FRAMEBUFFER, objid_array[i]);
1010 if (objid_array != NULL) {
1014 _COREGL_FASTPATH_FUNC_END();
1019 fastpath_glBindFramebuffer(GLenum target, GLuint framebuffer)
1023 DEFINE_FASTPAH_GL_FUNC();
1024 _COREGL_FASTPATH_FUNC_BEGIN();
1025 INIT_FASTPATH_GL_FUNC();
1027 if (GET_REAL_OBJ(GL_OBJECT_TYPE_FRAMEBUFFER, framebuffer, &real_obj) != 1) {
1028 _set_gl_error(GL_OUT_OF_MEMORY);
1032 if (target == GL_FRAMEBUFFER) {
1033 if (current_ctx->gl_framebuffer_binding_read_used == 1) {
1034 CURR_STATE_COMPARE(gl_framebuffer_binding_read, real_obj) {
1035 IF_GL_SUCCESS(_orig_fastpath_glBindFramebuffer(target, real_obj)) {
1037 current_ctx->_bind_flag1 &= (~_BIND_FLAG1_BIT_gl_framebuffer_binding_read);
1039 current_ctx->_bind_flag1 |= _BIND_FLAG1_BIT_gl_framebuffer_binding_read;
1040 current_ctx->gl_framebuffer_binding_read[0] = real_obj;
1043 CURR_STATE_COMPARE(gl_framebuffer_binding_draw, real_obj) {
1044 IF_GL_SUCCESS(_orig_fastpath_glBindFramebuffer(target, real_obj)) {
1046 current_ctx->_bind_flag1 &= (~_BIND_FLAG1_BIT_gl_framebuffer_binding_draw);
1048 current_ctx->_bind_flag1 |= _BIND_FLAG1_BIT_gl_framebuffer_binding_draw;
1049 current_ctx->gl_framebuffer_binding_draw[0] = real_obj;
1053 CURR_STATE_COMPARE(gl_framebuffer_binding, real_obj) {
1054 IF_GL_SUCCESS(_orig_fastpath_glBindFramebuffer(target, real_obj)) {
1056 current_ctx->_bind_flag1 &= (~_BIND_FLAG1_BIT_gl_framebuffer_binding);
1058 current_ctx->_bind_flag1 |= _BIND_FLAG1_BIT_gl_framebuffer_binding;
1059 current_ctx->gl_framebuffer_binding[0] = real_obj;
1063 } else if (target == GL_READ_FRAMEBUFFER &&
1064 current_ctx->gl_framebuffer_binding_read_used) {
1065 CURR_STATE_COMPARE(gl_framebuffer_binding_read, real_obj) {
1066 IF_GL_SUCCESS(_orig_fastpath_glBindFramebuffer(target, real_obj)) {
1068 current_ctx->_bind_flag1 &= (~_BIND_FLAG1_BIT_gl_framebuffer_binding_read);
1070 current_ctx->_bind_flag1 |= _BIND_FLAG1_BIT_gl_framebuffer_binding_read;
1071 current_ctx->gl_framebuffer_binding_read[0] = real_obj;
1074 } else if (target == GL_DRAW_FRAMEBUFFER &&
1075 current_ctx->gl_framebuffer_binding_draw_used) {
1076 CURR_STATE_COMPARE(gl_framebuffer_binding_draw, real_obj) {
1077 IF_GL_SUCCESS(_orig_fastpath_glBindFramebuffer(target, real_obj)) {
1079 current_ctx->_bind_flag1 &= (~_BIND_FLAG1_BIT_gl_framebuffer_binding_draw);
1081 current_ctx->_bind_flag1 |= _BIND_FLAG1_BIT_gl_framebuffer_binding_draw;
1082 current_ctx->gl_framebuffer_binding_draw[0] = real_obj;
1086 _set_gl_error(GL_INVALID_ENUM);
1092 _COREGL_FASTPATH_FUNC_END();
1097 fastpath_glIsFramebuffer(GLuint framebuffer)
1099 GLboolean ret = GL_FALSE;
1102 DEFINE_FASTPAH_GL_FUNC();
1103 _COREGL_FASTPATH_FUNC_BEGIN();
1104 INIT_FASTPATH_GL_FUNC();
1106 if (GET_REAL_OBJ(GL_OBJECT_TYPE_FRAMEBUFFER, framebuffer, &real_obj) != 1) {
1111 ret = _orig_fastpath_glIsFramebuffer(real_obj);
1116 _COREGL_FASTPATH_FUNC_END();
1122 fastpath_glDeleteFramebuffers(GLsizei n, const GLuint *framebuffers)
1125 GLuint *objid_array = NULL;
1127 DEFINE_FASTPAH_GL_FUNC();
1128 _COREGL_FASTPATH_FUNC_BEGIN();
1129 INIT_FASTPATH_GL_FUNC();
1132 _set_gl_error(GL_INVALID_VALUE);
1135 if (n == 0) goto finish;
1136 if (framebuffers == NULL) goto finish;
1138 AST(current_ctx->ostate.shared != NULL);
1140 objid_array = (GLuint *)calloc(1, sizeof(GLuint) * n);
1144 for (i = 0; i < n; i++) {
1145 int real_objid = _COREGL_INT_INIT_VALUE;
1146 if (framebuffers[i] == 0) continue;
1148 real_objid = fastpath_ostate_get_object(¤t_ctx->ostate,
1149 GL_OBJECT_TYPE_FRAMEBUFFER, framebuffers[i]);
1150 if (real_objid == 0) continue;
1152 AST(fastpath_ostate_remove_object(¤t_ctx->ostate,
1153 GL_OBJECT_TYPE_FRAMEBUFFER, framebuffers[i]) == 1);
1154 objid_array[real_n++] = real_objid;
1157 IF_GL_SUCCESS(_orig_fastpath_glDeleteFramebuffers(real_n, objid_array)) {
1158 for (i = 0; i < real_n; i++) {
1159 General_Trace_List *current = NULL;
1160 current = current_ctx->ostate.shared->using_gctxs;
1162 while (current != NULL) {
1163 GLGlueContext *cur_gctx = (GLGlueContext *)current->value;
1165 if (cur_gctx->gl_framebuffer_binding[0] == objid_array[i]) {
1166 cur_gctx->_bind_flag1 &= (~_BIND_FLAG1_BIT_gl_framebuffer_binding);
1167 cur_gctx->gl_framebuffer_binding[0] = 0;
1169 if (cur_gctx->gl_framebuffer_binding_read[0] == objid_array[i]) {
1170 cur_gctx->_bind_flag1 &= (~_BIND_FLAG1_BIT_gl_framebuffer_binding_read);
1171 cur_gctx->gl_framebuffer_binding_read[0] = 0;
1173 if (cur_gctx->gl_framebuffer_binding_draw[0] == objid_array[i]) {
1174 cur_gctx->_bind_flag1 &= (~_BIND_FLAG1_BIT_gl_framebuffer_binding_draw);
1175 cur_gctx->gl_framebuffer_binding_draw[0] = 0;
1178 current = current->next;
1187 if (objid_array != NULL) {
1191 _COREGL_FASTPATH_FUNC_END();
1194 //////////////////////////////////////////////////////////////////////////////////
1197 fastpath_glGenRenderbuffers(GLsizei n, GLuint *renderbuffers)
1200 GLuint *objid_array = NULL;
1202 DEFINE_FASTPAH_GL_FUNC();
1203 _COREGL_FASTPATH_FUNC_BEGIN();
1204 INIT_FASTPATH_GL_FUNC();
1207 _set_gl_error(GL_INVALID_VALUE);
1210 if (n == 0) goto finish;
1211 if (renderbuffers == NULL) goto finish;
1213 AST(current_ctx->ostate.shared != NULL);
1215 objid_array = (GLuint *)calloc(1, sizeof(GLuint) * n);
1217 IF_GL_SUCCESS(_orig_fastpath_glGenRenderbuffers(n, objid_array)) {
1218 for (i = 0; i < n; i++) {
1219 renderbuffers[i] = fastpath_ostate_create_object(¤t_ctx->ostate,
1220 GL_OBJECT_TYPE_RENDERBUFFER, objid_array[i]);
1227 if (objid_array != NULL) {
1231 _COREGL_FASTPATH_FUNC_END();
1236 fastpath_glBindRenderbuffer(GLenum target, GLuint renderbuffer)
1240 DEFINE_FASTPAH_GL_FUNC();
1241 _COREGL_FASTPATH_FUNC_BEGIN();
1242 INIT_FASTPATH_GL_FUNC();
1244 if (GET_REAL_OBJ(GL_OBJECT_TYPE_RENDERBUFFER, renderbuffer, &real_obj) != 1) {
1245 _set_gl_error(GL_OUT_OF_MEMORY);
1249 if (target == GL_RENDERBUFFER) {
1250 CURR_STATE_COMPARE(gl_renderbuffer_binding, real_obj) {
1251 IF_GL_SUCCESS(_orig_fastpath_glBindRenderbuffer(target, real_obj)) {
1253 current_ctx->_bind_flag1 &= (~_BIND_FLAG1_BIT_gl_renderbuffer_binding);
1255 current_ctx->_bind_flag1 |= _BIND_FLAG1_BIT_gl_renderbuffer_binding;
1256 current_ctx->gl_renderbuffer_binding[0] = real_obj;
1260 _set_gl_error(GL_INVALID_ENUM);
1267 _COREGL_FASTPATH_FUNC_END();
1272 fastpath_glFramebufferRenderbuffer(GLenum target, GLenum attachment,
1273 GLenum renderbuffertarget, GLuint renderbuffer)
1277 DEFINE_FASTPAH_GL_FUNC();
1278 _COREGL_FASTPATH_FUNC_BEGIN();
1279 INIT_FASTPATH_GL_FUNC();
1281 if (GET_REAL_OBJ(GL_OBJECT_TYPE_RENDERBUFFER, renderbuffer, &real_obj) != 1) {
1282 _set_gl_error(GL_OUT_OF_MEMORY);
1286 _orig_fastpath_glFramebufferRenderbuffer(target, attachment, renderbuffertarget,
1292 _COREGL_FASTPATH_FUNC_END();
1297 fastpath_glIsRenderbuffer(GLuint renderbuffer)
1299 GLboolean ret = GL_FALSE;
1302 DEFINE_FASTPAH_GL_FUNC();
1303 _COREGL_FASTPATH_FUNC_BEGIN();
1304 INIT_FASTPATH_GL_FUNC();
1306 if (GET_REAL_OBJ(GL_OBJECT_TYPE_RENDERBUFFER, renderbuffer, &real_obj) != 1) {
1311 ret = _orig_fastpath_glIsRenderbuffer(real_obj);
1316 _COREGL_FASTPATH_FUNC_END();
1322 fastpath_glDeleteRenderbuffers(GLsizei n, const GLuint *renderbuffers)
1325 GLuint *objid_array = NULL;
1327 DEFINE_FASTPAH_GL_FUNC();
1328 _COREGL_FASTPATH_FUNC_BEGIN();
1329 INIT_FASTPATH_GL_FUNC();
1332 _set_gl_error(GL_INVALID_VALUE);
1335 if (n == 0) goto finish;
1336 if (renderbuffers == NULL) goto finish;
1338 AST(current_ctx->ostate.shared != NULL);
1340 objid_array = (GLuint *)calloc(1, sizeof(GLuint) * n);
1344 for (i = 0; i < n; i++) {
1345 int real_objid = _COREGL_INT_INIT_VALUE;
1346 if (renderbuffers[i] == 0) continue;
1348 real_objid = fastpath_ostate_get_object(¤t_ctx->ostate,
1349 GL_OBJECT_TYPE_RENDERBUFFER, renderbuffers[i]);
1350 if (real_objid == 0) continue;
1352 AST(fastpath_ostate_remove_object(¤t_ctx->ostate,
1353 GL_OBJECT_TYPE_RENDERBUFFER, renderbuffers[i]) == 1);
1354 objid_array[real_n++] = real_objid;
1357 IF_GL_SUCCESS(_orig_fastpath_glDeleteRenderbuffers(real_n, objid_array)) {
1358 for (i = 0; i < real_n; i++) {
1359 General_Trace_List *current = NULL;
1360 current = current_ctx->ostate.shared->using_gctxs;
1362 while (current != NULL) {
1363 GLGlueContext *cur_gctx = (GLGlueContext *)current->value;
1365 if (cur_gctx->gl_renderbuffer_binding[0] == objid_array[i]) {
1366 cur_gctx->_bind_flag1 &= (~_BIND_FLAG1_BIT_gl_renderbuffer_binding);
1367 cur_gctx->gl_renderbuffer_binding[0] = 0;
1370 current = current->next;
1379 if (objid_array != NULL) {
1383 _COREGL_FASTPATH_FUNC_END();
1387 //////////////////////////////////////////////////////////////////////////////////
1390 fastpath_glCreateProgram(void)
1394 DEFINE_FASTPAH_GL_FUNC();
1395 _COREGL_FASTPATH_FUNC_BEGIN();
1396 INIT_FASTPATH_GL_FUNC();
1398 AST(current_ctx->ostate.shared != NULL);
1400 ret = _create_program_object(¤t_ctx->ostate, 1, GL_NONE);
1402 _attach_program_object(¤t_ctx->ostate, ret);
1407 _COREGL_FASTPATH_FUNC_END();
1413 fastpath_glCreateShader(GLenum type)
1417 DEFINE_FASTPAH_GL_FUNC();
1418 _COREGL_FASTPATH_FUNC_BEGIN();
1419 INIT_FASTPATH_GL_FUNC();
1421 AST(current_ctx->ostate.shared != NULL);
1423 ret = _create_program_object(¤t_ctx->ostate, 0, type);
1425 _attach_program_object(¤t_ctx->ostate, ret);
1430 _COREGL_FASTPATH_FUNC_END();
1436 fastpath_glShaderSource(GLuint shader, GLsizei count, const char **string,
1437 const GLint *length)
1441 DEFINE_FASTPAH_GL_FUNC();
1442 _COREGL_FASTPATH_FUNC_BEGIN();
1443 INIT_FASTPATH_GL_FUNC();
1445 if (GET_REAL_OBJ(GL_OBJECT_TYPE_PROGRAM, shader, &real_obj) != 1) {
1446 _set_gl_error(GL_INVALID_VALUE);
1449 _orig_fastpath_glShaderSource(real_obj, count, string, length);
1454 _COREGL_FASTPATH_FUNC_END();
1459 fastpath_glShaderBinary(GLsizei n, const GLuint *shaders, GLenum binaryformat,
1460 const void *binary, GLsizei length)
1463 GLuint *objid_array = NULL;
1465 DEFINE_FASTPAH_GL_FUNC();
1466 _COREGL_FASTPATH_FUNC_BEGIN();
1467 INIT_FASTPATH_GL_FUNC();
1470 _set_gl_error(GL_INVALID_VALUE);
1473 if (n == 0) goto finish;
1474 if (shaders == NULL) goto finish;
1476 AST(current_ctx->ostate.shared != NULL);
1478 objid_array = (GLuint *)calloc(1, sizeof(GLuint) * n);
1480 for (i = 0; i < n; i++) {
1481 if (shaders[i] == 0) continue;
1482 objid_array[i] = fastpath_ostate_get_object(¤t_ctx->ostate,
1483 GL_OBJECT_TYPE_PROGRAM, shaders[i]);
1486 _orig_fastpath_glShaderBinary(n, objid_array, binaryformat, binary, length);
1491 if (objid_array != NULL) {
1496 _COREGL_FASTPATH_FUNC_END();
1501 fastpath_glCompileShader(GLuint shader)
1505 DEFINE_FASTPAH_GL_FUNC();
1506 _COREGL_FASTPATH_FUNC_BEGIN();
1507 INIT_FASTPATH_GL_FUNC();
1509 if (GET_REAL_OBJ(GL_OBJECT_TYPE_PROGRAM, shader, &real_obj) != 1) {
1510 _set_gl_error(GL_INVALID_VALUE);
1514 _orig_fastpath_glCompileShader(real_obj);
1519 _COREGL_FASTPATH_FUNC_END();
1524 fastpath_glBindAttribLocation(GLuint program, GLuint index, const char *name)
1528 DEFINE_FASTPAH_GL_FUNC();
1529 _COREGL_FASTPATH_FUNC_BEGIN();
1530 INIT_FASTPATH_GL_FUNC();
1532 if (GET_REAL_OBJ(GL_OBJECT_TYPE_PROGRAM, program, &real_obj) != 1) {
1533 _set_gl_error(GL_INVALID_VALUE);
1537 _orig_fastpath_glBindAttribLocation(real_obj, index, name);
1542 _COREGL_FASTPATH_FUNC_END();
1547 fastpath_glAttachShader(GLuint program, GLuint shader)
1549 GLuint real_obj_program;
1550 GLuint real_obj_shader;
1552 DEFINE_FASTPAH_GL_FUNC();
1553 _COREGL_FASTPATH_FUNC_BEGIN();
1554 INIT_FASTPATH_GL_FUNC();
1556 if (GET_REAL_OBJ(GL_OBJECT_TYPE_PROGRAM, program, &real_obj_program) != 1 ||
1557 GET_REAL_OBJ(GL_OBJECT_TYPE_PROGRAM, shader, &real_obj_shader) != 1) {
1558 _set_gl_error(GL_INVALID_VALUE);
1562 IF_GL_SUCCESS(_orig_fastpath_glAttachShader(real_obj_program,
1564 _update_program_attach_info(¤t_ctx->ostate, program);
1565 _attach_program_object(¤t_ctx->ostate, shader);
1571 _COREGL_FASTPATH_FUNC_END();
1576 fastpath_glDetachShader(GLuint program, GLuint shader)
1578 GLuint real_obj_program;
1579 GLuint real_obj_shader;
1581 DEFINE_FASTPAH_GL_FUNC();
1582 _COREGL_FASTPATH_FUNC_BEGIN();
1583 INIT_FASTPATH_GL_FUNC();
1585 if (GET_REAL_OBJ(GL_OBJECT_TYPE_PROGRAM, program, &real_obj_program) != 1 ||
1586 GET_REAL_OBJ(GL_OBJECT_TYPE_PROGRAM, shader, &real_obj_shader) != 1) {
1587 _set_gl_error(GL_INVALID_VALUE);
1591 IF_GL_SUCCESS(_orig_fastpath_glDetachShader(real_obj_program,
1593 _update_program_attach_info(¤t_ctx->ostate, program);
1594 _detach_program_object(¤t_ctx->ostate, real_obj_shader, 0, 0);
1600 _COREGL_FASTPATH_FUNC_END();
1605 fastpath_glIsShader(GLuint shader)
1607 GLboolean ret = GL_FALSE;
1610 DEFINE_FASTPAH_GL_FUNC();
1611 _COREGL_FASTPATH_FUNC_BEGIN();
1612 INIT_FASTPATH_GL_FUNC();
1614 if (GET_REAL_OBJ(GL_OBJECT_TYPE_PROGRAM, shader, &real_obj) != 1) {
1619 ret = _orig_fastpath_glIsShader(real_obj);
1624 _COREGL_FASTPATH_FUNC_END();
1630 fastpath_glIsProgram(GLuint program)
1632 GLboolean ret = GL_FALSE;
1635 DEFINE_FASTPAH_GL_FUNC();
1636 _COREGL_FASTPATH_FUNC_BEGIN();
1637 INIT_FASTPATH_GL_FUNC();
1639 if (GET_REAL_OBJ(GL_OBJECT_TYPE_PROGRAM, program, &real_obj) != 1) {
1644 ret = _orig_fastpath_glIsProgram(real_obj);
1649 _COREGL_FASTPATH_FUNC_END();
1655 fastpath_glLinkProgram(GLuint program)
1659 DEFINE_FASTPAH_GL_FUNC();
1660 _COREGL_FASTPATH_FUNC_BEGIN();
1661 INIT_FASTPATH_GL_FUNC();
1663 if (GET_REAL_OBJ(GL_OBJECT_TYPE_PROGRAM, program, &real_obj) != 1) {
1664 _set_gl_error(GL_INVALID_VALUE);
1668 _orig_fastpath_glLinkProgram(real_obj);
1673 _COREGL_FASTPATH_FUNC_END();
1678 fastpath_glValidateProgram(GLuint program)
1682 DEFINE_FASTPAH_GL_FUNC();
1683 _COREGL_FASTPATH_FUNC_BEGIN();
1684 INIT_FASTPATH_GL_FUNC();
1686 if (GET_REAL_OBJ(GL_OBJECT_TYPE_PROGRAM, program, &real_obj) != 1) {
1687 _set_gl_error(GL_INVALID_VALUE);
1691 _orig_fastpath_glValidateProgram(real_obj);
1696 _COREGL_FASTPATH_FUNC_END();
1701 fastpath_glUseProgram(GLuint program)
1705 DEFINE_FASTPAH_GL_FUNC();
1706 _COREGL_FASTPATH_FUNC_BEGIN();
1707 INIT_FASTPATH_GL_FUNC();
1709 if (GET_REAL_OBJ(GL_OBJECT_TYPE_PROGRAM, program, &real_obj) != 1) {
1710 _set_gl_error(GL_INVALID_VALUE);
1714 CURR_STATE_COMPARE(gl_current_program, real_obj) {
1715 IF_GL_SUCCESS(_orig_fastpath_glUseProgram(real_obj)) {
1716 _attach_program_object(¤t_ctx->ostate, program);
1717 _detach_program_object(¤t_ctx->ostate, current_ctx->gl_current_program[0],
1720 current_ctx->_clear_flag1 |= _CLEAR_FLAG1_BIT_gl_current_program;
1721 current_ctx->gl_current_program[0] = real_obj;
1727 _COREGL_FASTPATH_FUNC_END();
1732 fastpath_glGetActiveAttrib(GLuint program, GLuint index, GLsizei bufsize,
1733 GLsizei *length, GLint *size, GLenum *type, char *name)
1737 DEFINE_FASTPAH_GL_FUNC();
1738 _COREGL_FASTPATH_FUNC_BEGIN();
1739 INIT_FASTPATH_GL_FUNC();
1741 if (GET_REAL_OBJ(GL_OBJECT_TYPE_PROGRAM, program, &real_obj) != 1) {
1742 _set_gl_error(GL_INVALID_VALUE);
1746 _orig_fastpath_glGetActiveAttrib(real_obj, index, bufsize, length, size, type,
1752 _COREGL_FASTPATH_FUNC_END();
1757 fastpath_glGetActiveUniform(GLuint program, GLuint index, GLsizei bufsize,
1758 GLsizei *length, GLint *size, GLenum *type, char *name)
1762 DEFINE_FASTPAH_GL_FUNC();
1763 _COREGL_FASTPATH_FUNC_BEGIN();
1764 INIT_FASTPATH_GL_FUNC();
1766 if (GET_REAL_OBJ(GL_OBJECT_TYPE_PROGRAM, program, &real_obj) != 1) {
1767 _set_gl_error(GL_INVALID_VALUE);
1771 _orig_fastpath_glGetActiveUniform(real_obj, index, bufsize, length, size, type,
1777 _COREGL_FASTPATH_FUNC_END();
1782 fastpath_glGetAttachedShaders(GLuint program, GLsizei maxcount, GLsizei *count,
1786 GLsizei real_count = _COREGL_INT_INIT_VALUE;
1789 DEFINE_FASTPAH_GL_FUNC();
1790 _COREGL_FASTPATH_FUNC_BEGIN();
1791 INIT_FASTPATH_GL_FUNC();
1793 if (GET_REAL_OBJ(GL_OBJECT_TYPE_PROGRAM, program, &real_obj) != 1) {
1794 _set_gl_error(GL_INVALID_VALUE);
1798 IF_GL_SUCCESS(_orig_fastpath_glGetAttachedShaders(real_obj, maxcount,
1799 &real_count, shaders)) {
1800 for (i = 0; i < real_count; i++) {
1801 if (shaders[i] != 0)
1802 shaders[i] = fastpath_ostate_find_object(¤t_ctx->ostate,
1803 GL_OBJECT_TYPE_PROGRAM, shaders[i]);
1805 if (count != NULL) *count = real_count;
1811 _COREGL_FASTPATH_FUNC_END();
1816 fastpath_glGetAttribLocation(GLuint program, const char *name)
1818 int ret = _COREGL_INT_INIT_VALUE;
1821 DEFINE_FASTPAH_GL_FUNC();
1822 _COREGL_FASTPATH_FUNC_BEGIN();
1823 INIT_FASTPATH_GL_FUNC();
1825 if (GET_REAL_OBJ(GL_OBJECT_TYPE_PROGRAM, program, &real_obj) != 1) {
1826 _set_gl_error(GL_INVALID_VALUE);
1830 ret = _orig_fastpath_glGetAttribLocation(real_obj, name);
1835 _COREGL_FASTPATH_FUNC_END();
1841 fastpath_glGetShaderiv(GLuint shader, GLenum pname, GLint *params)
1845 DEFINE_FASTPAH_GL_FUNC();
1846 _COREGL_FASTPATH_FUNC_BEGIN();
1847 INIT_FASTPATH_GL_FUNC();
1849 if (GET_REAL_OBJ(GL_OBJECT_TYPE_PROGRAM, shader, &real_obj) != 1) {
1850 _set_gl_error(GL_INVALID_VALUE);
1855 case GL_DELETE_STATUS:
1857 if (_is_deleted_program_object(¤t_ctx->ostate, shader) == 1)
1861 _orig_fastpath_glGetShaderiv(real_obj, pname, params);
1868 _COREGL_FASTPATH_FUNC_END();
1873 fastpath_glGetShaderInfoLog(GLuint shader, GLsizei bufsize, GLsizei *length,
1878 DEFINE_FASTPAH_GL_FUNC();
1879 _COREGL_FASTPATH_FUNC_BEGIN();
1880 INIT_FASTPATH_GL_FUNC();
1882 if (GET_REAL_OBJ(GL_OBJECT_TYPE_PROGRAM, shader, &real_obj) != 1) {
1883 _set_gl_error(GL_INVALID_VALUE);
1887 _orig_fastpath_glGetShaderInfoLog(real_obj, bufsize, length, infolog);
1892 _COREGL_FASTPATH_FUNC_END();
1897 fastpath_glGetProgramiv(GLuint program, GLenum pname, GLint *params)
1901 DEFINE_FASTPAH_GL_FUNC();
1902 _COREGL_FASTPATH_FUNC_BEGIN();
1903 INIT_FASTPATH_GL_FUNC();
1905 if (GET_REAL_OBJ(GL_OBJECT_TYPE_PROGRAM, program, &real_obj) != 1) {
1906 _set_gl_error(GL_INVALID_VALUE);
1911 case GL_DELETE_STATUS:
1913 if (_is_deleted_program_object(¤t_ctx->ostate, program) == 1)
1917 _orig_fastpath_glGetProgramiv(real_obj, pname, params);
1924 _COREGL_FASTPATH_FUNC_END();
1929 fastpath_glGetProgramInfoLog(GLuint program, GLsizei bufsize, GLsizei *length,
1934 DEFINE_FASTPAH_GL_FUNC();
1935 _COREGL_FASTPATH_FUNC_BEGIN();
1936 INIT_FASTPATH_GL_FUNC();
1938 if (GET_REAL_OBJ(GL_OBJECT_TYPE_PROGRAM, program, &real_obj) != 1) {
1939 _set_gl_error(GL_INVALID_VALUE);
1943 _orig_fastpath_glGetProgramInfoLog(real_obj, bufsize, length, infolog);
1948 _COREGL_FASTPATH_FUNC_END();
1953 fastpath_glGetShaderSource(GLuint shader, GLsizei bufsize, GLsizei *length,
1958 DEFINE_FASTPAH_GL_FUNC();
1959 _COREGL_FASTPATH_FUNC_BEGIN();
1960 INIT_FASTPATH_GL_FUNC();
1962 if (GET_REAL_OBJ(GL_OBJECT_TYPE_PROGRAM, shader, &real_obj) != 1) {
1963 _set_gl_error(GL_INVALID_VALUE);
1967 _orig_fastpath_glGetShaderSource(real_obj, bufsize, length, source);
1972 _COREGL_FASTPATH_FUNC_END();
1977 fastpath_glGetUniformfv(GLuint program, GLint location, GLfloat *params)
1981 DEFINE_FASTPAH_GL_FUNC();
1982 _COREGL_FASTPATH_FUNC_BEGIN();
1983 INIT_FASTPATH_GL_FUNC();
1985 if (GET_REAL_OBJ(GL_OBJECT_TYPE_PROGRAM, program, &real_obj) != 1) {
1986 _set_gl_error(GL_INVALID_VALUE);
1990 _orig_fastpath_glGetUniformfv(real_obj, location, params);
1995 _COREGL_FASTPATH_FUNC_END();
2000 fastpath_glGetUniformiv(GLuint program, GLint location, GLint *params)
2004 DEFINE_FASTPAH_GL_FUNC();
2005 _COREGL_FASTPATH_FUNC_BEGIN();
2006 INIT_FASTPATH_GL_FUNC();
2008 if (GET_REAL_OBJ(GL_OBJECT_TYPE_PROGRAM, program, &real_obj) != 1) {
2009 _set_gl_error(GL_INVALID_VALUE);
2013 _orig_fastpath_glGetUniformiv(real_obj, location, params);
2018 _COREGL_FASTPATH_FUNC_END();
2023 fastpath_glUseProgramStagesEXT(GLuint pipeline, GLbitfield stages,
2028 DEFINE_FASTPAH_GL_FUNC();
2029 _COREGL_FASTPATH_FUNC_BEGIN();
2030 INIT_FASTPATH_GL_FUNC();
2032 if (GET_REAL_OBJ(GL_OBJECT_TYPE_PROGRAM, program, &real_obj) != 1) {
2033 _set_gl_error(GL_INVALID_VALUE);
2037 _orig_fastpath_glUseProgramStagesEXT(pipeline, stages, real_obj);
2042 _COREGL_FASTPATH_FUNC_END();
2047 fastpath_glActiveShaderProgramEXT(GLuint pipeline, GLuint program)
2051 DEFINE_FASTPAH_GL_FUNC();
2052 _COREGL_FASTPATH_FUNC_BEGIN();
2053 INIT_FASTPATH_GL_FUNC();
2055 if (GET_REAL_OBJ(GL_OBJECT_TYPE_PROGRAM, program, &real_obj) != 1) {
2056 _set_gl_error(GL_INVALID_VALUE);
2060 _orig_fastpath_glActiveShaderProgramEXT(pipeline, real_obj);
2065 _COREGL_FASTPATH_FUNC_END();
2070 fastpath_glProgramParameteriEXT(GLuint program, GLenum pname, GLint value)
2074 DEFINE_FASTPAH_GL_FUNC();
2075 _COREGL_FASTPATH_FUNC_BEGIN();
2076 INIT_FASTPATH_GL_FUNC();
2078 if (GET_REAL_OBJ(GL_OBJECT_TYPE_PROGRAM, program, &real_obj) != 1) {
2079 _set_gl_error(GL_INVALID_VALUE);
2083 _orig_fastpath_glProgramParameteriEXT(real_obj, pname, value);
2088 _COREGL_FASTPATH_FUNC_END();
2093 fastpath_glProgramUniform1iEXT(GLuint program, GLint location, GLint x)
2097 DEFINE_FASTPAH_GL_FUNC();
2098 _COREGL_FASTPATH_FUNC_BEGIN();
2099 INIT_FASTPATH_GL_FUNC();
2101 if (GET_REAL_OBJ(GL_OBJECT_TYPE_PROGRAM, program, &real_obj) != 1) {
2102 _set_gl_error(GL_INVALID_VALUE);
2106 _orig_fastpath_glProgramUniform1iEXT(real_obj, location, x);
2111 _COREGL_FASTPATH_FUNC_END();
2116 fastpath_glProgramUniform2iEXT(GLuint program, GLint location, GLint x, GLint y)
2120 DEFINE_FASTPAH_GL_FUNC();
2121 _COREGL_FASTPATH_FUNC_BEGIN();
2122 INIT_FASTPATH_GL_FUNC();
2124 if (GET_REAL_OBJ(GL_OBJECT_TYPE_PROGRAM, program, &real_obj) != 1) {
2125 _set_gl_error(GL_INVALID_VALUE);
2129 _orig_fastpath_glProgramUniform2iEXT(real_obj, location, x, y);
2134 _COREGL_FASTPATH_FUNC_END();
2139 fastpath_glProgramUniform3iEXT(GLuint program, GLint location, GLint x, GLint y,
2144 DEFINE_FASTPAH_GL_FUNC();
2145 _COREGL_FASTPATH_FUNC_BEGIN();
2146 INIT_FASTPATH_GL_FUNC();
2148 if (GET_REAL_OBJ(GL_OBJECT_TYPE_PROGRAM, program, &real_obj) != 1) {
2149 _set_gl_error(GL_INVALID_VALUE);
2153 _orig_fastpath_glProgramUniform3iEXT(real_obj, location, x, y, z);
2158 _COREGL_FASTPATH_FUNC_END();
2163 fastpath_glProgramUniform4iEXT(GLuint program, GLint location, GLint x, GLint y,
2168 DEFINE_FASTPAH_GL_FUNC();
2169 _COREGL_FASTPATH_FUNC_BEGIN();
2170 INIT_FASTPATH_GL_FUNC();
2172 if (GET_REAL_OBJ(GL_OBJECT_TYPE_PROGRAM, program, &real_obj) != 1) {
2173 _set_gl_error(GL_INVALID_VALUE);
2177 _orig_fastpath_glProgramUniform4iEXT(real_obj, location, x, y, z, w);
2182 _COREGL_FASTPATH_FUNC_END();
2187 fastpath_glProgramUniform1fEXT(GLuint program, GLint location, GLfloat x)
2191 DEFINE_FASTPAH_GL_FUNC();
2192 _COREGL_FASTPATH_FUNC_BEGIN();
2193 INIT_FASTPATH_GL_FUNC();
2195 if (GET_REAL_OBJ(GL_OBJECT_TYPE_PROGRAM, program, &real_obj) != 1) {
2196 _set_gl_error(GL_INVALID_VALUE);
2200 _orig_fastpath_glProgramUniform1fEXT(real_obj, location, x);
2205 _COREGL_FASTPATH_FUNC_END();
2210 fastpath_glProgramUniform2fEXT(GLuint program, GLint location, GLfloat x,
2215 DEFINE_FASTPAH_GL_FUNC();
2216 _COREGL_FASTPATH_FUNC_BEGIN();
2217 INIT_FASTPATH_GL_FUNC();
2219 if (GET_REAL_OBJ(GL_OBJECT_TYPE_PROGRAM, program, &real_obj) != 1) {
2220 _set_gl_error(GL_INVALID_VALUE);
2224 _orig_fastpath_glProgramUniform2fEXT(real_obj, location, x, y);
2229 _COREGL_FASTPATH_FUNC_END();
2234 fastpath_glProgramUniform3fEXT(GLuint program, GLint location, GLfloat x,
2235 GLfloat y, GLfloat z)
2239 DEFINE_FASTPAH_GL_FUNC();
2240 _COREGL_FASTPATH_FUNC_BEGIN();
2241 INIT_FASTPATH_GL_FUNC();
2243 if (GET_REAL_OBJ(GL_OBJECT_TYPE_PROGRAM, program, &real_obj) != 1) {
2244 _set_gl_error(GL_INVALID_VALUE);
2248 _orig_fastpath_glProgramUniform3fEXT(real_obj, location, x, y, z);
2253 _COREGL_FASTPATH_FUNC_END();
2258 fastpath_glProgramUniform4fEXT(GLuint program, GLint location, GLfloat x,
2259 GLfloat y, GLfloat z, GLfloat w)
2263 DEFINE_FASTPAH_GL_FUNC();
2264 _COREGL_FASTPATH_FUNC_BEGIN();
2265 INIT_FASTPATH_GL_FUNC();
2267 if (GET_REAL_OBJ(GL_OBJECT_TYPE_PROGRAM, program, &real_obj) != 1) {
2268 _set_gl_error(GL_INVALID_VALUE);
2272 _orig_fastpath_glProgramUniform4fEXT(real_obj, location, x, y, z, w);
2277 _COREGL_FASTPATH_FUNC_END();
2282 fastpath_glProgramUniform1ivEXT(GLuint program, GLint location, GLsizei count,
2287 DEFINE_FASTPAH_GL_FUNC();
2288 _COREGL_FASTPATH_FUNC_BEGIN();
2289 INIT_FASTPATH_GL_FUNC();
2291 if (GET_REAL_OBJ(GL_OBJECT_TYPE_PROGRAM, program, &real_obj) != 1) {
2292 _set_gl_error(GL_INVALID_VALUE);
2296 _orig_fastpath_glProgramUniform1ivEXT(real_obj, location, count, value);
2301 _COREGL_FASTPATH_FUNC_END();
2306 fastpath_glProgramUniform2ivEXT(GLuint program, GLint location, GLsizei count,
2311 DEFINE_FASTPAH_GL_FUNC();
2312 _COREGL_FASTPATH_FUNC_BEGIN();
2313 INIT_FASTPATH_GL_FUNC();
2315 if (GET_REAL_OBJ(GL_OBJECT_TYPE_PROGRAM, program, &real_obj) != 1) {
2316 _set_gl_error(GL_INVALID_VALUE);
2320 _orig_fastpath_glProgramUniform2ivEXT(real_obj, location, count, value);
2325 _COREGL_FASTPATH_FUNC_END();
2330 fastpath_glProgramUniform3ivEXT(GLuint program, GLint location, GLsizei count,
2335 DEFINE_FASTPAH_GL_FUNC();
2336 _COREGL_FASTPATH_FUNC_BEGIN();
2337 INIT_FASTPATH_GL_FUNC();
2339 if (GET_REAL_OBJ(GL_OBJECT_TYPE_PROGRAM, program, &real_obj) != 1) {
2340 _set_gl_error(GL_INVALID_VALUE);
2344 _orig_fastpath_glProgramUniform3ivEXT(real_obj, location, count, value);
2349 _COREGL_FASTPATH_FUNC_END();
2354 fastpath_glProgramUniform4ivEXT(GLuint program, GLint location, GLsizei count,
2359 DEFINE_FASTPAH_GL_FUNC();
2360 _COREGL_FASTPATH_FUNC_BEGIN();
2361 INIT_FASTPATH_GL_FUNC();
2363 if (GET_REAL_OBJ(GL_OBJECT_TYPE_PROGRAM, program, &real_obj) != 1) {
2364 _set_gl_error(GL_INVALID_VALUE);
2368 _orig_fastpath_glProgramUniform4ivEXT(real_obj, location, count, value);
2373 _COREGL_FASTPATH_FUNC_END();
2378 fastpath_glProgramUniform1fvEXT(GLuint program, GLint location, GLsizei count,
2379 const GLfloat *value)
2383 DEFINE_FASTPAH_GL_FUNC();
2384 _COREGL_FASTPATH_FUNC_BEGIN();
2385 INIT_FASTPATH_GL_FUNC();
2387 if (GET_REAL_OBJ(GL_OBJECT_TYPE_PROGRAM, program, &real_obj) != 1) {
2388 _set_gl_error(GL_INVALID_VALUE);
2392 _orig_fastpath_glProgramUniform1fvEXT(real_obj, location, count, value);
2397 _COREGL_FASTPATH_FUNC_END();
2402 fastpath_glProgramUniform2fvEXT(GLuint program, GLint location, GLsizei count,
2403 const GLfloat *value)
2407 DEFINE_FASTPAH_GL_FUNC();
2408 _COREGL_FASTPATH_FUNC_BEGIN();
2409 INIT_FASTPATH_GL_FUNC();
2411 if (GET_REAL_OBJ(GL_OBJECT_TYPE_PROGRAM, program, &real_obj) != 1) {
2412 _set_gl_error(GL_INVALID_VALUE);
2416 _orig_fastpath_glProgramUniform2fvEXT(real_obj, location, count, value);
2421 _COREGL_FASTPATH_FUNC_END();
2426 fastpath_glProgramUniform3fvEXT(GLuint program, GLint location, GLsizei count,
2427 const GLfloat *value)
2431 DEFINE_FASTPAH_GL_FUNC();
2432 _COREGL_FASTPATH_FUNC_BEGIN();
2433 INIT_FASTPATH_GL_FUNC();
2435 if (GET_REAL_OBJ(GL_OBJECT_TYPE_PROGRAM, program, &real_obj) != 1) {
2436 _set_gl_error(GL_INVALID_VALUE);
2440 _orig_fastpath_glProgramUniform3fvEXT(real_obj, location, count, value);
2445 _COREGL_FASTPATH_FUNC_END();
2450 fastpath_glProgramUniform4fvEXT(GLuint program, GLint location, GLsizei count,
2451 const GLfloat *value)
2455 DEFINE_FASTPAH_GL_FUNC();
2456 _COREGL_FASTPATH_FUNC_BEGIN();
2457 INIT_FASTPATH_GL_FUNC();
2459 if (GET_REAL_OBJ(GL_OBJECT_TYPE_PROGRAM, program, &real_obj) != 1) {
2460 _set_gl_error(GL_INVALID_VALUE);
2464 _orig_fastpath_glProgramUniform4fvEXT(real_obj, location, count, value);
2469 _COREGL_FASTPATH_FUNC_END();
2474 fastpath_glProgramUniformMatrix2fvEXT(GLuint program, GLint location,
2475 GLsizei count, GLboolean transpose, const GLfloat *value)
2479 DEFINE_FASTPAH_GL_FUNC();
2480 _COREGL_FASTPATH_FUNC_BEGIN();
2481 INIT_FASTPATH_GL_FUNC();
2483 if (GET_REAL_OBJ(GL_OBJECT_TYPE_PROGRAM, program, &real_obj) != 1) {
2484 _set_gl_error(GL_INVALID_VALUE);
2488 _orig_fastpath_glProgramUniformMatrix2fvEXT(real_obj, location, count,
2494 _COREGL_FASTPATH_FUNC_END();
2499 fastpath_glProgramUniformMatrix3fvEXT(GLuint program, GLint location,
2500 GLsizei count, GLboolean transpose, const GLfloat *value)
2504 DEFINE_FASTPAH_GL_FUNC();
2505 _COREGL_FASTPATH_FUNC_BEGIN();
2506 INIT_FASTPATH_GL_FUNC();
2508 if (GET_REAL_OBJ(GL_OBJECT_TYPE_PROGRAM, program, &real_obj) != 1) {
2509 _set_gl_error(GL_INVALID_VALUE);
2513 _orig_fastpath_glProgramUniformMatrix3fvEXT(real_obj, location, count,
2519 _COREGL_FASTPATH_FUNC_END();
2524 fastpath_glProgramUniformMatrix4fvEXT(GLuint program, GLint location,
2525 GLsizei count, GLboolean transpose, const GLfloat *value)
2529 DEFINE_FASTPAH_GL_FUNC();
2530 _COREGL_FASTPATH_FUNC_BEGIN();
2531 INIT_FASTPATH_GL_FUNC();
2533 if (GET_REAL_OBJ(GL_OBJECT_TYPE_PROGRAM, program, &real_obj) != 1) {
2534 _set_gl_error(GL_INVALID_VALUE);
2538 _orig_fastpath_glProgramUniformMatrix4fvEXT(real_obj, location, count,
2544 _COREGL_FASTPATH_FUNC_END();
2549 fastpath_glGetUniformLocation(GLuint program, const char *name)
2551 int ret = _COREGL_INT_INIT_VALUE;
2554 DEFINE_FASTPAH_GL_FUNC();
2555 _COREGL_FASTPATH_FUNC_BEGIN();
2556 INIT_FASTPATH_GL_FUNC();
2558 if (GET_REAL_OBJ(GL_OBJECT_TYPE_PROGRAM, program, &real_obj) != 1) {
2559 _set_gl_error(GL_INVALID_VALUE);
2564 ret = _orig_fastpath_glGetUniformLocation(real_obj, name);
2569 _COREGL_FASTPATH_FUNC_END();
2574 fastpath_glDeleteShader(GLuint shader)
2578 DEFINE_FASTPAH_GL_FUNC();
2579 _COREGL_FASTPATH_FUNC_BEGIN();
2580 INIT_FASTPATH_GL_FUNC();
2582 if (GET_REAL_OBJ(GL_OBJECT_TYPE_PROGRAM, shader, &real_obj) != 1) {
2583 _set_gl_error(GL_INVALID_VALUE);
2587 _detach_program_object(¤t_ctx->ostate, real_obj, 0, 1);
2592 _COREGL_FASTPATH_FUNC_END();
2596 fastpath_glDeleteProgram(GLuint program)
2600 DEFINE_FASTPAH_GL_FUNC();
2601 _COREGL_FASTPATH_FUNC_BEGIN();
2602 INIT_FASTPATH_GL_FUNC();
2604 if (GET_REAL_OBJ(GL_OBJECT_TYPE_PROGRAM, program, &real_obj) != 1) {
2605 _set_gl_error(GL_INVALID_VALUE);
2609 _detach_program_object(¤t_ctx->ostate, real_obj, 1, 1);
2614 _COREGL_FASTPATH_FUNC_END();
2619 //////////////////////////////////////////////////////////////////////////////////
2622 fastpath_glBlendColor(GLclampf red, GLclampf green, GLclampf blue,
2625 DEFINE_FASTPAH_GL_FUNC();
2626 _COREGL_FASTPATH_FUNC_BEGIN();
2627 INIT_FASTPATH_GL_FUNC();
2629 if ((current_ctx->gl_blend_color[0] != red) ||
2630 (current_ctx->gl_blend_color[1] != green) ||
2631 (current_ctx->gl_blend_color[2] != blue) ||
2632 (current_ctx->gl_blend_color[3] != alpha)) {
2633 IF_GL_SUCCESS(_orig_fastpath_glBlendColor(red, green, blue, alpha)) {
2634 current_ctx->_blend_flag |= _BLEND_FLAG_BIT_gl_blend_color;
2635 current_ctx->gl_blend_color[0] = red;
2636 current_ctx->gl_blend_color[1] = green;
2637 current_ctx->gl_blend_color[2] = blue;
2638 current_ctx->gl_blend_color[3] = alpha;
2644 _COREGL_FASTPATH_FUNC_END();
2649 fastpath_glBlendEquation(GLenum mode)
2651 DEFINE_FASTPAH_GL_FUNC();
2652 _COREGL_FASTPATH_FUNC_BEGIN();
2653 INIT_FASTPATH_GL_FUNC();
2655 IF_GL_SUCCESS(_orig_fastpath_glBlendEquation(mode)) {
2656 current_ctx->_blend_flag |=
2657 _BLEND_FLAG_BIT_gl_blend_equation_rgb |
2658 _BLEND_FLAG_BIT_gl_blend_equation_alpha;
2660 _orig_fastpath_glGetIntegerv(GL_BLEND_EQUATION_RGB,
2661 (GLint *) & (current_ctx->gl_blend_equation_rgb));
2662 _orig_fastpath_glGetIntegerv(GL_BLEND_EQUATION_ALPHA,
2663 (GLint *) & (current_ctx->gl_blend_equation_alpha));
2668 _COREGL_FASTPATH_FUNC_END();
2673 fastpath_glBlendEquationSeparate(GLenum modeRGB, GLenum modeAlpha)
2675 DEFINE_FASTPAH_GL_FUNC();
2676 _COREGL_FASTPATH_FUNC_BEGIN();
2677 INIT_FASTPATH_GL_FUNC();
2679 if ((current_ctx->gl_blend_equation_rgb[0] != modeRGB) ||
2680 (current_ctx->gl_blend_equation_alpha[0] != modeAlpha)) {
2681 IF_GL_SUCCESS(_orig_fastpath_glBlendEquationSeparate(modeRGB, modeAlpha)) {
2682 current_ctx->_blend_flag |=
2683 _BLEND_FLAG_BIT_gl_blend_equation_rgb |
2684 _BLEND_FLAG_BIT_gl_blend_equation_alpha;
2686 current_ctx->gl_blend_equation_rgb[0] = modeRGB;
2687 current_ctx->gl_blend_equation_alpha[0] = modeAlpha;
2693 _COREGL_FASTPATH_FUNC_END();
2698 fastpath_glBlendFunc(GLenum sfactor, GLenum dfactor)
2700 DEFINE_FASTPAH_GL_FUNC();
2701 _COREGL_FASTPATH_FUNC_BEGIN();
2702 INIT_FASTPATH_GL_FUNC();
2704 IF_GL_SUCCESS(_orig_fastpath_glBlendFunc(sfactor, dfactor)) {
2705 current_ctx->_blend_flag |=
2706 _BLEND_FLAG_BIT_gl_blend_src_rgb |
2707 _BLEND_FLAG_BIT_gl_blend_src_alpha |
2708 _BLEND_FLAG_BIT_gl_blend_dst_rgb |
2709 _BLEND_FLAG_BIT_gl_blend_dst_alpha;
2711 _orig_fastpath_glGetIntegerv(GL_BLEND_SRC_RGB,
2712 (GLint *) & (current_ctx->gl_blend_src_rgb));
2713 _orig_fastpath_glGetIntegerv(GL_BLEND_SRC_ALPHA,
2714 (GLint *) & (current_ctx->gl_blend_src_alpha));
2715 _orig_fastpath_glGetIntegerv(GL_BLEND_DST_RGB,
2716 (GLint *) & (current_ctx->gl_blend_dst_rgb));
2717 _orig_fastpath_glGetIntegerv(GL_BLEND_DST_ALPHA,
2718 (GLint *) & (current_ctx->gl_blend_dst_alpha));
2723 _COREGL_FASTPATH_FUNC_END();
2728 fastpath_glBlendFuncSeparate(GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha,
2731 DEFINE_FASTPAH_GL_FUNC();
2732 _COREGL_FASTPATH_FUNC_BEGIN();
2733 INIT_FASTPATH_GL_FUNC();
2735 if ((current_ctx->gl_blend_src_rgb[0] != srcRGB) ||
2736 (current_ctx->gl_blend_dst_rgb[0] != dstRGB) ||
2737 (current_ctx->gl_blend_src_alpha[0] != srcAlpha) ||
2738 (current_ctx->gl_blend_dst_alpha[0] != dstAlpha)) {
2739 IF_GL_SUCCESS(_orig_fastpath_glBlendFuncSeparate(srcRGB, dstRGB, srcAlpha,
2741 current_ctx->_blend_flag |=
2742 _BLEND_FLAG_BIT_gl_blend_src_rgb |
2743 _BLEND_FLAG_BIT_gl_blend_src_alpha |
2744 _BLEND_FLAG_BIT_gl_blend_dst_rgb |
2745 _BLEND_FLAG_BIT_gl_blend_dst_alpha;
2747 current_ctx->gl_blend_src_rgb[0] = srcRGB;
2748 current_ctx->gl_blend_dst_rgb[0] = dstRGB;
2749 current_ctx->gl_blend_src_alpha[0] = srcAlpha;
2750 current_ctx->gl_blend_dst_alpha[0] = dstAlpha;
2756 _COREGL_FASTPATH_FUNC_END();
2761 fastpath_glClearColor(GLclampf red, GLclampf green, GLclampf blue,
2764 DEFINE_FASTPAH_GL_FUNC();
2765 _COREGL_FASTPATH_FUNC_BEGIN();
2766 INIT_FASTPATH_GL_FUNC();
2768 if ((current_ctx->gl_color_clear_value[0] != red) ||
2769 (current_ctx->gl_color_clear_value[1] != green) ||
2770 (current_ctx->gl_color_clear_value[2] != blue) ||
2771 (current_ctx->gl_color_clear_value[3] != alpha)) {
2772 IF_GL_SUCCESS(_orig_fastpath_glClearColor(red, green, blue, alpha)) {
2773 current_ctx->_clear_flag1 |= _CLEAR_FLAG1_BIT_gl_color_clear_value;
2774 current_ctx->gl_color_clear_value[0] = red;
2775 current_ctx->gl_color_clear_value[1] = green;
2776 current_ctx->gl_color_clear_value[2] = blue;
2777 current_ctx->gl_color_clear_value[3] = alpha;
2783 _COREGL_FASTPATH_FUNC_END();
2788 fastpath_glClearDepthf(GLclampf depth)
2790 DEFINE_FASTPAH_GL_FUNC();
2791 _COREGL_FASTPATH_FUNC_BEGIN();
2792 INIT_FASTPATH_GL_FUNC();
2794 CURR_STATE_COMPARE(gl_depth_clear_value, depth) {
2795 IF_GL_SUCCESS(_orig_fastpath_glClearDepthf(depth)) {
2796 current_ctx->_clear_flag2 |= _CLEAR_FLAG2_BIT_gl_depth_clear_value;
2797 current_ctx->gl_depth_clear_value[0] = depth;
2803 _COREGL_FASTPATH_FUNC_END();
2808 fastpath_glClearStencil(GLint s)
2810 DEFINE_FASTPAH_GL_FUNC();
2811 _COREGL_FASTPATH_FUNC_BEGIN();
2812 INIT_FASTPATH_GL_FUNC();
2814 CURR_STATE_COMPARE(gl_stencil_clear_value, s) {
2815 IF_GL_SUCCESS(_orig_fastpath_glClearStencil(s)) {
2816 current_ctx->_stencil_flag2 |= _STENCIL_FLAG2_BIT_gl_stencil_clear_value;
2817 current_ctx->gl_stencil_clear_value[0] = s;
2823 _COREGL_FASTPATH_FUNC_END();
2828 fastpath_glColorMask(GLboolean red, GLboolean green, GLboolean blue,
2831 DEFINE_FASTPAH_GL_FUNC();
2832 _COREGL_FASTPATH_FUNC_BEGIN();
2833 INIT_FASTPATH_GL_FUNC();
2835 if ((current_ctx->gl_color_writemask[0] != red) ||
2836 (current_ctx->gl_color_writemask[1] != green) ||
2837 (current_ctx->gl_color_writemask[2] != blue) ||
2838 (current_ctx->gl_color_writemask[3] != alpha)) {
2839 IF_GL_SUCCESS(_orig_fastpath_glColorMask(red, green, blue, alpha)) {
2840 current_ctx->_clear_flag2 |= _CLEAR_FLAG2_BIT_gl_color_writemask;
2841 current_ctx->gl_color_writemask[0] = red;
2842 current_ctx->gl_color_writemask[1] = green;
2843 current_ctx->gl_color_writemask[2] = blue;
2844 current_ctx->gl_color_writemask[3] = alpha;
2850 _COREGL_FASTPATH_FUNC_END();
2855 fastpath_glCullFace(GLenum mode)
2857 DEFINE_FASTPAH_GL_FUNC();
2858 _COREGL_FASTPATH_FUNC_BEGIN();
2859 INIT_FASTPATH_GL_FUNC();
2861 CURR_STATE_COMPARE(gl_cull_face_mode, mode) {
2862 IF_GL_SUCCESS(_orig_fastpath_glCullFace(mode)) {
2863 current_ctx->_clear_flag2 |= _CLEAR_FLAG2_BIT_gl_cull_face_mode;
2864 current_ctx->gl_cull_face_mode[0] = mode;
2870 _COREGL_FASTPATH_FUNC_END();
2875 fastpath_glDepthFunc(GLenum func)
2877 DEFINE_FASTPAH_GL_FUNC();
2878 _COREGL_FASTPATH_FUNC_BEGIN();
2879 INIT_FASTPATH_GL_FUNC();
2881 CURR_STATE_COMPARE(gl_depth_func, func) {
2882 IF_GL_SUCCESS(_orig_fastpath_glDepthFunc(func)) {
2883 current_ctx->_clear_flag2 |= _CLEAR_FLAG2_BIT_gl_depth_func;
2884 current_ctx->gl_depth_func[0] = func;
2890 _COREGL_FASTPATH_FUNC_END();
2895 fastpath_glDepthMask(GLboolean flag)
2897 DEFINE_FASTPAH_GL_FUNC();
2898 _COREGL_FASTPATH_FUNC_BEGIN();
2899 INIT_FASTPATH_GL_FUNC();
2901 CURR_STATE_COMPARE(gl_depth_writemask, flag) {
2902 IF_GL_SUCCESS(_orig_fastpath_glDepthMask(flag)) {
2903 current_ctx->_clear_flag2 |= _CLEAR_FLAG2_BIT_gl_depth_writemask;
2904 current_ctx->gl_depth_writemask[0] = flag;
2910 _COREGL_FASTPATH_FUNC_END();
2915 fastpath_glDepthRangef(GLclampf zNear, GLclampf zFar)
2917 DEFINE_FASTPAH_GL_FUNC();
2918 _COREGL_FASTPATH_FUNC_BEGIN();
2919 INIT_FASTPATH_GL_FUNC();
2921 if ((current_ctx->gl_depth_range[0] != zNear) ||
2922 (current_ctx->gl_depth_range[1] != zFar)) {
2923 IF_GL_SUCCESS(_orig_fastpath_glDepthRangef(zNear, zFar)) {
2924 current_ctx->_clear_flag2 |= _CLEAR_FLAG2_BIT_gl_depth_range;
2925 current_ctx->gl_depth_range[0] = zNear;
2926 current_ctx->gl_depth_range[1] = zFar;
2932 _COREGL_FASTPATH_FUNC_END();
2937 fastpath_glDisable(GLenum cap)
2939 DEFINE_FASTPAH_GL_FUNC();
2940 _COREGL_FASTPATH_FUNC_BEGIN();
2941 INIT_FASTPATH_GL_FUNC();
2943 #define STATE_PROC(gl_state, flagid, flagbit) \
2944 CURR_STATE_COMPARE(gl_state, GL_FALSE) \
2946 _orig_fastpath_glDisable(cap); \
2947 current_ctx->flagid &= (~flagbit##_##gl_state); \
2948 current_ctx->gl_state[0] = GL_FALSE; \
2954 STATE_PROC(gl_blend, _enable_flag1, _ENABLE_FLAG1_BIT);
2957 STATE_PROC(gl_cull_face, _enable_flag1, _ENABLE_FLAG1_BIT);
2960 STATE_PROC(gl_depth_test, _enable_flag1, _ENABLE_FLAG1_BIT);
2963 STATE_PROC(gl_dither, _enable_flag1, _ENABLE_FLAG1_BIT);
2965 case GL_POLYGON_OFFSET_FILL:
2966 STATE_PROC(gl_polygon_offset_fill, _enable_flag2, _ENABLE_FLAG2_BIT);
2968 case GL_PRIMITIVE_RESTART_FIXED_INDEX:
2969 STATE_PROC_WITH_CHECK(gl_primitive_restart_fixed_index, _enable_flag3,
2972 case GL_RASTERIZER_DISCARD:
2973 STATE_PROC_WITH_CHECK(gl_rasterizer_discard, _enable_flag3, _ENABLE_FLAG3_BIT);
2975 case GL_SAMPLE_ALPHA_TO_COVERAGE:
2976 STATE_PROC(gl_sample_alpha_to_coverage, _enable_flag2, _ENABLE_FLAG2_BIT);
2978 case GL_SAMPLE_COVERAGE:
2979 STATE_PROC(gl_sample_coverage, _enable_flag2, _ENABLE_FLAG2_BIT);
2981 case GL_SCISSOR_TEST:
2982 STATE_PROC(gl_scissor_test, _enable_flag2, _ENABLE_FLAG2_BIT);
2984 case GL_STENCIL_TEST:
2985 STATE_PROC(gl_stencil_test, _enable_flag2, _ENABLE_FLAG2_BIT);
2988 _set_gl_error(GL_INVALID_ENUM);
2999 _COREGL_FASTPATH_FUNC_END();
3004 fastpath_glDisableVertexAttribArray(GLuint index)
3006 DEFINE_FASTPAH_GL_FUNC();
3007 _COREGL_FASTPATH_FUNC_BEGIN();
3008 INIT_FASTPATH_GL_FUNC();
3010 IF_GL_SUCCESS(_orig_fastpath_glDisableVertexAttribArray(index)) {
3011 if (current_ctx->gl_vertex_array_binding[0] == 0) {
3012 current_ctx->_vattrib_flag |= _VATTRIB_FLAG_BIT_gl_vertex_array;
3013 current_ctx->gl_vertex_array_enabled[index] = GL_FALSE;
3020 _COREGL_FASTPATH_FUNC_END();
3024 fastpath_glEnable(GLenum cap)
3026 DEFINE_FASTPAH_GL_FUNC();
3027 _COREGL_FASTPATH_FUNC_BEGIN();
3028 INIT_FASTPATH_GL_FUNC();
3030 #define STATE_PROC(gl_state, flagid, flagbit) \
3031 CURR_STATE_COMPARE(gl_state, GL_TRUE) \
3033 _orig_fastpath_glEnable(cap); \
3034 current_ctx->flagid |= flagbit##_##gl_state; \
3035 current_ctx->gl_state[0] = GL_TRUE; \
3041 STATE_PROC(gl_blend, _enable_flag1, _ENABLE_FLAG1_BIT);
3044 STATE_PROC(gl_cull_face, _enable_flag1, _ENABLE_FLAG1_BIT);
3047 STATE_PROC(gl_depth_test, _enable_flag1, _ENABLE_FLAG1_BIT);
3050 STATE_PROC(gl_dither, _enable_flag1, _ENABLE_FLAG1_BIT);
3052 case GL_POLYGON_OFFSET_FILL:
3053 STATE_PROC(gl_polygon_offset_fill, _enable_flag2, _ENABLE_FLAG2_BIT);
3055 case GL_PRIMITIVE_RESTART_FIXED_INDEX:
3056 STATE_PROC_WITH_CHECK(gl_primitive_restart_fixed_index, _enable_flag3,
3059 case GL_RASTERIZER_DISCARD:
3060 STATE_PROC_WITH_CHECK(gl_rasterizer_discard, _enable_flag3, _ENABLE_FLAG3_BIT);
3062 case GL_SAMPLE_ALPHA_TO_COVERAGE:
3063 STATE_PROC(gl_sample_alpha_to_coverage, _enable_flag2, _ENABLE_FLAG2_BIT);
3065 case GL_SAMPLE_COVERAGE:
3066 STATE_PROC(gl_sample_coverage, _enable_flag2, _ENABLE_FLAG2_BIT);
3068 case GL_SCISSOR_TEST:
3069 STATE_PROC(gl_scissor_test, _enable_flag2, _ENABLE_FLAG2_BIT);
3071 case GL_STENCIL_TEST:
3072 STATE_PROC(gl_stencil_test, _enable_flag2, _ENABLE_FLAG2_BIT);
3075 _set_gl_error(GL_INVALID_ENUM);
3084 _COREGL_FASTPATH_FUNC_END();
3089 fastpath_glEnableVertexAttribArray(GLuint index)
3091 DEFINE_FASTPAH_GL_FUNC();
3092 _COREGL_FASTPATH_FUNC_BEGIN();
3093 INIT_FASTPATH_GL_FUNC();
3095 IF_GL_SUCCESS(_orig_fastpath_glEnableVertexAttribArray(index)) {
3096 if (current_ctx->gl_vertex_array_binding[0] == 0) {
3097 current_ctx->_vattrib_flag |= _VATTRIB_FLAG_BIT_gl_vertex_array;
3098 current_ctx->gl_vertex_array_enabled[index] = GL_TRUE;
3105 _COREGL_FASTPATH_FUNC_END();
3110 fastpath_glFrontFace(GLenum mode)
3112 DEFINE_FASTPAH_GL_FUNC();
3113 _COREGL_FASTPATH_FUNC_BEGIN();
3114 INIT_FASTPATH_GL_FUNC();
3116 CURR_STATE_COMPARE(gl_front_face, mode) {
3117 IF_GL_SUCCESS(_orig_fastpath_glFrontFace(mode)) {
3118 current_ctx->_misc_flag1 |= _MISC_FLAG1_BIT_gl_front_face;
3119 current_ctx->gl_front_face[0] = mode;
3125 _COREGL_FASTPATH_FUNC_END();
3129 fastpath_glHint(GLenum target, GLenum mode)
3131 DEFINE_FASTPAH_GL_FUNC();
3132 _COREGL_FASTPATH_FUNC_BEGIN();
3133 INIT_FASTPATH_GL_FUNC();
3136 #define STATE_PROC(gl_state, flagid, flagbit) \
3137 CURR_STATE_COMPARE(gl_state, mode) \
3139 IF_GL_SUCCESS(_orig_fastpath_glHint(target, mode)) \
3141 current_ctx->flagid |= flagbit##_##gl_state; \
3142 current_ctx->gl_state[0] = mode; \
3148 case GL_FRAGMENT_SHADER_DERIVATIVE_HINT:
3149 STATE_PROC_WITH_CHECK(gl_fragment_shader_derivative_hint, _misc_flag1,
3152 case GL_GENERATE_MIPMAP_HINT:
3153 STATE_PROC(gl_generate_mipmap_hint, _tex_flag1, _TEX_FLAG1_BIT);
3156 _set_gl_error(GL_INVALID_ENUM);
3165 _COREGL_FASTPATH_FUNC_END();
3170 fastpath_glLineWidth(GLfloat width)
3172 DEFINE_FASTPAH_GL_FUNC();
3173 _COREGL_FASTPATH_FUNC_BEGIN();
3174 INIT_FASTPATH_GL_FUNC();
3176 CURR_STATE_COMPARE(gl_line_width, width) {
3177 IF_GL_SUCCESS(_orig_fastpath_glLineWidth(width)) {
3178 current_ctx->_misc_flag1 |= _MISC_FLAG1_BIT_gl_line_width;
3179 current_ctx->gl_line_width[0] = width;
3185 _COREGL_FASTPATH_FUNC_END();
3190 fastpath_glPixelStorei(GLenum pname, GLint param)
3192 DEFINE_FASTPAH_GL_FUNC();
3193 _COREGL_FASTPATH_FUNC_BEGIN();
3194 INIT_FASTPATH_GL_FUNC();
3196 #define STATE_PROC(gl_state, flagid, flagbit) \
3197 CURR_STATE_COMPARE(gl_state, param) \
3199 IF_GL_SUCCESS(_orig_fastpath_glPixelStorei(pname, param)) \
3201 current_ctx->flagid |= flagbit##_##gl_state; \
3202 current_ctx->gl_state[0] = param; \
3208 case GL_PACK_ROW_LENGTH:
3209 STATE_PROC_WITH_CHECK(gl_pack_row_length, _pixel_flag1, _PIXEL_FLAG1_BIT);
3211 case GL_PACK_SKIP_PIXELS:
3212 STATE_PROC_WITH_CHECK(gl_pack_skip_pixels, _pixel_flag1, _PIXEL_FLAG1_BIT);
3214 case GL_PACK_SKIP_ROWS:
3215 STATE_PROC_WITH_CHECK(gl_pack_skip_rows, _pixel_flag1, _PIXEL_FLAG1_BIT);
3217 case GL_PACK_ALIGNMENT:
3218 STATE_PROC(gl_pack_alignment, _pixel_flag1, _PIXEL_FLAG1_BIT);
3220 case GL_UNPACK_ROW_LENGTH:
3221 STATE_PROC_WITH_CHECK(gl_unpack_row_length, _pixel_flag2, _PIXEL_FLAG2_BIT);
3223 case GL_UNPACK_IMAGE_HEIGHT:
3224 STATE_PROC_WITH_CHECK(gl_unpack_image_height, _pixel_flag2, _PIXEL_FLAG2_BIT);
3226 case GL_UNPACK_SKIP_PIXELS:
3227 STATE_PROC_WITH_CHECK(gl_unpack_skip_pixels, _pixel_flag2, _PIXEL_FLAG2_BIT);
3229 case GL_UNPACK_SKIP_IMAGES:
3230 STATE_PROC_WITH_CHECK(gl_unpack_skip_images, _pixel_flag2, _PIXEL_FLAG2_BIT);
3232 case GL_UNPACK_ALIGNMENT:
3233 STATE_PROC(gl_unpack_alignment, _pixel_flag2, _PIXEL_FLAG2_BIT);
3236 _set_gl_error(GL_INVALID_ENUM);
3246 _COREGL_FASTPATH_FUNC_END();
3251 fastpath_glPolygonOffset(GLfloat factor, GLfloat units)
3253 DEFINE_FASTPAH_GL_FUNC();
3254 _COREGL_FASTPATH_FUNC_BEGIN();
3255 INIT_FASTPATH_GL_FUNC();
3257 if ((current_ctx->gl_polygon_offset_factor[0] != factor) ||
3258 (current_ctx->gl_polygon_offset_units[0] != units)) {
3259 IF_GL_SUCCESS(_orig_fastpath_glPolygonOffset(factor, units)) {
3260 current_ctx->_misc_flag1 |=
3261 _MISC_FLAG1_BIT_gl_polygon_offset_factor |
3262 _MISC_FLAG1_BIT_gl_polygon_offset_units;
3264 current_ctx->gl_polygon_offset_factor[0] = factor;
3265 current_ctx->gl_polygon_offset_units[0] = units;
3271 _COREGL_FASTPATH_FUNC_END();
3276 fastpath_glSampleCoverage(GLclampf value, GLboolean invert)
3278 DEFINE_FASTPAH_GL_FUNC();
3279 _COREGL_FASTPATH_FUNC_BEGIN();
3280 INIT_FASTPATH_GL_FUNC();
3282 if ((current_ctx->gl_sample_coverage_value[0] != value) ||
3283 (current_ctx->gl_sample_coverage_invert[0] != invert)) {
3284 IF_GL_SUCCESS(_orig_fastpath_glSampleCoverage(value, invert)) {
3285 current_ctx->_misc_flag1 |=
3286 _MISC_FLAG1_BIT_gl_sample_coverage_value |
3287 _MISC_FLAG1_BIT_gl_sample_coverage_invert;
3289 current_ctx->gl_sample_coverage_value[0] = value;
3290 current_ctx->gl_sample_coverage_invert[0] = invert;
3296 _COREGL_FASTPATH_FUNC_END();
3301 fastpath_glScissor(GLint x, GLint y, GLsizei width, GLsizei height)
3303 DEFINE_FASTPAH_GL_FUNC();
3304 _COREGL_FASTPATH_FUNC_BEGIN();
3305 INIT_FASTPATH_GL_FUNC();
3307 if ((current_ctx->gl_scissor_box[0] != x) ||
3308 (current_ctx->gl_scissor_box[1] != y) ||
3309 (current_ctx->gl_scissor_box[2] != width) ||
3310 (current_ctx->gl_scissor_box[3] != height)) {
3311 IF_GL_SUCCESS(_orig_fastpath_glScissor(x, y, width, height)) {
3312 current_ctx->_misc_flag2 |= _MISC_FLAG2_BIT_gl_scissor_box;
3313 current_ctx->gl_scissor_box[0] = x;
3314 current_ctx->gl_scissor_box[1] = y;
3315 current_ctx->gl_scissor_box[2] = width;
3316 current_ctx->gl_scissor_box[3] = height;
3322 _COREGL_FASTPATH_FUNC_END();
3327 fastpath_glStencilFunc(GLenum func, GLint ref, GLuint mask)
3329 DEFINE_FASTPAH_GL_FUNC();
3330 _COREGL_FASTPATH_FUNC_BEGIN();
3331 INIT_FASTPATH_GL_FUNC();
3333 if ((current_ctx->gl_stencil_func[0] != func) ||
3334 (current_ctx->gl_stencil_ref[0] != ref) ||
3335 (current_ctx->gl_stencil_value_mask[0] != mask) ||
3336 (current_ctx->gl_stencil_back_func[0] != func) ||
3337 (current_ctx->gl_stencil_back_ref[0] != ref) ||
3338 (current_ctx->gl_stencil_back_value_mask[0] != mask)) {
3339 IF_GL_SUCCESS(_orig_fastpath_glStencilFunc(func, ref, mask)) {
3340 current_ctx->_stencil_flag1 |=
3341 _STENCIL_FLAG1_BIT_gl_stencil_func |
3342 _STENCIL_FLAG1_BIT_gl_stencil_ref |
3343 _STENCIL_FLAG1_BIT_gl_stencil_value_mask;
3345 current_ctx->gl_stencil_func[0] = func;
3346 current_ctx->gl_stencil_ref[0] = ref;
3347 current_ctx->gl_stencil_value_mask[0] = mask;
3349 current_ctx->_stencil_flag2 |=
3350 _STENCIL_FLAG2_BIT_gl_stencil_back_func |
3351 _STENCIL_FLAG2_BIT_gl_stencil_back_ref |
3352 _STENCIL_FLAG2_BIT_gl_stencil_back_value_mask;
3354 current_ctx->gl_stencil_back_func[0] = func;
3355 current_ctx->gl_stencil_back_ref[0] = ref;
3356 current_ctx->gl_stencil_back_value_mask[0] = mask;
3362 _COREGL_FASTPATH_FUNC_END();
3367 fastpath_glStencilFuncSeparate(GLenum face, GLenum func, GLint ref, GLuint mask)
3369 DEFINE_FASTPAH_GL_FUNC();
3370 _COREGL_FASTPATH_FUNC_BEGIN();
3371 INIT_FASTPATH_GL_FUNC();
3373 if ((face == GL_FRONT) || (face == GL_FRONT_AND_BACK)) {
3374 if ((current_ctx->gl_stencil_func[0] != func) ||
3375 (current_ctx->gl_stencil_ref[0] != ref) ||
3376 (current_ctx->gl_stencil_value_mask[0] != mask)) {
3377 IF_GL_SUCCESS(_orig_fastpath_glStencilFuncSeparate(face, func, ref, mask)) {
3378 current_ctx->_stencil_flag1 |=
3379 _STENCIL_FLAG1_BIT_gl_stencil_func |
3380 _STENCIL_FLAG1_BIT_gl_stencil_ref |
3381 _STENCIL_FLAG1_BIT_gl_stencil_value_mask;
3383 current_ctx->gl_stencil_func[0] = func;
3384 current_ctx->gl_stencil_ref[0] = ref;
3385 current_ctx->gl_stencil_value_mask[0] = mask;
3388 } else if ((face == GL_BACK) || (face == GL_FRONT_AND_BACK)) {
3389 if ((current_ctx->gl_stencil_back_func[0] != func) ||
3390 (current_ctx->gl_stencil_back_ref[0] != ref) ||
3391 (current_ctx->gl_stencil_back_value_mask[0] != mask)) {
3392 IF_GL_SUCCESS(_orig_fastpath_glStencilFuncSeparate(face, func, ref, mask)) {
3393 current_ctx->_stencil_flag2 |=
3394 _STENCIL_FLAG2_BIT_gl_stencil_back_func |
3395 _STENCIL_FLAG2_BIT_gl_stencil_back_ref |
3396 _STENCIL_FLAG2_BIT_gl_stencil_back_value_mask;
3398 current_ctx->gl_stencil_back_func[0] = func;
3399 current_ctx->gl_stencil_back_ref[0] = ref;
3400 current_ctx->gl_stencil_back_value_mask[0] = mask;
3404 _set_gl_error(GL_INVALID_ENUM);
3410 _COREGL_FASTPATH_FUNC_END();
3415 fastpath_glStencilMask(GLuint mask)
3417 DEFINE_FASTPAH_GL_FUNC();
3418 _COREGL_FASTPATH_FUNC_BEGIN();
3419 INIT_FASTPATH_GL_FUNC();
3421 if ((current_ctx->gl_stencil_writemask[0] != mask) ||
3422 (current_ctx->gl_stencil_back_writemask[0] != mask)) {
3423 IF_GL_SUCCESS(_orig_fastpath_glStencilMask(mask)) {
3424 current_ctx->_stencil_flag1 |= _STENCIL_FLAG1_BIT_gl_stencil_writemask;
3425 current_ctx->_stencil_flag2 |= _STENCIL_FLAG2_BIT_gl_stencil_back_writemask;
3427 current_ctx->gl_stencil_writemask[0] = mask;
3428 current_ctx->gl_stencil_back_writemask[0] = mask;
3434 _COREGL_FASTPATH_FUNC_END();
3439 fastpath_glStencilMaskSeparate(GLenum face, GLuint mask)
3441 DEFINE_FASTPAH_GL_FUNC();
3442 _COREGL_FASTPATH_FUNC_BEGIN();
3443 INIT_FASTPATH_GL_FUNC();
3445 if ((face == GL_FRONT) || (face == GL_FRONT_AND_BACK)) {
3446 if (current_ctx->gl_stencil_writemask[0] != mask) {
3447 IF_GL_SUCCESS(_orig_fastpath_glStencilMaskSeparate(face, mask)) {
3448 current_ctx->_stencil_flag1 |= _STENCIL_FLAG1_BIT_gl_stencil_writemask;
3449 current_ctx->gl_stencil_writemask[0] = mask;
3452 } else if ((face == GL_BACK) || (face == GL_FRONT_AND_BACK)) {
3453 if (current_ctx->gl_stencil_back_writemask[0] != mask) {
3454 IF_GL_SUCCESS(_orig_fastpath_glStencilMaskSeparate(face, mask)) {
3455 current_ctx->_stencil_flag2 |= _STENCIL_FLAG2_BIT_gl_stencil_back_writemask;
3456 current_ctx->gl_stencil_back_writemask[0] = mask;
3460 _set_gl_error(GL_INVALID_ENUM);
3466 _COREGL_FASTPATH_FUNC_END();
3471 fastpath_glStencilOp(GLenum fail, GLenum zfail, GLenum zpass)
3473 DEFINE_FASTPAH_GL_FUNC();
3474 _COREGL_FASTPATH_FUNC_BEGIN();
3475 INIT_FASTPATH_GL_FUNC();
3477 if ((current_ctx->gl_stencil_fail[0] != fail) ||
3478 (current_ctx->gl_stencil_pass_depth_fail[0] != zfail) ||
3479 (current_ctx->gl_stencil_pass_depth_pass[0] != zpass) ||
3480 (current_ctx->gl_stencil_back_fail[0] != fail) ||
3481 (current_ctx->gl_stencil_back_pass_depth_fail[0] != zfail) ||
3482 (current_ctx->gl_stencil_back_pass_depth_pass[0] != zpass)) {
3483 IF_GL_SUCCESS(_orig_fastpath_glStencilOp(fail, zfail, zpass)) {
3484 current_ctx->_stencil_flag1 |=
3485 _STENCIL_FLAG1_BIT_gl_stencil_fail |
3486 _STENCIL_FLAG1_BIT_gl_stencil_pass_depth_fail |
3487 _STENCIL_FLAG1_BIT_gl_stencil_pass_depth_pass;
3489 current_ctx->gl_stencil_fail[0] = fail;
3490 current_ctx->gl_stencil_pass_depth_fail[0] = zfail;
3491 current_ctx->gl_stencil_pass_depth_pass[0] = zpass;
3493 current_ctx->_stencil_flag2 |=
3494 _STENCIL_FLAG2_BIT_gl_stencil_back_fail |
3495 _STENCIL_FLAG2_BIT_gl_stencil_back_pass_depth_fail |
3496 _STENCIL_FLAG2_BIT_gl_stencil_back_pass_depth_pass;
3498 current_ctx->gl_stencil_back_fail[0] = fail;
3499 current_ctx->gl_stencil_back_pass_depth_fail[0] = zfail;
3500 current_ctx->gl_stencil_back_pass_depth_pass[0] = zpass;
3506 _COREGL_FASTPATH_FUNC_END();
3511 fastpath_glStencilOpSeparate(GLenum face, GLenum fail, GLenum zfail,
3514 DEFINE_FASTPAH_GL_FUNC();
3515 _COREGL_FASTPATH_FUNC_BEGIN();
3516 INIT_FASTPATH_GL_FUNC();
3518 if ((face == GL_FRONT) || (face == GL_FRONT_AND_BACK)) {
3519 if ((current_ctx->gl_stencil_fail[0] != fail) ||
3520 (current_ctx->gl_stencil_pass_depth_fail[0] != zfail) ||
3521 (current_ctx->gl_stencil_pass_depth_pass[0] != zpass)) {
3522 IF_GL_SUCCESS(_orig_fastpath_glStencilOpSeparate(face, fail, zfail, zpass)) {
3523 current_ctx->_stencil_flag1 |=
3524 _STENCIL_FLAG1_BIT_gl_stencil_fail |
3525 _STENCIL_FLAG1_BIT_gl_stencil_pass_depth_fail |
3526 _STENCIL_FLAG1_BIT_gl_stencil_pass_depth_pass;
3528 current_ctx->gl_stencil_fail[0] = fail;
3529 current_ctx->gl_stencil_pass_depth_fail[0] = zfail;
3530 current_ctx->gl_stencil_pass_depth_pass[0] = zpass;
3533 } else if ((face == GL_BACK) || (face == GL_FRONT_AND_BACK)) {
3534 if ((current_ctx->gl_stencil_back_fail[0] != fail) ||
3535 (current_ctx->gl_stencil_back_pass_depth_fail[0] != zfail) ||
3536 (current_ctx->gl_stencil_back_pass_depth_pass[0] != zpass)) {
3537 IF_GL_SUCCESS(_orig_fastpath_glStencilOpSeparate(face, fail, zfail, zpass)) {
3538 current_ctx->_stencil_flag2 |=
3539 _STENCIL_FLAG2_BIT_gl_stencil_back_fail |
3540 _STENCIL_FLAG2_BIT_gl_stencil_back_pass_depth_fail |
3541 _STENCIL_FLAG2_BIT_gl_stencil_back_pass_depth_pass;
3543 current_ctx->gl_stencil_back_fail[0] = fail;
3544 current_ctx->gl_stencil_back_pass_depth_fail[0] = zfail;
3545 current_ctx->gl_stencil_back_pass_depth_pass[0] = zpass;
3549 _set_gl_error(GL_INVALID_ENUM);
3555 _COREGL_FASTPATH_FUNC_END();
3560 fastpath_glVertexAttrib1f(GLuint index, GLfloat x)
3562 DEFINE_FASTPAH_GL_FUNC();
3563 _COREGL_FASTPATH_FUNC_BEGIN();
3564 INIT_FASTPATH_GL_FUNC();
3566 IF_GL_SUCCESS(_orig_fastpath_glVertexAttrib1f(index, x)) {
3567 if (current_ctx->gl_vertex_array_binding[0] == 0) {
3568 current_ctx->_vattrib_flag |= _VATTRIB_FLAG_BIT_gl_vertex_attrib_value;
3569 current_ctx->gl_vertex_array_size[index] = 0;
3570 current_ctx->gl_vertex_array_integer[index] = GL_FALSE;
3572 current_ctx->gl_vertex_attrib_value[index * 4 + 0] = x;
3573 current_ctx->gl_vertex_attrib_value[index * 4 + 1] = 0;
3574 current_ctx->gl_vertex_attrib_value[index * 4 + 2] = 0;
3575 current_ctx->gl_vertex_attrib_value[index * 4 + 3] = 1;
3581 _COREGL_FASTPATH_FUNC_END();
3586 fastpath_glVertexAttrib1fv(GLuint index, const GLfloat *values)
3588 DEFINE_FASTPAH_GL_FUNC();
3589 _COREGL_FASTPATH_FUNC_BEGIN();
3590 INIT_FASTPATH_GL_FUNC();
3592 IF_GL_SUCCESS(_orig_fastpath_glVertexAttrib1fv(index, values)) {
3593 if (current_ctx->gl_vertex_array_binding[0] == 0) {
3594 current_ctx->_vattrib_flag |= _VATTRIB_FLAG_BIT_gl_vertex_attrib_value;
3595 current_ctx->gl_vertex_array_size[index] = 0;
3596 current_ctx->gl_vertex_array_integer[index] = GL_FALSE;
3598 current_ctx->gl_vertex_attrib_value[index * 4 + 0] = values[0];
3599 current_ctx->gl_vertex_attrib_value[index * 4 + 1] = 0;
3600 current_ctx->gl_vertex_attrib_value[index * 4 + 2] = 0;
3601 current_ctx->gl_vertex_attrib_value[index * 4 + 3] = 1;
3607 _COREGL_FASTPATH_FUNC_END();
3612 fastpath_glVertexAttrib2f(GLuint index, GLfloat x, GLfloat y)
3614 DEFINE_FASTPAH_GL_FUNC();
3615 _COREGL_FASTPATH_FUNC_BEGIN();
3616 INIT_FASTPATH_GL_FUNC();
3618 IF_GL_SUCCESS(_orig_fastpath_glVertexAttrib2f(index, x, y)) {
3619 if (current_ctx->gl_vertex_array_binding[0] == 0) {
3620 current_ctx->_vattrib_flag |= _VATTRIB_FLAG_BIT_gl_vertex_attrib_value;
3621 current_ctx->gl_vertex_array_size[index] = 0;
3622 current_ctx->gl_vertex_array_integer[index] = GL_FALSE;
3624 current_ctx->gl_vertex_attrib_value[index * 4 + 0] = x;
3625 current_ctx->gl_vertex_attrib_value[index * 4 + 1] = y;
3626 current_ctx->gl_vertex_attrib_value[index * 4 + 2] = 0;
3627 current_ctx->gl_vertex_attrib_value[index * 4 + 3] = 1;
3633 _COREGL_FASTPATH_FUNC_END();
3638 fastpath_glVertexAttrib2fv(GLuint index, const GLfloat *values)
3640 DEFINE_FASTPAH_GL_FUNC();
3641 _COREGL_FASTPATH_FUNC_BEGIN();
3642 INIT_FASTPATH_GL_FUNC();
3644 IF_GL_SUCCESS(_orig_fastpath_glVertexAttrib2fv(index, values)) {
3645 if (current_ctx->gl_vertex_array_binding[0] == 0) {
3646 current_ctx->_vattrib_flag |= _VATTRIB_FLAG_BIT_gl_vertex_attrib_value;
3647 current_ctx->gl_vertex_array_size[index] = 0;
3648 current_ctx->gl_vertex_array_integer[index] = GL_FALSE;
3650 current_ctx->gl_vertex_attrib_value[index * 4 + 0] = values[0];
3651 current_ctx->gl_vertex_attrib_value[index * 4 + 1] = values[1];
3652 current_ctx->gl_vertex_attrib_value[index * 4 + 2] = 0;
3653 current_ctx->gl_vertex_attrib_value[index * 4 + 3] = 1;
3659 _COREGL_FASTPATH_FUNC_END();
3664 fastpath_glVertexAttrib3f(GLuint index, GLfloat x, GLfloat y, GLfloat z)
3666 DEFINE_FASTPAH_GL_FUNC();
3667 _COREGL_FASTPATH_FUNC_BEGIN();
3668 INIT_FASTPATH_GL_FUNC();
3670 IF_GL_SUCCESS(_orig_fastpath_glVertexAttrib3f(index, x, y, z)) {
3671 if (current_ctx->gl_vertex_array_binding[0] == 0) {
3672 current_ctx->_vattrib_flag |= _VATTRIB_FLAG_BIT_gl_vertex_attrib_value;
3673 current_ctx->gl_vertex_array_size[index] = 0;
3674 current_ctx->gl_vertex_array_integer[index] = GL_FALSE;
3676 current_ctx->gl_vertex_attrib_value[index * 4 + 0] = x;
3677 current_ctx->gl_vertex_attrib_value[index * 4 + 1] = y;
3678 current_ctx->gl_vertex_attrib_value[index * 4 + 2] = z;
3679 current_ctx->gl_vertex_attrib_value[index * 4 + 3] = 1;
3685 _COREGL_FASTPATH_FUNC_END();
3690 fastpath_glVertexAttrib3fv(GLuint index, const GLfloat *values)
3692 DEFINE_FASTPAH_GL_FUNC();
3693 _COREGL_FASTPATH_FUNC_BEGIN();
3694 INIT_FASTPATH_GL_FUNC();
3696 IF_GL_SUCCESS(_orig_fastpath_glVertexAttrib3fv(index, values)) {
3697 if (current_ctx->gl_vertex_array_binding[0] == 0) {
3698 current_ctx->_vattrib_flag |= _VATTRIB_FLAG_BIT_gl_vertex_attrib_value;
3699 current_ctx->gl_vertex_array_size[index] = 0;
3700 current_ctx->gl_vertex_array_integer[index] = GL_FALSE;
3702 current_ctx->gl_vertex_attrib_value[index * 4 + 0] = values[0];
3703 current_ctx->gl_vertex_attrib_value[index * 4 + 1] = values[1];
3704 current_ctx->gl_vertex_attrib_value[index * 4 + 2] = values[2];
3705 current_ctx->gl_vertex_attrib_value[index * 4 + 3] = 1;
3711 _COREGL_FASTPATH_FUNC_END();
3716 fastpath_glVertexAttrib4f(GLuint index, GLfloat x, GLfloat y, GLfloat z,
3719 DEFINE_FASTPAH_GL_FUNC();
3720 _COREGL_FASTPATH_FUNC_BEGIN();
3721 INIT_FASTPATH_GL_FUNC();
3723 IF_GL_SUCCESS(_orig_fastpath_glVertexAttrib4f(index, x, y, z, w)) {
3724 if (current_ctx->gl_vertex_array_binding[0] == 0) {
3725 current_ctx->_vattrib_flag |= _VATTRIB_FLAG_BIT_gl_vertex_attrib_value;
3726 current_ctx->gl_vertex_array_size[index] = 0;
3727 current_ctx->gl_vertex_array_integer[index] = GL_FALSE;
3729 current_ctx->gl_vertex_attrib_value[index * 4 + 0] = x;
3730 current_ctx->gl_vertex_attrib_value[index * 4 + 1] = y;
3731 current_ctx->gl_vertex_attrib_value[index * 4 + 2] = z;
3732 current_ctx->gl_vertex_attrib_value[index * 4 + 3] = w;
3738 _COREGL_FASTPATH_FUNC_END();
3743 fastpath_glVertexAttrib4fv(GLuint index, const GLfloat *values)
3745 DEFINE_FASTPAH_GL_FUNC();
3746 _COREGL_FASTPATH_FUNC_BEGIN();
3747 INIT_FASTPATH_GL_FUNC();
3749 IF_GL_SUCCESS(_orig_fastpath_glVertexAttrib4fv(index, values)) {
3750 if (current_ctx->gl_vertex_array_binding[0] == 0) {
3751 current_ctx->_vattrib_flag |= _VATTRIB_FLAG_BIT_gl_vertex_attrib_value;
3752 current_ctx->gl_vertex_array_size[index] = 0;
3753 current_ctx->gl_vertex_array_integer[index] = GL_FALSE;
3755 current_ctx->gl_vertex_attrib_value[index * 4 + 0] = values[0];
3756 current_ctx->gl_vertex_attrib_value[index * 4 + 1] = values[1];
3757 current_ctx->gl_vertex_attrib_value[index * 4 + 2] = values[2];
3758 current_ctx->gl_vertex_attrib_value[index * 4 + 3] = values[3];
3764 _COREGL_FASTPATH_FUNC_END();
3769 fastpath_glVertexAttribPointer(GLuint index, GLint size, GLenum type,
3770 GLboolean normalized, GLsizei stride, const void *pointer)
3772 DEFINE_FASTPAH_GL_FUNC();
3773 _COREGL_FASTPATH_FUNC_BEGIN();
3774 INIT_FASTPATH_GL_FUNC();
3776 IF_GL_SUCCESS(_orig_fastpath_glVertexAttribPointer(index, size, type,
3777 normalized, stride, pointer)) {
3778 if (current_ctx->gl_vertex_array_binding[0] == 0) {
3779 current_ctx->_vattrib_flag |= _VATTRIB_FLAG_BIT_gl_vertex_array;
3781 current_ctx->gl_vertex_array_buf_id[index] =
3782 current_ctx->gl_array_buffer_binding[0];
3783 current_ctx->gl_vertex_array_size[index] = size;
3784 current_ctx->gl_vertex_array_type[index] = type;
3785 current_ctx->gl_vertex_array_normalized[index] = normalized;
3786 current_ctx->gl_vertex_array_integer[index] = GL_FALSE;
3787 current_ctx->gl_vertex_array_stride[index] = stride;
3788 current_ctx->gl_vertex_array_pointer[index] = (GLvoid *)pointer;
3794 _COREGL_FASTPATH_FUNC_END();
3799 fastpath_glViewport(GLint x, GLint y, GLsizei width, GLsizei height)
3801 DEFINE_FASTPAH_GL_FUNC();
3802 _COREGL_FASTPATH_FUNC_BEGIN();
3803 INIT_FASTPATH_GL_FUNC();
3805 if ((current_ctx->gl_viewport[0] != x) ||
3806 (current_ctx->gl_viewport[1] != y) ||
3807 (current_ctx->gl_viewport[2] != width) ||
3808 (current_ctx->gl_viewport[3] != height)) {
3809 IF_GL_SUCCESS(_orig_fastpath_glViewport(x, y, width, height)) {
3810 current_ctx->_clear_flag1 |= _CLEAR_FLAG1_BIT_gl_viewport;
3811 current_ctx->gl_viewport[0] = x;
3812 current_ctx->gl_viewport[1] = y;
3813 current_ctx->gl_viewport[2] = width;
3814 current_ctx->gl_viewport[3] = height;
3821 _COREGL_FASTPATH_FUNC_END();
3824 #define TRANS_VALUE(index, value) \
3828 case GL_INT: if (!is64) ((GLint *)ptr)[index] = value; else ((GLint64 *)ptr)[index] = value; break; \
3829 case GL_FLOAT: ((GLfloat *)ptr)[index] = (GLfloat)value; break; \
3830 case GL_BOOL: ((GLboolean *)ptr)[index] = (value == 0) ? GL_FALSE : GL_TRUE; break; \
3834 #define EXTRACT_VALUE(index, value) \
3838 case GL_INT: if (!is64) value = ((GLint *)ptr)[index]; else value = ((GLint64 *)ptr)[index]; break; \
3839 case GL_FLOAT: value = ((GLfloat *)ptr)[index]; break; \
3840 case GL_BOOL: value = ((GLboolean *)ptr)[index]; break; \
3845 _modify_get_value(GLenum pname, GLvoid *ptr, GLenum get_type, GLboolean is64)
3847 GLboolean ret = GL_FALSE;
3849 DEFINE_FASTPAH_GL_FUNC();
3850 INIT_FASTPATH_GL_FUNC();
3853 case GL_NUM_EXTENSIONS:
3854 _valid_extension_string();
3855 TRANS_VALUE(0, gl_extension_count);
3858 case GL_TEXTURE_BINDING_2D:
3859 case GL_TEXTURE_BINDING_CUBE_MAP:
3860 case GL_ARRAY_BUFFER_BINDING:
3861 case GL_ELEMENT_ARRAY_BUFFER_BINDING:
3862 case GL_COPY_READ_BUFFER_BINDING:
3863 case GL_COPY_WRITE_BUFFER_BINDING:
3864 case GL_PIXEL_PACK_BUFFER_BINDING:
3865 case GL_PIXEL_UNPACK_BUFFER_BINDING:
3866 case GL_TRANSFORM_FEEDBACK_BUFFER_BINDING:
3867 case GL_UNIFORM_BUFFER_BINDING:
3868 case GL_DRAW_FRAMEBUFFER_BINDING:
3869 case GL_READ_FRAMEBUFFER_BINDING:
3870 case GL_RENDERBUFFER_BINDING:
3871 case GL_CURRENT_PROGRAM:
3872 case GL_VERTEX_ARRAY_BINDING:
3873 case GL_SAMPLER_BINDING:
3874 case GL_TRANSFORM_FEEDBACK_BINDING:
3875 case GL_PROGRAM_PIPELINE_BINDING: {
3876 GLint real_obj_id = _COREGL_INT_INIT_VALUE;
3877 GLuint glue_obj_id = _COREGL_INT_INIT_VALUE;
3878 GL_Object_Type obj_type = GL_OBJECT_TYPE_UNKNOWN;
3879 EXTRACT_VALUE(0, real_obj_id);
3882 case GL_TEXTURE_BINDING_2D:
3883 case GL_TEXTURE_BINDING_CUBE_MAP:
3884 obj_type = GL_OBJECT_TYPE_TEXTURE;
3886 case GL_ARRAY_BUFFER_BINDING:
3887 case GL_ELEMENT_ARRAY_BUFFER_BINDING:
3888 case GL_COPY_READ_BUFFER_BINDING:
3889 case GL_COPY_WRITE_BUFFER_BINDING:
3890 case GL_PIXEL_PACK_BUFFER_BINDING:
3891 case GL_PIXEL_UNPACK_BUFFER_BINDING:
3892 case GL_TRANSFORM_FEEDBACK_BUFFER_BINDING:
3893 case GL_UNIFORM_BUFFER_BINDING:
3894 obj_type = GL_OBJECT_TYPE_BUFFER;
3896 case GL_DRAW_FRAMEBUFFER_BINDING:
3897 case GL_READ_FRAMEBUFFER_BINDING:
3898 obj_type = GL_OBJECT_TYPE_FRAMEBUFFER;
3900 case GL_RENDERBUFFER_BINDING:
3901 obj_type = GL_OBJECT_TYPE_RENDERBUFFER;
3903 case GL_CURRENT_PROGRAM:
3904 obj_type = GL_OBJECT_TYPE_PROGRAM;
3906 case GL_VERTEX_ARRAY_BINDING:
3907 obj_type = GL_OBJECT_TYPE_VERTEXARRAY;
3909 case GL_SAMPLER_BINDING:
3910 obj_type = GL_OBJECT_TYPE_SAMPLER;
3912 case GL_TRANSFORM_FEEDBACK_BINDING:
3913 obj_type = GL_OBJECT_TYPE_TRANSFORMFEEDBACK;
3915 case GL_PROGRAM_PIPELINE_BINDING:
3916 obj_type = GL_OBJECT_TYPE_PROGRAMPIPELINE;
3918 AST(obj_type != GL_OBJECT_TYPE_UNKNOWN);
3919 AST(GET_GLUE_OBJ(obj_type, real_obj_id, &glue_obj_id) == 1);
3920 TRANS_VALUE(0, glue_obj_id);
3933 fastpath_glGetBooleanv(GLenum pname, GLboolean *params)
3935 DEFINE_FASTPAH_GL_FUNC();
3936 _COREGL_FASTPATH_FUNC_BEGIN();
3937 INIT_FASTPATH_GL_FUNC();
3939 IF_GL_SUCCESS(_orig_fastpath_glGetBooleanv(pname, params)) {
3940 _modify_get_value(pname, params, GL_BOOL, GL_FALSE);
3945 _COREGL_FASTPATH_FUNC_END();
3949 fastpath_glGetFloatv(GLenum pname, GLfloat *params)
3951 DEFINE_FASTPAH_GL_FUNC();
3952 _COREGL_FASTPATH_FUNC_BEGIN();
3953 INIT_FASTPATH_GL_FUNC();
3955 IF_GL_SUCCESS(_orig_fastpath_glGetFloatv(pname, params)) {
3956 _modify_get_value(pname, params, GL_FLOAT, GL_FALSE);
3961 _COREGL_FASTPATH_FUNC_END();
3965 fastpath_glGetIntegerv(GLenum pname, GLint *params)
3967 DEFINE_FASTPAH_GL_FUNC();
3968 _COREGL_FASTPATH_FUNC_BEGIN();
3969 INIT_FASTPATH_GL_FUNC();
3971 IF_GL_SUCCESS(_orig_fastpath_glGetIntegerv(pname, params)) {
3972 _modify_get_value(pname, params, GL_INT, GL_FALSE);
3977 _COREGL_FASTPATH_FUNC_END();
3982 /* ES 3.0 PASS (SUPPORT) */
3984 fastpath_glGetProgramBinary(GLuint program, GLsizei bufsize, GLsizei *length,
3985 GLenum *binaryFormat, void *binary)
3989 DEFINE_FASTPAH_GL_FUNC();
3990 _COREGL_FASTPATH_FUNC_BEGIN();
3991 INIT_FASTPATH_GL_FUNC();
3993 if (GET_REAL_OBJ(GL_OBJECT_TYPE_PROGRAM, program, &real_obj) != 1) {
3994 _set_gl_error(GL_INVALID_VALUE);
3998 _orig_fastpath_glGetProgramBinary(real_obj, bufsize, length, binaryFormat,
4004 _COREGL_FASTPATH_FUNC_END();
4009 fastpath_glGetProgramBinaryOES(GLuint program, GLsizei bufsize, GLsizei *length,
4010 GLenum *binaryFormat, void *binary)
4014 DEFINE_FASTPAH_GL_FUNC();
4015 _COREGL_FASTPATH_FUNC_BEGIN();
4016 INIT_FASTPATH_GL_FUNC();
4018 if (GET_REAL_OBJ(GL_OBJECT_TYPE_PROGRAM, program, &real_obj) != 1) {
4019 _set_gl_error(GL_INVALID_VALUE);
4023 _orig_fastpath_glGetProgramBinaryOES(real_obj, bufsize, length, binaryFormat,
4029 _COREGL_FASTPATH_FUNC_END();
4034 fastpath_glProgramBinary(GLuint program, GLenum binaryFormat,
4035 const void *binary, GLint length)
4039 DEFINE_FASTPAH_GL_FUNC();
4040 _COREGL_FASTPATH_FUNC_BEGIN();
4041 INIT_FASTPATH_GL_FUNC();
4043 if (GET_REAL_OBJ(GL_OBJECT_TYPE_PROGRAM, program, &real_obj) != 1) {
4044 _set_gl_error(GL_INVALID_VALUE);
4048 _orig_fastpath_glProgramBinary(real_obj, binaryFormat, binary, length);
4053 _COREGL_FASTPATH_FUNC_END();
4058 fastpath_glProgramBinaryOES(GLuint program, GLenum binaryFormat,
4059 const void *binary, GLint length)
4063 DEFINE_FASTPAH_GL_FUNC();
4064 _COREGL_FASTPATH_FUNC_BEGIN();
4065 INIT_FASTPATH_GL_FUNC();
4067 if (GET_REAL_OBJ(GL_OBJECT_TYPE_PROGRAM, program, &real_obj) != 1) {
4068 _set_gl_error(GL_INVALID_VALUE);
4072 _orig_fastpath_glProgramBinaryOES(real_obj, binaryFormat, binary, length);
4077 _COREGL_FASTPATH_FUNC_END();
4082 fastpath_glReadBuffer(GLenum mode)
4084 DEFINE_FASTPAH_GL_FUNC();
4085 _COREGL_FASTPATH_FUNC_BEGIN();
4086 INIT_FASTPATH_GL_FUNC();
4088 CURR_STATE_COMPARE(gl_read_buffer, mode) {
4089 IF_GL_SUCCESS(_orig_fastpath_glReadBuffer(mode)) {
4090 current_ctx->_misc_flag3 |= _MISC_FLAG3_BIT_gl_read_buffer;
4091 current_ctx->gl_read_buffer[0] = mode;
4098 _COREGL_FASTPATH_FUNC_END();
4103 fastpath_glGenQueries(GLsizei n, GLuint *ids)
4106 GLuint *objid_array = NULL;
4108 DEFINE_FASTPAH_GL_FUNC();
4109 _COREGL_FASTPATH_FUNC_BEGIN();
4110 INIT_FASTPATH_GL_FUNC();
4113 _set_gl_error(GL_INVALID_VALUE);
4116 if (n == 0) goto finish;
4117 if (ids == NULL) goto finish;
4119 AST(current_ctx->ostate.shared != NULL);
4121 objid_array = (GLuint *)calloc(1, sizeof(GLuint) * n);
4123 IF_GL_SUCCESS(_orig_fastpath_glGenQueries(n, objid_array)) {
4124 for (i = 0; i < n; i++) {
4125 ids[i] = fastpath_ostate_create_object(¤t_ctx->ostate,
4126 GL_OBJECT_TYPE_QUERY, objid_array[i]);
4133 if (objid_array != NULL) {
4137 _COREGL_FASTPATH_FUNC_END();
4142 fastpath_glDeleteQueries(GLsizei n, const GLuint *ids)
4145 GLuint *objid_array = NULL;
4147 DEFINE_FASTPAH_GL_FUNC();
4148 _COREGL_FASTPATH_FUNC_BEGIN();
4149 INIT_FASTPATH_GL_FUNC();
4152 _set_gl_error(GL_INVALID_VALUE);
4155 if (n == 0) goto finish;
4156 if (ids == NULL) goto finish;
4158 AST(current_ctx->ostate.shared != NULL);
4160 objid_array = (GLuint *)calloc(1, sizeof(GLuint) * n);
4164 for (i = 0; i < n; i++) {
4165 int real_objid = _COREGL_INT_INIT_VALUE;
4166 if (ids[i] == 0) continue;
4168 real_objid = fastpath_ostate_get_object(¤t_ctx->ostate,
4169 GL_OBJECT_TYPE_QUERY, ids[i]);
4170 if (real_objid == 0) continue;
4172 AST(fastpath_ostate_remove_object(¤t_ctx->ostate, GL_OBJECT_TYPE_QUERY,
4174 objid_array[real_n++] = real_objid;
4177 _orig_fastpath_glDeleteQueries(real_n, objid_array);
4183 if (objid_array != NULL) {
4187 _COREGL_FASTPATH_FUNC_END();
4192 fastpath_glIsQuery(GLuint id)
4194 GLboolean ret = GL_FALSE;
4197 DEFINE_FASTPAH_GL_FUNC();
4198 _COREGL_FASTPATH_FUNC_BEGIN();
4199 INIT_FASTPATH_GL_FUNC();
4201 if (GET_REAL_OBJ(GL_OBJECT_TYPE_QUERY, id, &real_obj) != 1) {
4206 ret = _orig_fastpath_glIsQuery(real_obj);
4211 _COREGL_FASTPATH_FUNC_END();
4217 fastpath_glBeginQuery(GLenum target, GLuint id)
4221 DEFINE_FASTPAH_GL_FUNC();
4222 _COREGL_FASTPATH_FUNC_BEGIN();
4223 INIT_FASTPATH_GL_FUNC();
4225 if (GET_REAL_OBJ(GL_OBJECT_TYPE_QUERY, id, &real_obj) != 1) {
4226 // TODO : Begin - Context Switch
4227 _set_gl_error(GL_INVALID_OPERATION);
4231 _orig_fastpath_glBeginQuery(target, real_obj);
4236 _COREGL_FASTPATH_FUNC_END();
4241 fastpath_glGetQueryiv(GLenum target, GLenum pname, GLint *params)
4243 GLuint glue_obj_id = _COREGL_INT_INIT_VALUE;
4245 DEFINE_FASTPAH_GL_FUNC();
4246 _COREGL_FASTPATH_FUNC_BEGIN();
4247 INIT_FASTPATH_GL_FUNC();
4249 _orig_fastpath_glGetQueryiv(target, pname, params);
4252 case GL_CURRENT_QUERY:
4253 if (params[0] != 0) {
4254 AST(GET_GLUE_OBJ(GL_OBJECT_TYPE_QUERY, params[0], &glue_obj_id) == 1);
4255 params[0] = glue_obj_id;
4263 _COREGL_FASTPATH_FUNC_END();
4268 fastpath_glGetQueryObjectuiv(GLuint id, GLenum pname, GLuint *params)
4272 DEFINE_FASTPAH_GL_FUNC();
4273 _COREGL_FASTPATH_FUNC_BEGIN();
4274 INIT_FASTPATH_GL_FUNC();
4276 if (GET_REAL_OBJ(GL_OBJECT_TYPE_QUERY, id, &real_obj) != 1) {
4277 _set_gl_error(GL_INVALID_OPERATION);
4281 _orig_fastpath_glGetQueryObjectuiv(real_obj, pname, params);
4286 _COREGL_FASTPATH_FUNC_END();
4291 fastpath_glDrawBuffers(GLsizei n, const GLenum *bufs)
4293 DEFINE_FASTPAH_GL_FUNC();
4294 _COREGL_FASTPATH_FUNC_BEGIN();
4295 INIT_FASTPATH_GL_FUNC();
4297 IF_GL_SUCCESS(_orig_fastpath_glDrawBuffers(n, bufs)) {
4298 current_ctx->_misc_flag3 |= _MISC_FLAG3_BIT_gl_draw_buffers;
4299 fastpath_state_get_draw_buffers(current_ctx->gl_draw_buffers);
4305 _COREGL_FASTPATH_FUNC_END();
4310 fastpath_glFramebufferTextureLayer(GLenum target, GLenum attachment,
4311 GLuint texture, GLint level, GLint layer)
4315 DEFINE_FASTPAH_GL_FUNC();
4316 _COREGL_FASTPATH_FUNC_BEGIN();
4317 INIT_FASTPATH_GL_FUNC();
4319 if (GET_REAL_OBJ(GL_OBJECT_TYPE_TEXTURE, texture, &real_obj) != 1) {
4320 _set_gl_error(GL_OUT_OF_MEMORY);
4324 _orig_fastpath_glFramebufferTextureLayer(target, attachment, texture, level,
4330 _COREGL_FASTPATH_FUNC_END();
4334 ////////////////////////////////////////////////////////////////////////
4337 fastpath_glGenVertexArrays(GLsizei n, GLuint *arrays)
4340 GLuint *objid_array = NULL;
4342 DEFINE_FASTPAH_GL_FUNC();
4343 _COREGL_FASTPATH_FUNC_BEGIN();
4344 INIT_FASTPATH_GL_FUNC();
4347 _set_gl_error(GL_INVALID_VALUE);
4350 if (n == 0) goto finish;
4351 if (arrays == NULL) goto finish;
4353 AST(current_ctx->ostate.shared != NULL);
4355 objid_array = (GLuint *)calloc(1, sizeof(GLuint) * n);
4357 IF_GL_SUCCESS(_orig_fastpath_glGenVertexArrays(n, objid_array)) {
4358 for (i = 0; i < n; i++) {
4359 arrays[i] = fastpath_ostate_create_object(¤t_ctx->ostate,
4360 GL_OBJECT_TYPE_VERTEXARRAY, objid_array[i]);
4367 if (objid_array != NULL) {
4371 _COREGL_FASTPATH_FUNC_END();
4376 fastpath_glBindVertexArray(GLuint array)
4380 DEFINE_FASTPAH_GL_FUNC();
4381 _COREGL_FASTPATH_FUNC_BEGIN();
4382 INIT_FASTPATH_GL_FUNC();
4384 if (GET_REAL_OBJ(GL_OBJECT_TYPE_VERTEXARRAY, array, &real_obj) != 1) {
4385 _set_gl_error(GL_INVALID_OPERATION);
4389 if (current_ctx->gl_vertex_array_binding[0] != real_obj) {
4390 IF_GL_SUCCESS(_orig_fastpath_glBindVertexArray(real_obj)) {
4391 current_ctx->_misc_flag3 |= _MISC_FLAG3_BIT_gl_vertex_array_binding;
4392 current_ctx->gl_vertex_array_binding[0] = real_obj;
4398 _COREGL_FASTPATH_FUNC_END();
4403 fastpath_glIsVertexArray(GLuint array)
4405 GLboolean ret = GL_FALSE;
4408 DEFINE_FASTPAH_GL_FUNC();
4409 _COREGL_FASTPATH_FUNC_BEGIN();
4410 INIT_FASTPATH_GL_FUNC();
4412 if (GET_REAL_OBJ(GL_OBJECT_TYPE_VERTEXARRAY, array, &real_obj) != 1) {
4417 ret = _orig_fastpath_glIsVertexArray(real_obj);
4422 _COREGL_FASTPATH_FUNC_END();
4428 fastpath_glDeleteVertexArrays(GLsizei n, const GLuint *arrays)
4431 GLuint *objid_array = NULL;
4433 DEFINE_FASTPAH_GL_FUNC();
4434 _COREGL_FASTPATH_FUNC_BEGIN();
4435 INIT_FASTPATH_GL_FUNC();
4438 _set_gl_error(GL_INVALID_VALUE);
4441 if (n == 0) goto finish;
4442 if (arrays == NULL) goto finish;
4444 AST(current_ctx->ostate.shared != NULL);
4446 objid_array = (GLuint *)calloc(1, sizeof(GLuint) * n);
4450 for (i = 0; i < n; i++) {
4451 int real_objid = _COREGL_INT_INIT_VALUE;
4452 if (arrays[i] == 0) continue;
4454 real_objid = fastpath_ostate_get_object(¤t_ctx->ostate,
4455 GL_OBJECT_TYPE_VERTEXARRAY, arrays[i]);
4456 if (real_objid == 0) continue;
4458 AST(fastpath_ostate_remove_object(¤t_ctx->ostate,
4459 GL_OBJECT_TYPE_VERTEXARRAY, arrays[i]) == 1);
4460 objid_array[real_n++] = real_objid;
4463 IF_GL_SUCCESS(_orig_fastpath_glDeleteVertexArrays(real_n, objid_array)) {
4464 for (i = 0; i < real_n; i++) {
4465 General_Trace_List *current = NULL;
4466 current = current_ctx->ostate.shared->using_gctxs;
4468 while (current != NULL) {
4469 GLGlueContext *cur_gctx = (GLGlueContext *)current->value;
4471 if (cur_gctx->gl_vertex_array_binding[0] == objid_array[i])
4472 cur_gctx->gl_vertex_array_binding[0] = 0;
4474 current = current->next;
4483 if (objid_array != NULL) {
4487 _COREGL_FASTPATH_FUNC_END();
4490 ////////////////////////////////////////////////////////////////////////
4493 fastpath_glGetIntegeri_v(GLenum target, GLuint index, GLint *data)
4495 DEFINE_FASTPAH_GL_FUNC();
4496 _COREGL_FASTPATH_FUNC_BEGIN();
4497 INIT_FASTPATH_GL_FUNC();
4499 IF_GL_SUCCESS(_orig_fastpath_glGetIntegeri_v(target, index, data)) {
4500 _modify_get_value(target, data, GL_INT, GL_FALSE);
4505 _COREGL_FASTPATH_FUNC_END();
4508 ////////////////////////////////////////////////////////////////////////
4511 fastpath_glGenTransformFeedbacks(GLsizei n, GLuint *ids)
4514 GLuint *objid_array = NULL;
4516 DEFINE_FASTPAH_GL_FUNC();
4517 _COREGL_FASTPATH_FUNC_BEGIN();
4518 INIT_FASTPATH_GL_FUNC();
4521 _set_gl_error(GL_INVALID_VALUE);
4524 if (n == 0) goto finish;
4525 if (ids == NULL) goto finish;
4527 AST(current_ctx->ostate.shared != NULL);
4529 objid_array = (GLuint *)calloc(1, sizeof(GLuint) * n);
4531 IF_GL_SUCCESS(_orig_fastpath_glGenTransformFeedbacks(n, objid_array)) {
4532 for (i = 0; i < n; i++) {
4533 ids[i] = fastpath_ostate_create_object(¤t_ctx->ostate,
4534 GL_OBJECT_TYPE_TRANSFORMFEEDBACK, objid_array[i]);
4541 if (objid_array != NULL) {
4545 _COREGL_FASTPATH_FUNC_END();
4550 fastpath_glBindTransformFeedback(GLenum target, GLuint id)
4554 DEFINE_FASTPAH_GL_FUNC();
4555 _COREGL_FASTPATH_FUNC_BEGIN();
4556 INIT_FASTPATH_GL_FUNC();
4558 if (GET_REAL_OBJ(GL_OBJECT_TYPE_TRANSFORMFEEDBACK, id, &real_obj) != 1) {
4559 _set_gl_error(GL_OUT_OF_MEMORY);
4563 if (current_ctx->gl_transform_feedback_binding[0] != real_obj) {
4564 IF_GL_SUCCESS(_orig_fastpath_glBindTransformFeedback(target, real_obj)) {
4565 current_ctx->_misc_flag3 |= _MISC_FLAG3_BIT_gl_transform_feedback_binding;
4566 current_ctx->gl_transform_feedback_binding[0] = real_obj;
4572 _COREGL_FASTPATH_FUNC_END();
4577 fastpath_glBeginTransformFeedback(GLenum primitiveMode)
4579 DEFINE_FASTPAH_GL_FUNC();
4580 _COREGL_FASTPATH_FUNC_BEGIN();
4581 INIT_FASTPATH_GL_FUNC();
4583 IF_GL_SUCCESS(_orig_fastpath_glBeginTransformFeedback(primitiveMode)) {
4584 current_ctx->_misc_flag3 |= _MISC_FLAG3_BIT_gl_transform_feedback;
4586 current_ctx->gl_transform_feedback_active[0] = GL_TRUE;
4587 current_ctx->gl_transform_feedback_paused[0] = GL_FALSE;
4593 _COREGL_FASTPATH_FUNC_END();
4598 fastpath_glEndTransformFeedback()
4600 DEFINE_FASTPAH_GL_FUNC();
4601 _COREGL_FASTPATH_FUNC_BEGIN();
4602 INIT_FASTPATH_GL_FUNC();
4604 IF_GL_SUCCESS(_orig_fastpath_glEndTransformFeedback()) {
4605 current_ctx->_misc_flag3 |= _MISC_FLAG3_BIT_gl_transform_feedback;
4607 current_ctx->gl_transform_feedback_active[0] = GL_FALSE;
4608 current_ctx->gl_transform_feedback_paused[0] = GL_FALSE;
4614 _COREGL_FASTPATH_FUNC_END();
4619 fastpath_glPauseTransformFeedback()
4621 DEFINE_FASTPAH_GL_FUNC();
4622 _COREGL_FASTPATH_FUNC_BEGIN();
4623 INIT_FASTPATH_GL_FUNC();
4625 IF_GL_SUCCESS(_orig_fastpath_glPauseTransformFeedback()) {
4626 current_ctx->_misc_flag3 |= _MISC_FLAG3_BIT_gl_transform_feedback;
4628 current_ctx->gl_transform_feedback_active[0] = GL_TRUE;
4629 current_ctx->gl_transform_feedback_paused[0] = GL_TRUE;
4635 _COREGL_FASTPATH_FUNC_END();
4639 fastpath_glResumeTransformFeedback()
4641 DEFINE_FASTPAH_GL_FUNC();
4642 _COREGL_FASTPATH_FUNC_BEGIN();
4643 INIT_FASTPATH_GL_FUNC();
4645 IF_GL_SUCCESS(_orig_fastpath_glResumeTransformFeedback()) {
4646 current_ctx->_misc_flag3 |= _MISC_FLAG3_BIT_gl_transform_feedback;
4648 current_ctx->gl_transform_feedback_active[0] = GL_TRUE;
4649 current_ctx->gl_transform_feedback_paused[0] = GL_FALSE;
4655 _COREGL_FASTPATH_FUNC_END();
4660 fastpath_glIsTransformFeedback(GLuint id)
4662 GLboolean ret = GL_FALSE;
4665 DEFINE_FASTPAH_GL_FUNC();
4666 _COREGL_FASTPATH_FUNC_BEGIN();
4667 INIT_FASTPATH_GL_FUNC();
4669 if (GET_REAL_OBJ(GL_OBJECT_TYPE_TRANSFORMFEEDBACK, id, &real_obj) != 1) {
4674 ret = _orig_fastpath_glIsTransformFeedback(real_obj);
4679 _COREGL_FASTPATH_FUNC_END();
4685 fastpath_glDeleteTransformFeedbacks(GLsizei n, const GLuint *ids)
4688 GLuint *objid_array = NULL;
4690 DEFINE_FASTPAH_GL_FUNC();
4691 _COREGL_FASTPATH_FUNC_BEGIN();
4692 INIT_FASTPATH_GL_FUNC();
4695 _set_gl_error(GL_INVALID_VALUE);
4698 if (n == 0) goto finish;
4699 if (ids == NULL) goto finish;
4701 AST(current_ctx->ostate.shared != NULL);
4703 objid_array = (GLuint *)calloc(1, sizeof(GLuint) * n);
4707 for (i = 0; i < n; i++) {
4708 int real_objid = _COREGL_INT_INIT_VALUE;
4709 if (ids[i] == 0) continue;
4711 real_objid = fastpath_ostate_get_object(¤t_ctx->ostate,
4712 GL_OBJECT_TYPE_TRANSFORMFEEDBACK, ids[i]);
4713 if (real_objid == 0) continue;
4715 AST(fastpath_ostate_remove_object(¤t_ctx->ostate,
4716 GL_OBJECT_TYPE_TRANSFORMFEEDBACK, ids[i]) == 1);
4717 objid_array[real_n++] = real_objid;
4720 IF_GL_SUCCESS(_orig_fastpath_glDeleteTransformFeedbacks(real_n, objid_array)) {
4721 for (i = 0; i < real_n; i++) {
4722 General_Trace_List *current = NULL;
4723 current = current_ctx->ostate.shared->using_gctxs;
4725 while (current != NULL) {
4726 GLGlueContext *cur_gctx = (GLGlueContext *)current->value;
4728 if (cur_gctx->gl_transform_feedback_binding[0] == objid_array[i])
4729 cur_gctx->gl_transform_feedback_binding[0] = 0;
4731 current = current->next;
4740 if (objid_array != NULL) {
4744 _COREGL_FASTPATH_FUNC_END();
4747 ////////////////////////////////////////////////////////////////////////
4751 fastpath_glBindBufferBase(GLenum target, GLuint index, GLuint buffer)
4755 DEFINE_FASTPAH_GL_FUNC();
4756 _COREGL_FASTPATH_FUNC_BEGIN();
4757 INIT_FASTPATH_GL_FUNC();
4759 if (GET_REAL_OBJ(GL_OBJECT_TYPE_BUFFER, buffer, &real_obj) != 1) {
4760 _set_gl_error(GL_OUT_OF_MEMORY);
4764 #define STATE_PROC(gl_state, flagid, flagbit) \
4766 CURR_STATE_COMPARE(gl_state, real_obj) \
4768 IF_GL_SUCCESS(_orig_fastpath_glBindBufferBase(target, index, real_obj)) \
4770 current_ctx->flagid |= flagbit##_##gl_state; \
4771 current_ctx->gl_state##_array[index] = real_obj; \
4772 current_ctx->gl_state##_array_offset[index] = 0; \
4773 current_ctx->gl_state##_array_size[index] = 0; \
4781 case GL_TRANSFORM_FEEDBACK_BUFFER:
4782 STATE_PROC(gl_transform_feedback_buffer_binding, _bind_flag2, _BIND_FLAG2_BIT);
4784 case GL_UNIFORM_BUFFER:
4785 STATE_PROC(gl_uniform_buffer_binding, _bind_flag2, _BIND_FLAG2_BIT);
4788 _set_gl_error(GL_INVALID_ENUM);
4798 _COREGL_FASTPATH_FUNC_END();
4804 fastpath_glBindBufferRange(GLenum target, GLuint index, GLuint buffer,
4805 GLintptr offset, GLsizeiptr size)
4809 DEFINE_FASTPAH_GL_FUNC();
4810 _COREGL_FASTPATH_FUNC_BEGIN();
4811 INIT_FASTPATH_GL_FUNC();
4813 if (GET_REAL_OBJ(GL_OBJECT_TYPE_BUFFER, buffer, &real_obj) != 1) {
4814 _set_gl_error(GL_OUT_OF_MEMORY);
4818 #define STATE_PROC(gl_state, flagnum) \
4820 CURR_STATE_COMPARE(gl_state, real_obj) \
4822 IF_GL_SUCCESS(_orig_fastpath_glBindBufferRange(target, index, real_obj, offset, size)) \
4824 current_ctx->_bind_flag2 |= _BIND_FLAG2_BIT_##gl_state; \
4825 current_ctx->gl_state##_array[index] = real_obj; \
4826 current_ctx->gl_state##_array_offset[index] = offset; \
4827 current_ctx->gl_state##_array_size[index] = size; \
4835 case GL_TRANSFORM_FEEDBACK_BUFFER:
4836 STATE_PROC(gl_transform_feedback_buffer_binding, 0);
4838 case GL_UNIFORM_BUFFER:
4839 STATE_PROC(gl_uniform_buffer_binding, 0);
4842 _set_gl_error(GL_INVALID_ENUM);
4852 _COREGL_FASTPATH_FUNC_END();
4857 fastpath_glTransformFeedbackVaryings(GLuint program, GLsizei count,
4858 const GLchar *const *varyings, GLenum bufferMode)
4862 DEFINE_FASTPAH_GL_FUNC();
4863 _COREGL_FASTPATH_FUNC_BEGIN();
4864 INIT_FASTPATH_GL_FUNC();
4866 if (GET_REAL_OBJ(GL_OBJECT_TYPE_PROGRAM, program, &real_obj) != 1) {
4867 _set_gl_error(GL_INVALID_VALUE);
4871 _orig_fastpath_glTransformFeedbackVaryings(real_obj, count, varyings,
4876 _COREGL_FASTPATH_FUNC_END();
4881 fastpath_glGetTransformFeedbackVarying(GLuint program, GLuint index,
4882 GLsizei bufSize, GLsizei *length, GLsizei *size, GLenum *type, GLchar *name)
4886 DEFINE_FASTPAH_GL_FUNC();
4887 _COREGL_FASTPATH_FUNC_BEGIN();
4888 INIT_FASTPATH_GL_FUNC();
4890 if (GET_REAL_OBJ(GL_OBJECT_TYPE_PROGRAM, program, &real_obj) != 1) {
4891 _set_gl_error(GL_INVALID_VALUE);
4895 _orig_fastpath_glGetTransformFeedbackVarying(real_obj, index, bufSize, length,
4900 _COREGL_FASTPATH_FUNC_END();
4905 fastpath_glVertexAttribIPointer(GLuint index, GLint size, GLenum type,
4906 GLsizei stride, const GLvoid *pointer)
4908 DEFINE_FASTPAH_GL_FUNC();
4909 _COREGL_FASTPATH_FUNC_BEGIN();
4910 INIT_FASTPATH_GL_FUNC();
4912 IF_GL_SUCCESS(_orig_fastpath_glVertexAttribIPointer(index, size, type, stride,
4914 if (current_ctx->gl_vertex_array_binding[0] == 0) {
4915 current_ctx->_vattrib_flag |= _VATTRIB_FLAG_BIT_gl_vertex_array;
4917 current_ctx->gl_vertex_array_buf_id[index] =
4918 current_ctx->gl_array_buffer_binding[0];
4919 current_ctx->gl_vertex_array_size[index] = size;
4920 current_ctx->gl_vertex_array_type[index] = type;
4921 current_ctx->gl_vertex_array_normalized[index] = GL_FALSE;
4922 current_ctx->gl_vertex_array_integer[index] = GL_TRUE;
4923 current_ctx->gl_vertex_array_stride[index] = stride;
4924 current_ctx->gl_vertex_array_pointer[index] = (GLvoid *)pointer;
4930 _COREGL_FASTPATH_FUNC_END();
4935 fastpath_glVertexAttribI4i(GLuint index, GLint x, GLint y, GLint z, GLint w)
4937 DEFINE_FASTPAH_GL_FUNC();
4938 _COREGL_FASTPATH_FUNC_BEGIN();
4939 INIT_FASTPATH_GL_FUNC();
4941 IF_GL_SUCCESS(_orig_fastpath_glVertexAttribI4i(index, x, y, z, w)) {
4942 if (current_ctx->gl_vertex_array_binding[0] == 0) {
4943 current_ctx->_vattrib_flag |= _VATTRIB_FLAG_BIT_gl_vertex_attrib_value;
4944 current_ctx->gl_vertex_array_size[index] = 0;
4945 current_ctx->gl_vertex_array_integer[index] = GL_TRUE;
4947 current_ctx->gl_vertex_array_type[index] = GL_INT;
4948 current_ctx->gl_vertex_attrib_value_integer[index * 4 + 0] = x;
4949 current_ctx->gl_vertex_attrib_value_integer[index * 4 + 1] = y;
4950 current_ctx->gl_vertex_attrib_value_integer[index * 4 + 2] = z;
4951 current_ctx->gl_vertex_attrib_value_integer[index * 4 + 3] = w;
4957 _COREGL_FASTPATH_FUNC_END();
4962 fastpath_glVertexAttribI4ui(GLuint index, GLuint x, GLuint y, GLuint z,
4965 DEFINE_FASTPAH_GL_FUNC();
4966 _COREGL_FASTPATH_FUNC_BEGIN();
4967 INIT_FASTPATH_GL_FUNC();
4969 IF_GL_SUCCESS(_orig_fastpath_glVertexAttribI4ui(index, x, y, z, w)) {
4970 if (current_ctx->gl_vertex_array_binding[0] == 0) {
4971 current_ctx->_vattrib_flag |= _VATTRIB_FLAG_BIT_gl_vertex_attrib_value;
4972 current_ctx->gl_vertex_array_size[index] = 0;
4973 current_ctx->gl_vertex_array_integer[index] = GL_TRUE;
4975 current_ctx->gl_vertex_array_type[index] = GL_UNSIGNED_INT;
4976 current_ctx->gl_vertex_attrib_value_unsigned_integer[index * 4 + 0] = x;
4977 current_ctx->gl_vertex_attrib_value_unsigned_integer[index * 4 + 1] = y;
4978 current_ctx->gl_vertex_attrib_value_unsigned_integer[index * 4 + 2] = z;
4979 current_ctx->gl_vertex_attrib_value_unsigned_integer[index * 4 + 3] = w;
4985 _COREGL_FASTPATH_FUNC_END();
4990 fastpath_glVertexAttribI4iv(GLuint index, const GLint *v)
4992 DEFINE_FASTPAH_GL_FUNC();
4993 _COREGL_FASTPATH_FUNC_BEGIN();
4994 INIT_FASTPATH_GL_FUNC();
4996 IF_GL_SUCCESS(_orig_fastpath_glVertexAttribI4iv(index, v)) {
4997 if (current_ctx->gl_vertex_array_binding[0] == 0) {
4998 current_ctx->_vattrib_flag |= _VATTRIB_FLAG_BIT_gl_vertex_attrib_value;
4999 current_ctx->gl_vertex_array_size[index] = 0;
5000 current_ctx->gl_vertex_array_integer[index] = GL_TRUE;
5002 current_ctx->gl_vertex_array_type[index] = GL_INT;
5003 current_ctx->gl_vertex_attrib_value_integer[index * 4 + 0] = v[0];
5004 current_ctx->gl_vertex_attrib_value_integer[index * 4 + 1] = v[1];
5005 current_ctx->gl_vertex_attrib_value_integer[index * 4 + 2] = v[2];
5006 current_ctx->gl_vertex_attrib_value_integer[index * 4 + 3] = v[3];
5012 _COREGL_FASTPATH_FUNC_END();
5017 fastpath_glVertexAttribI4uiv(GLuint index, const GLuint *v)
5019 DEFINE_FASTPAH_GL_FUNC();
5020 _COREGL_FASTPATH_FUNC_BEGIN();
5021 INIT_FASTPATH_GL_FUNC();
5023 IF_GL_SUCCESS(_orig_fastpath_glVertexAttribI4uiv(index, v)) {
5024 if (current_ctx->gl_vertex_array_binding[0] == 0) {
5025 current_ctx->_vattrib_flag |= _VATTRIB_FLAG_BIT_gl_vertex_attrib_value;
5026 current_ctx->gl_vertex_array_size[index] = 0;
5027 current_ctx->gl_vertex_array_integer[index] = GL_TRUE;
5029 current_ctx->gl_vertex_array_type[index] = GL_UNSIGNED_INT;
5030 current_ctx->gl_vertex_attrib_value_unsigned_integer[index * 4 + 0] = v[0];
5031 current_ctx->gl_vertex_attrib_value_unsigned_integer[index * 4 + 1] = v[1];
5032 current_ctx->gl_vertex_attrib_value_unsigned_integer[index * 4 + 2] = v[2];
5033 current_ctx->gl_vertex_attrib_value_unsigned_integer[index * 4 + 3] = v[3];
5039 _COREGL_FASTPATH_FUNC_END();
5044 fastpath_glGetUniformuiv(GLuint program, GLint location, GLuint *params)
5048 DEFINE_FASTPAH_GL_FUNC();
5049 _COREGL_FASTPATH_FUNC_BEGIN();
5050 INIT_FASTPATH_GL_FUNC();
5052 if (GET_REAL_OBJ(GL_OBJECT_TYPE_PROGRAM, program, &real_obj) != 1) {
5053 _set_gl_error(GL_INVALID_VALUE);
5057 _orig_fastpath_glGetUniformuiv(real_obj, location, params);
5062 _COREGL_FASTPATH_FUNC_END();
5067 fastpath_glGetFragDataLocation(GLuint program, const GLchar *name)
5069 GLint ret = _COREGL_INT_INIT_VALUE;
5072 DEFINE_FASTPAH_GL_FUNC();
5073 _COREGL_FASTPATH_FUNC_BEGIN();
5074 INIT_FASTPATH_GL_FUNC();
5076 if (GET_REAL_OBJ(GL_OBJECT_TYPE_PROGRAM, program, &real_obj) != 1) {
5077 _set_gl_error(GL_INVALID_VALUE);
5081 ret = _orig_fastpath_glGetFragDataLocation(real_obj, name);
5086 _COREGL_FASTPATH_FUNC_END();
5092 fastpath_glGetStringi(GLenum name, GLuint index)
5094 const char *ret = NULL;
5096 DEFINE_FASTPAH_GL_FUNC();
5097 _COREGL_FASTPATH_FUNC_BEGIN();
5098 INIT_FASTPATH_GL_FUNC();
5102 _set_gl_error(GL_INVALID_ENUM);
5105 _valid_extension_string();
5106 if (index < 0 || index >= gl_extension_count) {
5107 _set_gl_error(GL_INVALID_VALUE);
5110 ret = string_each_extensions[index];
5113 IF_GL_SUCCESS(ret = (const char *)_orig_fastpath_glGetStringi(name, index)) {
5124 _COREGL_FASTPATH_FUNC_END();
5125 return (const GLubyte *)ret;
5130 fastpath_glGetUniformIndices(GLuint program, GLsizei uniformCount,
5131 const GLchar *const *uniformNames, GLuint *uniformIndices)
5135 DEFINE_FASTPAH_GL_FUNC();
5136 _COREGL_FASTPATH_FUNC_BEGIN();
5137 INIT_FASTPATH_GL_FUNC();
5139 if (GET_REAL_OBJ(GL_OBJECT_TYPE_PROGRAM, program, &real_obj) != 1) {
5140 _set_gl_error(GL_INVALID_VALUE);
5144 _orig_fastpath_glGetUniformIndices(real_obj, uniformCount, uniformNames,
5150 _COREGL_FASTPATH_FUNC_END();
5155 fastpath_glGetActiveUniformsiv(GLuint program, GLsizei uniformCount,
5156 const GLuint *uniformIndices, GLenum pname, GLint *params)
5160 DEFINE_FASTPAH_GL_FUNC();
5161 _COREGL_FASTPATH_FUNC_BEGIN();
5162 INIT_FASTPATH_GL_FUNC();
5164 if (GET_REAL_OBJ(GL_OBJECT_TYPE_PROGRAM, program, &real_obj) != 1) {
5165 _set_gl_error(GL_INVALID_VALUE);
5169 _orig_fastpath_glGetActiveUniformsiv(real_obj, uniformCount, uniformIndices,
5175 _COREGL_FASTPATH_FUNC_END();
5180 fastpath_glGetUniformBlockIndex(GLuint program, const GLchar *uniformBlockName)
5182 GLuint ret = _COREGL_INT_INIT_VALUE;
5185 DEFINE_FASTPAH_GL_FUNC();
5186 _COREGL_FASTPATH_FUNC_BEGIN();
5187 INIT_FASTPATH_GL_FUNC();
5189 if (GET_REAL_OBJ(GL_OBJECT_TYPE_PROGRAM, program, &real_obj) != 1) {
5190 _set_gl_error(GL_INVALID_VALUE);
5194 ret = _orig_fastpath_glGetUniformBlockIndex(real_obj, uniformBlockName);
5199 _COREGL_FASTPATH_FUNC_END();
5204 fastpath_glGetActiveUniformBlockiv(GLuint program, GLuint uniformBlockIndex,
5205 GLenum pname, GLint *params)
5209 DEFINE_FASTPAH_GL_FUNC();
5210 _COREGL_FASTPATH_FUNC_BEGIN();
5211 INIT_FASTPATH_GL_FUNC();
5213 if (GET_REAL_OBJ(GL_OBJECT_TYPE_PROGRAM, program, &real_obj) != 1) {
5214 _set_gl_error(GL_INVALID_VALUE);
5218 _orig_fastpath_glGetActiveUniformBlockiv(real_obj, uniformBlockIndex, pname,
5224 _COREGL_FASTPATH_FUNC_END();
5228 fastpath_glGetActiveUniformBlockName(GLuint program, GLuint uniformBlockIndex,
5229 GLsizei bufSize, GLsizei *length, GLchar *uniformBlockName)
5233 DEFINE_FASTPAH_GL_FUNC();
5234 _COREGL_FASTPATH_FUNC_BEGIN();
5235 INIT_FASTPATH_GL_FUNC();
5237 if (GET_REAL_OBJ(GL_OBJECT_TYPE_PROGRAM, program, &real_obj) != 1) {
5238 _set_gl_error(GL_INVALID_VALUE);
5242 _orig_fastpath_glGetActiveUniformBlockName(real_obj, uniformBlockIndex, bufSize,
5243 length, uniformBlockName);
5248 _COREGL_FASTPATH_FUNC_END();
5253 fastpath_glUniformBlockBinding(GLuint program, GLuint uniformBlockIndex,
5254 GLuint uniformBlockBinding)
5258 DEFINE_FASTPAH_GL_FUNC();
5259 _COREGL_FASTPATH_FUNC_BEGIN();
5260 INIT_FASTPATH_GL_FUNC();
5262 if (GET_REAL_OBJ(GL_OBJECT_TYPE_PROGRAM, program, &real_obj) != 1) {
5263 _set_gl_error(GL_INVALID_VALUE);
5267 _orig_fastpath_glUniformBlockBinding(real_obj, uniformBlockIndex,
5268 uniformBlockBinding);
5273 _COREGL_FASTPATH_FUNC_END();
5278 fastpath_glGetInteger64v(GLenum pname, GLint64 *params)
5280 DEFINE_FASTPAH_GL_FUNC();
5281 _COREGL_FASTPATH_FUNC_BEGIN();
5282 INIT_FASTPATH_GL_FUNC();
5284 IF_GL_SUCCESS(_orig_fastpath_glGetInteger64v(pname, params)) {
5285 _modify_get_value(pname, params, GL_INT, GL_TRUE);
5290 _COREGL_FASTPATH_FUNC_END();
5295 fastpath_glGetInteger64i_v(GLenum target, GLuint index, GLint64 *data)
5297 DEFINE_FASTPAH_GL_FUNC();
5298 _COREGL_FASTPATH_FUNC_BEGIN();
5299 INIT_FASTPATH_GL_FUNC();
5301 IF_GL_SUCCESS(_orig_fastpath_glGetInteger64i_v(target, index, data)) {
5302 _modify_get_value(target, data, GL_INT, GL_TRUE);
5307 _COREGL_FASTPATH_FUNC_END();
5311 ////////////////////////////////////////////////////////////////////////
5314 fastpath_glGenSamplers(GLsizei n, GLuint *samplers)
5317 GLuint *objid_array = NULL;
5319 DEFINE_FASTPAH_GL_FUNC();
5320 _COREGL_FASTPATH_FUNC_BEGIN();
5321 INIT_FASTPATH_GL_FUNC();
5324 _set_gl_error(GL_INVALID_VALUE);
5327 if (n == 0) goto finish;
5328 if (samplers == NULL) goto finish;
5330 AST(current_ctx->ostate.shared != NULL);
5332 objid_array = (GLuint *)calloc(1, sizeof(GLuint) * n);
5334 IF_GL_SUCCESS(_orig_fastpath_glGenSamplers(n, objid_array)) {
5335 for (i = 0; i < n; i++) {
5336 samplers[i] = fastpath_ostate_create_object(¤t_ctx->ostate,
5337 GL_OBJECT_TYPE_SAMPLER, objid_array[i]);
5344 if (objid_array != NULL) {
5348 _COREGL_FASTPATH_FUNC_END();
5353 fastpath_glBindSampler(GLuint unit, GLuint sampler)
5357 DEFINE_FASTPAH_GL_FUNC();
5358 _COREGL_FASTPATH_FUNC_BEGIN();
5359 INIT_FASTPATH_GL_FUNC();
5361 if (GET_REAL_OBJ(GL_OBJECT_TYPE_SAMPLER, sampler, &real_obj) != 1) {
5362 _set_gl_error(GL_OUT_OF_MEMORY);
5366 _orig_fastpath_glBindSampler(unit, real_obj);
5370 _COREGL_FASTPATH_FUNC_END();
5375 fastpath_glIsSampler(GLuint sampler)
5377 GLboolean ret = GL_FALSE;
5380 DEFINE_FASTPAH_GL_FUNC();
5381 _COREGL_FASTPATH_FUNC_BEGIN();
5382 INIT_FASTPATH_GL_FUNC();
5384 if (GET_REAL_OBJ(GL_OBJECT_TYPE_SAMPLER, sampler, &real_obj) != 1) {
5389 ret = _orig_fastpath_glIsSampler(real_obj);
5394 _COREGL_FASTPATH_FUNC_END();
5400 fastpath_glDeleteSamplers(GLsizei n, const GLuint *samplers)
5403 GLuint *objid_array = NULL;
5405 DEFINE_FASTPAH_GL_FUNC();
5406 _COREGL_FASTPATH_FUNC_BEGIN();
5407 INIT_FASTPATH_GL_FUNC();
5410 _set_gl_error(GL_INVALID_VALUE);
5413 if (n == 0) goto finish;
5414 if (samplers == NULL) goto finish;
5416 AST(current_ctx->ostate.shared != NULL);
5418 objid_array = (GLuint *)calloc(1, sizeof(GLuint) * n);
5422 for (i = 0; i < n; i++) {
5423 int real_objid = _COREGL_INT_INIT_VALUE;
5424 if (samplers[i] == 0) continue;
5426 real_objid = fastpath_ostate_get_object(¤t_ctx->ostate,
5427 GL_OBJECT_TYPE_SAMPLER, samplers[i]);
5428 if (real_objid == 0) continue;
5430 AST(fastpath_ostate_remove_object(¤t_ctx->ostate, GL_OBJECT_TYPE_SAMPLER,
5432 objid_array[real_n++] = real_objid;
5435 _orig_fastpath_glDeleteSamplers(real_n, objid_array);
5441 if (objid_array != NULL) {
5445 _COREGL_FASTPATH_FUNC_END();
5448 ////////////////////////////////////////////////////////////////////////
5452 fastpath_glSamplerParameteri(GLuint sampler, GLenum pname, GLint param)
5456 DEFINE_FASTPAH_GL_FUNC();
5457 _COREGL_FASTPATH_FUNC_BEGIN();
5458 INIT_FASTPATH_GL_FUNC();
5460 if (GET_REAL_OBJ(GL_OBJECT_TYPE_SAMPLER, sampler, &real_obj) != 1) {
5464 _orig_fastpath_glSamplerParameteri(real_obj, pname, param);
5469 _COREGL_FASTPATH_FUNC_END();
5473 fastpath_glSamplerParameteriv(GLuint sampler, GLenum pname, const GLint *param)
5477 DEFINE_FASTPAH_GL_FUNC();
5478 _COREGL_FASTPATH_FUNC_BEGIN();
5479 INIT_FASTPATH_GL_FUNC();
5481 if (GET_REAL_OBJ(GL_OBJECT_TYPE_SAMPLER, sampler, &real_obj) != 1) {
5485 _orig_fastpath_glSamplerParameteriv(real_obj, pname, param);
5490 _COREGL_FASTPATH_FUNC_END();
5494 fastpath_glSamplerParameterf(GLuint sampler, GLenum pname, GLfloat param)
5498 DEFINE_FASTPAH_GL_FUNC();
5499 _COREGL_FASTPATH_FUNC_BEGIN();
5500 INIT_FASTPATH_GL_FUNC();
5502 if (GET_REAL_OBJ(GL_OBJECT_TYPE_SAMPLER, sampler, &real_obj) != 1) {
5506 _orig_fastpath_glSamplerParameterf(real_obj, pname, param);
5511 _COREGL_FASTPATH_FUNC_END();
5515 fastpath_glSamplerParameterfv(GLuint sampler, GLenum pname,
5516 const GLfloat *param)
5520 DEFINE_FASTPAH_GL_FUNC();
5521 _COREGL_FASTPATH_FUNC_BEGIN();
5522 INIT_FASTPATH_GL_FUNC();
5524 if (GET_REAL_OBJ(GL_OBJECT_TYPE_SAMPLER, sampler, &real_obj) != 1) {
5528 _orig_fastpath_glSamplerParameterfv(real_obj, pname, param);
5533 _COREGL_FASTPATH_FUNC_END();
5537 fastpath_glGetSamplerParameteriv(GLuint sampler, GLenum pname, GLint *params)
5541 DEFINE_FASTPAH_GL_FUNC();
5542 _COREGL_FASTPATH_FUNC_BEGIN();
5543 INIT_FASTPATH_GL_FUNC();
5545 if (GET_REAL_OBJ(GL_OBJECT_TYPE_SAMPLER, sampler, &real_obj) != 1) {
5549 _orig_fastpath_glGetSamplerParameteriv(real_obj, pname, params);
5554 _COREGL_FASTPATH_FUNC_END();
5558 fastpath_glGetSamplerParameterfv(GLuint sampler, GLenum pname, GLfloat *params)
5562 DEFINE_FASTPAH_GL_FUNC();
5563 _COREGL_FASTPATH_FUNC_BEGIN();
5564 INIT_FASTPATH_GL_FUNC();
5566 if (GET_REAL_OBJ(GL_OBJECT_TYPE_SAMPLER, sampler, &real_obj) != 1) {
5570 _orig_fastpath_glGetSamplerParameterfv(real_obj, pname, params);
5575 _COREGL_FASTPATH_FUNC_END();
5580 fastpath_glVertexAttribDivisor(GLuint index, GLuint divisor)
5582 DEFINE_FASTPAH_GL_FUNC();
5583 _COREGL_FASTPATH_FUNC_BEGIN();
5584 INIT_FASTPATH_GL_FUNC();
5586 IF_GL_SUCCESS(_orig_fastpath_glVertexAttribDivisor(index, divisor)) {
5587 if (current_ctx->gl_vertex_array_binding[0] == 0) {
5588 current_ctx->_vattrib_flag |= _VATTRIB_FLAG_BIT_gl_vertex_array;
5589 current_ctx->gl_vertex_array_divisor[index] = divisor;
5595 _COREGL_FASTPATH_FUNC_END();
5600 fastpath_glProgramParameteri(GLuint program, GLenum pname, GLint value)
5604 DEFINE_FASTPAH_GL_FUNC();
5605 _COREGL_FASTPATH_FUNC_BEGIN();
5606 INIT_FASTPATH_GL_FUNC();
5608 if (GET_REAL_OBJ(GL_OBJECT_TYPE_PROGRAM, program, &real_obj) != 1) {
5609 _set_gl_error(GL_INVALID_VALUE);
5613 _orig_fastpath_glProgramParameteri(real_obj, pname, value);
5618 _COREGL_FASTPATH_FUNC_END();
5624 fastpath_glCreateShaderProgramv(GLenum type, GLsizei count,
5625 const GLchar *const *strings)
5628 GLuint real_obj = 0;
5630 DEFINE_FASTPAH_GL_FUNC();
5631 _COREGL_FASTPATH_FUNC_BEGIN();
5632 INIT_FASTPATH_GL_FUNC();
5634 AST(current_ctx->ostate.shared != NULL);
5636 real_obj = _orig_fastpath_glCreateShaderProgramv(type, count, strings);
5637 if (real_obj != 0) {
5638 ret = fastpath_ostate_create_object(¤t_ctx->ostate,
5639 GL_OBJECT_TYPE_PROGRAM, real_obj);
5641 Program_object_attached_tag *poat = NULL;
5642 poat = (Program_object_attached_tag *)calloc(1,
5643 sizeof(Program_object_attached_tag));
5646 poat->is_deleting = 0;
5647 poat->shader_count = 0;
5649 fastpath_ostate_set_object_tag(¤t_ctx->ostate, GL_OBJECT_TYPE_PROGRAM,
5652 _attach_program_object(¤t_ctx->ostate, real_obj);
5657 _COREGL_FASTPATH_FUNC_END();
5662 fastpath_glGenProgramPipelines( GLsizei n, GLuint *pipelines)
5665 GLuint *objid_array = NULL;
5667 DEFINE_FASTPAH_GL_FUNC();
5668 _COREGL_FASTPATH_FUNC_BEGIN();
5669 INIT_FASTPATH_GL_FUNC();
5671 if (n < 0 || pipelines == NULL) {
5672 _set_gl_error(GL_INVALID_VALUE);
5676 AST(current_ctx->ostate.shared != NULL);
5678 objid_array = (GLuint *)calloc(1, sizeof(GLuint) * n);
5680 IF_GL_SUCCESS(_orig_fastpath_glGenProgramPipelines(n, objid_array)) {
5681 for (i = 0; i < n; i++) {
5682 pipelines[i] = fastpath_ostate_create_object(¤t_ctx->ostate,
5683 GL_OBJECT_TYPE_PROGRAMPIPELINE, objid_array[i]);
5690 if (objid_array != NULL) {
5694 _COREGL_FASTPATH_FUNC_END();
5698 fastpath_glBindProgramPipeline( GLuint pipeline)
5702 DEFINE_FASTPAH_GL_FUNC();
5703 _COREGL_FASTPATH_FUNC_BEGIN();
5704 INIT_FASTPATH_GL_FUNC();
5706 if (GET_REAL_OBJ(GL_OBJECT_TYPE_PROGRAMPIPELINE, pipeline, &real_obj) != 1) {
5707 _set_gl_error(GL_INVALID_OPERATION);
5711 if (current_ctx->gl_program_pipeline_binding[0] != real_obj) {
5712 IF_GL_SUCCESS(_orig_fastpath_glBindProgramPipeline(real_obj)) {
5713 current_ctx->_misc_flag3 |= _MISC_FLAG3_BIT_gl_program_pipeline_binding;
5714 current_ctx->gl_program_pipeline_binding[0] = real_obj;
5721 _COREGL_FASTPATH_FUNC_END();
5725 fastpath_glGetProgramPipelineiv(GLuint pipeline, GLenum pname, GLint *params)
5729 DEFINE_FASTPAH_GL_FUNC();
5730 _COREGL_FASTPATH_FUNC_BEGIN();
5731 INIT_FASTPATH_GL_FUNC();
5733 if (params == NULL ||
5734 GET_REAL_OBJ(GL_OBJECT_TYPE_PROGRAMPIPELINE, pipeline, &real_obj) != 1) {
5735 _set_gl_error(GL_INVALID_VALUE);
5740 case GL_ACTIVE_PROGRAM:
5741 case GL_VERTEX_SHADER:
5742 case GL_FRAGMENT_SHADER:
5743 case GL_COMPUTE_SHADER:
5744 case GL_INFO_LOG_LENGTH:
5745 case GL_VALIDATE_STATUS:
5746 _orig_fastpath_glGetProgramPipelineiv(real_obj, pname, params);
5749 _set_gl_error(GL_INVALID_ENUM);
5756 _COREGL_FASTPATH_FUNC_END();
5760 fastpath_glDeleteProgramPipelines(GLsizei n, GLuint const *pipelines)
5763 GLuint *objid_array = NULL;
5765 DEFINE_FASTPAH_GL_FUNC();
5766 _COREGL_FASTPATH_FUNC_BEGIN();
5767 INIT_FASTPATH_GL_FUNC();
5769 if (n < 0 || pipelines == NULL) {
5770 _set_gl_error(GL_INVALID_VALUE);
5777 AST(current_ctx->ostate.shared != NULL);
5779 objid_array = (GLuint *)calloc(1, sizeof(GLuint) * n);
5783 for (i = 0; i < n; i++) {
5784 int real_objid = _COREGL_INT_INIT_VALUE;
5785 if (pipelines[i] == 0) continue;
5787 real_objid = fastpath_ostate_get_object(¤t_ctx->ostate,
5788 GL_OBJECT_TYPE_PROGRAMPIPELINE, pipelines[i]);
5789 if (real_objid == 0) continue;
5791 AST(fastpath_ostate_remove_object(¤t_ctx->ostate,
5792 GL_OBJECT_TYPE_PROGRAMPIPELINE, pipelines[i]) == 1);
5793 objid_array[real_n++] = real_objid;
5796 IF_GL_SUCCESS(_orig_fastpath_glDeleteProgramPipelines(real_n, objid_array)) {
5797 for (i = 0; i < real_n; i++) {
5798 General_Trace_List *current = NULL;
5799 current = current_ctx->ostate.shared->using_gctxs;
5801 while (current != NULL) {
5802 GLGlueContext *cur_gctx = (GLGlueContext *)current->value;
5804 if (cur_gctx->gl_program_pipeline_binding[0] == objid_array[i])
5805 cur_gctx->gl_program_pipeline_binding[0] = 0;
5807 current = current->next;
5816 if (objid_array != NULL) {
5820 _COREGL_FASTPATH_FUNC_END();
5824 fastpath_glIsProgramPipeline( GLuint pipeline)
5826 GLboolean ret = GL_FALSE;
5829 DEFINE_FASTPAH_GL_FUNC();
5830 _COREGL_FASTPATH_FUNC_BEGIN();
5831 INIT_FASTPATH_GL_FUNC();
5833 if (GET_REAL_OBJ(GL_OBJECT_TYPE_PROGRAMPIPELINE, pipeline, &real_obj) != 1) {
5838 ret = _orig_fastpath_glIsProgramPipeline(real_obj);
5843 _COREGL_FASTPATH_FUNC_END();
5848 fastpath_glValidateProgramPipeline(GLuint pipeline)
5852 DEFINE_FASTPAH_GL_FUNC();
5853 _COREGL_FASTPATH_FUNC_BEGIN();
5854 INIT_FASTPATH_GL_FUNC();
5856 if (GET_REAL_OBJ(GL_OBJECT_TYPE_PROGRAMPIPELINE, pipeline, &real_obj) != 1) {
5857 _set_gl_error(GL_INVALID_VALUE);
5861 _orig_fastpath_glValidateProgramPipeline(real_obj);
5866 _COREGL_FASTPATH_FUNC_END();
5870 fastpath_glGetProgramPipelineInfoLog(GLuint pipeline, GLsizei bufSize,
5871 GLsizei *length, GLchar *infoLog)
5875 DEFINE_FASTPAH_GL_FUNC();
5876 _COREGL_FASTPATH_FUNC_BEGIN();
5877 INIT_FASTPATH_GL_FUNC();
5879 if (NULL == infoLog || bufSize < 0 ||
5880 GET_REAL_OBJ(GL_OBJECT_TYPE_PROGRAMPIPELINE, pipeline, &real_obj) != 1) {
5881 _set_gl_error(GL_INVALID_VALUE);
5885 _orig_fastpath_glGetProgramPipelineInfoLog(real_obj, bufSize, length, infoLog);
5890 _COREGL_FASTPATH_FUNC_END();
5894 fastpath_glDispatchCompute(GLuint num_groups_x, GLuint num_groups_y,
5895 GLuint num_groups_z)
5897 DEFINE_FASTPAH_GL_FUNC();
5898 _COREGL_FASTPATH_FUNC_BEGIN();
5899 INIT_FASTPATH_GL_FUNC();
5901 if (num_groups_x > GL_MAX_COMPUTE_WORK_GROUP_COUNT ||
5902 num_groups_y > GL_MAX_COMPUTE_WORK_GROUP_COUNT ||
5903 num_groups_z > GL_MAX_COMPUTE_WORK_GROUP_COUNT) {
5904 _set_gl_error(GL_INVALID_VALUE);
5908 if (num_groups_x == 0 || num_groups_y == 0 || num_groups_z == 0) {
5912 _orig_fastpath_glDispatchCompute(num_groups_x, num_groups_y, num_groups_z);
5915 _COREGL_FASTPATH_FUNC_END();
5919 fastpath_glDispatchComputeIndirect( GLintptr indirect)
5921 DEFINE_FASTPAH_GL_FUNC();
5922 _COREGL_FASTPATH_FUNC_BEGIN();
5923 INIT_FASTPATH_GL_FUNC();
5925 if (indirect < 0 || (indirect % sizeof(GLuint)) != 0) {
5926 _set_gl_error(GL_INVALID_VALUE);
5930 _orig_fastpath_glDispatchComputeIndirect(indirect);
5933 _COREGL_FASTPATH_FUNC_END();
5937 fastpath_glGetProgramInterfaceiv(GLuint program, GLenum programInterface,
5938 GLenum pname, GLint *params)
5942 DEFINE_FASTPAH_GL_FUNC();
5943 _COREGL_FASTPATH_FUNC_BEGIN();
5944 INIT_FASTPATH_GL_FUNC();
5946 if (params == NULL ||
5947 GET_REAL_OBJ(GL_OBJECT_TYPE_PROGRAM, program, &real_obj) != 1) {
5948 _set_gl_error(GL_INVALID_VALUE);
5952 _orig_fastpath_glGetProgramInterfaceiv(real_obj, programInterface, pname,
5958 _COREGL_FASTPATH_FUNC_END();
5962 fastpath_glGetProgramResourceIndex( GLuint program, GLenum programInterface,
5966 GLuint ret = GL_INVALID_INDEX;
5968 DEFINE_FASTPAH_GL_FUNC();
5969 _COREGL_FASTPATH_FUNC_BEGIN();
5970 INIT_FASTPATH_GL_FUNC();
5973 GET_REAL_OBJ(GL_OBJECT_TYPE_PROGRAM, program, &real_obj) != 1) {
5974 _set_gl_error(GL_INVALID_VALUE);
5978 ret = _orig_fastpath_glGetProgramResourceIndex(real_obj, programInterface,
5984 _COREGL_FASTPATH_FUNC_END();
5989 fastpath_glGetProgramResourceName(GLuint program, GLenum programInterface,
5990 GLuint index, GLsizei bufSize, GLsizei *length, GLchar *name)
5994 DEFINE_FASTPAH_GL_FUNC();
5995 _COREGL_FASTPATH_FUNC_BEGIN();
5996 INIT_FASTPATH_GL_FUNC();
5998 if ((NULL == name && 0 != bufSize) || 0 > bufSize ||
5999 GET_REAL_OBJ(GL_OBJECT_TYPE_PROGRAM, program, &real_obj) != 1) {
6000 _set_gl_error(GL_INVALID_VALUE);
6004 _orig_fastpath_glGetProgramResourceName(real_obj, programInterface, index,
6005 bufSize, length, name);
6010 _COREGL_FASTPATH_FUNC_END();
6014 fastpath_glGetProgramResourceiv( GLuint program, GLenum programInterface,
6015 GLuint index, GLsizei propCount, const GLenum *props, GLsizei bufSize,
6016 GLsizei *length, GLint *params)
6020 DEFINE_FASTPAH_GL_FUNC();
6021 _COREGL_FASTPATH_FUNC_BEGIN();
6022 INIT_FASTPATH_GL_FUNC();
6024 if (0 > bufSize || 0 >= propCount || NULL == props || ((NULL == params &&
6026 GET_REAL_OBJ(GL_OBJECT_TYPE_PROGRAM, program, &real_obj) != 1) {
6027 _set_gl_error(GL_INVALID_VALUE);
6031 _orig_fastpath_glGetProgramResourceiv(real_obj, programInterface, index,
6032 propCount, props, bufSize, length, params);
6037 _COREGL_FASTPATH_FUNC_END();
6041 fastpath_glGetProgramResourceLocation(GLuint program, GLenum programInterface,
6047 DEFINE_FASTPAH_GL_FUNC();
6048 _COREGL_FASTPATH_FUNC_BEGIN();
6049 INIT_FASTPATH_GL_FUNC();
6052 GET_REAL_OBJ(GL_OBJECT_TYPE_PROGRAM, program, &real_obj) != 1) {
6053 _set_gl_error(GL_INVALID_VALUE);
6057 ret = _orig_fastpath_glGetProgramResourceLocation(real_obj, programInterface,
6063 _COREGL_FASTPATH_FUNC_END();
6068 fastpath_glUseProgramStages(GLuint pipeline, GLbitfield stages, GLuint program)
6072 DEFINE_FASTPAH_GL_FUNC();
6073 _COREGL_FASTPATH_FUNC_BEGIN();
6074 INIT_FASTPATH_GL_FUNC();
6076 if (GET_REAL_OBJ(GL_OBJECT_TYPE_PROGRAM, program, &real_obj) != 1) {
6077 _set_gl_error(GL_INVALID_VALUE);
6081 _orig_fastpath_glUseProgramStages(pipeline, stages, real_obj);
6086 _COREGL_FASTPATH_FUNC_END();
6090 fastpath_glActiveShaderProgram(GLuint pipeline, GLuint program)
6094 DEFINE_FASTPAH_GL_FUNC();
6095 _COREGL_FASTPATH_FUNC_BEGIN();
6096 INIT_FASTPATH_GL_FUNC();
6098 if (GET_REAL_OBJ(GL_OBJECT_TYPE_PROGRAM, program, &real_obj) != 1) {
6099 _set_gl_error(GL_INVALID_VALUE);
6103 _orig_fastpath_glActiveShaderProgram(pipeline, real_obj);
6108 _COREGL_FASTPATH_FUNC_END();
6112 fastpath_glProgramUniform1iv(GLuint program, GLint location, GLsizei count,
6117 DEFINE_FASTPAH_GL_FUNC();
6118 _COREGL_FASTPATH_FUNC_BEGIN();
6119 INIT_FASTPATH_GL_FUNC();
6121 if (GET_REAL_OBJ(GL_OBJECT_TYPE_PROGRAM, program, &real_obj) != 1) {
6122 _set_gl_error(GL_INVALID_VALUE);
6126 _orig_fastpath_glProgramUniform1iv(real_obj, location, count, value);
6131 _COREGL_FASTPATH_FUNC_END();
6136 fastpath_glProgramUniform2iv(GLuint program, GLint location, GLsizei count,
6141 DEFINE_FASTPAH_GL_FUNC();
6142 _COREGL_FASTPATH_FUNC_BEGIN();
6143 INIT_FASTPATH_GL_FUNC();
6145 if (GET_REAL_OBJ(GL_OBJECT_TYPE_PROGRAM, program, &real_obj) != 1) {
6146 _set_gl_error(GL_INVALID_VALUE);
6150 _orig_fastpath_glProgramUniform2iv(real_obj, location, count, value);
6155 _COREGL_FASTPATH_FUNC_END();
6160 fastpath_glProgramUniform3iv(GLuint program, GLint location, GLsizei count,
6165 DEFINE_FASTPAH_GL_FUNC();
6166 _COREGL_FASTPATH_FUNC_BEGIN();
6167 INIT_FASTPATH_GL_FUNC();
6169 if (GET_REAL_OBJ(GL_OBJECT_TYPE_PROGRAM, program, &real_obj) != 1) {
6170 _set_gl_error(GL_INVALID_VALUE);
6174 _orig_fastpath_glProgramUniform3iv(real_obj, location, count, value);
6179 _COREGL_FASTPATH_FUNC_END();
6184 fastpath_glProgramUniform4iv(GLuint program, GLint location, GLsizei count,
6189 DEFINE_FASTPAH_GL_FUNC();
6190 _COREGL_FASTPATH_FUNC_BEGIN();
6191 INIT_FASTPATH_GL_FUNC();
6193 if (GET_REAL_OBJ(GL_OBJECT_TYPE_PROGRAM, program, &real_obj) != 1) {
6194 _set_gl_error(GL_INVALID_VALUE);
6198 _orig_fastpath_glProgramUniform4iv(real_obj, location, count, value);
6203 _COREGL_FASTPATH_FUNC_END();
6209 fastpath_glProgramUniform1fv(GLuint program, GLint location, GLsizei count,
6210 const GLfloat *value)
6214 DEFINE_FASTPAH_GL_FUNC();
6215 _COREGL_FASTPATH_FUNC_BEGIN();
6216 INIT_FASTPATH_GL_FUNC();
6218 if (GET_REAL_OBJ(GL_OBJECT_TYPE_PROGRAM, program, &real_obj) != 1) {
6219 _set_gl_error(GL_INVALID_VALUE);
6223 _orig_fastpath_glProgramUniform1fv(real_obj, location, count, value);
6228 _COREGL_FASTPATH_FUNC_END();
6233 fastpath_glProgramUniform2fv(GLuint program, GLint location, GLsizei count,
6234 const GLfloat *value)
6238 DEFINE_FASTPAH_GL_FUNC();
6239 _COREGL_FASTPATH_FUNC_BEGIN();
6240 INIT_FASTPATH_GL_FUNC();
6242 if (GET_REAL_OBJ(GL_OBJECT_TYPE_PROGRAM, program, &real_obj) != 1) {
6243 _set_gl_error(GL_INVALID_VALUE);
6247 _orig_fastpath_glProgramUniform2fv(real_obj, location, count, value);
6252 _COREGL_FASTPATH_FUNC_END();
6257 fastpath_glProgramUniform3fv(GLuint program, GLint location, GLsizei count,
6258 const GLfloat *value)
6262 DEFINE_FASTPAH_GL_FUNC();
6263 _COREGL_FASTPATH_FUNC_BEGIN();
6264 INIT_FASTPATH_GL_FUNC();
6266 if (GET_REAL_OBJ(GL_OBJECT_TYPE_PROGRAM, program, &real_obj) != 1) {
6267 _set_gl_error(GL_INVALID_VALUE);
6271 _orig_fastpath_glProgramUniform3fv(real_obj, location, count, value);
6276 _COREGL_FASTPATH_FUNC_END();
6281 fastpath_glProgramUniform4fv(GLuint program, GLint location, GLsizei count,
6282 const GLfloat *value)
6286 DEFINE_FASTPAH_GL_FUNC();
6287 _COREGL_FASTPATH_FUNC_BEGIN();
6288 INIT_FASTPATH_GL_FUNC();
6290 if (GET_REAL_OBJ(GL_OBJECT_TYPE_PROGRAM, program, &real_obj) != 1) {
6291 _set_gl_error(GL_INVALID_VALUE);
6295 _orig_fastpath_glProgramUniform4fv(real_obj, location, count, value);
6300 _COREGL_FASTPATH_FUNC_END();
6304 fastpath_glProgramUniformMatrix2fv(GLuint program, GLint location,
6305 GLsizei count, GLboolean transpose, const GLfloat *value)
6309 DEFINE_FASTPAH_GL_FUNC();
6310 _COREGL_FASTPATH_FUNC_BEGIN();
6311 INIT_FASTPATH_GL_FUNC();
6313 if (GET_REAL_OBJ(GL_OBJECT_TYPE_PROGRAM, program, &real_obj) != 1) {
6314 _set_gl_error(GL_INVALID_VALUE);
6318 _orig_fastpath_glProgramUniformMatrix2fv(real_obj, location, count, transpose,
6324 _COREGL_FASTPATH_FUNC_END();
6329 fastpath_glProgramUniformMatrix3fv(GLuint program, GLint location,
6330 GLsizei count, GLboolean transpose, const GLfloat *value)
6334 DEFINE_FASTPAH_GL_FUNC();
6335 _COREGL_FASTPATH_FUNC_BEGIN();
6336 INIT_FASTPATH_GL_FUNC();
6338 if (GET_REAL_OBJ(GL_OBJECT_TYPE_PROGRAM, program, &real_obj) != 1) {
6339 _set_gl_error(GL_INVALID_VALUE);
6343 _orig_fastpath_glProgramUniformMatrix3fv(real_obj, location, count, transpose,
6349 _COREGL_FASTPATH_FUNC_END();
6354 fastpath_glProgramUniformMatrix4fv(GLuint program, GLint location,
6355 GLsizei count, GLboolean transpose, const GLfloat *value)
6359 DEFINE_FASTPAH_GL_FUNC();
6360 _COREGL_FASTPATH_FUNC_BEGIN();
6361 INIT_FASTPATH_GL_FUNC();
6363 if (GET_REAL_OBJ(GL_OBJECT_TYPE_PROGRAM, program, &real_obj) != 1) {
6364 _set_gl_error(GL_INVALID_VALUE);
6368 _orig_fastpath_glProgramUniformMatrix4fv(real_obj, location, count, transpose,
6374 _COREGL_FASTPATH_FUNC_END();
6379 fastpath_glProgramUniform1i(GLuint program, GLint location, GLint x)
6383 DEFINE_FASTPAH_GL_FUNC();
6384 _COREGL_FASTPATH_FUNC_BEGIN();
6385 INIT_FASTPATH_GL_FUNC();
6387 if (GET_REAL_OBJ(GL_OBJECT_TYPE_PROGRAM, program, &real_obj) != 1) {
6388 _set_gl_error(GL_INVALID_VALUE);
6392 _orig_fastpath_glProgramUniform1i(real_obj, location, x);
6397 _COREGL_FASTPATH_FUNC_END();
6402 fastpath_glProgramUniform2i(GLuint program, GLint location, GLint x, GLint y)
6406 DEFINE_FASTPAH_GL_FUNC();
6407 _COREGL_FASTPATH_FUNC_BEGIN();
6408 INIT_FASTPATH_GL_FUNC();
6410 if (GET_REAL_OBJ(GL_OBJECT_TYPE_PROGRAM, program, &real_obj) != 1) {
6411 _set_gl_error(GL_INVALID_VALUE);
6415 _orig_fastpath_glProgramUniform2i(real_obj, location, x, y);
6420 _COREGL_FASTPATH_FUNC_END();
6425 fastpath_glProgramUniform3i(GLuint program, GLint location, GLint x, GLint y,
6430 DEFINE_FASTPAH_GL_FUNC();
6431 _COREGL_FASTPATH_FUNC_BEGIN();
6432 INIT_FASTPATH_GL_FUNC();
6434 if (GET_REAL_OBJ(GL_OBJECT_TYPE_PROGRAM, program, &real_obj) != 1) {
6435 _set_gl_error(GL_INVALID_VALUE);
6439 _orig_fastpath_glProgramUniform3i(real_obj, location, x, y, z);
6444 _COREGL_FASTPATH_FUNC_END();
6449 fastpath_glProgramUniform4i(GLuint program, GLint location, GLint x, GLint y,
6454 DEFINE_FASTPAH_GL_FUNC();
6455 _COREGL_FASTPATH_FUNC_BEGIN();
6456 INIT_FASTPATH_GL_FUNC();
6458 if (GET_REAL_OBJ(GL_OBJECT_TYPE_PROGRAM, program, &real_obj) != 1) {
6459 _set_gl_error(GL_INVALID_VALUE);
6463 _orig_fastpath_glProgramUniform4i(real_obj, location, x, y, z, w);
6468 _COREGL_FASTPATH_FUNC_END();
6473 fastpath_glProgramUniform1f(GLuint program, GLint location, GLfloat x)
6477 DEFINE_FASTPAH_GL_FUNC();
6478 _COREGL_FASTPATH_FUNC_BEGIN();
6479 INIT_FASTPATH_GL_FUNC();
6481 if (GET_REAL_OBJ(GL_OBJECT_TYPE_PROGRAM, program, &real_obj) != 1) {
6482 _set_gl_error(GL_INVALID_VALUE);
6486 _orig_fastpath_glProgramUniform1f(real_obj, location, x);
6491 _COREGL_FASTPATH_FUNC_END();
6496 fastpath_glProgramUniform2f(GLuint program, GLint location, GLfloat x,
6501 DEFINE_FASTPAH_GL_FUNC();
6502 _COREGL_FASTPATH_FUNC_BEGIN();
6503 INIT_FASTPATH_GL_FUNC();
6505 if (GET_REAL_OBJ(GL_OBJECT_TYPE_PROGRAM, program, &real_obj) != 1) {
6506 _set_gl_error(GL_INVALID_VALUE);
6510 _orig_fastpath_glProgramUniform2f(real_obj, location, x, y);
6515 _COREGL_FASTPATH_FUNC_END();
6520 fastpath_glProgramUniform3f(GLuint program, GLint location, GLfloat x,
6521 GLfloat y, GLfloat z)
6525 DEFINE_FASTPAH_GL_FUNC();
6526 _COREGL_FASTPATH_FUNC_BEGIN();
6527 INIT_FASTPATH_GL_FUNC();
6529 if (GET_REAL_OBJ(GL_OBJECT_TYPE_PROGRAM, program, &real_obj) != 1) {
6530 _set_gl_error(GL_INVALID_VALUE);
6534 _orig_fastpath_glProgramUniform3f(real_obj, location, x, y, z);
6539 _COREGL_FASTPATH_FUNC_END();
6544 fastpath_glProgramUniform4f(GLuint program, GLint location, GLfloat x,
6545 GLfloat y, GLfloat z, GLfloat w)
6549 DEFINE_FASTPAH_GL_FUNC();
6550 _COREGL_FASTPATH_FUNC_BEGIN();
6551 INIT_FASTPATH_GL_FUNC();
6553 if (GET_REAL_OBJ(GL_OBJECT_TYPE_PROGRAM, program, &real_obj) != 1) {
6554 _set_gl_error(GL_INVALID_VALUE);
6558 _orig_fastpath_glProgramUniform4f(real_obj, location, x, y, z, w);
6563 _COREGL_FASTPATH_FUNC_END();
6567 fastpath_glProgramUniform1ui(GLuint program, GLint location, GLuint x)
6571 DEFINE_FASTPAH_GL_FUNC();
6572 _COREGL_FASTPATH_FUNC_BEGIN();
6573 INIT_FASTPATH_GL_FUNC();
6575 if (GET_REAL_OBJ(GL_OBJECT_TYPE_PROGRAM, program, &real_obj) != 1) {
6576 _set_gl_error(GL_INVALID_VALUE);
6580 _orig_fastpath_glProgramUniform1ui(real_obj, location, x);
6585 _COREGL_FASTPATH_FUNC_END();
6590 fastpath_glProgramUniform2ui(GLuint program, GLint location, GLuint x, GLuint y)
6594 DEFINE_FASTPAH_GL_FUNC();
6595 _COREGL_FASTPATH_FUNC_BEGIN();
6596 INIT_FASTPATH_GL_FUNC();
6598 if (GET_REAL_OBJ(GL_OBJECT_TYPE_PROGRAM, program, &real_obj) != 1) {
6599 _set_gl_error(GL_INVALID_VALUE);
6603 _orig_fastpath_glProgramUniform2ui(real_obj, location, x, y);
6608 _COREGL_FASTPATH_FUNC_END();
6613 fastpath_glProgramUniform3ui(GLuint program, GLint location, GLuint x, GLuint y,
6618 DEFINE_FASTPAH_GL_FUNC();
6619 _COREGL_FASTPATH_FUNC_BEGIN();
6620 INIT_FASTPATH_GL_FUNC();
6622 if (GET_REAL_OBJ(GL_OBJECT_TYPE_PROGRAM, program, &real_obj) != 1) {
6623 _set_gl_error(GL_INVALID_VALUE);
6627 _orig_fastpath_glProgramUniform3ui(real_obj, location, x, y, z);
6632 _COREGL_FASTPATH_FUNC_END();
6637 fastpath_glProgramUniform4ui(GLuint program, GLint location, GLuint x, GLuint y,
6642 DEFINE_FASTPAH_GL_FUNC();
6643 _COREGL_FASTPATH_FUNC_BEGIN();
6644 INIT_FASTPATH_GL_FUNC();
6646 if (GET_REAL_OBJ(GL_OBJECT_TYPE_PROGRAM, program, &real_obj) != 1) {
6647 _set_gl_error(GL_INVALID_VALUE);
6651 _orig_fastpath_glProgramUniform4ui(real_obj, location, x, y, z, w);
6656 _COREGL_FASTPATH_FUNC_END();
6660 fastpath_glProgramUniform1uiv(GLuint program, GLint location, GLsizei count,
6661 const GLuint *value)
6665 DEFINE_FASTPAH_GL_FUNC();
6666 _COREGL_FASTPATH_FUNC_BEGIN();
6667 INIT_FASTPATH_GL_FUNC();
6669 if (GET_REAL_OBJ(GL_OBJECT_TYPE_PROGRAM, program, &real_obj) != 1) {
6670 _set_gl_error(GL_INVALID_VALUE);
6674 _orig_fastpath_glProgramUniform1uiv(real_obj, location, count, value);
6679 _COREGL_FASTPATH_FUNC_END();
6684 fastpath_glProgramUniform2uiv(GLuint program, GLint location, GLsizei count,
6685 const GLuint *value)
6689 DEFINE_FASTPAH_GL_FUNC();
6690 _COREGL_FASTPATH_FUNC_BEGIN();
6691 INIT_FASTPATH_GL_FUNC();
6693 if (GET_REAL_OBJ(GL_OBJECT_TYPE_PROGRAM, program, &real_obj) != 1) {
6694 _set_gl_error(GL_INVALID_VALUE);
6698 _orig_fastpath_glProgramUniform2uiv(real_obj, location, count, value);
6703 _COREGL_FASTPATH_FUNC_END();
6708 fastpath_glProgramUniform3uiv(GLuint program, GLint location, GLsizei count,
6709 const GLuint *value)
6713 DEFINE_FASTPAH_GL_FUNC();
6714 _COREGL_FASTPATH_FUNC_BEGIN();
6715 INIT_FASTPATH_GL_FUNC();
6717 if (GET_REAL_OBJ(GL_OBJECT_TYPE_PROGRAM, program, &real_obj) != 1) {
6718 _set_gl_error(GL_INVALID_VALUE);
6722 _orig_fastpath_glProgramUniform3uiv(real_obj, location, count, value);
6727 _COREGL_FASTPATH_FUNC_END();
6732 fastpath_glProgramUniform4uiv(GLuint program, GLint location, GLsizei count,
6733 const GLuint *value)
6737 DEFINE_FASTPAH_GL_FUNC();
6738 _COREGL_FASTPATH_FUNC_BEGIN();
6739 INIT_FASTPATH_GL_FUNC();
6741 if (GET_REAL_OBJ(GL_OBJECT_TYPE_PROGRAM, program, &real_obj) != 1) {
6742 _set_gl_error(GL_INVALID_VALUE);
6746 _orig_fastpath_glProgramUniform4uiv(real_obj, location, count, value);
6751 _COREGL_FASTPATH_FUNC_END();
6755 fastpath_glProgramUniformMatrix2x3fv(GLuint program, GLint location,
6756 GLsizei count, GLboolean transpose, const GLfloat *value)
6760 DEFINE_FASTPAH_GL_FUNC();
6761 _COREGL_FASTPATH_FUNC_BEGIN();
6762 INIT_FASTPATH_GL_FUNC();
6764 if (GET_REAL_OBJ(GL_OBJECT_TYPE_PROGRAM, program, &real_obj) != 1) {
6765 _set_gl_error(GL_INVALID_VALUE);
6769 _orig_fastpath_glProgramUniformMatrix2x3fv(real_obj, location, count, transpose,
6775 _COREGL_FASTPATH_FUNC_END();
6780 fastpath_glProgramUniformMatrix3x2fv(GLuint program, GLint location,
6781 GLsizei count, GLboolean transpose, const GLfloat *value)
6785 DEFINE_FASTPAH_GL_FUNC();
6786 _COREGL_FASTPATH_FUNC_BEGIN();
6787 INIT_FASTPATH_GL_FUNC();
6789 if (GET_REAL_OBJ(GL_OBJECT_TYPE_PROGRAM, program, &real_obj) != 1) {
6790 _set_gl_error(GL_INVALID_VALUE);
6794 _orig_fastpath_glProgramUniformMatrix3x2fv(real_obj, location, count, transpose,
6800 _COREGL_FASTPATH_FUNC_END();
6805 fastpath_glProgramUniformMatrix4x2fv(GLuint program, GLint location,
6806 GLsizei count, GLboolean transpose, const GLfloat *value)
6810 DEFINE_FASTPAH_GL_FUNC();
6811 _COREGL_FASTPATH_FUNC_BEGIN();
6812 INIT_FASTPATH_GL_FUNC();
6814 if (GET_REAL_OBJ(GL_OBJECT_TYPE_PROGRAM, program, &real_obj) != 1) {
6815 _set_gl_error(GL_INVALID_VALUE);
6819 _orig_fastpath_glProgramUniformMatrix4x2fv(real_obj, location, count, transpose,
6825 _COREGL_FASTPATH_FUNC_END();
6829 fastpath_glProgramUniformMatrix2x4fv(GLuint program, GLint location,
6830 GLsizei count, GLboolean transpose, const GLfloat *value)
6834 DEFINE_FASTPAH_GL_FUNC();
6835 _COREGL_FASTPATH_FUNC_BEGIN();
6836 INIT_FASTPATH_GL_FUNC();
6838 if (GET_REAL_OBJ(GL_OBJECT_TYPE_PROGRAM, program, &real_obj) != 1) {
6839 _set_gl_error(GL_INVALID_VALUE);
6843 _orig_fastpath_glProgramUniformMatrix2x4fv(real_obj, location, count, transpose,
6849 _COREGL_FASTPATH_FUNC_END();
6854 fastpath_glProgramUniformMatrix3x4fv(GLuint program, GLint location,
6855 GLsizei count, GLboolean transpose, const GLfloat *value)
6859 DEFINE_FASTPAH_GL_FUNC();
6860 _COREGL_FASTPATH_FUNC_BEGIN();
6861 INIT_FASTPATH_GL_FUNC();
6863 if (GET_REAL_OBJ(GL_OBJECT_TYPE_PROGRAM, program, &real_obj) != 1) {
6864 _set_gl_error(GL_INVALID_VALUE);
6868 _orig_fastpath_glProgramUniformMatrix3x4fv(real_obj, location, count, transpose,
6874 _COREGL_FASTPATH_FUNC_END();
6879 fastpath_glProgramUniformMatrix4x3fv(GLuint program, GLint location,
6880 GLsizei count, GLboolean transpose, const GLfloat *value)
6884 DEFINE_FASTPAH_GL_FUNC();
6885 _COREGL_FASTPATH_FUNC_BEGIN();
6886 INIT_FASTPATH_GL_FUNC();
6888 if (GET_REAL_OBJ(GL_OBJECT_TYPE_PROGRAM, program, &real_obj) != 1) {
6889 _set_gl_error(GL_INVALID_VALUE);
6893 _orig_fastpath_glProgramUniformMatrix4x3fv(real_obj, location, count, transpose,
6899 _COREGL_FASTPATH_FUNC_END();
6903 fastpath_glBindImageTexture(GLuint unit, GLuint texture, GLint level,
6904 GLboolean layered, GLint layer, GLenum access, GLenum format)
6906 DEFINE_FASTPAH_GL_FUNC();
6907 _COREGL_FASTPATH_FUNC_BEGIN();
6908 INIT_FASTPATH_GL_FUNC();
6910 _orig_fastpath_glBindImageTexture(unit, texture, level, layered, layer, access,
6916 _COREGL_FASTPATH_FUNC_END();
6920 fastpath_glGetBooleani_v (GLenum target, GLuint index, GLboolean *data)
6922 DEFINE_FASTPAH_GL_FUNC();
6923 _COREGL_FASTPATH_FUNC_BEGIN();
6924 INIT_FASTPATH_GL_FUNC();
6926 IF_GL_SUCCESS(_orig_fastpath_glGetBooleani_v(target, index, data)) {
6927 _modify_get_value(target, data, GL_BOOL, GL_FALSE);
6933 _COREGL_FASTPATH_FUNC_END();
6937 fastpath_glMemoryBarrier (GLbitfield barriers)
6939 DEFINE_FASTPAH_GL_FUNC();
6940 _COREGL_FASTPATH_FUNC_BEGIN();
6941 INIT_FASTPATH_GL_FUNC();
6943 _orig_fastpath_glMemoryBarrier(barriers);
6948 _COREGL_FASTPATH_FUNC_END();
6952 fastpath_glMemoryBarrierByRegion (GLbitfield barriers)
6954 DEFINE_FASTPAH_GL_FUNC();
6955 _COREGL_FASTPATH_FUNC_BEGIN();
6956 INIT_FASTPATH_GL_FUNC();
6958 _orig_fastpath_glMemoryBarrierByRegion(barriers);
6963 _COREGL_FASTPATH_FUNC_END();
6967 fastpath_glTexStorage2DMultisample (GLenum target, GLsizei samples,
6968 GLenum internalformat, GLsizei width, GLsizei height,
6969 GLboolean fixedsamplelocations)
6971 DEFINE_FASTPAH_GL_FUNC();
6972 _COREGL_FASTPATH_FUNC_BEGIN();
6973 INIT_FASTPATH_GL_FUNC();
6975 _orig_fastpath_glTexStorage2DMultisample (target, samples, internalformat,
6976 width, height, fixedsamplelocations);
6981 _COREGL_FASTPATH_FUNC_END();
6985 fastpath_glGetMultisamplefv (GLenum pname, GLuint index, GLfloat *val)
6987 DEFINE_FASTPAH_GL_FUNC();
6988 _COREGL_FASTPATH_FUNC_BEGIN();
6989 INIT_FASTPATH_GL_FUNC();
6991 _orig_fastpath_glGetMultisamplefv (pname, index, val);
6996 _COREGL_FASTPATH_FUNC_END();
7000 fastpath_glSampleMaski (GLuint maskNumber, GLbitfield mask)
7002 DEFINE_FASTPAH_GL_FUNC();
7003 _COREGL_FASTPATH_FUNC_BEGIN();
7004 INIT_FASTPATH_GL_FUNC();
7006 _orig_fastpath_glSampleMaski(maskNumber, mask);
7011 _COREGL_FASTPATH_FUNC_END();
7015 fastpath_glGetTexLevelParameteriv (GLenum target, GLint level, GLenum pname,
7018 DEFINE_FASTPAH_GL_FUNC();
7019 _COREGL_FASTPATH_FUNC_BEGIN();
7020 INIT_FASTPATH_GL_FUNC();
7022 _orig_fastpath_glGetTexLevelParameteriv (target, level, pname, params);
7027 _COREGL_FASTPATH_FUNC_END();
7031 fastpath_glGetTexLevelParameterfv (GLenum target, GLint level, GLenum pname,
7034 DEFINE_FASTPAH_GL_FUNC();
7035 _COREGL_FASTPATH_FUNC_BEGIN();
7036 INIT_FASTPATH_GL_FUNC();
7038 _orig_fastpath_glGetTexLevelParameterfv (target, level, pname, params);
7043 _COREGL_FASTPATH_FUNC_END();
7047 fastpath_glBindVertexBuffer (GLuint bindingindex, GLuint buffer,
7048 GLintptr offset, GLsizei stride)
7050 DEFINE_FASTPAH_GL_FUNC();
7051 _COREGL_FASTPATH_FUNC_BEGIN();
7052 INIT_FASTPATH_GL_FUNC();
7054 _orig_fastpath_glBindVertexBuffer(bindingindex, buffer, offset, stride);
7059 _COREGL_FASTPATH_FUNC_END();
7064 fastpath_glVertexAttribFormat (GLuint attribindex, GLint size, GLenum type,
7065 GLboolean normalized, GLuint relativeoffset)
7067 DEFINE_FASTPAH_GL_FUNC();
7068 _COREGL_FASTPATH_FUNC_BEGIN();
7069 INIT_FASTPATH_GL_FUNC();
7071 _orig_fastpath_glVertexAttribFormat (attribindex, size, type, normalized,
7077 _COREGL_FASTPATH_FUNC_END();
7081 fastpath_glVertexAttribIFormat (GLuint attribindex, GLint size, GLenum type,
7082 GLuint relativeoffset)
7084 DEFINE_FASTPAH_GL_FUNC();
7085 _COREGL_FASTPATH_FUNC_BEGIN();
7086 INIT_FASTPATH_GL_FUNC();
7088 _orig_fastpath_glVertexAttribIFormat (attribindex, size, type, relativeoffset);
7093 _COREGL_FASTPATH_FUNC_END();
7097 fastpath_glVertexAttribBinding (GLuint attribindex, GLuint bindingindex)
7099 DEFINE_FASTPAH_GL_FUNC();
7100 _COREGL_FASTPATH_FUNC_BEGIN();
7101 INIT_FASTPATH_GL_FUNC();
7103 _orig_fastpath_glVertexAttribBinding (attribindex, bindingindex);
7108 _COREGL_FASTPATH_FUNC_END();
7112 fastpath_glVertexBindingDivisor(GLuint bindingindex, GLuint divisor)
7114 DEFINE_FASTPAH_GL_FUNC();
7115 _COREGL_FASTPATH_FUNC_BEGIN();
7116 INIT_FASTPATH_GL_FUNC();
7118 _orig_fastpath_glVertexBindingDivisor (bindingindex, divisor);
7123 _COREGL_FASTPATH_FUNC_END();
7126 fastpath_glBindFramebufferOES(GLenum target, GLuint framebuffer)
7130 DEFINE_FASTPAH_GL_FUNC();
7131 _COREGL_FASTPATH_FUNC_BEGIN();
7132 INIT_FASTPATH_GL_FUNC();
7134 if (GET_REAL_OBJ(GL_OBJECT_TYPE_FRAMEBUFFER, framebuffer, &real_obj) != 1) {
7135 _set_gl_error(GL_OUT_OF_MEMORY);
7139 if (target == GL_FRAMEBUFFER) {
7140 if (current_ctx->gl_framebuffer_binding_read_used == 1) {
7141 CURR_STATE_COMPARE(gl_framebuffer_binding_read, real_obj) {
7142 IF_GL_SUCCESS(_orig_fastpath_glBindFramebufferOES(target, real_obj)) {
7144 current_ctx->_bind_flag1 &= (~_BIND_FLAG1_BIT_gl_framebuffer_binding_read);
7146 current_ctx->_bind_flag1 |= _BIND_FLAG1_BIT_gl_framebuffer_binding_read;
7147 current_ctx->gl_framebuffer_binding_read[0] = real_obj;
7150 CURR_STATE_COMPARE(gl_framebuffer_binding_draw, real_obj) {
7151 IF_GL_SUCCESS(_orig_fastpath_glBindFramebufferOES(target, real_obj)) {
7153 current_ctx->_bind_flag1 &= (~_BIND_FLAG1_BIT_gl_framebuffer_binding_draw);
7155 current_ctx->_bind_flag1 |= _BIND_FLAG1_BIT_gl_framebuffer_binding_draw;
7156 current_ctx->gl_framebuffer_binding_draw[0] = real_obj;
7160 CURR_STATE_COMPARE(gl_framebuffer_binding, real_obj) {
7161 IF_GL_SUCCESS(_orig_fastpath_glBindFramebufferOES(target, real_obj)) {
7163 current_ctx->_bind_flag1 &= (~_BIND_FLAG1_BIT_gl_framebuffer_binding);
7165 current_ctx->_bind_flag1 |= _BIND_FLAG1_BIT_gl_framebuffer_binding;
7166 current_ctx->gl_framebuffer_binding[0] = real_obj;
7170 } else if (target == GL_READ_FRAMEBUFFER &&
7171 current_ctx->gl_framebuffer_binding_read_used) {
7172 CURR_STATE_COMPARE(gl_framebuffer_binding_read, real_obj) {
7173 IF_GL_SUCCESS(_orig_fastpath_glBindFramebufferOES(target, real_obj)) {
7175 current_ctx->_bind_flag1 &= (~_BIND_FLAG1_BIT_gl_framebuffer_binding_read);
7177 current_ctx->_bind_flag1 |= _BIND_FLAG1_BIT_gl_framebuffer_binding_read;
7178 current_ctx->gl_framebuffer_binding_read[0] = real_obj;
7181 } else if (target == GL_DRAW_FRAMEBUFFER &&
7182 current_ctx->gl_framebuffer_binding_draw_used) {
7183 CURR_STATE_COMPARE(gl_framebuffer_binding_draw, real_obj) {
7184 IF_GL_SUCCESS(_orig_fastpath_glBindFramebufferOES(target, real_obj)) {
7186 current_ctx->_bind_flag1 &= (~_BIND_FLAG1_BIT_gl_framebuffer_binding_draw);
7188 current_ctx->_bind_flag1 |= _BIND_FLAG1_BIT_gl_framebuffer_binding_draw;
7189 current_ctx->gl_framebuffer_binding_draw[0] = real_obj;
7193 _set_gl_error(GL_INVALID_ENUM);
7199 _COREGL_FASTPATH_FUNC_END();
7203 fastpath_glBindRenderbufferOES(GLenum target, GLuint renderbuffer)
7207 DEFINE_FASTPAH_GL_FUNC();
7208 _COREGL_FASTPATH_FUNC_BEGIN();
7209 INIT_FASTPATH_GL_FUNC();
7211 if (GET_REAL_OBJ(GL_OBJECT_TYPE_RENDERBUFFER, renderbuffer, &real_obj) != 1) {
7212 _set_gl_error(GL_OUT_OF_MEMORY);
7216 if (target == GL_RENDERBUFFER) {
7217 CURR_STATE_COMPARE(gl_renderbuffer_binding, real_obj) {
7218 IF_GL_SUCCESS(_orig_fastpath_glBindRenderbufferOES(target, real_obj)) {
7220 current_ctx->_bind_flag1 &= (~_BIND_FLAG1_BIT_gl_renderbuffer_binding);
7222 current_ctx->_bind_flag1 |= _BIND_FLAG1_BIT_gl_renderbuffer_binding;
7223 current_ctx->gl_renderbuffer_binding[0] = real_obj;
7227 _set_gl_error(GL_INVALID_ENUM);
7234 _COREGL_FASTPATH_FUNC_END();
7239 fastpath_glClearBufferfi(GLenum buffer, GLint drawbuffer, GLfloat depth,
7244 DEFINE_FASTPAH_GL_FUNC();
7245 _COREGL_FASTPATH_FUNC_BEGIN();
7246 INIT_FASTPATH_GL_FUNC();
7248 if (GET_REAL_OBJ(GL_OBJECT_TYPE_BUFFER, buffer, &real_obj) != 1) {
7252 _orig_fastpath_glClearBufferfi(real_obj, drawbuffer, depth, stencil);
7257 _COREGL_FASTPATH_FUNC_END();
7261 fastpath_glClearBufferfv(GLenum buffer, GLint drawbuffer, GLfloat const *value)
7265 DEFINE_FASTPAH_GL_FUNC();
7266 _COREGL_FASTPATH_FUNC_BEGIN();
7267 INIT_FASTPATH_GL_FUNC();
7269 if (GET_REAL_OBJ(GL_OBJECT_TYPE_BUFFER, buffer, &real_obj) != 1) {
7273 _orig_fastpath_glClearBufferfv(buffer, drawbuffer, value);
7278 _COREGL_FASTPATH_FUNC_END();
7282 fastpath_glClearBufferiv(GLenum buffer, GLint drawbuffer, GLint const *value)
7286 DEFINE_FASTPAH_GL_FUNC();
7287 _COREGL_FASTPATH_FUNC_BEGIN();
7288 INIT_FASTPATH_GL_FUNC();
7290 if (GET_REAL_OBJ(GL_OBJECT_TYPE_BUFFER, buffer, &real_obj) != 1) {
7294 _orig_fastpath_glClearBufferiv(buffer, drawbuffer, value);
7299 _COREGL_FASTPATH_FUNC_END();
7303 fastpath_glClearBufferuiv(GLenum buffer, GLint drawbuffer, GLuint const *value)
7307 DEFINE_FASTPAH_GL_FUNC();
7308 _COREGL_FASTPATH_FUNC_BEGIN();
7309 INIT_FASTPATH_GL_FUNC();
7311 if (GET_REAL_OBJ(GL_OBJECT_TYPE_BUFFER, buffer, &real_obj) != 1) {
7315 _orig_fastpath_glClearBufferuiv(buffer, drawbuffer, value);
7320 _COREGL_FASTPATH_FUNC_END();
7324 fastpath_glDeleteFramebuffersOES(GLsizei n, const GLuint *framebuffers)
7327 GLuint *objid_array = NULL;
7329 DEFINE_FASTPAH_GL_FUNC();
7330 _COREGL_FASTPATH_FUNC_BEGIN();
7331 INIT_FASTPATH_GL_FUNC();
7334 _set_gl_error(GL_INVALID_VALUE);
7337 if (n == 0) goto finish;
7338 if (framebuffers == NULL) goto finish;
7340 AST(current_ctx->ostate.shared != NULL);
7342 objid_array = (GLuint *)calloc(1, sizeof(GLuint) * n);
7346 for (i = 0; i < n; i++) {
7347 int real_objid = _COREGL_INT_INIT_VALUE;
7348 if (framebuffers[i] == 0) continue;
7350 real_objid = fastpath_ostate_get_object(¤t_ctx->ostate,
7351 GL_OBJECT_TYPE_FRAMEBUFFER, framebuffers[i]);
7352 if (real_objid == 0) continue;
7354 AST(fastpath_ostate_remove_object(¤t_ctx->ostate,
7355 GL_OBJECT_TYPE_FRAMEBUFFER, framebuffers[i]) == 1);
7356 objid_array[real_n++] = real_objid;
7359 IF_GL_SUCCESS(_orig_fastpath_glDeleteFramebuffersOES(real_n, objid_array)) {
7360 for (i = 0; i < real_n; i++) {
7361 General_Trace_List *current = NULL;
7362 current = current_ctx->ostate.shared->using_gctxs;
7364 while (current != NULL) {
7365 GLGlueContext *cur_gctx = (GLGlueContext *)current->value;
7367 if (cur_gctx->gl_framebuffer_binding[0] == objid_array[i]) {
7368 cur_gctx->_bind_flag1 &= (~_BIND_FLAG1_BIT_gl_framebuffer_binding);
7369 cur_gctx->gl_framebuffer_binding[0] = 0;
7371 if (cur_gctx->gl_framebuffer_binding_read[0] == objid_array[i]) {
7372 cur_gctx->_bind_flag1 &= (~_BIND_FLAG1_BIT_gl_framebuffer_binding_read);
7373 cur_gctx->gl_framebuffer_binding_read[0] = 0;
7375 if (cur_gctx->gl_framebuffer_binding_draw[0] == objid_array[i]) {
7376 cur_gctx->_bind_flag1 &= (~_BIND_FLAG1_BIT_gl_framebuffer_binding_draw);
7377 cur_gctx->gl_framebuffer_binding_draw[0] = 0;
7380 current = current->next;
7389 if (objid_array != NULL) {
7393 _COREGL_FASTPATH_FUNC_END();
7397 fastpath_glDeleteRenderbuffersOES(GLsizei n, const GLuint *renderbuffers)
7400 GLuint *objid_array = NULL;
7402 DEFINE_FASTPAH_GL_FUNC();
7403 _COREGL_FASTPATH_FUNC_BEGIN();
7404 INIT_FASTPATH_GL_FUNC();
7407 _set_gl_error(GL_INVALID_VALUE);
7410 if (n == 0) goto finish;
7411 if (renderbuffers == NULL) goto finish;
7413 AST(current_ctx->ostate.shared != NULL);
7415 objid_array = (GLuint *)calloc(1, sizeof(GLuint) * n);
7419 for (i = 0; i < n; i++) {
7420 int real_objid = _COREGL_INT_INIT_VALUE;
7421 if (renderbuffers[i] == 0) continue;
7423 real_objid = fastpath_ostate_get_object(¤t_ctx->ostate,
7424 GL_OBJECT_TYPE_RENDERBUFFER, renderbuffers[i]);
7425 if (real_objid == 0) continue;
7427 AST(fastpath_ostate_remove_object(¤t_ctx->ostate,
7428 GL_OBJECT_TYPE_RENDERBUFFER, renderbuffers[i]) == 1);
7429 objid_array[real_n++] = real_objid;
7432 IF_GL_SUCCESS(_orig_fastpath_glDeleteRenderbuffersOES(real_n, objid_array)) {
7433 for (i = 0; i < real_n; i++) {
7434 General_Trace_List *current = NULL;
7435 current = current_ctx->ostate.shared->using_gctxs;
7437 while (current != NULL) {
7438 GLGlueContext *cur_gctx = (GLGlueContext *)current->value;
7440 if (cur_gctx->gl_renderbuffer_binding[0] == objid_array[i]) {
7441 cur_gctx->_bind_flag1 &= (~_BIND_FLAG1_BIT_gl_renderbuffer_binding);
7442 cur_gctx->gl_renderbuffer_binding[0] = 0;
7445 current = current->next;
7454 if (objid_array != NULL) {
7458 _COREGL_FASTPATH_FUNC_END();
7462 fastpath_glDepthRangefOES(GLclampf zNear, GLclampf zFar)
7464 DEFINE_FASTPAH_GL_FUNC();
7465 _COREGL_FASTPATH_FUNC_BEGIN();
7466 INIT_FASTPATH_GL_FUNC();
7468 if ((current_ctx->gl_depth_range[0] != zNear) ||
7469 (current_ctx->gl_depth_range[1] != zFar)) {
7470 IF_GL_SUCCESS(_orig_fastpath_glDepthRangefOES(zNear, zFar)) {
7471 current_ctx->_clear_flag2 |= _CLEAR_FLAG2_BIT_gl_depth_range;
7472 current_ctx->gl_depth_range[0] = zNear;
7473 current_ctx->gl_depth_range[1] = zFar;
7479 _COREGL_FASTPATH_FUNC_END();
7483 fastpath_glDepthRangexOES(GLclampx zNear, GLclampx zFar)
7485 DEFINE_FASTPAH_GL_FUNC();
7486 _COREGL_FASTPATH_FUNC_BEGIN();
7487 INIT_FASTPATH_GL_FUNC();
7489 if ((current_ctx->gl_depth_range[0] != zNear) ||
7490 (current_ctx->gl_depth_range[1] != zFar)) {
7491 IF_GL_SUCCESS(_orig_fastpath_glDepthRangexOES(zNear, zFar)) {
7492 current_ctx->_clear_flag2 |= _CLEAR_FLAG2_BIT_gl_depth_range;
7493 current_ctx->gl_depth_range[0] = zNear;
7494 current_ctx->gl_depth_range[1] = zFar;
7500 _COREGL_FASTPATH_FUNC_END();
7504 fastpath_glFramebufferParameteri(GLenum target, GLenum pname, GLint param)
7506 GLint real_obj = 0, fa_type = 0;
7508 DEFINE_FASTPAH_GL_FUNC();
7509 _COREGL_FASTPATH_FUNC_BEGIN();
7510 INIT_FASTPATH_GL_FUNC();
7513 case GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME:
7515 _orig_fastpath_glFramebufferParameteri(target, pname, real_obj);
7516 _orig_fastpath_glFramebufferParameteri(target,
7517 GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE, fa_type);
7520 if (GET_GLUE_OBJ(GL_OBJECT_TYPE_TEXTURE, real_obj, (GLuint *)¶m) != 1) {
7525 case GL_RENDERBUFFER:
7526 if (GET_GLUE_OBJ(GL_OBJECT_TYPE_RENDERBUFFER, real_obj,
7527 (GLuint *)¶m) != 1) {
7535 _orig_fastpath_glFramebufferParameteri(target, pname, param);
7542 _COREGL_FASTPATH_FUNC_END();
7546 fastpath_glGetFramebufferParameteriv(GLenum target, GLenum pname, GLint *params)
7548 GLint real_obj = 0, fa_type = 0;;
7550 DEFINE_FASTPAH_GL_FUNC();
7551 _COREGL_FASTPATH_FUNC_BEGIN();
7552 INIT_FASTPATH_GL_FUNC();
7555 case GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME:
7557 _orig_fastpath_glGetFramebufferParameteriv(target, pname, &real_obj);
7558 _orig_fastpath_glGetFramebufferParameteriv(target,
7559 GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE, &fa_type);
7562 if (GET_GLUE_OBJ(GL_OBJECT_TYPE_TEXTURE, real_obj, (GLuint *)params) != 1) {
7567 case GL_RENDERBUFFER:
7568 if (GET_GLUE_OBJ(GL_OBJECT_TYPE_RENDERBUFFER, real_obj,
7569 (GLuint *)params) != 1) {
7577 _orig_fastpath_glGetFramebufferParameteriv(target, pname, params);
7584 _COREGL_FASTPATH_FUNC_END();
7588 fastpath_glFramebufferRenderbufferOES(GLenum target, GLenum attachment,
7589 GLenum renderbuffertarget, GLuint renderbuffer)
7593 DEFINE_FASTPAH_GL_FUNC();
7594 _COREGL_FASTPATH_FUNC_BEGIN();
7595 INIT_FASTPATH_GL_FUNC();
7597 if (GET_REAL_OBJ(GL_OBJECT_TYPE_RENDERBUFFER, renderbuffer, &real_obj) != 1) {
7598 _set_gl_error(GL_OUT_OF_MEMORY);
7602 _orig_fastpath_glFramebufferRenderbufferOES(target, attachment,
7603 renderbuffertarget, real_obj);
7608 _COREGL_FASTPATH_FUNC_END();
7612 fastpath_glFramebufferTexture2DOES(GLenum target, GLenum attachment,
7613 GLenum textarget, GLuint texture, GLint level)
7617 DEFINE_FASTPAH_GL_FUNC();
7618 _COREGL_FASTPATH_FUNC_BEGIN();
7619 INIT_FASTPATH_GL_FUNC();
7621 if (GET_REAL_OBJ(GL_OBJECT_TYPE_TEXTURE, texture, &real_obj) != 1) {
7622 _set_gl_error(GL_OUT_OF_MEMORY);
7626 _orig_fastpath_glFramebufferTexture2DOES(target, attachment, textarget,
7632 _COREGL_FASTPATH_FUNC_END();
7636 fastpath_glGenFramebuffersOES(GLsizei n, GLuint *framebuffers)
7639 GLuint *objid_array = NULL;
7641 DEFINE_FASTPAH_GL_FUNC();
7642 _COREGL_FASTPATH_FUNC_BEGIN();
7643 INIT_FASTPATH_GL_FUNC();
7646 _set_gl_error(GL_INVALID_VALUE);
7649 if (n == 0) goto finish;
7650 if (framebuffers == NULL) goto finish;
7652 AST(current_ctx->ostate.shared != NULL);
7654 objid_array = (GLuint *)calloc(1, sizeof(GLuint) * n);
7656 IF_GL_SUCCESS(_orig_fastpath_glGenFramebuffersOES(n, objid_array)) {
7657 for (i = 0; i < n; i++) {
7658 framebuffers[i] = fastpath_ostate_create_object(¤t_ctx->ostate,
7659 GL_OBJECT_TYPE_FRAMEBUFFER, objid_array[i]);
7666 if (objid_array != NULL) {
7670 _COREGL_FASTPATH_FUNC_END();
7674 fastpath_glGenRenderbuffersOES(GLsizei n, GLuint *renderbuffers)
7677 GLuint *objid_array = NULL;
7679 DEFINE_FASTPAH_GL_FUNC();
7680 _COREGL_FASTPATH_FUNC_BEGIN();
7681 INIT_FASTPATH_GL_FUNC();
7684 _set_gl_error(GL_INVALID_VALUE);
7687 if (n == 0) goto finish;
7688 if (renderbuffers == NULL) goto finish;
7690 AST(current_ctx->ostate.shared != NULL);
7692 objid_array = (GLuint *)calloc(1, sizeof(GLuint) * n);
7694 IF_GL_SUCCESS(_orig_fastpath_glGenRenderbuffersOES(n, objid_array)) {
7695 for (i = 0; i < n; i++) {
7696 renderbuffers[i] = fastpath_ostate_create_object(¤t_ctx->ostate,
7697 GL_OBJECT_TYPE_RENDERBUFFER, objid_array[i]);
7704 if (objid_array != NULL) {
7708 _COREGL_FASTPATH_FUNC_END();
7712 fastpath_glGetFramebufferAttachmentParameterivOES(GLenum target,
7713 GLenum attachment, GLenum pname, GLint *params)
7715 GLint real_obj, fa_type;
7717 DEFINE_FASTPAH_GL_FUNC();
7718 _COREGL_FASTPATH_FUNC_BEGIN();
7719 INIT_FASTPATH_GL_FUNC();
7722 case GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME:
7724 _orig_fastpath_glGetFramebufferAttachmentParameterivOES(target, attachment,
7726 _orig_fastpath_glGetFramebufferAttachmentParameterivOES(target, attachment,
7727 GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE, &fa_type);
7730 if (GET_GLUE_OBJ(GL_OBJECT_TYPE_TEXTURE, real_obj, (GLuint *)params) != 1) {
7735 case GL_RENDERBUFFER:
7736 if (GET_GLUE_OBJ(GL_OBJECT_TYPE_RENDERBUFFER, real_obj,
7737 (GLuint *)params) != 1) {
7745 _orig_fastpath_glGetFramebufferAttachmentParameterivOES(target, attachment,
7753 _COREGL_FASTPATH_FUNC_END();
7757 fastpath_glGetQueryObjecti64vEXT(GLuint id, GLenum pname, GLint64 *params)
7761 DEFINE_FASTPAH_GL_FUNC();
7762 _COREGL_FASTPATH_FUNC_BEGIN();
7763 INIT_FASTPATH_GL_FUNC();
7765 if (GET_REAL_OBJ(GL_OBJECT_TYPE_QUERY, id, &real_obj) != 1) {
7766 _set_gl_error(GL_INVALID_OPERATION);
7770 _orig_fastpath_glGetQueryObjecti64vEXT(real_obj, pname, params);
7775 _COREGL_FASTPATH_FUNC_END();
7779 fastpath_glGetQueryObjectivEXT(GLuint id, GLenum pname, GLint *params)
7783 DEFINE_FASTPAH_GL_FUNC();
7784 _COREGL_FASTPATH_FUNC_BEGIN();
7785 INIT_FASTPATH_GL_FUNC();
7787 if (GET_REAL_OBJ(GL_OBJECT_TYPE_QUERY, id, &real_obj) != 1) {
7788 _set_gl_error(GL_INVALID_OPERATION);
7792 _orig_fastpath_glGetQueryObjectivEXT(real_obj, pname, params);
7797 _COREGL_FASTPATH_FUNC_END();
7801 fastpath_glGetQueryObjectui64vEXT(GLuint id, GLenum pname, GLuint64 *params)
7805 DEFINE_FASTPAH_GL_FUNC();
7806 _COREGL_FASTPATH_FUNC_BEGIN();
7807 INIT_FASTPATH_GL_FUNC();
7809 if (GET_REAL_OBJ(GL_OBJECT_TYPE_QUERY, id, &real_obj) != 1) {
7810 _set_gl_error(GL_INVALID_OPERATION);
7814 _orig_fastpath_glGetQueryObjectui64vEXT(real_obj, pname, params);
7819 _COREGL_FASTPATH_FUNC_END();
7823 fastpath_glGetQueryObjectuivEXT(GLuint id, GLenum pname, GLuint *params)
7827 DEFINE_FASTPAH_GL_FUNC();
7828 _COREGL_FASTPATH_FUNC_BEGIN();
7829 INIT_FASTPATH_GL_FUNC();
7831 if (GET_REAL_OBJ(GL_OBJECT_TYPE_QUERY, id, &real_obj) != 1) {
7832 _set_gl_error(GL_INVALID_OPERATION);
7836 _orig_fastpath_glGetQueryObjectuivEXT(real_obj, pname, params);
7841 _COREGL_FASTPATH_FUNC_END();
7845 fastpath_glGetQueryivEXT(GLenum target, GLenum pname, GLint *params)
7847 GLuint glue_obj_id = _COREGL_INT_INIT_VALUE;
7849 DEFINE_FASTPAH_GL_FUNC();
7850 _COREGL_FASTPATH_FUNC_BEGIN();
7851 INIT_FASTPATH_GL_FUNC();
7853 _orig_fastpath_glGetQueryivEXT(target, pname, params);
7856 case GL_CURRENT_QUERY:
7857 if (params[0] != 0) {
7858 AST(GET_GLUE_OBJ(GL_OBJECT_TYPE_QUERY, params[0], &glue_obj_id) == 1);
7859 params[0] = glue_obj_id;
7867 _COREGL_FASTPATH_FUNC_END();
7871 fastpath_glBeginQueryEXT(GLenum target, GLuint id)
7875 DEFINE_FASTPAH_GL_FUNC();
7876 _COREGL_FASTPATH_FUNC_BEGIN();
7877 INIT_FASTPATH_GL_FUNC();
7879 if (GET_REAL_OBJ(GL_OBJECT_TYPE_QUERY, id, &real_obj) != 1) {
7880 // TODO : Begin - Context Switch
7881 _set_gl_error(GL_INVALID_OPERATION);
7885 _orig_fastpath_glBeginQueryEXT(target, real_obj);
7890 _COREGL_FASTPATH_FUNC_END();
7894 fastpath_glDeleteQueriesEXT(GLsizei n, const GLuint *ids)
7897 GLuint *objid_array = NULL;
7899 DEFINE_FASTPAH_GL_FUNC();
7900 _COREGL_FASTPATH_FUNC_BEGIN();
7901 INIT_FASTPATH_GL_FUNC();
7904 _set_gl_error(GL_INVALID_VALUE);
7907 if (n == 0) goto finish;
7908 if (ids == NULL) goto finish;
7910 AST(current_ctx->ostate.shared != NULL);
7912 objid_array = (GLuint *)calloc(1, sizeof(GLuint) * n);
7916 for (i = 0; i < n; i++) {
7917 int real_objid = _COREGL_INT_INIT_VALUE;
7918 if (ids[i] == 0) continue;
7920 real_objid = fastpath_ostate_get_object(¤t_ctx->ostate,
7921 GL_OBJECT_TYPE_QUERY, ids[i]);
7922 if (real_objid == 0) continue;
7924 AST(fastpath_ostate_remove_object(¤t_ctx->ostate, GL_OBJECT_TYPE_QUERY,
7926 objid_array[real_n++] = real_objid;
7929 _orig_fastpath_glDeleteQueriesEXT(real_n, objid_array);
7935 if (objid_array != NULL) {
7939 _COREGL_FASTPATH_FUNC_END();
7943 fastpath_glGenQueriesEXT(GLsizei n, GLuint *ids)
7946 GLuint *objid_array = NULL;
7948 DEFINE_FASTPAH_GL_FUNC();
7949 _COREGL_FASTPATH_FUNC_BEGIN();
7950 INIT_FASTPATH_GL_FUNC();
7953 _set_gl_error(GL_INVALID_VALUE);
7956 if (n == 0) goto finish;
7957 if (ids == NULL) goto finish;
7959 AST(current_ctx->ostate.shared != NULL);
7961 objid_array = (GLuint *)calloc(1, sizeof(GLuint) * n);
7963 IF_GL_SUCCESS(_orig_fastpath_glGenQueriesEXT(n, objid_array)) {
7964 for (i = 0; i < n; i++) {
7965 ids[i] = fastpath_ostate_create_object(¤t_ctx->ostate,
7966 GL_OBJECT_TYPE_QUERY, objid_array[i]);
7973 if (objid_array != NULL) {
7977 _COREGL_FASTPATH_FUNC_END();
7981 fastpath_glIsFramebufferOES(GLuint framebuffer)
7983 GLboolean ret = GL_FALSE;
7986 DEFINE_FASTPAH_GL_FUNC();
7987 _COREGL_FASTPATH_FUNC_BEGIN();
7988 INIT_FASTPATH_GL_FUNC();
7990 if (GET_REAL_OBJ(GL_OBJECT_TYPE_FRAMEBUFFER, framebuffer, &real_obj) != 1) {
7995 ret = _orig_fastpath_glIsFramebufferOES(real_obj);
8000 _COREGL_FASTPATH_FUNC_END();
8005 fastpath_glIsQueryEXT(GLuint id)
8007 GLboolean ret = GL_FALSE;
8010 DEFINE_FASTPAH_GL_FUNC();
8011 _COREGL_FASTPATH_FUNC_BEGIN();
8012 INIT_FASTPATH_GL_FUNC();
8014 if (GET_REAL_OBJ(GL_OBJECT_TYPE_QUERY, id, &real_obj) != 1) {
8019 ret = _orig_fastpath_glIsQueryEXT(real_obj);
8024 _COREGL_FASTPATH_FUNC_END();
8029 fastpath_glIsRenderbufferOES(GLuint renderbuffer)
8031 GLboolean ret = GL_FALSE;
8034 DEFINE_FASTPAH_GL_FUNC();
8035 _COREGL_FASTPATH_FUNC_BEGIN();
8036 INIT_FASTPATH_GL_FUNC();
8038 if (GET_REAL_OBJ(GL_OBJECT_TYPE_RENDERBUFFER, renderbuffer, &real_obj) != 1) {
8043 ret = _orig_fastpath_glIsRenderbufferOES(real_obj);
8048 _COREGL_FASTPATH_FUNC_END();
8053 fastpath_glBlendEquationOES(GLenum mode)
8055 DEFINE_FASTPAH_GL_FUNC();
8056 _COREGL_FASTPATH_FUNC_BEGIN();
8057 INIT_FASTPATH_GL_FUNC();
8059 IF_GL_SUCCESS(_orig_fastpath_glBlendEquationOES(mode)) {
8060 current_ctx->_blend_flag |=
8061 _BLEND_FLAG_BIT_gl_blend_equation_rgb |
8062 _BLEND_FLAG_BIT_gl_blend_equation_alpha;
8064 _orig_fastpath_glGetIntegerv(GL_BLEND_EQUATION_RGB,
8065 (GLint *) & (current_ctx->gl_blend_equation_rgb));
8066 _orig_fastpath_glGetIntegerv(GL_BLEND_EQUATION_ALPHA,
8067 (GLint *) & (current_ctx->gl_blend_equation_alpha));
8072 _COREGL_FASTPATH_FUNC_END();
8077 fastpath_glBlendEquationSeparateOES(GLenum modeRGB, GLenum modeAlpha)
8079 DEFINE_FASTPAH_GL_FUNC();
8080 _COREGL_FASTPATH_FUNC_BEGIN();
8081 INIT_FASTPATH_GL_FUNC();
8083 if ((current_ctx->gl_blend_equation_rgb[0] != modeRGB) ||
8084 (current_ctx->gl_blend_equation_alpha[0] != modeAlpha)) {
8085 IF_GL_SUCCESS(_orig_fastpath_glBlendEquationSeparateOES(modeRGB, modeAlpha)) {
8086 current_ctx->_blend_flag |=
8087 _BLEND_FLAG_BIT_gl_blend_equation_rgb |
8088 _BLEND_FLAG_BIT_gl_blend_equation_alpha;
8090 current_ctx->gl_blend_equation_rgb[0] = modeRGB;
8091 current_ctx->gl_blend_equation_alpha[0] = modeAlpha;
8097 _COREGL_FASTPATH_FUNC_END();
8101 fastpath_glBlendFuncSeparateOES(GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha,
8104 DEFINE_FASTPAH_GL_FUNC();
8105 _COREGL_FASTPATH_FUNC_BEGIN();
8106 INIT_FASTPATH_GL_FUNC();
8108 if ((current_ctx->gl_blend_src_rgb[0] != srcRGB) ||
8109 (current_ctx->gl_blend_dst_rgb[0] != dstRGB) ||
8110 (current_ctx->gl_blend_src_alpha[0] != srcAlpha) ||
8111 (current_ctx->gl_blend_dst_alpha[0] != dstAlpha)) {
8112 IF_GL_SUCCESS(_orig_fastpath_glBlendFuncSeparateOES(srcRGB, dstRGB, srcAlpha,
8114 current_ctx->_blend_flag |=
8115 _BLEND_FLAG_BIT_gl_blend_src_rgb |
8116 _BLEND_FLAG_BIT_gl_blend_src_alpha |
8117 _BLEND_FLAG_BIT_gl_blend_dst_rgb |
8118 _BLEND_FLAG_BIT_gl_blend_dst_alpha;
8120 current_ctx->gl_blend_src_rgb[0] = srcRGB;
8121 current_ctx->gl_blend_dst_rgb[0] = dstRGB;
8122 current_ctx->gl_blend_src_alpha[0] = srcAlpha;
8123 current_ctx->gl_blend_dst_alpha[0] = dstAlpha;
8129 _COREGL_FASTPATH_FUNC_END();
8133 fastpath_glPolygonOffsetxOES(GLfixed factor, GLfixed units)
8135 DEFINE_FASTPAH_GL_FUNC();
8136 _COREGL_FASTPATH_FUNC_BEGIN();
8137 INIT_FASTPATH_GL_FUNC();
8139 if ((current_ctx->gl_polygon_offset_factor[0] != factor) ||
8140 (current_ctx->gl_polygon_offset_units[0] != units)) {
8141 IF_GL_SUCCESS(_orig_fastpath_glPolygonOffsetxOES(factor, units)) {
8142 current_ctx->_misc_flag1 |=
8143 _MISC_FLAG1_BIT_gl_polygon_offset_factor |
8144 _MISC_FLAG1_BIT_gl_polygon_offset_units;
8146 current_ctx->gl_polygon_offset_factor[0] = factor;
8147 current_ctx->gl_polygon_offset_units[0] = units;
8153 _COREGL_FASTPATH_FUNC_END();
8157 fastpath_glLineWidthxOES(GLfixed width)
8159 DEFINE_FASTPAH_GL_FUNC();
8160 _COREGL_FASTPATH_FUNC_BEGIN();
8161 INIT_FASTPATH_GL_FUNC();
8163 CURR_STATE_COMPARE(gl_line_width, width) {
8164 IF_GL_SUCCESS(_orig_fastpath_glLineWidthxOES(width)) {
8165 current_ctx->_misc_flag1 |= _MISC_FLAG1_BIT_gl_line_width;
8166 current_ctx->gl_line_width[0] = width;
8172 _COREGL_FASTPATH_FUNC_END();
8176 fastpath_glSampleCoveragexOES(GLclampx value, GLboolean invert)
8178 DEFINE_FASTPAH_GL_FUNC();
8179 _COREGL_FASTPATH_FUNC_BEGIN();
8180 INIT_FASTPATH_GL_FUNC();
8182 if ((current_ctx->gl_sample_coverage_value[0] != value) ||
8183 (current_ctx->gl_sample_coverage_invert[0] != invert)) {
8184 IF_GL_SUCCESS(_orig_fastpath_glSampleCoveragexOES(value, invert)) {
8185 current_ctx->_misc_flag1 |=
8186 _MISC_FLAG1_BIT_gl_sample_coverage_value |
8187 _MISC_FLAG1_BIT_gl_sample_coverage_invert;
8189 current_ctx->gl_sample_coverage_value[0] = value;
8190 current_ctx->gl_sample_coverage_invert[0] = invert;
8196 _COREGL_FASTPATH_FUNC_END();
8200 fastpath_glQueryCounterEXT(GLuint id, GLenum target)
8204 DEFINE_FASTPAH_GL_FUNC();
8205 _COREGL_FASTPATH_FUNC_BEGIN();
8206 INIT_FASTPATH_GL_FUNC();
8208 if (GET_REAL_OBJ(GL_OBJECT_TYPE_QUERY, id, &real_obj) != 1) {
8209 // TODO : Begin - Context Switch
8210 _set_gl_error(GL_INVALID_OPERATION);
8214 _orig_fastpath_glQueryCounterEXT(real_obj, target);
8219 _COREGL_FASTPATH_FUNC_END();
8223 fastpath_glGenVertexArraysOES(GLsizei n, GLuint *arrays)
8226 GLuint *objid_array = NULL;
8228 DEFINE_FASTPAH_GL_FUNC();
8229 _COREGL_FASTPATH_FUNC_BEGIN();
8230 INIT_FASTPATH_GL_FUNC();
8233 _set_gl_error(GL_INVALID_VALUE);
8236 if (n == 0) goto finish;
8237 if (arrays == NULL) goto finish;
8239 AST(current_ctx->ostate.shared != NULL);
8241 objid_array = (GLuint *)calloc(1, sizeof(GLuint) * n);
8243 IF_GL_SUCCESS(_orig_fastpath_glGenVertexArraysOES(n, objid_array)) {
8244 for (i = 0; i < n; i++) {
8245 arrays[i] = fastpath_ostate_create_object(¤t_ctx->ostate,
8246 GL_OBJECT_TYPE_VERTEXARRAY, objid_array[i]);
8253 if (objid_array != NULL) {
8257 _COREGL_FASTPATH_FUNC_END();
8262 fastpath_glBindVertexArrayOES(GLuint array)
8266 DEFINE_FASTPAH_GL_FUNC();
8267 _COREGL_FASTPATH_FUNC_BEGIN();
8268 INIT_FASTPATH_GL_FUNC();
8270 if (GET_REAL_OBJ(GL_OBJECT_TYPE_VERTEXARRAY, array, &real_obj) != 1) {
8271 _set_gl_error(GL_INVALID_OPERATION);
8274 if (current_ctx->gl_vertex_array_binding[0] != real_obj) {
8275 IF_GL_SUCCESS(_orig_fastpath_glBindVertexArrayOES(real_obj)) {
8276 current_ctx->_misc_flag3 |= _MISC_FLAG3_BIT_gl_vertex_array_binding;
8277 current_ctx->gl_vertex_array_binding[0] = real_obj;
8283 _COREGL_FASTPATH_FUNC_END();
8288 fastpath_glIsVertexArrayOES(GLuint array)
8290 GLboolean ret = GL_FALSE;
8293 DEFINE_FASTPAH_GL_FUNC();
8294 _COREGL_FASTPATH_FUNC_BEGIN();
8295 INIT_FASTPATH_GL_FUNC();
8297 if (GET_REAL_OBJ(GL_OBJECT_TYPE_VERTEXARRAY, array, &real_obj) != 1) {
8302 ret = _orig_fastpath_glIsVertexArrayOES(real_obj);
8307 _COREGL_FASTPATH_FUNC_END();
8313 fastpath_glDeleteVertexArraysOES(GLsizei n, const GLuint *arrays)
8316 GLuint *objid_array = NULL;
8318 DEFINE_FASTPAH_GL_FUNC();
8319 _COREGL_FASTPATH_FUNC_BEGIN();
8320 INIT_FASTPATH_GL_FUNC();
8323 _set_gl_error(GL_INVALID_VALUE);
8326 if (n == 0) goto finish;
8327 if (arrays == NULL) goto finish;
8329 AST(current_ctx->ostate.shared != NULL);
8331 objid_array = (GLuint *)calloc(1, sizeof(GLuint) * n);
8335 for (i = 0; i < n; i++) {
8336 int real_objid = _COREGL_INT_INIT_VALUE;
8337 if (arrays[i] == 0) continue;
8339 real_objid = fastpath_ostate_get_object(¤t_ctx->ostate,
8340 GL_OBJECT_TYPE_VERTEXARRAY, arrays[i]);
8341 if (real_objid == 0) continue;
8343 AST(fastpath_ostate_remove_object(¤t_ctx->ostate,
8344 GL_OBJECT_TYPE_VERTEXARRAY, arrays[i]) == 1);
8345 objid_array[real_n++] = real_objid;
8348 IF_GL_SUCCESS(_orig_fastpath_glDeleteVertexArraysOES(real_n, objid_array)) {
8349 for (i = 0; i < real_n; i++) {
8350 General_Trace_List *current = NULL;
8351 current = current_ctx->ostate.shared->using_gctxs;
8353 while (current != NULL) {
8354 GLGlueContext *cur_gctx = (GLGlueContext *)current->value;
8356 if (cur_gctx->gl_vertex_array_binding[0] == objid_array[i])
8357 cur_gctx->gl_vertex_array_binding[0] = 0;
8359 current = current->next;
8368 if (objid_array != NULL) {
8372 _COREGL_FASTPATH_FUNC_END();
8376 fastpath_glClearDepthfOES(GLclampf depth)
8378 DEFINE_FASTPAH_GL_FUNC();
8379 _COREGL_FASTPATH_FUNC_BEGIN();
8380 INIT_FASTPATH_GL_FUNC();
8382 CURR_STATE_COMPARE(gl_depth_clear_value, depth) {
8383 IF_GL_SUCCESS(_orig_fastpath_glClearDepthfOES(depth)) {
8384 current_ctx->_clear_flag2 |= _CLEAR_FLAG2_BIT_gl_depth_clear_value;
8385 current_ctx->gl_depth_clear_value[0] = depth;
8391 _COREGL_FASTPATH_FUNC_END();
8395 fastpath_glClearDepthxOES(GLclampx depth)
8397 DEFINE_FASTPAH_GL_FUNC();
8398 _COREGL_FASTPATH_FUNC_BEGIN();
8399 INIT_FASTPATH_GL_FUNC();
8401 CURR_STATE_COMPARE(gl_depth_clear_value, depth) {
8402 IF_GL_SUCCESS(_orig_fastpath_glClearDepthxOES(depth)) {
8403 current_ctx->_clear_flag2 |= _CLEAR_FLAG2_BIT_gl_depth_clear_value;
8404 current_ctx->gl_depth_clear_value[0] = depth;
8410 _COREGL_FASTPATH_FUNC_END();