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, GLuint *real_handle)
58 *real_handle = fastpath_ostate_get_object(ostate, type, glue_handle);
59 if (*real_handle == 0)
66 _get_glue_obj(GL_Object_State *ostate, GL_Object_Type type, GLuint real_handle, GLuint *glue_handle)
75 *glue_handle = fastpath_ostate_find_object(ostate, type, real_handle);
76 if (*glue_handle == 0)
85 GLenum glerror = GL_NONE;
86 DEFINE_FASTPAH_GL_FUNC();
87 INIT_FASTPATH_GL_FUNC();
89 glerror = _orig_fastpath_glGetError();
91 if (current_ctx->gl_error == GL_NO_ERROR && glerror != GL_NO_ERROR)
93 current_ctx->gl_error = glerror;
102 _set_gl_error(GLenum error)
104 DEFINE_FASTPAH_GL_FUNC();
105 INIT_FASTPATH_GL_FUNC();
109 if (current_ctx->gl_error == GL_NO_ERROR && error != GL_NO_ERROR)
111 current_ctx->gl_error = error;
121 GLsizei shader_count;
124 } Program_object_attached_tag;
127 _create_program_object(GL_Object_State *ostate, int is_program, GLenum shader_type)
133 real_obj = _orig_fastpath_glCreateProgram();
135 real_obj = _orig_fastpath_glCreateShader(shader_type);
139 ret = fastpath_ostate_create_object(ostate, GL_OBJECT_TYPE_PROGRAM, real_obj);
140 Program_object_attached_tag *poat = NULL;
142 if (ret != _COREGL_INT_INIT_VALUE)
144 poat = (Program_object_attached_tag *)calloc(1, sizeof(Program_object_attached_tag));
148 fastpath_ostate_remove_object(ostate, GL_OBJECT_TYPE_PROGRAM, ret);
150 poat->is_deleting = 0;
151 poat->shader_count = 0;
153 fastpath_ostate_set_object_tag(ostate, GL_OBJECT_TYPE_PROGRAM, ret, poat);
161 _update_program_attach_info(GL_Object_State *ostate, GLuint program)
163 Program_object_attached_tag *poat = NULL;
164 GLuint real_program = _COREGL_INT_INIT_VALUE;
166 poat = (Program_object_attached_tag *)fastpath_ostate_get_object_tag(ostate, GL_OBJECT_TYPE_PROGRAM, program);
169 real_program = fastpath_ostate_get_object(ostate, GL_OBJECT_TYPE_PROGRAM, program);
170 AST(real_program > 0);
172 _orig_fastpath_glGetAttachedShaders(real_program, 10, &poat->shader_count, poat->shaders);
176 _attach_program_object(GL_Object_State *ostate, GLuint object)
180 fastpath_ostate_use_object(ostate, GL_OBJECT_TYPE_PROGRAM, object);
185 _is_deleted_program_object(GL_Object_State *ostate, GLuint glue_object)
187 Program_object_attached_tag *poat = NULL;
188 poat = (Program_object_attached_tag *)fastpath_ostate_get_object_tag(ostate, GL_OBJECT_TYPE_PROGRAM, glue_object);
190 return poat->is_deleting;
194 _detach_program_object(GL_Object_State *ostate, GLuint real_object, int is_program, int is_deleting)
196 if (real_object != 0)
198 GLuint object = _COREGL_INT_INIT_VALUE;
199 Program_object_attached_tag *poat = NULL;
201 object = fastpath_ostate_find_object(ostate, GL_OBJECT_TYPE_PROGRAM, real_object);
204 poat = (Program_object_attached_tag *)fastpath_ostate_get_object_tag(ostate, GL_OBJECT_TYPE_PROGRAM, object);
207 if (is_deleting == 1)
209 if (poat->is_deleting == 0)
211 poat->is_deleting = 1;
212 /* Ref count increased when glCreateProgram/initial attach */
213 fastpath_ostate_remove_object(ostate, GL_OBJECT_TYPE_PROGRAM, object);
214 /* Ref count increased when glCreateProgram/create object */
215 /* So, we have to call the under function twice.*/
216 fastpath_ostate_remove_object(ostate, GL_OBJECT_TYPE_PROGRAM, object);
221 fastpath_ostate_remove_object(ostate, GL_OBJECT_TYPE_PROGRAM, object);
224 if (fastpath_ostate_get_object(ostate, GL_OBJECT_TYPE_PROGRAM, object) == 0)
226 // Is completely removed. De-referencing attached shader objects
228 for (i = 0; i < poat->shader_count; i++)
230 AST(is_program == 1);
231 _detach_program_object(ostate, poat->shaders[i], 0, 0);
238 _orig_fastpath_glDeleteProgram(real_object);
240 _orig_fastpath_glDeleteShader(real_object);
247 fastpath_release_gl_context(GLGlueContext *gctx)
250 if (gctx->gl_current_program[0] != 0)
252 _detach_program_object(&gctx->ostate, gctx->gl_current_program[0], 1, 0);
253 gctx->gl_current_program[0] = 0;
263 int vlen = _COREGL_INT_INIT_VALUE;
264 int i = _COREGL_INT_INIT_VALUE;
265 char vret_tmp[80 + 1] = { 0 };
266 IF_GL_SUCCESS(vret = (const char *)_orig_fastpath_glGetString(GL_VERSION))
268 vlen = (int)strlen(vret);
269 if (!strncmp(vret, "OpenGL ES", 9) && vlen >= 11)
274 if (vlen < 14) return 0.0f;
280 if (vret[i] == ' ' || vret[i] == 0x00 || i >= 80)
282 strncpy(vret_tmp, &vret[stp], i - stp);
283 vret_tmp[i - stp] = 0x00;
287 if (vret_tmp[0] != 0x00)
288 GLver = atof(vret_tmp);
295 Mutex extension_check_mutex = MUTEX_INITIALIZER;
296 char string_extensions[16384] = { 0x00 };
297 char string_each_extensions[128][64];
298 int gl_extension_count = 0;
302 _valid_extension_string()
304 char string_tmpbuf[2048];
305 const char *res = NULL;
307 AST(mutex_lock(&extension_check_mutex) == 1);
309 if (gl_extension_count == 0)
311 IF_GL_SUCCESS(res = (const char *)_orig_fastpath_glGetString(GL_EXTENSIONS))
313 if (string_extensions[0] == 0x00)
315 double GLver = _get_gl_version();
317 strcpy(string_tmpbuf, res);
318 char *fstr = &string_tmpbuf[0], *estr = NULL;
319 for (estr = fstr; ; estr++)
321 if (*estr == 0x00) break;
326 #define _COREGL_SYMBOL(RET_TYPE, FUNC_NAME, PARAM_LIST)
327 #define _COREGL_FASTPATH_SUPPORTED_EXTENSION(NAME, MINVER, MAXVER) \
328 if (!strcmp(fstr, NAME) && (MINVER < 0 || GLver >= MINVER) && (MAXVER < 0 || GLver <= MAXVER)) \
330 strcpy(string_each_extensions[gl_extension_count], fstr); \
331 strcat(string_extensions, fstr); \
332 strcat(string_extensions, " "); \
333 gl_extension_count++; \
336 # include "../../headers/sym_gl.h"
338 #undef _COREGL_FASTPATH_SUPPORTED_EXTENSION
339 #undef _COREGL_SYMBOL
348 AST(mutex_unlock(&extension_check_mutex) == 1);
353 fastpath_glGetError(void)
355 GLenum ret = GL_NONE;
357 DEFINE_FASTPAH_GL_FUNC();
358 _COREGL_FASTPATH_FUNC_BEGIN();
359 INIT_FASTPATH_GL_FUNC();
361 if (current_ctx->gl_error != GL_NO_ERROR)
363 ret = current_ctx->gl_error;
364 current_ctx->gl_error = GL_NO_ERROR;
365 _orig_fastpath_glGetError();
369 ret = _orig_fastpath_glGetError();
374 _COREGL_FASTPATH_FUNC_END();
380 fastpath_glGetString(GLenum name)
382 const char *ret = NULL;
383 static const char *string_gles20 = "OpenGL ES 2.0";
384 static const char *string_gles30 = "OpenGL ES 3.0";
386 DEFINE_FASTPAH_GL_FUNC();
387 _COREGL_FASTPATH_FUNC_BEGIN();
388 INIT_FASTPATH_GL_FUNC();
393 IF_GL_SUCCESS(ret = (const char *)_orig_fastpath_glGetString(name))
395 double GLver = _get_gl_version();
398 COREGL_WRN("\E[40;31;1mFastpath can't support %s (Fixed to %s)\E[0m\n", ret, string_gles30);
403 COREGL_WRN("\E[40;31;1mFastpath can't support %s (Fixed to %s)\E[0m\n", ret, string_gles20);
409 _valid_extension_string();
410 ret = string_extensions;
413 IF_GL_SUCCESS(ret = (const char *)_orig_fastpath_glGetString(name))
426 _COREGL_FASTPATH_FUNC_END();
427 return (const GLubyte *)ret;
430 ////////////////////////////////////////////////////////////////////////
433 fastpath_glActiveTexture(GLenum texture)
435 DEFINE_FASTPAH_GL_FUNC();
436 _COREGL_FASTPATH_FUNC_BEGIN();
437 INIT_FASTPATH_GL_FUNC();
439 CURR_STATE_COMPARE(gl_active_texture, texture)
441 IF_GL_SUCCESS(_orig_fastpath_glActiveTexture(texture))
443 current_ctx->_tex_flag1 |= _TEX_FLAG1_BIT_gl_active_texture;
444 current_ctx->gl_active_texture[0] = texture;
450 _COREGL_FASTPATH_FUNC_END();
455 fastpath_glGenTextures(GLsizei n, GLuint* textures)
458 GLuint *objid_array = NULL;
460 DEFINE_FASTPAH_GL_FUNC();
461 _COREGL_FASTPATH_FUNC_BEGIN();
462 INIT_FASTPATH_GL_FUNC();
466 _set_gl_error(GL_INVALID_VALUE);
469 if (n == 0) goto finish;
470 if (textures == NULL) goto finish;
472 AST(current_ctx->ostate.shared != NULL);
474 objid_array = (GLuint *)calloc(1, sizeof(GLuint) * n);
476 IF_GL_SUCCESS(_orig_fastpath_glGenTextures(n, objid_array))
478 for (i = 0; i < n; i++)
480 textures[i] = fastpath_ostate_create_object(¤t_ctx->ostate, GL_OBJECT_TYPE_TEXTURE, objid_array[i]);
487 if (objid_array != NULL)
492 _COREGL_FASTPATH_FUNC_END();
497 fastpath_glBindTexture(GLenum target, GLuint texture)
502 DEFINE_FASTPAH_GL_FUNC();
503 _COREGL_FASTPATH_FUNC_BEGIN();
504 INIT_FASTPATH_GL_FUNC();
506 active_idx = current_ctx->gl_active_texture[0] - GL_TEXTURE0;
508 if (GET_REAL_OBJ(GL_OBJECT_TYPE_TEXTURE, texture, &real_obj) != 1)
510 _set_gl_error(GL_OUT_OF_MEMORY);
515 #define STATE_PROC(gl_state, flagid, flagbit) \
516 if (current_ctx->gl_state[active_idx] != real_obj) \
518 IF_GL_SUCCESS(_orig_fastpath_glBindTexture(target, real_obj)) \
520 current_ctx->flagid |= flagbit##_##gl_state; \
521 current_ctx->gl_state[active_idx] = real_obj; \
528 STATE_PROC(gl_tex_2d_state, _tex_flag1, _TEX_FLAG1_BIT);
531 STATE_PROC_WITH_CHECK(gl_tex_3d_state, _tex_flag1, _TEX_FLAG1_BIT);
533 case GL_TEXTURE_2D_ARRAY:
534 STATE_PROC_WITH_CHECK(gl_tex_2d_array_state, _tex_flag1, _TEX_FLAG1_BIT);
536 case GL_TEXTURE_CUBE_MAP:
537 STATE_PROC(gl_tex_cube_state, _tex_flag1, _TEX_FLAG1_BIT);
539 case GL_TEXTURE_EXTERNAL_OES:
540 STATE_PROC(gl_tex_external_oes_state, _tex_flag1, _TEX_FLAG1_BIT);
543 _set_gl_error(GL_INVALID_ENUM);
553 _COREGL_FASTPATH_FUNC_END();
558 fastpath_glFramebufferTexture2D(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level)
562 DEFINE_FASTPAH_GL_FUNC();
563 _COREGL_FASTPATH_FUNC_BEGIN();
564 INIT_FASTPATH_GL_FUNC();
566 if (GET_REAL_OBJ(GL_OBJECT_TYPE_TEXTURE, texture, &real_obj) != 1)
568 _set_gl_error(GL_OUT_OF_MEMORY);
572 _orig_fastpath_glFramebufferTexture2D(target, attachment, textarget, real_obj, level);
577 _COREGL_FASTPATH_FUNC_END();
582 fastpath_glFramebufferTexture3DOES(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLint zoffset)
586 DEFINE_FASTPAH_GL_FUNC();
587 _COREGL_FASTPATH_FUNC_BEGIN();
588 INIT_FASTPATH_GL_FUNC();
590 if (GET_REAL_OBJ(GL_OBJECT_TYPE_TEXTURE, texture, &real_obj) != 1)
592 _set_gl_error(GL_OUT_OF_MEMORY);
596 _orig_fastpath_glFramebufferTexture3DOES(target, attachment, textarget, real_obj, level, zoffset);
601 _COREGL_FASTPATH_FUNC_END();
606 fastpath_glFramebufferTexture2DMultisampleEXT(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLsizei samples)
610 DEFINE_FASTPAH_GL_FUNC();
611 _COREGL_FASTPATH_FUNC_BEGIN();
612 INIT_FASTPATH_GL_FUNC();
614 if (GET_REAL_OBJ(GL_OBJECT_TYPE_TEXTURE, texture, &real_obj) != 1)
616 _set_gl_error(GL_OUT_OF_MEMORY);
620 _orig_fastpath_glFramebufferTexture2DMultisampleEXT(target, attachment, textarget, real_obj, level, samples);
625 _COREGL_FASTPATH_FUNC_END();
630 fastpath_glGetFramebufferAttachmentParameteriv(GLenum target, GLenum attachment, GLenum pname, GLint *params)
632 GLint real_obj, fa_type;
634 DEFINE_FASTPAH_GL_FUNC();
635 _COREGL_FASTPATH_FUNC_BEGIN();
636 INIT_FASTPATH_GL_FUNC();
640 case GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME:
642 _orig_fastpath_glGetFramebufferAttachmentParameteriv(target, attachment, pname, &real_obj);
643 _orig_fastpath_glGetFramebufferAttachmentParameteriv(target, attachment, GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE, &fa_type);
647 if (GET_GLUE_OBJ(GL_OBJECT_TYPE_TEXTURE, real_obj, (GLuint *)params) != 1)
653 case GL_RENDERBUFFER:
654 if (GET_GLUE_OBJ(GL_OBJECT_TYPE_RENDERBUFFER, real_obj, (GLuint *)params) != 1)
663 _orig_fastpath_glGetFramebufferAttachmentParameteriv(target, attachment, pname, params);
670 _COREGL_FASTPATH_FUNC_END();
675 fastpath_glIsTexture(GLuint texture)
677 GLboolean ret = GL_FALSE;
680 DEFINE_FASTPAH_GL_FUNC();
681 _COREGL_FASTPATH_FUNC_BEGIN();
682 INIT_FASTPATH_GL_FUNC();
684 if (GET_REAL_OBJ(GL_OBJECT_TYPE_TEXTURE, texture, &real_obj) != 1)
690 ret = _orig_fastpath_glIsTexture(real_obj);
695 _COREGL_FASTPATH_FUNC_END();
701 fastpath_glDeleteTextures(GLsizei n, const GLuint* textures)
704 GLuint *objid_array = NULL;
706 DEFINE_FASTPAH_GL_FUNC();
707 _COREGL_FASTPATH_FUNC_BEGIN();
708 INIT_FASTPATH_GL_FUNC();
712 _set_gl_error(GL_INVALID_VALUE);
715 if (n == 0) goto finish;
716 if (textures == NULL) goto finish;
718 AST(current_ctx->ostate.shared != NULL);
720 objid_array = (GLuint *)calloc(1, sizeof(GLuint) * n);
724 for (i = 0; i < n; i++)
726 int real_objid = _COREGL_INT_INIT_VALUE;
727 if (textures[i] == 0) continue;
729 real_objid = fastpath_ostate_get_object(¤t_ctx->ostate, GL_OBJECT_TYPE_TEXTURE, textures[i]);
730 if (real_objid == 0) continue;
732 AST(fastpath_ostate_remove_object(¤t_ctx->ostate, GL_OBJECT_TYPE_TEXTURE, textures[i]) == 1);
733 objid_array[real_n++] = real_objid;
736 IF_GL_SUCCESS(_orig_fastpath_glDeleteTextures(real_n, objid_array))
738 for (i = 0; i < real_n; i++)
740 General_Trace_List *current = NULL;
741 current = current_ctx->ostate.shared->using_gctxs;
743 while (current != NULL)
745 GLGlueContext *cur_gctx = (GLGlueContext *)current->value;
747 for (j = 0; j < cur_gctx->gl_num_tex_units[0]; j++)
749 if (cur_gctx->gl_tex_2d_state[j] == objid_array[i])
750 cur_gctx->gl_tex_2d_state[j] = 0;
751 if (cur_gctx->gl_tex_3d_state[j] == objid_array[i])
752 cur_gctx->gl_tex_3d_state[j] = 0;
753 if (cur_gctx->gl_tex_2d_array_state[j] == objid_array[i])
754 cur_gctx->gl_tex_2d_array_state[j] = 0;
755 if (cur_gctx->gl_tex_cube_state[j] == objid_array[i])
756 cur_gctx->gl_tex_cube_state[j] = 0;
757 if (cur_gctx->gl_tex_external_oes_state[j] == objid_array[i])
758 cur_gctx->gl_tex_external_oes_state[j] = 0;
761 current = current->next;
770 if (objid_array != NULL)
775 _COREGL_FASTPATH_FUNC_END();
778 ////////////////////////////////////////////////////////////////////////
781 fastpath_glGenBuffers(GLsizei n, GLuint* buffers)
784 GLuint *objid_array = NULL;
786 DEFINE_FASTPAH_GL_FUNC();
787 _COREGL_FASTPATH_FUNC_BEGIN();
788 INIT_FASTPATH_GL_FUNC();
792 _set_gl_error(GL_INVALID_VALUE);
795 if (n == 0) goto finish;
796 if (buffers == NULL) goto finish;
798 AST(current_ctx->ostate.shared != NULL);
800 objid_array = (GLuint *)calloc(1, sizeof(GLuint) * n);
802 IF_GL_SUCCESS(_orig_fastpath_glGenBuffers(n, objid_array))
804 for (i = 0; i < n; i++)
806 buffers[i] = fastpath_ostate_create_object(¤t_ctx->ostate, GL_OBJECT_TYPE_BUFFER, objid_array[i]);
813 if (objid_array != NULL)
818 _COREGL_FASTPATH_FUNC_END();
823 fastpath_glBindBuffer(GLenum target, GLuint buffer)
827 DEFINE_FASTPAH_GL_FUNC();
828 _COREGL_FASTPATH_FUNC_BEGIN();
829 INIT_FASTPATH_GL_FUNC();
831 if (GET_REAL_OBJ(GL_OBJECT_TYPE_BUFFER, buffer, &real_obj) != 1)
833 _set_gl_error(GL_OUT_OF_MEMORY);
838 #define STATE_PROC(gl_state, flagid, flagbit) \
839 CURR_STATE_COMPARE(gl_state, real_obj) \
841 IF_GL_SUCCESS(_orig_fastpath_glBindBuffer(target, real_obj)) \
844 current_ctx->flagid &= (~flagbit##_##gl_state); \
846 current_ctx->flagid |= flagbit##_##gl_state; \
848 current_ctx->gl_state[0] = real_obj; \
855 case GL_ARRAY_BUFFER:
856 STATE_PROC(gl_array_buffer_binding, _bind_flag1, _BIND_FLAG1_BIT);
858 case GL_COPY_READ_BUFFER:
859 STATE_PROC_WITH_CHECK(gl_copy_read_buffer_binding, _bind_flag2, _BIND_FLAG2_BIT);
861 case GL_COPY_WRITE_BUFFER:
862 STATE_PROC_WITH_CHECK(gl_copy_write_buffer_binding, _bind_flag2, _BIND_FLAG2_BIT);
864 case GL_ELEMENT_ARRAY_BUFFER:
865 STATE_PROC(gl_element_array_buffer_binding, _bind_flag1, _BIND_FLAG1_BIT);
867 case GL_PIXEL_PACK_BUFFER:
868 STATE_PROC_WITH_CHECK(gl_pixel_pack_buffer_binding, _bind_flag2, _BIND_FLAG2_BIT);
870 case GL_PIXEL_UNPACK_BUFFER:
871 STATE_PROC_WITH_CHECK(gl_pixel_unpack_buffer_binding, _bind_flag2, _BIND_FLAG2_BIT);
873 case GL_TRANSFORM_FEEDBACK_BUFFER:
874 STATE_PROC_WITH_CHECK(gl_transform_feedback_buffer_binding, _bind_flag2, _BIND_FLAG2_BIT);
876 case GL_UNIFORM_BUFFER:
877 STATE_PROC_WITH_CHECK(gl_uniform_buffer_binding, _bind_flag2, _BIND_FLAG2_BIT);
880 _set_gl_error(GL_INVALID_ENUM);
890 _COREGL_FASTPATH_FUNC_END();
895 fastpath_glIsBuffer(GLuint buffer)
897 GLboolean ret = GL_FALSE;
900 DEFINE_FASTPAH_GL_FUNC();
901 _COREGL_FASTPATH_FUNC_BEGIN();
902 INIT_FASTPATH_GL_FUNC();
904 if (GET_REAL_OBJ(GL_OBJECT_TYPE_BUFFER, buffer, &real_obj) != 1)
910 ret = _orig_fastpath_glIsBuffer(real_obj);
915 _COREGL_FASTPATH_FUNC_END();
921 fastpath_glDeleteBuffers(GLsizei n, const GLuint* buffers)
924 GLuint *objid_array = NULL;
926 DEFINE_FASTPAH_GL_FUNC();
927 _COREGL_FASTPATH_FUNC_BEGIN();
928 INIT_FASTPATH_GL_FUNC();
932 _set_gl_error(GL_INVALID_VALUE);
935 if (n == 0) goto finish;
936 if (buffers == NULL) goto finish;
938 AST(current_ctx->ostate.shared != NULL);
940 objid_array = (GLuint *)calloc(1, sizeof(GLuint) * n);
944 for (i = 0; i < n; i++)
946 int real_objid = _COREGL_INT_INIT_VALUE;
947 if (buffers[i] == 0) continue;
949 real_objid = fastpath_ostate_get_object(¤t_ctx->ostate, GL_OBJECT_TYPE_BUFFER, buffers[i]);
950 if (real_objid == 0) continue;
952 AST(fastpath_ostate_remove_object(¤t_ctx->ostate, GL_OBJECT_TYPE_BUFFER, buffers[i]) == 1);
953 objid_array[real_n++] = real_objid;
956 IF_GL_SUCCESS(_orig_fastpath_glDeleteBuffers(real_n, objid_array))
958 for (i = 0; i < real_n; i++)
960 General_Trace_List *current = NULL;
961 current = current_ctx->ostate.shared->using_gctxs;
963 while (current != NULL)
965 GLGlueContext *cur_gctx = (GLGlueContext *)current->value;
967 if (cur_gctx->gl_array_buffer_binding[0] == objid_array[i])
969 cur_gctx->_bind_flag1 &= (~_BIND_FLAG1_BIT_gl_array_buffer_binding);
970 cur_gctx->gl_array_buffer_binding[0] = 0;
972 if (cur_gctx->gl_copy_read_buffer_binding[0] == objid_array[i])
974 cur_gctx->_bind_flag2 &= (~_BIND_FLAG2_BIT_gl_copy_read_buffer_binding);
975 cur_gctx->gl_copy_read_buffer_binding[0] = 0;
977 if (cur_gctx->gl_copy_write_buffer_binding[0] == objid_array[i])
979 cur_gctx->_bind_flag2 &= (~_BIND_FLAG2_BIT_gl_copy_write_buffer_binding);
980 cur_gctx->gl_copy_write_buffer_binding[0] = 0;
982 if (cur_gctx->gl_element_array_buffer_binding[0] == objid_array[i])
984 cur_gctx->_bind_flag1 &= (~_BIND_FLAG1_BIT_gl_element_array_buffer_binding);
985 cur_gctx->gl_element_array_buffer_binding[0] = 0;
987 if (cur_gctx->gl_pixel_pack_buffer_binding[0] == objid_array[i])
989 cur_gctx->_bind_flag2 &= (~_BIND_FLAG2_BIT_gl_pixel_pack_buffer_binding);
990 cur_gctx->gl_pixel_pack_buffer_binding[0] = 0;
992 if (cur_gctx->gl_pixel_unpack_buffer_binding[0] == objid_array[i])
994 cur_gctx->_bind_flag2 &= (~_BIND_FLAG2_BIT_gl_pixel_unpack_buffer_binding);
995 cur_gctx->gl_pixel_unpack_buffer_binding[0] = 0;
997 if (cur_gctx->gl_transform_feedback_buffer_binding[0] == objid_array[i])
999 cur_gctx->_bind_flag2 &= (~_BIND_FLAG2_BIT_gl_transform_feedback_buffer_binding);
1000 cur_gctx->gl_transform_feedback_buffer_binding[0] = 0;
1002 if (cur_gctx->gl_uniform_buffer_binding[0] == objid_array[i])
1004 cur_gctx->_bind_flag2 &= (~_BIND_FLAG2_BIT_gl_uniform_buffer_binding);
1005 cur_gctx->gl_uniform_buffer_binding[0] = 0;
1008 current = current->next;
1017 if (objid_array != NULL)
1022 _COREGL_FASTPATH_FUNC_END();
1025 //////////////////////////////////////////////////////////////////////////////////
1028 fastpath_glGenFramebuffers(GLsizei n, GLuint* framebuffers)
1031 GLuint *objid_array = NULL;
1033 DEFINE_FASTPAH_GL_FUNC();
1034 _COREGL_FASTPATH_FUNC_BEGIN();
1035 INIT_FASTPATH_GL_FUNC();
1039 _set_gl_error(GL_INVALID_VALUE);
1042 if (n == 0) goto finish;
1043 if (framebuffers == NULL) goto finish;
1045 AST(current_ctx->ostate.shared != NULL);
1047 objid_array = (GLuint *)calloc(1, sizeof(GLuint) * n);
1049 IF_GL_SUCCESS(_orig_fastpath_glGenFramebuffers(n, objid_array))
1051 for (i = 0; i < n; i++)
1053 framebuffers[i] = fastpath_ostate_create_object(¤t_ctx->ostate, GL_OBJECT_TYPE_FRAMEBUFFER, objid_array[i]);
1060 if (objid_array != NULL)
1065 _COREGL_FASTPATH_FUNC_END();
1070 fastpath_glBindFramebuffer(GLenum target, GLuint framebuffer)
1074 DEFINE_FASTPAH_GL_FUNC();
1075 _COREGL_FASTPATH_FUNC_BEGIN();
1076 INIT_FASTPATH_GL_FUNC();
1078 if (GET_REAL_OBJ(GL_OBJECT_TYPE_FRAMEBUFFER, framebuffer, &real_obj) != 1)
1080 _set_gl_error(GL_OUT_OF_MEMORY);
1084 if (target == GL_FRAMEBUFFER)
1086 if (current_ctx->gl_framebuffer_binding_read_used == 1)
1088 CURR_STATE_COMPARE(gl_framebuffer_binding_read, real_obj)
1090 IF_GL_SUCCESS(_orig_fastpath_glBindFramebuffer(target, real_obj))
1093 current_ctx->_bind_flag1 &= (~_BIND_FLAG1_BIT_gl_framebuffer_binding_read);
1095 current_ctx->_bind_flag1 |= _BIND_FLAG1_BIT_gl_framebuffer_binding_read;
1096 current_ctx->gl_framebuffer_binding_read[0] = real_obj;
1099 CURR_STATE_COMPARE(gl_framebuffer_binding_draw, real_obj)
1101 IF_GL_SUCCESS(_orig_fastpath_glBindFramebuffer(target, real_obj))
1104 current_ctx->_bind_flag1 &= (~_BIND_FLAG1_BIT_gl_framebuffer_binding_draw);
1106 current_ctx->_bind_flag1 |= _BIND_FLAG1_BIT_gl_framebuffer_binding_draw;
1107 current_ctx->gl_framebuffer_binding_draw[0] = real_obj;
1113 CURR_STATE_COMPARE(gl_framebuffer_binding, real_obj)
1115 IF_GL_SUCCESS(_orig_fastpath_glBindFramebuffer(target, real_obj))
1118 current_ctx->_bind_flag1 &= (~_BIND_FLAG1_BIT_gl_framebuffer_binding);
1120 current_ctx->_bind_flag1 |= _BIND_FLAG1_BIT_gl_framebuffer_binding;
1121 current_ctx->gl_framebuffer_binding[0] = real_obj;
1126 else if (target == GL_READ_FRAMEBUFFER && current_ctx->gl_framebuffer_binding_read_used)
1128 CURR_STATE_COMPARE(gl_framebuffer_binding_read, real_obj)
1130 IF_GL_SUCCESS(_orig_fastpath_glBindFramebuffer(target, real_obj))
1133 current_ctx->_bind_flag1 &= (~_BIND_FLAG1_BIT_gl_framebuffer_binding_read);
1135 current_ctx->_bind_flag1 |= _BIND_FLAG1_BIT_gl_framebuffer_binding_read;
1136 current_ctx->gl_framebuffer_binding_read[0] = real_obj;
1140 else if (target == GL_DRAW_FRAMEBUFFER && current_ctx->gl_framebuffer_binding_draw_used)
1142 CURR_STATE_COMPARE(gl_framebuffer_binding_draw, real_obj)
1144 IF_GL_SUCCESS(_orig_fastpath_glBindFramebuffer(target, real_obj))
1147 current_ctx->_bind_flag1 &= (~_BIND_FLAG1_BIT_gl_framebuffer_binding_draw);
1149 current_ctx->_bind_flag1 |= _BIND_FLAG1_BIT_gl_framebuffer_binding_draw;
1150 current_ctx->gl_framebuffer_binding_draw[0] = real_obj;
1156 _set_gl_error(GL_INVALID_ENUM);
1162 _COREGL_FASTPATH_FUNC_END();
1167 fastpath_glIsFramebuffer(GLuint framebuffer)
1169 GLboolean ret = GL_FALSE;
1172 DEFINE_FASTPAH_GL_FUNC();
1173 _COREGL_FASTPATH_FUNC_BEGIN();
1174 INIT_FASTPATH_GL_FUNC();
1176 if (GET_REAL_OBJ(GL_OBJECT_TYPE_FRAMEBUFFER, framebuffer, &real_obj) != 1)
1182 ret = _orig_fastpath_glIsFramebuffer(real_obj);
1187 _COREGL_FASTPATH_FUNC_END();
1193 fastpath_glDeleteFramebuffers(GLsizei n, const GLuint* framebuffers)
1196 GLuint *objid_array = NULL;
1198 DEFINE_FASTPAH_GL_FUNC();
1199 _COREGL_FASTPATH_FUNC_BEGIN();
1200 INIT_FASTPATH_GL_FUNC();
1204 _set_gl_error(GL_INVALID_VALUE);
1207 if (n == 0) goto finish;
1208 if (framebuffers == NULL) goto finish;
1210 AST(current_ctx->ostate.shared != NULL);
1212 objid_array = (GLuint *)calloc(1, sizeof(GLuint) * n);
1216 for (i = 0; i < n; i++)
1218 int real_objid = _COREGL_INT_INIT_VALUE;
1219 if (framebuffers[i] == 0) continue;
1221 real_objid = fastpath_ostate_get_object(¤t_ctx->ostate, GL_OBJECT_TYPE_FRAMEBUFFER, framebuffers[i]);
1222 if (real_objid == 0) continue;
1224 AST(fastpath_ostate_remove_object(¤t_ctx->ostate, GL_OBJECT_TYPE_FRAMEBUFFER, framebuffers[i]) == 1);
1225 objid_array[real_n++] = real_objid;
1228 IF_GL_SUCCESS(_orig_fastpath_glDeleteFramebuffers(real_n, objid_array))
1230 for (i = 0; i < real_n; i++)
1232 General_Trace_List *current = NULL;
1233 current = current_ctx->ostate.shared->using_gctxs;
1235 while (current != NULL)
1237 GLGlueContext *cur_gctx = (GLGlueContext *)current->value;
1239 if (cur_gctx->gl_framebuffer_binding[0] == objid_array[i])
1241 cur_gctx->_bind_flag1 &= (~_BIND_FLAG1_BIT_gl_framebuffer_binding);
1242 cur_gctx->gl_framebuffer_binding[0] = 0;
1244 if (cur_gctx->gl_framebuffer_binding_read[0] == objid_array[i])
1246 cur_gctx->_bind_flag1 &= (~_BIND_FLAG1_BIT_gl_framebuffer_binding_read);
1247 cur_gctx->gl_framebuffer_binding_read[0] = 0;
1249 if (cur_gctx->gl_framebuffer_binding_draw[0] == objid_array[i])
1251 cur_gctx->_bind_flag1 &= (~_BIND_FLAG1_BIT_gl_framebuffer_binding_draw);
1252 cur_gctx->gl_framebuffer_binding_draw[0] = 0;
1255 current = current->next;
1264 if (objid_array != NULL)
1269 _COREGL_FASTPATH_FUNC_END();
1272 //////////////////////////////////////////////////////////////////////////////////
1275 fastpath_glGenRenderbuffers(GLsizei n, GLuint* renderbuffers)
1278 GLuint *objid_array = NULL;
1280 DEFINE_FASTPAH_GL_FUNC();
1281 _COREGL_FASTPATH_FUNC_BEGIN();
1282 INIT_FASTPATH_GL_FUNC();
1286 _set_gl_error(GL_INVALID_VALUE);
1289 if (n == 0) goto finish;
1290 if (renderbuffers == NULL) goto finish;
1292 AST(current_ctx->ostate.shared != NULL);
1294 objid_array = (GLuint *)calloc(1, sizeof(GLuint) * n);
1296 IF_GL_SUCCESS(_orig_fastpath_glGenRenderbuffers(n, objid_array))
1298 for (i = 0; i < n; i++)
1300 renderbuffers[i] = fastpath_ostate_create_object(¤t_ctx->ostate, GL_OBJECT_TYPE_RENDERBUFFER, objid_array[i]);
1307 if (objid_array != NULL)
1312 _COREGL_FASTPATH_FUNC_END();
1317 fastpath_glBindRenderbuffer(GLenum target, GLuint renderbuffer)
1321 DEFINE_FASTPAH_GL_FUNC();
1322 _COREGL_FASTPATH_FUNC_BEGIN();
1323 INIT_FASTPATH_GL_FUNC();
1325 if (GET_REAL_OBJ(GL_OBJECT_TYPE_RENDERBUFFER, renderbuffer, &real_obj) != 1)
1327 _set_gl_error(GL_OUT_OF_MEMORY);
1331 if (target == GL_RENDERBUFFER)
1333 CURR_STATE_COMPARE(gl_renderbuffer_binding, real_obj)
1335 IF_GL_SUCCESS(_orig_fastpath_glBindRenderbuffer(target, real_obj))
1338 current_ctx->_bind_flag1 &= (~_BIND_FLAG1_BIT_gl_renderbuffer_binding);
1340 current_ctx->_bind_flag1 |= _BIND_FLAG1_BIT_gl_renderbuffer_binding;
1341 current_ctx->gl_renderbuffer_binding[0] = real_obj;
1347 _set_gl_error(GL_INVALID_ENUM);
1354 _COREGL_FASTPATH_FUNC_END();
1359 fastpath_glFramebufferRenderbuffer(GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer)
1363 DEFINE_FASTPAH_GL_FUNC();
1364 _COREGL_FASTPATH_FUNC_BEGIN();
1365 INIT_FASTPATH_GL_FUNC();
1367 if (GET_REAL_OBJ(GL_OBJECT_TYPE_RENDERBUFFER, renderbuffer, &real_obj) != 1)
1369 _set_gl_error(GL_OUT_OF_MEMORY);
1373 _orig_fastpath_glFramebufferRenderbuffer(target, attachment, renderbuffertarget, real_obj);
1378 _COREGL_FASTPATH_FUNC_END();
1383 fastpath_glIsRenderbuffer(GLuint renderbuffer)
1385 GLboolean ret = GL_FALSE;
1388 DEFINE_FASTPAH_GL_FUNC();
1389 _COREGL_FASTPATH_FUNC_BEGIN();
1390 INIT_FASTPATH_GL_FUNC();
1392 if (GET_REAL_OBJ(GL_OBJECT_TYPE_RENDERBUFFER, renderbuffer, &real_obj) != 1)
1398 ret = _orig_fastpath_glIsRenderbuffer(real_obj);
1403 _COREGL_FASTPATH_FUNC_END();
1409 fastpath_glDeleteRenderbuffers(GLsizei n, const GLuint* renderbuffers)
1412 GLuint *objid_array = NULL;
1414 DEFINE_FASTPAH_GL_FUNC();
1415 _COREGL_FASTPATH_FUNC_BEGIN();
1416 INIT_FASTPATH_GL_FUNC();
1420 _set_gl_error(GL_INVALID_VALUE);
1423 if (n == 0) goto finish;
1424 if (renderbuffers == NULL) goto finish;
1426 AST(current_ctx->ostate.shared != NULL);
1428 objid_array = (GLuint *)calloc(1, sizeof(GLuint) * n);
1432 for (i = 0; i < n; i++)
1434 int real_objid = _COREGL_INT_INIT_VALUE;
1435 if (renderbuffers[i] == 0) continue;
1437 real_objid = fastpath_ostate_get_object(¤t_ctx->ostate, GL_OBJECT_TYPE_RENDERBUFFER, renderbuffers[i]);
1438 if (real_objid == 0) continue;
1440 AST(fastpath_ostate_remove_object(¤t_ctx->ostate, GL_OBJECT_TYPE_RENDERBUFFER, renderbuffers[i]) == 1);
1441 objid_array[real_n++] = real_objid;
1444 IF_GL_SUCCESS(_orig_fastpath_glDeleteRenderbuffers(real_n, objid_array))
1446 for (i = 0; i < real_n; i++)
1448 General_Trace_List *current = NULL;
1449 current = current_ctx->ostate.shared->using_gctxs;
1451 while (current != NULL)
1453 GLGlueContext *cur_gctx = (GLGlueContext *)current->value;
1455 if (cur_gctx->gl_renderbuffer_binding[0] == objid_array[i])
1457 cur_gctx->_bind_flag1 &= (~_BIND_FLAG1_BIT_gl_renderbuffer_binding);
1458 cur_gctx->gl_renderbuffer_binding[0] = 0;
1461 current = current->next;
1470 if (objid_array != NULL)
1475 _COREGL_FASTPATH_FUNC_END();
1479 //////////////////////////////////////////////////////////////////////////////////
1482 fastpath_glCreateProgram(void)
1486 DEFINE_FASTPAH_GL_FUNC();
1487 _COREGL_FASTPATH_FUNC_BEGIN();
1488 INIT_FASTPATH_GL_FUNC();
1490 AST(current_ctx->ostate.shared != NULL);
1492 ret = _create_program_object(¤t_ctx->ostate, 1, GL_NONE);
1494 _attach_program_object(¤t_ctx->ostate, ret);
1499 _COREGL_FASTPATH_FUNC_END();
1505 fastpath_glCreateShader(GLenum type)
1509 DEFINE_FASTPAH_GL_FUNC();
1510 _COREGL_FASTPATH_FUNC_BEGIN();
1511 INIT_FASTPATH_GL_FUNC();
1513 AST(current_ctx->ostate.shared != NULL);
1515 ret = _create_program_object(¤t_ctx->ostate, 0, type);
1517 _attach_program_object(¤t_ctx->ostate, ret);
1522 _COREGL_FASTPATH_FUNC_END();
1528 fastpath_glShaderSource(GLuint shader, GLsizei count, const char** string, const GLint* length)
1532 DEFINE_FASTPAH_GL_FUNC();
1533 _COREGL_FASTPATH_FUNC_BEGIN();
1534 INIT_FASTPATH_GL_FUNC();
1536 if (GET_REAL_OBJ(GL_OBJECT_TYPE_PROGRAM, shader, &real_obj) != 1)
1538 _set_gl_error(GL_INVALID_VALUE);
1541 _orig_fastpath_glShaderSource(real_obj, count, string, length);
1546 _COREGL_FASTPATH_FUNC_END();
1551 fastpath_glShaderBinary(GLsizei n, const GLuint* shaders, GLenum binaryformat, const void* binary, GLsizei length)
1554 GLuint *objid_array = NULL;
1556 DEFINE_FASTPAH_GL_FUNC();
1557 _COREGL_FASTPATH_FUNC_BEGIN();
1558 INIT_FASTPATH_GL_FUNC();
1562 _set_gl_error(GL_INVALID_VALUE);
1565 if (n == 0) goto finish;
1566 if (shaders == NULL) goto finish;
1568 AST(current_ctx->ostate.shared != NULL);
1570 objid_array = (GLuint *)calloc(1, sizeof(GLuint) * n);
1572 for (i = 0; i < n; i++)
1574 if (shaders[i] == 0) continue;
1575 objid_array[i] = fastpath_ostate_get_object(¤t_ctx->ostate, GL_OBJECT_TYPE_PROGRAM, shaders[i]);
1578 _orig_fastpath_glShaderBinary(n, objid_array, binaryformat, binary, length);
1583 if (objid_array != NULL)
1589 _COREGL_FASTPATH_FUNC_END();
1594 fastpath_glCompileShader(GLuint shader)
1598 DEFINE_FASTPAH_GL_FUNC();
1599 _COREGL_FASTPATH_FUNC_BEGIN();
1600 INIT_FASTPATH_GL_FUNC();
1602 if (GET_REAL_OBJ(GL_OBJECT_TYPE_PROGRAM, shader, &real_obj) != 1)
1604 _set_gl_error(GL_INVALID_VALUE);
1608 _orig_fastpath_glCompileShader(real_obj);
1613 _COREGL_FASTPATH_FUNC_END();
1618 fastpath_glBindAttribLocation(GLuint program, GLuint index, const char* name)
1622 DEFINE_FASTPAH_GL_FUNC();
1623 _COREGL_FASTPATH_FUNC_BEGIN();
1624 INIT_FASTPATH_GL_FUNC();
1626 if (GET_REAL_OBJ(GL_OBJECT_TYPE_PROGRAM, program, &real_obj) != 1)
1628 _set_gl_error(GL_INVALID_VALUE);
1632 _orig_fastpath_glBindAttribLocation(real_obj, index, name);
1637 _COREGL_FASTPATH_FUNC_END();
1642 fastpath_glAttachShader(GLuint program, GLuint shader)
1644 GLuint real_obj_program;
1645 GLuint real_obj_shader;
1647 DEFINE_FASTPAH_GL_FUNC();
1648 _COREGL_FASTPATH_FUNC_BEGIN();
1649 INIT_FASTPATH_GL_FUNC();
1651 if (GET_REAL_OBJ(GL_OBJECT_TYPE_PROGRAM, program, &real_obj_program) != 1 ||
1652 GET_REAL_OBJ(GL_OBJECT_TYPE_PROGRAM, shader, &real_obj_shader) != 1)
1654 _set_gl_error(GL_INVALID_VALUE);
1658 IF_GL_SUCCESS(_orig_fastpath_glAttachShader(real_obj_program, real_obj_shader))
1660 _update_program_attach_info(¤t_ctx->ostate, program);
1661 _attach_program_object(¤t_ctx->ostate, shader);
1667 _COREGL_FASTPATH_FUNC_END();
1672 fastpath_glDetachShader(GLuint program, GLuint shader)
1674 GLuint real_obj_program;
1675 GLuint real_obj_shader;
1677 DEFINE_FASTPAH_GL_FUNC();
1678 _COREGL_FASTPATH_FUNC_BEGIN();
1679 INIT_FASTPATH_GL_FUNC();
1681 if (GET_REAL_OBJ(GL_OBJECT_TYPE_PROGRAM, program, &real_obj_program) != 1 ||
1682 GET_REAL_OBJ(GL_OBJECT_TYPE_PROGRAM, shader, &real_obj_shader) != 1)
1684 _set_gl_error(GL_INVALID_VALUE);
1688 IF_GL_SUCCESS(_orig_fastpath_glDetachShader(real_obj_program, real_obj_shader))
1690 _update_program_attach_info(¤t_ctx->ostate, program);
1691 _detach_program_object(¤t_ctx->ostate, real_obj_shader, 0, 0);
1697 _COREGL_FASTPATH_FUNC_END();
1702 fastpath_glIsShader(GLuint shader)
1704 GLboolean ret = GL_FALSE;
1707 DEFINE_FASTPAH_GL_FUNC();
1708 _COREGL_FASTPATH_FUNC_BEGIN();
1709 INIT_FASTPATH_GL_FUNC();
1711 if (GET_REAL_OBJ(GL_OBJECT_TYPE_PROGRAM, shader, &real_obj) != 1)
1717 ret = _orig_fastpath_glIsShader(real_obj);
1722 _COREGL_FASTPATH_FUNC_END();
1728 fastpath_glIsProgram(GLuint program)
1730 GLboolean ret = GL_FALSE;
1733 DEFINE_FASTPAH_GL_FUNC();
1734 _COREGL_FASTPATH_FUNC_BEGIN();
1735 INIT_FASTPATH_GL_FUNC();
1737 if (GET_REAL_OBJ(GL_OBJECT_TYPE_PROGRAM, program, &real_obj) != 1)
1743 ret = _orig_fastpath_glIsProgram(real_obj);
1748 _COREGL_FASTPATH_FUNC_END();
1754 fastpath_glLinkProgram(GLuint program)
1758 DEFINE_FASTPAH_GL_FUNC();
1759 _COREGL_FASTPATH_FUNC_BEGIN();
1760 INIT_FASTPATH_GL_FUNC();
1762 if (GET_REAL_OBJ(GL_OBJECT_TYPE_PROGRAM, program, &real_obj) != 1)
1764 _set_gl_error(GL_INVALID_VALUE);
1768 _orig_fastpath_glLinkProgram(real_obj);
1773 _COREGL_FASTPATH_FUNC_END();
1778 fastpath_glValidateProgram(GLuint program)
1782 DEFINE_FASTPAH_GL_FUNC();
1783 _COREGL_FASTPATH_FUNC_BEGIN();
1784 INIT_FASTPATH_GL_FUNC();
1786 if (GET_REAL_OBJ(GL_OBJECT_TYPE_PROGRAM, program, &real_obj) != 1)
1788 _set_gl_error(GL_INVALID_VALUE);
1792 _orig_fastpath_glValidateProgram(real_obj);
1797 _COREGL_FASTPATH_FUNC_END();
1802 fastpath_glUseProgram(GLuint program)
1806 DEFINE_FASTPAH_GL_FUNC();
1807 _COREGL_FASTPATH_FUNC_BEGIN();
1808 INIT_FASTPATH_GL_FUNC();
1810 if (GET_REAL_OBJ(GL_OBJECT_TYPE_PROGRAM, program, &real_obj) != 1)
1812 _set_gl_error(GL_INVALID_VALUE);
1816 CURR_STATE_COMPARE(gl_current_program, real_obj)
1818 IF_GL_SUCCESS(_orig_fastpath_glUseProgram(real_obj))
1820 _attach_program_object(¤t_ctx->ostate, program);
1821 _detach_program_object(¤t_ctx->ostate, current_ctx->gl_current_program[0], 1, 0);
1823 current_ctx->_clear_flag1 |= _CLEAR_FLAG1_BIT_gl_current_program;
1824 current_ctx->gl_current_program[0] = real_obj;
1830 _COREGL_FASTPATH_FUNC_END();
1835 fastpath_glGetActiveAttrib(GLuint program, GLuint index, GLsizei bufsize, GLsizei* length, GLint* size, GLenum* type, char* name)
1839 DEFINE_FASTPAH_GL_FUNC();
1840 _COREGL_FASTPATH_FUNC_BEGIN();
1841 INIT_FASTPATH_GL_FUNC();
1843 if (GET_REAL_OBJ(GL_OBJECT_TYPE_PROGRAM, program, &real_obj) != 1)
1845 _set_gl_error(GL_INVALID_VALUE);
1849 _orig_fastpath_glGetActiveAttrib(real_obj, index, bufsize, length, size, type, name);
1854 _COREGL_FASTPATH_FUNC_END();
1859 fastpath_glGetActiveUniform(GLuint program, GLuint index, GLsizei bufsize, GLsizei* length, GLint* size, GLenum* type, char* name)
1863 DEFINE_FASTPAH_GL_FUNC();
1864 _COREGL_FASTPATH_FUNC_BEGIN();
1865 INIT_FASTPATH_GL_FUNC();
1867 if (GET_REAL_OBJ(GL_OBJECT_TYPE_PROGRAM, program, &real_obj) != 1)
1869 _set_gl_error(GL_INVALID_VALUE);
1873 _orig_fastpath_glGetActiveUniform(real_obj, index, bufsize, length, size, type, name);
1878 _COREGL_FASTPATH_FUNC_END();
1883 fastpath_glGetAttachedShaders(GLuint program, GLsizei maxcount, GLsizei* count, GLuint* shaders)
1886 GLsizei real_count = _COREGL_INT_INIT_VALUE;
1889 DEFINE_FASTPAH_GL_FUNC();
1890 _COREGL_FASTPATH_FUNC_BEGIN();
1891 INIT_FASTPATH_GL_FUNC();
1893 if (GET_REAL_OBJ(GL_OBJECT_TYPE_PROGRAM, program, &real_obj) != 1)
1895 _set_gl_error(GL_INVALID_VALUE);
1899 IF_GL_SUCCESS(_orig_fastpath_glGetAttachedShaders(real_obj, maxcount, &real_count, shaders))
1901 for (i = 0; i < real_count; i++)
1903 if (shaders[i] != 0)
1904 shaders[i] = fastpath_ostate_find_object(¤t_ctx->ostate, GL_OBJECT_TYPE_PROGRAM, shaders[i]);
1906 if (count != NULL) *count = real_count;
1912 _COREGL_FASTPATH_FUNC_END();
1917 fastpath_glGetAttribLocation(GLuint program, const char* name)
1919 int ret = _COREGL_INT_INIT_VALUE;
1922 DEFINE_FASTPAH_GL_FUNC();
1923 _COREGL_FASTPATH_FUNC_BEGIN();
1924 INIT_FASTPATH_GL_FUNC();
1926 if (GET_REAL_OBJ(GL_OBJECT_TYPE_PROGRAM, program, &real_obj) != 1)
1928 _set_gl_error(GL_INVALID_VALUE);
1932 ret = _orig_fastpath_glGetAttribLocation(real_obj, name);
1937 _COREGL_FASTPATH_FUNC_END();
1943 fastpath_glGetShaderiv(GLuint shader, GLenum pname, GLint* params)
1947 DEFINE_FASTPAH_GL_FUNC();
1948 _COREGL_FASTPATH_FUNC_BEGIN();
1949 INIT_FASTPATH_GL_FUNC();
1951 if (GET_REAL_OBJ(GL_OBJECT_TYPE_PROGRAM, shader, &real_obj) != 1)
1953 _set_gl_error(GL_INVALID_VALUE);
1959 case GL_DELETE_STATUS:
1961 if (_is_deleted_program_object(¤t_ctx->ostate, shader) == 1)
1965 _orig_fastpath_glGetShaderiv(real_obj, pname, params);
1972 _COREGL_FASTPATH_FUNC_END();
1977 fastpath_glGetShaderInfoLog(GLuint shader, GLsizei bufsize, GLsizei* length, char* infolog)
1981 DEFINE_FASTPAH_GL_FUNC();
1982 _COREGL_FASTPATH_FUNC_BEGIN();
1983 INIT_FASTPATH_GL_FUNC();
1985 if (GET_REAL_OBJ(GL_OBJECT_TYPE_PROGRAM, shader, &real_obj) != 1)
1987 _set_gl_error(GL_INVALID_VALUE);
1991 _orig_fastpath_glGetShaderInfoLog(real_obj, bufsize, length, infolog);
1996 _COREGL_FASTPATH_FUNC_END();
2001 fastpath_glGetProgramiv(GLuint program, GLenum pname, GLint* params)
2005 DEFINE_FASTPAH_GL_FUNC();
2006 _COREGL_FASTPATH_FUNC_BEGIN();
2007 INIT_FASTPATH_GL_FUNC();
2009 if (GET_REAL_OBJ(GL_OBJECT_TYPE_PROGRAM, program, &real_obj) != 1)
2011 _set_gl_error(GL_INVALID_VALUE);
2017 case GL_DELETE_STATUS:
2019 if (_is_deleted_program_object(¤t_ctx->ostate, program) == 1)
2023 _orig_fastpath_glGetProgramiv(real_obj, pname, params);
2030 _COREGL_FASTPATH_FUNC_END();
2035 fastpath_glGetProgramInfoLog(GLuint program, GLsizei bufsize, GLsizei* length, char* infolog)
2039 DEFINE_FASTPAH_GL_FUNC();
2040 _COREGL_FASTPATH_FUNC_BEGIN();
2041 INIT_FASTPATH_GL_FUNC();
2043 if (GET_REAL_OBJ(GL_OBJECT_TYPE_PROGRAM, program, &real_obj) != 1)
2045 _set_gl_error(GL_INVALID_VALUE);
2049 _orig_fastpath_glGetProgramInfoLog(real_obj, bufsize, length, infolog);
2054 _COREGL_FASTPATH_FUNC_END();
2059 fastpath_glGetShaderSource(GLuint shader, GLsizei bufsize, GLsizei* length, char* source)
2063 DEFINE_FASTPAH_GL_FUNC();
2064 _COREGL_FASTPATH_FUNC_BEGIN();
2065 INIT_FASTPATH_GL_FUNC();
2067 if (GET_REAL_OBJ(GL_OBJECT_TYPE_PROGRAM, shader, &real_obj) != 1)
2069 _set_gl_error(GL_INVALID_VALUE);
2073 _orig_fastpath_glGetShaderSource(real_obj, bufsize, length, source);
2078 _COREGL_FASTPATH_FUNC_END();
2083 fastpath_glGetUniformfv(GLuint program, GLint location, GLfloat* params)
2087 DEFINE_FASTPAH_GL_FUNC();
2088 _COREGL_FASTPATH_FUNC_BEGIN();
2089 INIT_FASTPATH_GL_FUNC();
2091 if (GET_REAL_OBJ(GL_OBJECT_TYPE_PROGRAM, program, &real_obj) != 1)
2093 _set_gl_error(GL_INVALID_VALUE);
2097 _orig_fastpath_glGetUniformfv(real_obj, location, params);
2102 _COREGL_FASTPATH_FUNC_END();
2107 fastpath_glGetUniformiv(GLuint program, GLint location, GLint* params)
2111 DEFINE_FASTPAH_GL_FUNC();
2112 _COREGL_FASTPATH_FUNC_BEGIN();
2113 INIT_FASTPATH_GL_FUNC();
2115 if (GET_REAL_OBJ(GL_OBJECT_TYPE_PROGRAM, program, &real_obj) != 1)
2117 _set_gl_error(GL_INVALID_VALUE);
2121 _orig_fastpath_glGetUniformiv(real_obj, location, params);
2126 _COREGL_FASTPATH_FUNC_END();
2131 fastpath_glUseProgramStagesEXT(GLuint pipeline, GLbitfield stages, GLuint program)
2135 DEFINE_FASTPAH_GL_FUNC();
2136 _COREGL_FASTPATH_FUNC_BEGIN();
2137 INIT_FASTPATH_GL_FUNC();
2139 if (GET_REAL_OBJ(GL_OBJECT_TYPE_PROGRAM, program, &real_obj) != 1)
2141 _set_gl_error(GL_INVALID_VALUE);
2145 _orig_fastpath_glUseProgramStagesEXT(pipeline, stages, real_obj);
2150 _COREGL_FASTPATH_FUNC_END();
2155 fastpath_glActiveShaderProgramEXT(GLuint pipeline, GLuint program)
2159 DEFINE_FASTPAH_GL_FUNC();
2160 _COREGL_FASTPATH_FUNC_BEGIN();
2161 INIT_FASTPATH_GL_FUNC();
2163 if (GET_REAL_OBJ(GL_OBJECT_TYPE_PROGRAM, program, &real_obj) != 1)
2165 _set_gl_error(GL_INVALID_VALUE);
2169 _orig_fastpath_glActiveShaderProgramEXT(pipeline, real_obj);
2174 _COREGL_FASTPATH_FUNC_END();
2179 fastpath_glProgramParameteriEXT(GLuint program, GLenum pname, GLint value)
2183 DEFINE_FASTPAH_GL_FUNC();
2184 _COREGL_FASTPATH_FUNC_BEGIN();
2185 INIT_FASTPATH_GL_FUNC();
2187 if (GET_REAL_OBJ(GL_OBJECT_TYPE_PROGRAM, program, &real_obj) != 1)
2189 _set_gl_error(GL_INVALID_VALUE);
2193 _orig_fastpath_glProgramParameteriEXT(real_obj, pname, value);
2198 _COREGL_FASTPATH_FUNC_END();
2203 fastpath_glProgramUniform1iEXT(GLuint program, GLint location, GLint x)
2207 DEFINE_FASTPAH_GL_FUNC();
2208 _COREGL_FASTPATH_FUNC_BEGIN();
2209 INIT_FASTPATH_GL_FUNC();
2211 if (GET_REAL_OBJ(GL_OBJECT_TYPE_PROGRAM, program, &real_obj) != 1)
2213 _set_gl_error(GL_INVALID_VALUE);
2217 _orig_fastpath_glProgramUniform1iEXT(real_obj, location, x);
2222 _COREGL_FASTPATH_FUNC_END();
2227 fastpath_glProgramUniform2iEXT(GLuint program, GLint location, GLint x, GLint y)
2231 DEFINE_FASTPAH_GL_FUNC();
2232 _COREGL_FASTPATH_FUNC_BEGIN();
2233 INIT_FASTPATH_GL_FUNC();
2235 if (GET_REAL_OBJ(GL_OBJECT_TYPE_PROGRAM, program, &real_obj) != 1)
2237 _set_gl_error(GL_INVALID_VALUE);
2241 _orig_fastpath_glProgramUniform2iEXT(real_obj, location, x, y);
2246 _COREGL_FASTPATH_FUNC_END();
2251 fastpath_glProgramUniform3iEXT(GLuint program, GLint location, GLint x, GLint y, GLint z)
2255 DEFINE_FASTPAH_GL_FUNC();
2256 _COREGL_FASTPATH_FUNC_BEGIN();
2257 INIT_FASTPATH_GL_FUNC();
2259 if (GET_REAL_OBJ(GL_OBJECT_TYPE_PROGRAM, program, &real_obj) != 1)
2261 _set_gl_error(GL_INVALID_VALUE);
2265 _orig_fastpath_glProgramUniform3iEXT(real_obj, location, x, y, z);
2270 _COREGL_FASTPATH_FUNC_END();
2275 fastpath_glProgramUniform4iEXT(GLuint program, GLint location, GLint x, GLint y, GLint z, GLint w)
2279 DEFINE_FASTPAH_GL_FUNC();
2280 _COREGL_FASTPATH_FUNC_BEGIN();
2281 INIT_FASTPATH_GL_FUNC();
2283 if (GET_REAL_OBJ(GL_OBJECT_TYPE_PROGRAM, program, &real_obj) != 1)
2285 _set_gl_error(GL_INVALID_VALUE);
2289 _orig_fastpath_glProgramUniform4iEXT(real_obj, location, x, y, z, w);
2294 _COREGL_FASTPATH_FUNC_END();
2299 fastpath_glProgramUniform1fEXT(GLuint program, GLint location, GLfloat x)
2303 DEFINE_FASTPAH_GL_FUNC();
2304 _COREGL_FASTPATH_FUNC_BEGIN();
2305 INIT_FASTPATH_GL_FUNC();
2307 if (GET_REAL_OBJ(GL_OBJECT_TYPE_PROGRAM, program, &real_obj) != 1)
2309 _set_gl_error(GL_INVALID_VALUE);
2313 _orig_fastpath_glProgramUniform1fEXT(real_obj, location, x);
2318 _COREGL_FASTPATH_FUNC_END();
2323 fastpath_glProgramUniform2fEXT(GLuint program, GLint location, GLfloat x, GLfloat y)
2327 DEFINE_FASTPAH_GL_FUNC();
2328 _COREGL_FASTPATH_FUNC_BEGIN();
2329 INIT_FASTPATH_GL_FUNC();
2331 if (GET_REAL_OBJ(GL_OBJECT_TYPE_PROGRAM, program, &real_obj) != 1)
2333 _set_gl_error(GL_INVALID_VALUE);
2337 _orig_fastpath_glProgramUniform2fEXT(real_obj, location, x, y);
2342 _COREGL_FASTPATH_FUNC_END();
2347 fastpath_glProgramUniform3fEXT(GLuint program, GLint location, GLfloat x, GLfloat y, GLfloat z)
2351 DEFINE_FASTPAH_GL_FUNC();
2352 _COREGL_FASTPATH_FUNC_BEGIN();
2353 INIT_FASTPATH_GL_FUNC();
2355 if (GET_REAL_OBJ(GL_OBJECT_TYPE_PROGRAM, program, &real_obj) != 1)
2357 _set_gl_error(GL_INVALID_VALUE);
2361 _orig_fastpath_glProgramUniform3fEXT(real_obj, location, x, y, z);
2366 _COREGL_FASTPATH_FUNC_END();
2371 fastpath_glProgramUniform4fEXT(GLuint program, GLint location, GLfloat x, GLfloat y, GLfloat z, GLfloat w)
2375 DEFINE_FASTPAH_GL_FUNC();
2376 _COREGL_FASTPATH_FUNC_BEGIN();
2377 INIT_FASTPATH_GL_FUNC();
2379 if (GET_REAL_OBJ(GL_OBJECT_TYPE_PROGRAM, program, &real_obj) != 1)
2381 _set_gl_error(GL_INVALID_VALUE);
2385 _orig_fastpath_glProgramUniform4fEXT(real_obj, location, x, y, z, w);
2390 _COREGL_FASTPATH_FUNC_END();
2395 fastpath_glProgramUniform1ivEXT(GLuint program, GLint location, GLsizei count, const GLint *value)
2399 DEFINE_FASTPAH_GL_FUNC();
2400 _COREGL_FASTPATH_FUNC_BEGIN();
2401 INIT_FASTPATH_GL_FUNC();
2403 if (GET_REAL_OBJ(GL_OBJECT_TYPE_PROGRAM, program, &real_obj) != 1)
2405 _set_gl_error(GL_INVALID_VALUE);
2409 _orig_fastpath_glProgramUniform1ivEXT(real_obj, location, count, value);
2414 _COREGL_FASTPATH_FUNC_END();
2419 fastpath_glProgramUniform2ivEXT(GLuint program, GLint location, GLsizei count, const GLint *value)
2423 DEFINE_FASTPAH_GL_FUNC();
2424 _COREGL_FASTPATH_FUNC_BEGIN();
2425 INIT_FASTPATH_GL_FUNC();
2427 if (GET_REAL_OBJ(GL_OBJECT_TYPE_PROGRAM, program, &real_obj) != 1)
2429 _set_gl_error(GL_INVALID_VALUE);
2433 _orig_fastpath_glProgramUniform2ivEXT(real_obj, location, count, value);
2438 _COREGL_FASTPATH_FUNC_END();
2443 fastpath_glProgramUniform3ivEXT(GLuint program, GLint location, GLsizei count, const GLint *value)
2447 DEFINE_FASTPAH_GL_FUNC();
2448 _COREGL_FASTPATH_FUNC_BEGIN();
2449 INIT_FASTPATH_GL_FUNC();
2451 if (GET_REAL_OBJ(GL_OBJECT_TYPE_PROGRAM, program, &real_obj) != 1)
2453 _set_gl_error(GL_INVALID_VALUE);
2457 _orig_fastpath_glProgramUniform3ivEXT(real_obj, location, count, value);
2462 _COREGL_FASTPATH_FUNC_END();
2467 fastpath_glProgramUniform4ivEXT(GLuint program, GLint location, GLsizei count, const GLint *value)
2471 DEFINE_FASTPAH_GL_FUNC();
2472 _COREGL_FASTPATH_FUNC_BEGIN();
2473 INIT_FASTPATH_GL_FUNC();
2475 if (GET_REAL_OBJ(GL_OBJECT_TYPE_PROGRAM, program, &real_obj) != 1)
2477 _set_gl_error(GL_INVALID_VALUE);
2481 _orig_fastpath_glProgramUniform4ivEXT(real_obj, location, count, value);
2486 _COREGL_FASTPATH_FUNC_END();
2491 fastpath_glProgramUniform1fvEXT(GLuint program, GLint location, GLsizei count, const GLfloat *value)
2495 DEFINE_FASTPAH_GL_FUNC();
2496 _COREGL_FASTPATH_FUNC_BEGIN();
2497 INIT_FASTPATH_GL_FUNC();
2499 if (GET_REAL_OBJ(GL_OBJECT_TYPE_PROGRAM, program, &real_obj) != 1)
2501 _set_gl_error(GL_INVALID_VALUE);
2505 _orig_fastpath_glProgramUniform1fvEXT(real_obj, location, count, value);
2510 _COREGL_FASTPATH_FUNC_END();
2515 fastpath_glProgramUniform2fvEXT(GLuint program, GLint location, GLsizei count, const GLfloat *value)
2519 DEFINE_FASTPAH_GL_FUNC();
2520 _COREGL_FASTPATH_FUNC_BEGIN();
2521 INIT_FASTPATH_GL_FUNC();
2523 if (GET_REAL_OBJ(GL_OBJECT_TYPE_PROGRAM, program, &real_obj) != 1)
2525 _set_gl_error(GL_INVALID_VALUE);
2529 _orig_fastpath_glProgramUniform2fvEXT(real_obj, location, count, value);
2534 _COREGL_FASTPATH_FUNC_END();
2539 fastpath_glProgramUniform3fvEXT(GLuint program, GLint location, GLsizei count, const GLfloat *value)
2543 DEFINE_FASTPAH_GL_FUNC();
2544 _COREGL_FASTPATH_FUNC_BEGIN();
2545 INIT_FASTPATH_GL_FUNC();
2547 if (GET_REAL_OBJ(GL_OBJECT_TYPE_PROGRAM, program, &real_obj) != 1)
2549 _set_gl_error(GL_INVALID_VALUE);
2553 _orig_fastpath_glProgramUniform3fvEXT(real_obj, location, count, value);
2558 _COREGL_FASTPATH_FUNC_END();
2563 fastpath_glProgramUniform4fvEXT(GLuint program, GLint location, GLsizei count, const GLfloat *value)
2567 DEFINE_FASTPAH_GL_FUNC();
2568 _COREGL_FASTPATH_FUNC_BEGIN();
2569 INIT_FASTPATH_GL_FUNC();
2571 if (GET_REAL_OBJ(GL_OBJECT_TYPE_PROGRAM, program, &real_obj) != 1)
2573 _set_gl_error(GL_INVALID_VALUE);
2577 _orig_fastpath_glProgramUniform4fvEXT(real_obj, location, count, value);
2582 _COREGL_FASTPATH_FUNC_END();
2587 fastpath_glProgramUniformMatrix2fvEXT(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
2591 DEFINE_FASTPAH_GL_FUNC();
2592 _COREGL_FASTPATH_FUNC_BEGIN();
2593 INIT_FASTPATH_GL_FUNC();
2595 if (GET_REAL_OBJ(GL_OBJECT_TYPE_PROGRAM, program, &real_obj) != 1)
2597 _set_gl_error(GL_INVALID_VALUE);
2601 _orig_fastpath_glProgramUniformMatrix2fvEXT(real_obj, location, count, transpose, value);
2606 _COREGL_FASTPATH_FUNC_END();
2611 fastpath_glProgramUniformMatrix3fvEXT(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
2615 DEFINE_FASTPAH_GL_FUNC();
2616 _COREGL_FASTPATH_FUNC_BEGIN();
2617 INIT_FASTPATH_GL_FUNC();
2619 if (GET_REAL_OBJ(GL_OBJECT_TYPE_PROGRAM, program, &real_obj) != 1)
2621 _set_gl_error(GL_INVALID_VALUE);
2625 _orig_fastpath_glProgramUniformMatrix3fvEXT(real_obj, location, count, transpose, value);
2630 _COREGL_FASTPATH_FUNC_END();
2635 fastpath_glProgramUniformMatrix4fvEXT(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
2639 DEFINE_FASTPAH_GL_FUNC();
2640 _COREGL_FASTPATH_FUNC_BEGIN();
2641 INIT_FASTPATH_GL_FUNC();
2643 if (GET_REAL_OBJ(GL_OBJECT_TYPE_PROGRAM, program, &real_obj) != 1)
2645 _set_gl_error(GL_INVALID_VALUE);
2649 _orig_fastpath_glProgramUniformMatrix4fvEXT(real_obj, location, count, transpose, value);
2654 _COREGL_FASTPATH_FUNC_END();
2659 fastpath_glGetUniformLocation(GLuint program, const char* name)
2661 int ret = _COREGL_INT_INIT_VALUE;
2664 DEFINE_FASTPAH_GL_FUNC();
2665 _COREGL_FASTPATH_FUNC_BEGIN();
2666 INIT_FASTPATH_GL_FUNC();
2668 if (GET_REAL_OBJ(GL_OBJECT_TYPE_PROGRAM, program, &real_obj) != 1)
2670 _set_gl_error(GL_INVALID_VALUE);
2675 ret = _orig_fastpath_glGetUniformLocation(real_obj, name);
2680 _COREGL_FASTPATH_FUNC_END();
2685 fastpath_glDeleteShader(GLuint shader)
2689 DEFINE_FASTPAH_GL_FUNC();
2690 _COREGL_FASTPATH_FUNC_BEGIN();
2691 INIT_FASTPATH_GL_FUNC();
2693 if (GET_REAL_OBJ(GL_OBJECT_TYPE_PROGRAM, shader, &real_obj) != 1)
2695 _set_gl_error(GL_INVALID_VALUE);
2699 _detach_program_object(¤t_ctx->ostate, real_obj, 0, 1);
2704 _COREGL_FASTPATH_FUNC_END();
2708 fastpath_glDeleteProgram(GLuint program)
2712 DEFINE_FASTPAH_GL_FUNC();
2713 _COREGL_FASTPATH_FUNC_BEGIN();
2714 INIT_FASTPATH_GL_FUNC();
2716 if (GET_REAL_OBJ(GL_OBJECT_TYPE_PROGRAM, program, &real_obj) != 1)
2718 _set_gl_error(GL_INVALID_VALUE);
2722 _detach_program_object(¤t_ctx->ostate, real_obj, 1, 1);
2727 _COREGL_FASTPATH_FUNC_END();
2732 //////////////////////////////////////////////////////////////////////////////////
2735 fastpath_glBlendColor(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha)
2737 DEFINE_FASTPAH_GL_FUNC();
2738 _COREGL_FASTPATH_FUNC_BEGIN();
2739 INIT_FASTPATH_GL_FUNC();
2741 if ((current_ctx->gl_blend_color[0] != red) ||
2742 (current_ctx->gl_blend_color[1] != green) ||
2743 (current_ctx->gl_blend_color[2] != blue) ||
2744 (current_ctx->gl_blend_color[3] != alpha))
2746 IF_GL_SUCCESS(_orig_fastpath_glBlendColor(red, green, blue, alpha))
2748 current_ctx->_blend_flag |= _BLEND_FLAG_BIT_gl_blend_color;
2749 current_ctx->gl_blend_color[0] = red;
2750 current_ctx->gl_blend_color[1] = green;
2751 current_ctx->gl_blend_color[2] = blue;
2752 current_ctx->gl_blend_color[3] = alpha;
2758 _COREGL_FASTPATH_FUNC_END();
2763 fastpath_glBlendEquation(GLenum mode)
2765 DEFINE_FASTPAH_GL_FUNC();
2766 _COREGL_FASTPATH_FUNC_BEGIN();
2767 INIT_FASTPATH_GL_FUNC();
2769 IF_GL_SUCCESS(_orig_fastpath_glBlendEquation(mode))
2771 current_ctx->_blend_flag |=
2772 _BLEND_FLAG_BIT_gl_blend_equation_rgb |
2773 _BLEND_FLAG_BIT_gl_blend_equation_alpha;
2775 _orig_fastpath_glGetIntegerv(GL_BLEND_EQUATION_RGB, (GLint*) & (current_ctx->gl_blend_equation_rgb));
2776 _orig_fastpath_glGetIntegerv(GL_BLEND_EQUATION_ALPHA, (GLint*) & (current_ctx->gl_blend_equation_alpha));
2781 _COREGL_FASTPATH_FUNC_END();
2786 fastpath_glBlendEquationSeparate(GLenum modeRGB, GLenum modeAlpha)
2788 DEFINE_FASTPAH_GL_FUNC();
2789 _COREGL_FASTPATH_FUNC_BEGIN();
2790 INIT_FASTPATH_GL_FUNC();
2792 if ((current_ctx->gl_blend_equation_rgb[0] != modeRGB) ||
2793 (current_ctx->gl_blend_equation_alpha[0] != modeAlpha))
2795 IF_GL_SUCCESS(_orig_fastpath_glBlendEquationSeparate(modeRGB, modeAlpha))
2797 current_ctx->_blend_flag |=
2798 _BLEND_FLAG_BIT_gl_blend_equation_rgb |
2799 _BLEND_FLAG_BIT_gl_blend_equation_alpha;
2801 current_ctx->gl_blend_equation_rgb[0] = modeRGB;
2802 current_ctx->gl_blend_equation_alpha[0] = modeAlpha;
2808 _COREGL_FASTPATH_FUNC_END();
2813 fastpath_glBlendFunc(GLenum sfactor, GLenum dfactor)
2815 DEFINE_FASTPAH_GL_FUNC();
2816 _COREGL_FASTPATH_FUNC_BEGIN();
2817 INIT_FASTPATH_GL_FUNC();
2819 IF_GL_SUCCESS(_orig_fastpath_glBlendFunc(sfactor, dfactor))
2821 current_ctx->_blend_flag |=
2822 _BLEND_FLAG_BIT_gl_blend_src_rgb |
2823 _BLEND_FLAG_BIT_gl_blend_src_alpha |
2824 _BLEND_FLAG_BIT_gl_blend_dst_rgb |
2825 _BLEND_FLAG_BIT_gl_blend_dst_alpha;
2827 _orig_fastpath_glGetIntegerv(GL_BLEND_SRC_RGB, (GLint*) & (current_ctx->gl_blend_src_rgb));
2828 _orig_fastpath_glGetIntegerv(GL_BLEND_SRC_ALPHA, (GLint*) & (current_ctx->gl_blend_src_alpha));
2829 _orig_fastpath_glGetIntegerv(GL_BLEND_DST_RGB, (GLint*) & (current_ctx->gl_blend_dst_rgb));
2830 _orig_fastpath_glGetIntegerv(GL_BLEND_DST_ALPHA, (GLint*) & (current_ctx->gl_blend_dst_alpha));
2835 _COREGL_FASTPATH_FUNC_END();
2840 fastpath_glBlendFuncSeparate(GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha)
2842 DEFINE_FASTPAH_GL_FUNC();
2843 _COREGL_FASTPATH_FUNC_BEGIN();
2844 INIT_FASTPATH_GL_FUNC();
2846 if ((current_ctx->gl_blend_src_rgb[0] != srcRGB) ||
2847 (current_ctx->gl_blend_dst_rgb[0] != dstRGB) ||
2848 (current_ctx->gl_blend_src_alpha[0] != srcAlpha) ||
2849 (current_ctx->gl_blend_dst_alpha[0] != dstAlpha))
2851 IF_GL_SUCCESS(_orig_fastpath_glBlendFuncSeparate(srcRGB, dstRGB, srcAlpha, dstAlpha))
2853 current_ctx->_blend_flag |=
2854 _BLEND_FLAG_BIT_gl_blend_src_rgb |
2855 _BLEND_FLAG_BIT_gl_blend_src_alpha |
2856 _BLEND_FLAG_BIT_gl_blend_dst_rgb |
2857 _BLEND_FLAG_BIT_gl_blend_dst_alpha;
2859 current_ctx->gl_blend_src_rgb[0] = srcRGB;
2860 current_ctx->gl_blend_dst_rgb[0] = dstRGB;
2861 current_ctx->gl_blend_src_alpha[0] = srcAlpha;
2862 current_ctx->gl_blend_dst_alpha[0] = dstAlpha;
2868 _COREGL_FASTPATH_FUNC_END();
2873 fastpath_glClearColor(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha)
2875 DEFINE_FASTPAH_GL_FUNC();
2876 _COREGL_FASTPATH_FUNC_BEGIN();
2877 INIT_FASTPATH_GL_FUNC();
2879 if ((current_ctx->gl_color_clear_value[0] != red) ||
2880 (current_ctx->gl_color_clear_value[1] != green) ||
2881 (current_ctx->gl_color_clear_value[2] != blue) ||
2882 (current_ctx->gl_color_clear_value[3] != alpha))
2884 IF_GL_SUCCESS(_orig_fastpath_glClearColor(red, green, blue, alpha))
2886 current_ctx->_clear_flag1 |= _CLEAR_FLAG1_BIT_gl_color_clear_value;
2887 current_ctx->gl_color_clear_value[0] = red;
2888 current_ctx->gl_color_clear_value[1] = green;
2889 current_ctx->gl_color_clear_value[2] = blue;
2890 current_ctx->gl_color_clear_value[3] = alpha;
2896 _COREGL_FASTPATH_FUNC_END();
2901 fastpath_glClearDepthf(GLclampf depth)
2903 DEFINE_FASTPAH_GL_FUNC();
2904 _COREGL_FASTPATH_FUNC_BEGIN();
2905 INIT_FASTPATH_GL_FUNC();
2907 CURR_STATE_COMPARE(gl_depth_clear_value, depth)
2909 IF_GL_SUCCESS(_orig_fastpath_glClearDepthf(depth))
2911 current_ctx->_clear_flag2 |= _CLEAR_FLAG2_BIT_gl_depth_clear_value;
2912 current_ctx->gl_depth_clear_value[0] = depth;
2918 _COREGL_FASTPATH_FUNC_END();
2923 fastpath_glClearStencil(GLint s)
2925 DEFINE_FASTPAH_GL_FUNC();
2926 _COREGL_FASTPATH_FUNC_BEGIN();
2927 INIT_FASTPATH_GL_FUNC();
2929 CURR_STATE_COMPARE(gl_stencil_clear_value, s)
2931 IF_GL_SUCCESS(_orig_fastpath_glClearStencil(s))
2933 current_ctx->_stencil_flag2 |= _STENCIL_FLAG2_BIT_gl_stencil_clear_value;
2934 current_ctx->gl_stencil_clear_value[0] = s;
2940 _COREGL_FASTPATH_FUNC_END();
2945 fastpath_glColorMask(GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha)
2947 DEFINE_FASTPAH_GL_FUNC();
2948 _COREGL_FASTPATH_FUNC_BEGIN();
2949 INIT_FASTPATH_GL_FUNC();
2951 if ((current_ctx->gl_color_writemask[0] != red) ||
2952 (current_ctx->gl_color_writemask[1] != green) ||
2953 (current_ctx->gl_color_writemask[2] != blue) ||
2954 (current_ctx->gl_color_writemask[3] != alpha))
2956 IF_GL_SUCCESS(_orig_fastpath_glColorMask(red, green, blue, alpha))
2958 current_ctx->_clear_flag2 |= _CLEAR_FLAG2_BIT_gl_color_writemask;
2959 current_ctx->gl_color_writemask[0] = red;
2960 current_ctx->gl_color_writemask[1] = green;
2961 current_ctx->gl_color_writemask[2] = blue;
2962 current_ctx->gl_color_writemask[3] = alpha;
2968 _COREGL_FASTPATH_FUNC_END();
2973 fastpath_glCullFace(GLenum mode)
2975 DEFINE_FASTPAH_GL_FUNC();
2976 _COREGL_FASTPATH_FUNC_BEGIN();
2977 INIT_FASTPATH_GL_FUNC();
2979 CURR_STATE_COMPARE(gl_cull_face_mode, mode)
2981 IF_GL_SUCCESS(_orig_fastpath_glCullFace(mode))
2983 current_ctx->_clear_flag2 |= _CLEAR_FLAG2_BIT_gl_cull_face_mode;
2984 current_ctx->gl_cull_face_mode[0] = mode;
2990 _COREGL_FASTPATH_FUNC_END();
2995 fastpath_glDepthFunc(GLenum func)
2997 DEFINE_FASTPAH_GL_FUNC();
2998 _COREGL_FASTPATH_FUNC_BEGIN();
2999 INIT_FASTPATH_GL_FUNC();
3001 CURR_STATE_COMPARE(gl_depth_func, func)
3003 IF_GL_SUCCESS(_orig_fastpath_glDepthFunc(func))
3005 current_ctx->_clear_flag2 |= _CLEAR_FLAG2_BIT_gl_depth_func;
3006 current_ctx->gl_depth_func[0] = func;
3012 _COREGL_FASTPATH_FUNC_END();
3017 fastpath_glDepthMask(GLboolean flag)
3019 DEFINE_FASTPAH_GL_FUNC();
3020 _COREGL_FASTPATH_FUNC_BEGIN();
3021 INIT_FASTPATH_GL_FUNC();
3023 CURR_STATE_COMPARE(gl_depth_writemask, flag)
3025 IF_GL_SUCCESS(_orig_fastpath_glDepthMask(flag))
3027 current_ctx->_clear_flag2 |= _CLEAR_FLAG2_BIT_gl_depth_writemask;
3028 current_ctx->gl_depth_writemask[0] = flag;
3034 _COREGL_FASTPATH_FUNC_END();
3039 fastpath_glDepthRangef(GLclampf zNear, GLclampf zFar)
3041 DEFINE_FASTPAH_GL_FUNC();
3042 _COREGL_FASTPATH_FUNC_BEGIN();
3043 INIT_FASTPATH_GL_FUNC();
3045 if ((current_ctx->gl_depth_range[0] != zNear) ||
3046 (current_ctx->gl_depth_range[1] != zFar))
3048 IF_GL_SUCCESS(_orig_fastpath_glDepthRangef(zNear, zFar))
3050 current_ctx->_clear_flag2 |= _CLEAR_FLAG2_BIT_gl_depth_range;
3051 current_ctx->gl_depth_range[0] = zNear;
3052 current_ctx->gl_depth_range[1] = zFar;
3058 _COREGL_FASTPATH_FUNC_END();
3063 fastpath_glDisable(GLenum cap)
3065 DEFINE_FASTPAH_GL_FUNC();
3066 _COREGL_FASTPATH_FUNC_BEGIN();
3067 INIT_FASTPATH_GL_FUNC();
3069 #define STATE_PROC(gl_state, flagid, flagbit) \
3070 CURR_STATE_COMPARE(gl_state, GL_FALSE) \
3072 _orig_fastpath_glDisable(cap); \
3073 current_ctx->flagid &= (~flagbit##_##gl_state); \
3074 current_ctx->gl_state[0] = GL_FALSE; \
3081 STATE_PROC(gl_blend, _enable_flag1, _ENABLE_FLAG1_BIT);
3084 STATE_PROC(gl_cull_face, _enable_flag1, _ENABLE_FLAG1_BIT);
3087 STATE_PROC(gl_depth_test, _enable_flag1, _ENABLE_FLAG1_BIT);
3090 STATE_PROC(gl_dither, _enable_flag1, _ENABLE_FLAG1_BIT);
3092 case GL_POLYGON_OFFSET_FILL:
3093 STATE_PROC(gl_polygon_offset_fill, _enable_flag2, _ENABLE_FLAG2_BIT);
3095 case GL_PRIMITIVE_RESTART_FIXED_INDEX:
3096 STATE_PROC_WITH_CHECK(gl_primitive_restart_fixed_index, _enable_flag3, _ENABLE_FLAG3_BIT);
3098 case GL_RASTERIZER_DISCARD:
3099 STATE_PROC_WITH_CHECK(gl_rasterizer_discard, _enable_flag3, _ENABLE_FLAG3_BIT);
3101 case GL_SAMPLE_ALPHA_TO_COVERAGE:
3102 STATE_PROC(gl_sample_alpha_to_coverage, _enable_flag2, _ENABLE_FLAG2_BIT);
3104 case GL_SAMPLE_COVERAGE:
3105 STATE_PROC(gl_sample_coverage, _enable_flag2, _ENABLE_FLAG2_BIT);
3107 case GL_SCISSOR_TEST:
3108 STATE_PROC(gl_scissor_test, _enable_flag2, _ENABLE_FLAG2_BIT);
3110 case GL_STENCIL_TEST:
3111 STATE_PROC(gl_stencil_test, _enable_flag2, _ENABLE_FLAG2_BIT);
3114 _set_gl_error(GL_INVALID_ENUM);
3125 _COREGL_FASTPATH_FUNC_END();
3130 fastpath_glDisableVertexAttribArray(GLuint index)
3132 DEFINE_FASTPAH_GL_FUNC();
3133 _COREGL_FASTPATH_FUNC_BEGIN();
3134 INIT_FASTPATH_GL_FUNC();
3136 IF_GL_SUCCESS(_orig_fastpath_glDisableVertexAttribArray(index))
3138 if (current_ctx->gl_vertex_array_binding[0] == 0)
3140 current_ctx->_vattrib_flag |= _VATTRIB_FLAG_BIT_gl_vertex_array;
3141 current_ctx->gl_vertex_array_enabled[index] = GL_FALSE;
3148 _COREGL_FASTPATH_FUNC_END();
3152 fastpath_glEnable(GLenum cap)
3154 DEFINE_FASTPAH_GL_FUNC();
3155 _COREGL_FASTPATH_FUNC_BEGIN();
3156 INIT_FASTPATH_GL_FUNC();
3158 #define STATE_PROC(gl_state, flagid, flagbit) \
3159 CURR_STATE_COMPARE(gl_state, GL_TRUE) \
3161 _orig_fastpath_glEnable(cap); \
3162 current_ctx->flagid |= flagbit##_##gl_state; \
3163 current_ctx->gl_state[0] = GL_TRUE; \
3170 STATE_PROC(gl_blend, _enable_flag1, _ENABLE_FLAG1_BIT);
3173 STATE_PROC(gl_cull_face, _enable_flag1, _ENABLE_FLAG1_BIT);
3176 STATE_PROC(gl_depth_test, _enable_flag1, _ENABLE_FLAG1_BIT);
3179 STATE_PROC(gl_dither, _enable_flag1, _ENABLE_FLAG1_BIT);
3181 case GL_POLYGON_OFFSET_FILL:
3182 STATE_PROC(gl_polygon_offset_fill, _enable_flag2, _ENABLE_FLAG2_BIT);
3184 case GL_PRIMITIVE_RESTART_FIXED_INDEX:
3185 STATE_PROC_WITH_CHECK(gl_primitive_restart_fixed_index, _enable_flag3, _ENABLE_FLAG3_BIT);
3187 case GL_RASTERIZER_DISCARD:
3188 STATE_PROC_WITH_CHECK(gl_rasterizer_discard, _enable_flag3, _ENABLE_FLAG3_BIT);
3190 case GL_SAMPLE_ALPHA_TO_COVERAGE:
3191 STATE_PROC(gl_sample_alpha_to_coverage, _enable_flag2, _ENABLE_FLAG2_BIT);
3193 case GL_SAMPLE_COVERAGE:
3194 STATE_PROC(gl_sample_coverage, _enable_flag2, _ENABLE_FLAG2_BIT);
3196 case GL_SCISSOR_TEST:
3197 STATE_PROC(gl_scissor_test, _enable_flag2, _ENABLE_FLAG2_BIT);
3199 case GL_STENCIL_TEST:
3200 STATE_PROC(gl_stencil_test, _enable_flag2, _ENABLE_FLAG2_BIT);
3203 _set_gl_error(GL_INVALID_ENUM);
3212 _COREGL_FASTPATH_FUNC_END();
3217 fastpath_glEnableVertexAttribArray(GLuint index)
3219 DEFINE_FASTPAH_GL_FUNC();
3220 _COREGL_FASTPATH_FUNC_BEGIN();
3221 INIT_FASTPATH_GL_FUNC();
3223 IF_GL_SUCCESS(_orig_fastpath_glEnableVertexAttribArray(index))
3225 if (current_ctx->gl_vertex_array_binding[0] == 0)
3227 current_ctx->_vattrib_flag |= _VATTRIB_FLAG_BIT_gl_vertex_array;
3228 current_ctx->gl_vertex_array_enabled[index] = GL_TRUE;
3235 _COREGL_FASTPATH_FUNC_END();
3240 fastpath_glFrontFace(GLenum mode)
3242 DEFINE_FASTPAH_GL_FUNC();
3243 _COREGL_FASTPATH_FUNC_BEGIN();
3244 INIT_FASTPATH_GL_FUNC();
3246 CURR_STATE_COMPARE(gl_front_face, mode)
3248 IF_GL_SUCCESS(_orig_fastpath_glFrontFace(mode))
3250 current_ctx->_misc_flag1 |= _MISC_FLAG1_BIT_gl_front_face;
3251 current_ctx->gl_front_face[0] = mode;
3257 _COREGL_FASTPATH_FUNC_END();
3261 fastpath_glHint(GLenum target, GLenum mode)
3263 DEFINE_FASTPAH_GL_FUNC();
3264 _COREGL_FASTPATH_FUNC_BEGIN();
3265 INIT_FASTPATH_GL_FUNC();
3268 #define STATE_PROC(gl_state, flagid, flagbit) \
3269 CURR_STATE_COMPARE(gl_state, mode) \
3271 IF_GL_SUCCESS(_orig_fastpath_glHint(target, mode)) \
3273 current_ctx->flagid |= flagbit##_##gl_state; \
3274 current_ctx->gl_state[0] = mode; \
3281 case GL_FRAGMENT_SHADER_DERIVATIVE_HINT:
3282 STATE_PROC_WITH_CHECK(gl_fragment_shader_derivative_hint, _misc_flag1, _MISC_FLAG1_BIT);
3284 case GL_GENERATE_MIPMAP_HINT:
3285 STATE_PROC(gl_generate_mipmap_hint, _tex_flag1, _TEX_FLAG1_BIT);
3288 _set_gl_error(GL_INVALID_ENUM);
3297 _COREGL_FASTPATH_FUNC_END();
3302 fastpath_glLineWidth(GLfloat width)
3304 DEFINE_FASTPAH_GL_FUNC();
3305 _COREGL_FASTPATH_FUNC_BEGIN();
3306 INIT_FASTPATH_GL_FUNC();
3308 CURR_STATE_COMPARE(gl_line_width, width)
3310 IF_GL_SUCCESS(_orig_fastpath_glLineWidth(width))
3312 current_ctx->_misc_flag1 |= _MISC_FLAG1_BIT_gl_line_width;
3313 current_ctx->gl_line_width[0] = width;
3319 _COREGL_FASTPATH_FUNC_END();
3324 fastpath_glPixelStorei(GLenum pname, GLint param)
3326 DEFINE_FASTPAH_GL_FUNC();
3327 _COREGL_FASTPATH_FUNC_BEGIN();
3328 INIT_FASTPATH_GL_FUNC();
3330 #define STATE_PROC(gl_state, flagid, flagbit) \
3331 CURR_STATE_COMPARE(gl_state, param) \
3333 IF_GL_SUCCESS(_orig_fastpath_glPixelStorei(pname, param)) \
3335 current_ctx->flagid |= flagbit##_##gl_state; \
3336 current_ctx->gl_state[0] = param; \
3343 case GL_PACK_ROW_LENGTH:
3344 STATE_PROC_WITH_CHECK(gl_pack_row_length, _pixel_flag1, _PIXEL_FLAG1_BIT);
3346 case GL_PACK_SKIP_PIXELS:
3347 STATE_PROC_WITH_CHECK(gl_pack_skip_pixels, _pixel_flag1, _PIXEL_FLAG1_BIT);
3349 case GL_PACK_SKIP_ROWS:
3350 STATE_PROC_WITH_CHECK(gl_pack_skip_rows, _pixel_flag1, _PIXEL_FLAG1_BIT);
3352 case GL_PACK_ALIGNMENT:
3353 STATE_PROC(gl_pack_alignment, _pixel_flag1, _PIXEL_FLAG1_BIT);
3355 case GL_UNPACK_ROW_LENGTH:
3356 STATE_PROC_WITH_CHECK(gl_unpack_row_length, _pixel_flag2, _PIXEL_FLAG2_BIT);
3358 case GL_UNPACK_IMAGE_HEIGHT:
3359 STATE_PROC_WITH_CHECK(gl_unpack_image_height, _pixel_flag2, _PIXEL_FLAG2_BIT);
3361 case GL_UNPACK_SKIP_PIXELS:
3362 STATE_PROC_WITH_CHECK(gl_unpack_skip_pixels, _pixel_flag2, _PIXEL_FLAG2_BIT);
3364 case GL_UNPACK_SKIP_IMAGES:
3365 STATE_PROC_WITH_CHECK(gl_unpack_skip_images, _pixel_flag2, _PIXEL_FLAG2_BIT);
3367 case GL_UNPACK_ALIGNMENT:
3368 STATE_PROC(gl_unpack_alignment, _pixel_flag2, _PIXEL_FLAG2_BIT);
3371 _set_gl_error(GL_INVALID_ENUM);
3381 _COREGL_FASTPATH_FUNC_END();
3386 fastpath_glPolygonOffset(GLfloat factor, GLfloat units)
3388 DEFINE_FASTPAH_GL_FUNC();
3389 _COREGL_FASTPATH_FUNC_BEGIN();
3390 INIT_FASTPATH_GL_FUNC();
3392 if ((current_ctx->gl_polygon_offset_factor[0] != factor) ||
3393 (current_ctx->gl_polygon_offset_units[0] != units))
3395 IF_GL_SUCCESS(_orig_fastpath_glPolygonOffset(factor, units))
3397 current_ctx->_misc_flag1 |=
3398 _MISC_FLAG1_BIT_gl_polygon_offset_factor |
3399 _MISC_FLAG1_BIT_gl_polygon_offset_units;
3401 current_ctx->gl_polygon_offset_factor[0] = factor;
3402 current_ctx->gl_polygon_offset_units[0] = units;
3408 _COREGL_FASTPATH_FUNC_END();
3413 fastpath_glSampleCoverage(GLclampf value, GLboolean invert)
3415 DEFINE_FASTPAH_GL_FUNC();
3416 _COREGL_FASTPATH_FUNC_BEGIN();
3417 INIT_FASTPATH_GL_FUNC();
3419 if ((current_ctx->gl_sample_coverage_value[0] != value) ||
3420 (current_ctx->gl_sample_coverage_invert[0] != invert))
3422 IF_GL_SUCCESS(_orig_fastpath_glSampleCoverage(value, invert))
3424 current_ctx->_misc_flag1 |=
3425 _MISC_FLAG1_BIT_gl_sample_coverage_value |
3426 _MISC_FLAG1_BIT_gl_sample_coverage_invert;
3428 current_ctx->gl_sample_coverage_value[0] = value;
3429 current_ctx->gl_sample_coverage_invert[0] = invert;
3435 _COREGL_FASTPATH_FUNC_END();
3440 fastpath_glScissor(GLint x, GLint y, GLsizei width, GLsizei height)
3442 DEFINE_FASTPAH_GL_FUNC();
3443 _COREGL_FASTPATH_FUNC_BEGIN();
3444 INIT_FASTPATH_GL_FUNC();
3446 if ((current_ctx->gl_scissor_box[0] != x) ||
3447 (current_ctx->gl_scissor_box[1] != y) ||
3448 (current_ctx->gl_scissor_box[2] != width) ||
3449 (current_ctx->gl_scissor_box[3] != height))
3451 IF_GL_SUCCESS(_orig_fastpath_glScissor(x, y, width, height))
3453 current_ctx->_misc_flag2 |= _MISC_FLAG2_BIT_gl_scissor_box;
3454 current_ctx->gl_scissor_box[0] = x;
3455 current_ctx->gl_scissor_box[1] = y;
3456 current_ctx->gl_scissor_box[2] = width;
3457 current_ctx->gl_scissor_box[3] = height;
3463 _COREGL_FASTPATH_FUNC_END();
3468 fastpath_glStencilFunc(GLenum func, GLint ref, GLuint mask)
3470 DEFINE_FASTPAH_GL_FUNC();
3471 _COREGL_FASTPATH_FUNC_BEGIN();
3472 INIT_FASTPATH_GL_FUNC();
3474 if ((current_ctx->gl_stencil_func[0] != func) ||
3475 (current_ctx->gl_stencil_ref[0] != ref) ||
3476 (current_ctx->gl_stencil_value_mask[0] != mask) ||
3477 (current_ctx->gl_stencil_back_func[0] != func) ||
3478 (current_ctx->gl_stencil_back_ref[0] != ref) ||
3479 (current_ctx->gl_stencil_back_value_mask[0] != mask))
3481 IF_GL_SUCCESS(_orig_fastpath_glStencilFunc(func, ref, mask))
3483 current_ctx->_stencil_flag1 |=
3484 _STENCIL_FLAG1_BIT_gl_stencil_func |
3485 _STENCIL_FLAG1_BIT_gl_stencil_ref |
3486 _STENCIL_FLAG1_BIT_gl_stencil_value_mask;
3488 current_ctx->gl_stencil_func[0] = func;
3489 current_ctx->gl_stencil_ref[0] = ref;
3490 current_ctx->gl_stencil_value_mask[0] = mask;
3492 current_ctx->_stencil_flag2 |=
3493 _STENCIL_FLAG2_BIT_gl_stencil_back_func |
3494 _STENCIL_FLAG2_BIT_gl_stencil_back_ref |
3495 _STENCIL_FLAG2_BIT_gl_stencil_back_value_mask;
3497 current_ctx->gl_stencil_back_func[0] = func;
3498 current_ctx->gl_stencil_back_ref[0] = ref;
3499 current_ctx->gl_stencil_back_value_mask[0] = mask;
3505 _COREGL_FASTPATH_FUNC_END();
3510 fastpath_glStencilFuncSeparate(GLenum face, GLenum func, GLint ref, GLuint mask)
3512 DEFINE_FASTPAH_GL_FUNC();
3513 _COREGL_FASTPATH_FUNC_BEGIN();
3514 INIT_FASTPATH_GL_FUNC();
3516 if ((face == GL_FRONT) || (face == GL_FRONT_AND_BACK))
3518 if ((current_ctx->gl_stencil_func[0] != func) ||
3519 (current_ctx->gl_stencil_ref[0] != ref) ||
3520 (current_ctx->gl_stencil_value_mask[0] != mask))
3522 IF_GL_SUCCESS(_orig_fastpath_glStencilFuncSeparate(face, func, ref, mask))
3524 current_ctx->_stencil_flag1 |=
3525 _STENCIL_FLAG1_BIT_gl_stencil_func |
3526 _STENCIL_FLAG1_BIT_gl_stencil_ref |
3527 _STENCIL_FLAG1_BIT_gl_stencil_value_mask;
3529 current_ctx->gl_stencil_func[0] = func;
3530 current_ctx->gl_stencil_ref[0] = ref;
3531 current_ctx->gl_stencil_value_mask[0] = mask;
3535 else if ((face == GL_BACK) || (face == GL_FRONT_AND_BACK))
3537 if ((current_ctx->gl_stencil_back_func[0] != func) ||
3538 (current_ctx->gl_stencil_back_ref[0] != ref) ||
3539 (current_ctx->gl_stencil_back_value_mask[0] != mask))
3541 IF_GL_SUCCESS(_orig_fastpath_glStencilFuncSeparate(face, func, ref, mask))
3543 current_ctx->_stencil_flag2 |=
3544 _STENCIL_FLAG2_BIT_gl_stencil_back_func |
3545 _STENCIL_FLAG2_BIT_gl_stencil_back_ref |
3546 _STENCIL_FLAG2_BIT_gl_stencil_back_value_mask;
3548 current_ctx->gl_stencil_back_func[0] = func;
3549 current_ctx->gl_stencil_back_ref[0] = ref;
3550 current_ctx->gl_stencil_back_value_mask[0] = mask;
3556 _set_gl_error(GL_INVALID_ENUM);
3562 _COREGL_FASTPATH_FUNC_END();
3567 fastpath_glStencilMask(GLuint mask)
3569 DEFINE_FASTPAH_GL_FUNC();
3570 _COREGL_FASTPATH_FUNC_BEGIN();
3571 INIT_FASTPATH_GL_FUNC();
3573 if ((current_ctx->gl_stencil_writemask[0] != mask) ||
3574 (current_ctx->gl_stencil_back_writemask[0] != mask))
3576 IF_GL_SUCCESS(_orig_fastpath_glStencilMask(mask))
3578 current_ctx->_stencil_flag1 |= _STENCIL_FLAG1_BIT_gl_stencil_writemask;
3579 current_ctx->_stencil_flag2 |= _STENCIL_FLAG2_BIT_gl_stencil_back_writemask;
3581 current_ctx->gl_stencil_writemask[0] = mask;
3582 current_ctx->gl_stencil_back_writemask[0] = mask;
3588 _COREGL_FASTPATH_FUNC_END();
3593 fastpath_glStencilMaskSeparate(GLenum face, GLuint mask)
3595 DEFINE_FASTPAH_GL_FUNC();
3596 _COREGL_FASTPATH_FUNC_BEGIN();
3597 INIT_FASTPATH_GL_FUNC();
3599 if ((face == GL_FRONT) || (face == GL_FRONT_AND_BACK))
3601 if (current_ctx->gl_stencil_writemask[0] != mask)
3603 IF_GL_SUCCESS(_orig_fastpath_glStencilMaskSeparate(face, mask))
3605 current_ctx->_stencil_flag1 |= _STENCIL_FLAG1_BIT_gl_stencil_writemask;
3606 current_ctx->gl_stencil_writemask[0] = mask;
3610 else if ((face == GL_BACK) || (face == GL_FRONT_AND_BACK))
3612 if (current_ctx->gl_stencil_back_writemask[0] != mask)
3614 IF_GL_SUCCESS(_orig_fastpath_glStencilMaskSeparate(face, mask))
3616 current_ctx->_stencil_flag2 |= _STENCIL_FLAG2_BIT_gl_stencil_back_writemask;
3617 current_ctx->gl_stencil_back_writemask[0] = mask;
3623 _set_gl_error(GL_INVALID_ENUM);
3629 _COREGL_FASTPATH_FUNC_END();
3634 fastpath_glStencilOp(GLenum fail, GLenum zfail, GLenum zpass)
3636 DEFINE_FASTPAH_GL_FUNC();
3637 _COREGL_FASTPATH_FUNC_BEGIN();
3638 INIT_FASTPATH_GL_FUNC();
3640 if ((current_ctx->gl_stencil_fail[0] != fail) ||
3641 (current_ctx->gl_stencil_pass_depth_fail[0] != zfail) ||
3642 (current_ctx->gl_stencil_pass_depth_pass[0] != zpass) ||
3643 (current_ctx->gl_stencil_back_fail[0] != fail) ||
3644 (current_ctx->gl_stencil_back_pass_depth_fail[0] != zfail) ||
3645 (current_ctx->gl_stencil_back_pass_depth_pass[0] != zpass))
3647 IF_GL_SUCCESS(_orig_fastpath_glStencilOp(fail, zfail, zpass))
3649 current_ctx->_stencil_flag1 |=
3650 _STENCIL_FLAG1_BIT_gl_stencil_fail |
3651 _STENCIL_FLAG1_BIT_gl_stencil_pass_depth_fail |
3652 _STENCIL_FLAG1_BIT_gl_stencil_pass_depth_pass;
3654 current_ctx->gl_stencil_fail[0] = fail;
3655 current_ctx->gl_stencil_pass_depth_fail[0] = zfail;
3656 current_ctx->gl_stencil_pass_depth_pass[0] = zpass;
3658 current_ctx->_stencil_flag2 |=
3659 _STENCIL_FLAG2_BIT_gl_stencil_back_fail |
3660 _STENCIL_FLAG2_BIT_gl_stencil_back_pass_depth_fail |
3661 _STENCIL_FLAG2_BIT_gl_stencil_back_pass_depth_pass;
3663 current_ctx->gl_stencil_back_fail[0] = fail;
3664 current_ctx->gl_stencil_back_pass_depth_fail[0] = zfail;
3665 current_ctx->gl_stencil_back_pass_depth_pass[0] = zpass;
3671 _COREGL_FASTPATH_FUNC_END();
3676 fastpath_glStencilOpSeparate(GLenum face, GLenum fail, GLenum zfail, GLenum zpass)
3678 DEFINE_FASTPAH_GL_FUNC();
3679 _COREGL_FASTPATH_FUNC_BEGIN();
3680 INIT_FASTPATH_GL_FUNC();
3682 if ((face == GL_FRONT) || (face == GL_FRONT_AND_BACK))
3684 if ((current_ctx->gl_stencil_fail[0] != fail) ||
3685 (current_ctx->gl_stencil_pass_depth_fail[0] != zfail) ||
3686 (current_ctx->gl_stencil_pass_depth_pass[0] != zpass))
3688 IF_GL_SUCCESS(_orig_fastpath_glStencilOpSeparate(face, fail, zfail, zpass))
3690 current_ctx->_stencil_flag1 |=
3691 _STENCIL_FLAG1_BIT_gl_stencil_fail |
3692 _STENCIL_FLAG1_BIT_gl_stencil_pass_depth_fail |
3693 _STENCIL_FLAG1_BIT_gl_stencil_pass_depth_pass;
3695 current_ctx->gl_stencil_fail[0] = fail;
3696 current_ctx->gl_stencil_pass_depth_fail[0] = zfail;
3697 current_ctx->gl_stencil_pass_depth_pass[0] = zpass;
3701 else if ((face == GL_BACK) || (face == GL_FRONT_AND_BACK))
3703 if ((current_ctx->gl_stencil_back_fail[0] != fail) ||
3704 (current_ctx->gl_stencil_back_pass_depth_fail[0] != zfail) ||
3705 (current_ctx->gl_stencil_back_pass_depth_pass[0] != zpass))
3707 IF_GL_SUCCESS(_orig_fastpath_glStencilOpSeparate(face, fail, zfail, zpass))
3709 current_ctx->_stencil_flag2 |=
3710 _STENCIL_FLAG2_BIT_gl_stencil_back_fail |
3711 _STENCIL_FLAG2_BIT_gl_stencil_back_pass_depth_fail |
3712 _STENCIL_FLAG2_BIT_gl_stencil_back_pass_depth_pass;
3714 current_ctx->gl_stencil_back_fail[0] = fail;
3715 current_ctx->gl_stencil_back_pass_depth_fail[0] = zfail;
3716 current_ctx->gl_stencil_back_pass_depth_pass[0] = zpass;
3722 _set_gl_error(GL_INVALID_ENUM);
3728 _COREGL_FASTPATH_FUNC_END();
3733 fastpath_glVertexAttrib1f(GLuint index, GLfloat x)
3735 DEFINE_FASTPAH_GL_FUNC();
3736 _COREGL_FASTPATH_FUNC_BEGIN();
3737 INIT_FASTPATH_GL_FUNC();
3739 IF_GL_SUCCESS(_orig_fastpath_glVertexAttrib1f(index, x))
3741 if (current_ctx->gl_vertex_array_binding[0] == 0)
3743 current_ctx->_vattrib_flag |= _VATTRIB_FLAG_BIT_gl_vertex_attrib_value;
3744 current_ctx->gl_vertex_array_size[index] = 0;
3745 current_ctx->gl_vertex_array_integer[index] = GL_FALSE;
3747 current_ctx->gl_vertex_attrib_value[index * 4 + 0] = x;
3748 current_ctx->gl_vertex_attrib_value[index * 4 + 1] = 0;
3749 current_ctx->gl_vertex_attrib_value[index * 4 + 2] = 0;
3750 current_ctx->gl_vertex_attrib_value[index * 4 + 3] = 1;
3756 _COREGL_FASTPATH_FUNC_END();
3761 fastpath_glVertexAttrib1fv(GLuint index, const GLfloat* values)
3763 DEFINE_FASTPAH_GL_FUNC();
3764 _COREGL_FASTPATH_FUNC_BEGIN();
3765 INIT_FASTPATH_GL_FUNC();
3767 IF_GL_SUCCESS(_orig_fastpath_glVertexAttrib1fv(index, values))
3769 if (current_ctx->gl_vertex_array_binding[0] == 0)
3771 current_ctx->_vattrib_flag |= _VATTRIB_FLAG_BIT_gl_vertex_attrib_value;
3772 current_ctx->gl_vertex_array_size[index] = 0;
3773 current_ctx->gl_vertex_array_integer[index] = GL_FALSE;
3775 current_ctx->gl_vertex_attrib_value[index * 4 + 0] = values[0];
3776 current_ctx->gl_vertex_attrib_value[index * 4 + 1] = 0;
3777 current_ctx->gl_vertex_attrib_value[index * 4 + 2] = 0;
3778 current_ctx->gl_vertex_attrib_value[index * 4 + 3] = 1;
3784 _COREGL_FASTPATH_FUNC_END();
3789 fastpath_glVertexAttrib2f(GLuint index, GLfloat x, GLfloat y)
3791 DEFINE_FASTPAH_GL_FUNC();
3792 _COREGL_FASTPATH_FUNC_BEGIN();
3793 INIT_FASTPATH_GL_FUNC();
3795 IF_GL_SUCCESS(_orig_fastpath_glVertexAttrib2f(index, x, y))
3797 if (current_ctx->gl_vertex_array_binding[0] == 0)
3799 current_ctx->_vattrib_flag |= _VATTRIB_FLAG_BIT_gl_vertex_attrib_value;
3800 current_ctx->gl_vertex_array_size[index] = 0;
3801 current_ctx->gl_vertex_array_integer[index] = GL_FALSE;
3803 current_ctx->gl_vertex_attrib_value[index * 4 + 0] = x;
3804 current_ctx->gl_vertex_attrib_value[index * 4 + 1] = y;
3805 current_ctx->gl_vertex_attrib_value[index * 4 + 2] = 0;
3806 current_ctx->gl_vertex_attrib_value[index * 4 + 3] = 1;
3812 _COREGL_FASTPATH_FUNC_END();
3817 fastpath_glVertexAttrib2fv(GLuint index, const GLfloat* values)
3819 DEFINE_FASTPAH_GL_FUNC();
3820 _COREGL_FASTPATH_FUNC_BEGIN();
3821 INIT_FASTPATH_GL_FUNC();
3823 IF_GL_SUCCESS(_orig_fastpath_glVertexAttrib2fv(index, values))
3825 if (current_ctx->gl_vertex_array_binding[0] == 0)
3827 current_ctx->_vattrib_flag |= _VATTRIB_FLAG_BIT_gl_vertex_attrib_value;
3828 current_ctx->gl_vertex_array_size[index] = 0;
3829 current_ctx->gl_vertex_array_integer[index] = GL_FALSE;
3831 current_ctx->gl_vertex_attrib_value[index * 4 + 0] = values[0];
3832 current_ctx->gl_vertex_attrib_value[index * 4 + 1] = values[1];
3833 current_ctx->gl_vertex_attrib_value[index * 4 + 2] = 0;
3834 current_ctx->gl_vertex_attrib_value[index * 4 + 3] = 1;
3840 _COREGL_FASTPATH_FUNC_END();
3845 fastpath_glVertexAttrib3f(GLuint index, GLfloat x, GLfloat y, GLfloat z)
3847 DEFINE_FASTPAH_GL_FUNC();
3848 _COREGL_FASTPATH_FUNC_BEGIN();
3849 INIT_FASTPATH_GL_FUNC();
3851 IF_GL_SUCCESS(_orig_fastpath_glVertexAttrib3f(index, x, y, z))
3853 if (current_ctx->gl_vertex_array_binding[0] == 0)
3855 current_ctx->_vattrib_flag |= _VATTRIB_FLAG_BIT_gl_vertex_attrib_value;
3856 current_ctx->gl_vertex_array_size[index] = 0;
3857 current_ctx->gl_vertex_array_integer[index] = GL_FALSE;
3859 current_ctx->gl_vertex_attrib_value[index * 4 + 0] = x;
3860 current_ctx->gl_vertex_attrib_value[index * 4 + 1] = y;
3861 current_ctx->gl_vertex_attrib_value[index * 4 + 2] = z;
3862 current_ctx->gl_vertex_attrib_value[index * 4 + 3] = 1;
3868 _COREGL_FASTPATH_FUNC_END();
3873 fastpath_glVertexAttrib3fv(GLuint index, const GLfloat* values)
3875 DEFINE_FASTPAH_GL_FUNC();
3876 _COREGL_FASTPATH_FUNC_BEGIN();
3877 INIT_FASTPATH_GL_FUNC();
3879 IF_GL_SUCCESS(_orig_fastpath_glVertexAttrib3fv(index, values))
3881 if (current_ctx->gl_vertex_array_binding[0] == 0)
3883 current_ctx->_vattrib_flag |= _VATTRIB_FLAG_BIT_gl_vertex_attrib_value;
3884 current_ctx->gl_vertex_array_size[index] = 0;
3885 current_ctx->gl_vertex_array_integer[index] = GL_FALSE;
3887 current_ctx->gl_vertex_attrib_value[index * 4 + 0] = values[0];
3888 current_ctx->gl_vertex_attrib_value[index * 4 + 1] = values[1];
3889 current_ctx->gl_vertex_attrib_value[index * 4 + 2] = values[2];
3890 current_ctx->gl_vertex_attrib_value[index * 4 + 3] = 1;
3896 _COREGL_FASTPATH_FUNC_END();
3901 fastpath_glVertexAttrib4f(GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w)
3903 DEFINE_FASTPAH_GL_FUNC();
3904 _COREGL_FASTPATH_FUNC_BEGIN();
3905 INIT_FASTPATH_GL_FUNC();
3907 IF_GL_SUCCESS(_orig_fastpath_glVertexAttrib4f(index, x, y, z, w))
3909 if (current_ctx->gl_vertex_array_binding[0] == 0)
3911 current_ctx->_vattrib_flag |= _VATTRIB_FLAG_BIT_gl_vertex_attrib_value;
3912 current_ctx->gl_vertex_array_size[index] = 0;
3913 current_ctx->gl_vertex_array_integer[index] = GL_FALSE;
3915 current_ctx->gl_vertex_attrib_value[index * 4 + 0] = x;
3916 current_ctx->gl_vertex_attrib_value[index * 4 + 1] = y;
3917 current_ctx->gl_vertex_attrib_value[index * 4 + 2] = z;
3918 current_ctx->gl_vertex_attrib_value[index * 4 + 3] = w;
3924 _COREGL_FASTPATH_FUNC_END();
3929 fastpath_glVertexAttrib4fv(GLuint index, const GLfloat* values)
3931 DEFINE_FASTPAH_GL_FUNC();
3932 _COREGL_FASTPATH_FUNC_BEGIN();
3933 INIT_FASTPATH_GL_FUNC();
3935 IF_GL_SUCCESS(_orig_fastpath_glVertexAttrib4fv(index, values))
3937 if (current_ctx->gl_vertex_array_binding[0] == 0)
3939 current_ctx->_vattrib_flag |= _VATTRIB_FLAG_BIT_gl_vertex_attrib_value;
3940 current_ctx->gl_vertex_array_size[index] = 0;
3941 current_ctx->gl_vertex_array_integer[index] = GL_FALSE;
3943 current_ctx->gl_vertex_attrib_value[index * 4 + 0] = values[0];
3944 current_ctx->gl_vertex_attrib_value[index * 4 + 1] = values[1];
3945 current_ctx->gl_vertex_attrib_value[index * 4 + 2] = values[2];
3946 current_ctx->gl_vertex_attrib_value[index * 4 + 3] = values[3];
3952 _COREGL_FASTPATH_FUNC_END();
3957 fastpath_glVertexAttribPointer(GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const void* pointer)
3959 DEFINE_FASTPAH_GL_FUNC();
3960 _COREGL_FASTPATH_FUNC_BEGIN();
3961 INIT_FASTPATH_GL_FUNC();
3963 IF_GL_SUCCESS(_orig_fastpath_glVertexAttribPointer(index, size, type, normalized, stride, pointer))
3965 if (current_ctx->gl_vertex_array_binding[0] == 0)
3967 current_ctx->_vattrib_flag |= _VATTRIB_FLAG_BIT_gl_vertex_array;
3969 current_ctx->gl_vertex_array_buf_id[index] = current_ctx->gl_array_buffer_binding[0];
3970 current_ctx->gl_vertex_array_size[index] = size;
3971 current_ctx->gl_vertex_array_type[index] = type;
3972 current_ctx->gl_vertex_array_normalized[index] = normalized;
3973 current_ctx->gl_vertex_array_integer[index] = GL_FALSE;
3974 current_ctx->gl_vertex_array_stride[index] = stride;
3975 current_ctx->gl_vertex_array_pointer[index] = (GLvoid *)pointer;
3981 _COREGL_FASTPATH_FUNC_END();
3986 fastpath_glViewport(GLint x, GLint y, GLsizei width, GLsizei height)
3988 DEFINE_FASTPAH_GL_FUNC();
3989 _COREGL_FASTPATH_FUNC_BEGIN();
3990 INIT_FASTPATH_GL_FUNC();
3992 if ((current_ctx->gl_viewport[0] != x) ||
3993 (current_ctx->gl_viewport[1] != y) ||
3994 (current_ctx->gl_viewport[2] != width) ||
3995 (current_ctx->gl_viewport[3] != height))
3997 IF_GL_SUCCESS(_orig_fastpath_glViewport(x, y, width, height))
3999 current_ctx->_clear_flag1 |= _CLEAR_FLAG1_BIT_gl_viewport;
4000 current_ctx->gl_viewport[0] = x;
4001 current_ctx->gl_viewport[1] = y;
4002 current_ctx->gl_viewport[2] = width;
4003 current_ctx->gl_viewport[3] = height;
4010 _COREGL_FASTPATH_FUNC_END();
4013 #define TRANS_VALUE(index, value) \
4017 case GL_INT: if (!is64) ((GLint *)ptr)[index] = value; else ((GLint64 *)ptr)[index] = value; break; \
4018 case GL_FLOAT: ((GLfloat *)ptr)[index] = (GLfloat)value; break; \
4019 case GL_BOOL: ((GLboolean *)ptr)[index] = (value == 0) ? GL_FALSE : GL_TRUE; break; \
4023 #define EXTRACT_VALUE(index, value) \
4027 case GL_INT: if (!is64) value = ((GLint *)ptr)[index]; else value = ((GLint64 *)ptr)[index]; break; \
4028 case GL_FLOAT: value = ((GLfloat *)ptr)[index]; break; \
4029 case GL_BOOL: value = ((GLboolean *)ptr)[index]; break; \
4034 _modify_get_value(GLenum pname, GLvoid *ptr, GLenum get_type, GLboolean is64)
4036 GLboolean ret = GL_FALSE;
4038 DEFINE_FASTPAH_GL_FUNC();
4039 INIT_FASTPATH_GL_FUNC();
4043 case GL_NUM_EXTENSIONS:
4044 _valid_extension_string();
4045 TRANS_VALUE(0, gl_extension_count);
4048 case GL_TEXTURE_BINDING_2D:
4049 case GL_TEXTURE_BINDING_CUBE_MAP:
4050 case GL_ARRAY_BUFFER_BINDING:
4051 case GL_ELEMENT_ARRAY_BUFFER_BINDING:
4052 case GL_COPY_READ_BUFFER_BINDING:
4053 case GL_COPY_WRITE_BUFFER_BINDING:
4054 case GL_PIXEL_PACK_BUFFER_BINDING:
4055 case GL_PIXEL_UNPACK_BUFFER_BINDING:
4056 case GL_TRANSFORM_FEEDBACK_BUFFER_BINDING:
4057 case GL_UNIFORM_BUFFER_BINDING:
4058 case GL_DRAW_FRAMEBUFFER_BINDING:
4059 case GL_READ_FRAMEBUFFER_BINDING:
4060 case GL_RENDERBUFFER_BINDING:
4061 case GL_CURRENT_PROGRAM:
4062 case GL_VERTEX_ARRAY_BINDING:
4063 case GL_SAMPLER_BINDING:
4064 case GL_TRANSFORM_FEEDBACK_BINDING:
4065 case GL_PROGRAM_PIPELINE_BINDING:
4067 GLint real_obj_id = _COREGL_INT_INIT_VALUE;
4068 GLuint glue_obj_id = _COREGL_INT_INIT_VALUE;
4069 GL_Object_Type obj_type = GL_OBJECT_TYPE_UNKNOWN;
4070 EXTRACT_VALUE(0, real_obj_id);
4074 case GL_TEXTURE_BINDING_2D:
4075 case GL_TEXTURE_BINDING_CUBE_MAP:
4076 obj_type = GL_OBJECT_TYPE_TEXTURE;
4078 case GL_ARRAY_BUFFER_BINDING:
4079 case GL_ELEMENT_ARRAY_BUFFER_BINDING:
4080 case GL_COPY_READ_BUFFER_BINDING:
4081 case GL_COPY_WRITE_BUFFER_BINDING:
4082 case GL_PIXEL_PACK_BUFFER_BINDING:
4083 case GL_PIXEL_UNPACK_BUFFER_BINDING:
4084 case GL_TRANSFORM_FEEDBACK_BUFFER_BINDING:
4085 case GL_UNIFORM_BUFFER_BINDING:
4086 obj_type = GL_OBJECT_TYPE_BUFFER;
4088 case GL_DRAW_FRAMEBUFFER_BINDING:
4089 case GL_READ_FRAMEBUFFER_BINDING:
4090 obj_type = GL_OBJECT_TYPE_FRAMEBUFFER;
4092 case GL_RENDERBUFFER_BINDING:
4093 obj_type = GL_OBJECT_TYPE_RENDERBUFFER;
4095 case GL_CURRENT_PROGRAM:
4096 obj_type = GL_OBJECT_TYPE_PROGRAM;
4098 case GL_VERTEX_ARRAY_BINDING:
4099 obj_type = GL_OBJECT_TYPE_VERTEXARRAY;
4101 case GL_SAMPLER_BINDING:
4102 obj_type = GL_OBJECT_TYPE_SAMPLER;
4104 case GL_TRANSFORM_FEEDBACK_BINDING:
4105 obj_type = GL_OBJECT_TYPE_TRANSFORMFEEDBACK;
4107 case GL_PROGRAM_PIPELINE_BINDING:
4108 obj_type = GL_OBJECT_TYPE_PROGRAMPIPELINE;
4110 AST(obj_type != GL_OBJECT_TYPE_UNKNOWN);
4111 AST(GET_GLUE_OBJ(obj_type, real_obj_id, &glue_obj_id) == 1);
4112 TRANS_VALUE(0, glue_obj_id);
4125 fastpath_glGetBooleanv(GLenum pname, GLboolean* params)
4127 DEFINE_FASTPAH_GL_FUNC();
4128 _COREGL_FASTPATH_FUNC_BEGIN();
4129 INIT_FASTPATH_GL_FUNC();
4131 IF_GL_SUCCESS(_orig_fastpath_glGetBooleanv(pname, params))
4133 _modify_get_value(pname, params, GL_BOOL, GL_FALSE);
4138 _COREGL_FASTPATH_FUNC_END();
4142 fastpath_glGetFloatv(GLenum pname, GLfloat* params)
4144 DEFINE_FASTPAH_GL_FUNC();
4145 _COREGL_FASTPATH_FUNC_BEGIN();
4146 INIT_FASTPATH_GL_FUNC();
4148 IF_GL_SUCCESS(_orig_fastpath_glGetFloatv(pname, params))
4150 _modify_get_value(pname, params, GL_FLOAT, GL_FALSE);
4155 _COREGL_FASTPATH_FUNC_END();
4159 fastpath_glGetIntegerv(GLenum pname, GLint* params)
4161 DEFINE_FASTPAH_GL_FUNC();
4162 _COREGL_FASTPATH_FUNC_BEGIN();
4163 INIT_FASTPATH_GL_FUNC();
4165 IF_GL_SUCCESS(_orig_fastpath_glGetIntegerv(pname, params))
4167 _modify_get_value(pname, params, GL_INT, GL_FALSE);
4172 _COREGL_FASTPATH_FUNC_END();
4177 /* ES 3.0 PASS (SUPPORT) */
4179 fastpath_glGetProgramBinary(GLuint program, GLsizei bufsize, GLsizei* length, GLenum* binaryFormat, void* binary)
4183 DEFINE_FASTPAH_GL_FUNC();
4184 _COREGL_FASTPATH_FUNC_BEGIN();
4185 INIT_FASTPATH_GL_FUNC();
4187 if (GET_REAL_OBJ(GL_OBJECT_TYPE_PROGRAM, program, &real_obj) != 1)
4189 _set_gl_error(GL_INVALID_VALUE);
4193 _orig_fastpath_glGetProgramBinary(real_obj, bufsize, length, binaryFormat, binary);
4198 _COREGL_FASTPATH_FUNC_END();
4203 fastpath_glGetProgramBinaryOES(GLuint program, GLsizei bufsize, GLsizei* length, GLenum* binaryFormat, void* binary)
4207 DEFINE_FASTPAH_GL_FUNC();
4208 _COREGL_FASTPATH_FUNC_BEGIN();
4209 INIT_FASTPATH_GL_FUNC();
4211 if (GET_REAL_OBJ(GL_OBJECT_TYPE_PROGRAM, program, &real_obj) != 1)
4213 _set_gl_error(GL_INVALID_VALUE);
4217 _orig_fastpath_glGetProgramBinaryOES(real_obj, bufsize, length, binaryFormat, binary);
4222 _COREGL_FASTPATH_FUNC_END();
4227 fastpath_glProgramBinary(GLuint program, GLenum binaryFormat, const void* binary, GLint length)
4231 DEFINE_FASTPAH_GL_FUNC();
4232 _COREGL_FASTPATH_FUNC_BEGIN();
4233 INIT_FASTPATH_GL_FUNC();
4235 if (GET_REAL_OBJ(GL_OBJECT_TYPE_PROGRAM, program, &real_obj) != 1)
4237 _set_gl_error(GL_INVALID_VALUE);
4241 _orig_fastpath_glProgramBinary(real_obj, binaryFormat, binary, length);
4246 _COREGL_FASTPATH_FUNC_END();
4251 fastpath_glProgramBinaryOES(GLuint program, GLenum binaryFormat, const void* binary, GLint length)
4255 DEFINE_FASTPAH_GL_FUNC();
4256 _COREGL_FASTPATH_FUNC_BEGIN();
4257 INIT_FASTPATH_GL_FUNC();
4259 if (GET_REAL_OBJ(GL_OBJECT_TYPE_PROGRAM, program, &real_obj) != 1)
4261 _set_gl_error(GL_INVALID_VALUE);
4265 _orig_fastpath_glProgramBinaryOES(real_obj, binaryFormat, binary, length);
4270 _COREGL_FASTPATH_FUNC_END();
4275 fastpath_glReadBuffer(GLenum mode)
4277 DEFINE_FASTPAH_GL_FUNC();
4278 _COREGL_FASTPATH_FUNC_BEGIN();
4279 INIT_FASTPATH_GL_FUNC();
4281 CURR_STATE_COMPARE(gl_read_buffer, mode)
4283 IF_GL_SUCCESS(_orig_fastpath_glReadBuffer(mode))
4285 current_ctx->_misc_flag3 |= _MISC_FLAG3_BIT_gl_read_buffer;
4286 current_ctx->gl_read_buffer[0] = mode;
4293 _COREGL_FASTPATH_FUNC_END();
4298 fastpath_glGenQueries(GLsizei n, GLuint* ids)
4301 GLuint *objid_array = NULL;
4303 DEFINE_FASTPAH_GL_FUNC();
4304 _COREGL_FASTPATH_FUNC_BEGIN();
4305 INIT_FASTPATH_GL_FUNC();
4309 _set_gl_error(GL_INVALID_VALUE);
4312 if (n == 0) goto finish;
4313 if (ids == NULL) goto finish;
4315 AST(current_ctx->ostate.shared != NULL);
4317 objid_array = (GLuint *)calloc(1, sizeof(GLuint) * n);
4319 IF_GL_SUCCESS(_orig_fastpath_glGenQueries(n, objid_array))
4321 for (i = 0; i < n; i++)
4323 ids[i] = fastpath_ostate_create_object(¤t_ctx->ostate, GL_OBJECT_TYPE_QUERY, objid_array[i]);
4330 if (objid_array != NULL)
4335 _COREGL_FASTPATH_FUNC_END();
4340 fastpath_glDeleteQueries(GLsizei n, const GLuint* ids)
4343 GLuint *objid_array = NULL;
4345 DEFINE_FASTPAH_GL_FUNC();
4346 _COREGL_FASTPATH_FUNC_BEGIN();
4347 INIT_FASTPATH_GL_FUNC();
4351 _set_gl_error(GL_INVALID_VALUE);
4354 if (n == 0) goto finish;
4355 if (ids == NULL) goto finish;
4357 AST(current_ctx->ostate.shared != NULL);
4359 objid_array = (GLuint *)calloc(1, sizeof(GLuint) * n);
4363 for (i = 0; i < n; i++)
4365 int real_objid = _COREGL_INT_INIT_VALUE;
4366 if (ids[i] == 0) continue;
4368 real_objid = fastpath_ostate_get_object(¤t_ctx->ostate, GL_OBJECT_TYPE_QUERY, ids[i]);
4369 if (real_objid == 0) continue;
4371 AST(fastpath_ostate_remove_object(¤t_ctx->ostate, GL_OBJECT_TYPE_QUERY, ids[i]) == 1);
4372 objid_array[real_n++] = real_objid;
4375 _orig_fastpath_glDeleteQueries(real_n, objid_array);
4381 if (objid_array != NULL)
4386 _COREGL_FASTPATH_FUNC_END();
4391 fastpath_glIsQuery(GLuint id)
4393 GLboolean ret = GL_FALSE;
4396 DEFINE_FASTPAH_GL_FUNC();
4397 _COREGL_FASTPATH_FUNC_BEGIN();
4398 INIT_FASTPATH_GL_FUNC();
4400 if (GET_REAL_OBJ(GL_OBJECT_TYPE_QUERY, id, &real_obj) != 1)
4406 ret = _orig_fastpath_glIsQuery(real_obj);
4411 _COREGL_FASTPATH_FUNC_END();
4417 fastpath_glBeginQuery(GLenum target, GLuint id)
4421 DEFINE_FASTPAH_GL_FUNC();
4422 _COREGL_FASTPATH_FUNC_BEGIN();
4423 INIT_FASTPATH_GL_FUNC();
4425 if (GET_REAL_OBJ(GL_OBJECT_TYPE_QUERY, id, &real_obj) != 1)
4427 // TODO : Begin - Context Switch
4428 _set_gl_error(GL_INVALID_OPERATION);
4432 _orig_fastpath_glBeginQuery(target, real_obj);
4437 _COREGL_FASTPATH_FUNC_END();
4442 fastpath_glGetQueryiv(GLenum target, GLenum pname, GLint* params)
4444 GLuint glue_obj_id = _COREGL_INT_INIT_VALUE;
4446 DEFINE_FASTPAH_GL_FUNC();
4447 _COREGL_FASTPATH_FUNC_BEGIN();
4448 INIT_FASTPATH_GL_FUNC();
4450 _orig_fastpath_glGetQueryiv(target, pname, params);
4454 case GL_CURRENT_QUERY:
4457 AST(GET_GLUE_OBJ(GL_OBJECT_TYPE_QUERY, params[0], &glue_obj_id) == 1);
4458 params[0] = glue_obj_id;
4466 _COREGL_FASTPATH_FUNC_END();
4471 fastpath_glGetQueryObjectuiv(GLuint id, GLenum pname, GLuint* params)
4475 DEFINE_FASTPAH_GL_FUNC();
4476 _COREGL_FASTPATH_FUNC_BEGIN();
4477 INIT_FASTPATH_GL_FUNC();
4479 if (GET_REAL_OBJ(GL_OBJECT_TYPE_QUERY, id, &real_obj) != 1)
4481 _set_gl_error(GL_INVALID_OPERATION);
4485 _orig_fastpath_glGetQueryObjectuiv(real_obj, pname, params);
4490 _COREGL_FASTPATH_FUNC_END();
4495 fastpath_glDrawBuffers(GLsizei n, const GLenum* bufs)
4497 DEFINE_FASTPAH_GL_FUNC();
4498 _COREGL_FASTPATH_FUNC_BEGIN();
4499 INIT_FASTPATH_GL_FUNC();
4501 IF_GL_SUCCESS(_orig_fastpath_glDrawBuffers(n, bufs))
4503 current_ctx->_misc_flag3 |= _MISC_FLAG3_BIT_gl_draw_buffers;
4504 fastpath_state_get_draw_buffers(current_ctx->gl_draw_buffers);
4510 _COREGL_FASTPATH_FUNC_END();
4515 fastpath_glFramebufferTextureLayer(GLenum target, GLenum attachment, GLuint texture, GLint level, GLint layer)
4519 DEFINE_FASTPAH_GL_FUNC();
4520 _COREGL_FASTPATH_FUNC_BEGIN();
4521 INIT_FASTPATH_GL_FUNC();
4523 if (GET_REAL_OBJ(GL_OBJECT_TYPE_TEXTURE, texture, &real_obj) != 1)
4525 _set_gl_error(GL_OUT_OF_MEMORY);
4529 _orig_fastpath_glFramebufferTextureLayer(target, attachment, texture, level, layer);
4534 _COREGL_FASTPATH_FUNC_END();
4538 ////////////////////////////////////////////////////////////////////////
4541 fastpath_glGenVertexArrays(GLsizei n, GLuint* arrays)
4544 GLuint *objid_array = NULL;
4546 DEFINE_FASTPAH_GL_FUNC();
4547 _COREGL_FASTPATH_FUNC_BEGIN();
4548 INIT_FASTPATH_GL_FUNC();
4552 _set_gl_error(GL_INVALID_VALUE);
4555 if (n == 0) goto finish;
4556 if (arrays == NULL) goto finish;
4558 AST(current_ctx->ostate.shared != NULL);
4560 objid_array = (GLuint *)calloc(1, sizeof(GLuint) * n);
4562 IF_GL_SUCCESS(_orig_fastpath_glGenVertexArrays(n, objid_array))
4564 for (i = 0; i < n; i++)
4566 arrays[i] = fastpath_ostate_create_object(¤t_ctx->ostate, GL_OBJECT_TYPE_VERTEXARRAY, objid_array[i]);
4573 if (objid_array != NULL)
4578 _COREGL_FASTPATH_FUNC_END();
4583 fastpath_glBindVertexArray(GLuint array)
4587 DEFINE_FASTPAH_GL_FUNC();
4588 _COREGL_FASTPATH_FUNC_BEGIN();
4589 INIT_FASTPATH_GL_FUNC();
4591 if (GET_REAL_OBJ(GL_OBJECT_TYPE_VERTEXARRAY, array, &real_obj) != 1)
4593 _set_gl_error(GL_INVALID_OPERATION);
4597 if (current_ctx->gl_vertex_array_binding[0] != real_obj)
4599 IF_GL_SUCCESS(_orig_fastpath_glBindVertexArray(real_obj))
4601 current_ctx->_misc_flag3 |= _MISC_FLAG3_BIT_gl_vertex_array_binding;
4602 current_ctx->gl_vertex_array_binding[0] = real_obj;
4608 _COREGL_FASTPATH_FUNC_END();
4613 fastpath_glIsVertexArray(GLuint array)
4615 GLboolean ret = GL_FALSE;
4618 DEFINE_FASTPAH_GL_FUNC();
4619 _COREGL_FASTPATH_FUNC_BEGIN();
4620 INIT_FASTPATH_GL_FUNC();
4622 if (GET_REAL_OBJ(GL_OBJECT_TYPE_VERTEXARRAY, array, &real_obj) != 1)
4628 ret = _orig_fastpath_glIsVertexArray(real_obj);
4633 _COREGL_FASTPATH_FUNC_END();
4639 fastpath_glDeleteVertexArrays(GLsizei n, const GLuint* arrays)
4642 GLuint *objid_array = NULL;
4644 DEFINE_FASTPAH_GL_FUNC();
4645 _COREGL_FASTPATH_FUNC_BEGIN();
4646 INIT_FASTPATH_GL_FUNC();
4650 _set_gl_error(GL_INVALID_VALUE);
4653 if (n == 0) goto finish;
4654 if (arrays == NULL) goto finish;
4656 AST(current_ctx->ostate.shared != NULL);
4658 objid_array = (GLuint *)calloc(1, sizeof(GLuint) * n);
4662 for (i = 0; i < n; i++)
4664 int real_objid = _COREGL_INT_INIT_VALUE;
4665 if (arrays[i] == 0) continue;
4667 real_objid = fastpath_ostate_get_object(¤t_ctx->ostate, GL_OBJECT_TYPE_VERTEXARRAY, arrays[i]);
4668 if (real_objid == 0) continue;
4670 AST(fastpath_ostate_remove_object(¤t_ctx->ostate, GL_OBJECT_TYPE_VERTEXARRAY, arrays[i]) == 1);
4671 objid_array[real_n++] = real_objid;
4674 IF_GL_SUCCESS(_orig_fastpath_glDeleteVertexArrays(real_n, objid_array))
4676 for (i = 0; i < real_n; i++)
4678 General_Trace_List *current = NULL;
4679 current = current_ctx->ostate.shared->using_gctxs;
4681 while (current != NULL)
4683 GLGlueContext *cur_gctx = (GLGlueContext *)current->value;
4685 if (cur_gctx->gl_vertex_array_binding[0] == objid_array[i])
4686 cur_gctx->gl_vertex_array_binding[0] = 0;
4688 current = current->next;
4697 if (objid_array != NULL)
4702 _COREGL_FASTPATH_FUNC_END();
4705 ////////////////////////////////////////////////////////////////////////
4708 fastpath_glGetIntegeri_v(GLenum target, GLuint index, GLint* data)
4710 DEFINE_FASTPAH_GL_FUNC();
4711 _COREGL_FASTPATH_FUNC_BEGIN();
4712 INIT_FASTPATH_GL_FUNC();
4714 IF_GL_SUCCESS(_orig_fastpath_glGetIntegeri_v(target, index, data))
4716 _modify_get_value(target, data, GL_INT, GL_FALSE);
4721 _COREGL_FASTPATH_FUNC_END();
4724 ////////////////////////////////////////////////////////////////////////
4727 fastpath_glGenTransformFeedbacks(GLsizei n, GLuint* ids)
4730 GLuint *objid_array = NULL;
4732 DEFINE_FASTPAH_GL_FUNC();
4733 _COREGL_FASTPATH_FUNC_BEGIN();
4734 INIT_FASTPATH_GL_FUNC();
4738 _set_gl_error(GL_INVALID_VALUE);
4741 if (n == 0) goto finish;
4742 if (ids == NULL) goto finish;
4744 AST(current_ctx->ostate.shared != NULL);
4746 objid_array = (GLuint *)calloc(1, sizeof(GLuint) * n);
4748 IF_GL_SUCCESS(_orig_fastpath_glGenTransformFeedbacks(n, objid_array))
4750 for (i = 0; i < n; i++)
4752 ids[i] = fastpath_ostate_create_object(¤t_ctx->ostate, GL_OBJECT_TYPE_TRANSFORMFEEDBACK, objid_array[i]);
4759 if (objid_array != NULL)
4764 _COREGL_FASTPATH_FUNC_END();
4769 fastpath_glBindTransformFeedback(GLenum target, GLuint id)
4773 DEFINE_FASTPAH_GL_FUNC();
4774 _COREGL_FASTPATH_FUNC_BEGIN();
4775 INIT_FASTPATH_GL_FUNC();
4777 if (GET_REAL_OBJ(GL_OBJECT_TYPE_TRANSFORMFEEDBACK, id, &real_obj) != 1)
4779 _set_gl_error(GL_OUT_OF_MEMORY);
4783 if (current_ctx->gl_transform_feedback_binding[0] != real_obj)
4785 IF_GL_SUCCESS(_orig_fastpath_glBindTransformFeedback(target, real_obj))
4787 current_ctx->_misc_flag3 |= _MISC_FLAG3_BIT_gl_transform_feedback_binding;
4788 current_ctx->gl_transform_feedback_binding[0] = real_obj;
4794 _COREGL_FASTPATH_FUNC_END();
4799 fastpath_glBeginTransformFeedback(GLenum primitiveMode)
4801 DEFINE_FASTPAH_GL_FUNC();
4802 _COREGL_FASTPATH_FUNC_BEGIN();
4803 INIT_FASTPATH_GL_FUNC();
4805 IF_GL_SUCCESS(_orig_fastpath_glBeginTransformFeedback(primitiveMode))
4807 current_ctx->_misc_flag3 |= _MISC_FLAG3_BIT_gl_transform_feedback;
4809 current_ctx->gl_transform_feedback_active[0] = GL_TRUE;
4810 current_ctx->gl_transform_feedback_paused[0] = GL_FALSE;
4816 _COREGL_FASTPATH_FUNC_END();
4821 fastpath_glEndTransformFeedback()
4823 DEFINE_FASTPAH_GL_FUNC();
4824 _COREGL_FASTPATH_FUNC_BEGIN();
4825 INIT_FASTPATH_GL_FUNC();
4827 IF_GL_SUCCESS(_orig_fastpath_glEndTransformFeedback())
4829 current_ctx->_misc_flag3 |= _MISC_FLAG3_BIT_gl_transform_feedback;
4831 current_ctx->gl_transform_feedback_active[0] = GL_FALSE;
4832 current_ctx->gl_transform_feedback_paused[0] = GL_FALSE;
4838 _COREGL_FASTPATH_FUNC_END();
4843 fastpath_glPauseTransformFeedback()
4845 DEFINE_FASTPAH_GL_FUNC();
4846 _COREGL_FASTPATH_FUNC_BEGIN();
4847 INIT_FASTPATH_GL_FUNC();
4849 IF_GL_SUCCESS(_orig_fastpath_glPauseTransformFeedback())
4851 current_ctx->_misc_flag3 |= _MISC_FLAG3_BIT_gl_transform_feedback;
4853 current_ctx->gl_transform_feedback_active[0] = GL_TRUE;
4854 current_ctx->gl_transform_feedback_paused[0] = GL_TRUE;
4860 _COREGL_FASTPATH_FUNC_END();
4864 fastpath_glResumeTransformFeedback()
4866 DEFINE_FASTPAH_GL_FUNC();
4867 _COREGL_FASTPATH_FUNC_BEGIN();
4868 INIT_FASTPATH_GL_FUNC();
4870 IF_GL_SUCCESS(_orig_fastpath_glResumeTransformFeedback())
4872 current_ctx->_misc_flag3 |= _MISC_FLAG3_BIT_gl_transform_feedback;
4874 current_ctx->gl_transform_feedback_active[0] = GL_TRUE;
4875 current_ctx->gl_transform_feedback_paused[0] = GL_FALSE;
4881 _COREGL_FASTPATH_FUNC_END();
4886 fastpath_glIsTransformFeedback(GLuint id)
4888 GLboolean ret = GL_FALSE;
4891 DEFINE_FASTPAH_GL_FUNC();
4892 _COREGL_FASTPATH_FUNC_BEGIN();
4893 INIT_FASTPATH_GL_FUNC();
4895 if (GET_REAL_OBJ(GL_OBJECT_TYPE_TRANSFORMFEEDBACK, id, &real_obj) != 1)
4901 ret = _orig_fastpath_glIsTransformFeedback(real_obj);
4906 _COREGL_FASTPATH_FUNC_END();
4912 fastpath_glDeleteTransformFeedbacks(GLsizei n, const GLuint* ids)
4915 GLuint *objid_array = NULL;
4917 DEFINE_FASTPAH_GL_FUNC();
4918 _COREGL_FASTPATH_FUNC_BEGIN();
4919 INIT_FASTPATH_GL_FUNC();
4923 _set_gl_error(GL_INVALID_VALUE);
4926 if (n == 0) goto finish;
4927 if (ids == NULL) goto finish;
4929 AST(current_ctx->ostate.shared != NULL);
4931 objid_array = (GLuint *)calloc(1, sizeof(GLuint) * n);
4935 for (i = 0; i < n; i++)
4937 int real_objid = _COREGL_INT_INIT_VALUE;
4938 if (ids[i] == 0) continue;
4940 real_objid = fastpath_ostate_get_object(¤t_ctx->ostate, GL_OBJECT_TYPE_TRANSFORMFEEDBACK, ids[i]);
4941 if (real_objid == 0) continue;
4943 AST(fastpath_ostate_remove_object(¤t_ctx->ostate, GL_OBJECT_TYPE_TRANSFORMFEEDBACK, ids[i]) == 1);
4944 objid_array[real_n++] = real_objid;
4947 IF_GL_SUCCESS(_orig_fastpath_glDeleteTransformFeedbacks(real_n, objid_array))
4949 for (i = 0; i < real_n; i++)
4951 General_Trace_List *current = NULL;
4952 current = current_ctx->ostate.shared->using_gctxs;
4954 while (current != NULL)
4956 GLGlueContext *cur_gctx = (GLGlueContext *)current->value;
4958 if (cur_gctx->gl_transform_feedback_binding[0] == objid_array[i])
4959 cur_gctx->gl_transform_feedback_binding[0] = 0;
4961 current = current->next;
4970 if (objid_array != NULL)
4975 _COREGL_FASTPATH_FUNC_END();
4978 ////////////////////////////////////////////////////////////////////////
4982 fastpath_glBindBufferBase(GLenum target, GLuint index, GLuint buffer)
4986 DEFINE_FASTPAH_GL_FUNC();
4987 _COREGL_FASTPATH_FUNC_BEGIN();
4988 INIT_FASTPATH_GL_FUNC();
4990 if (GET_REAL_OBJ(GL_OBJECT_TYPE_BUFFER, buffer, &real_obj) != 1)
4992 _set_gl_error(GL_OUT_OF_MEMORY);
4996 #define STATE_PROC(gl_state, flagid, flagbit) \
4998 CURR_STATE_COMPARE(gl_state, real_obj) \
5000 IF_GL_SUCCESS(_orig_fastpath_glBindBufferBase(target, index, real_obj)) \
5002 current_ctx->flagid |= flagbit##_##gl_state; \
5003 current_ctx->gl_state##_array[index] = real_obj; \
5004 current_ctx->gl_state##_array_offset[index] = 0; \
5005 current_ctx->gl_state##_array_size[index] = 0; \
5014 case GL_TRANSFORM_FEEDBACK_BUFFER:
5015 STATE_PROC(gl_transform_feedback_buffer_binding, _bind_flag2, _BIND_FLAG2_BIT);
5017 case GL_UNIFORM_BUFFER:
5018 STATE_PROC(gl_uniform_buffer_binding, _bind_flag2, _BIND_FLAG2_BIT);
5021 _set_gl_error(GL_INVALID_ENUM);
5031 _COREGL_FASTPATH_FUNC_END();
5037 fastpath_glBindBufferRange(GLenum target, GLuint index, GLuint buffer, GLintptr offset, GLsizeiptr size)
5041 DEFINE_FASTPAH_GL_FUNC();
5042 _COREGL_FASTPATH_FUNC_BEGIN();
5043 INIT_FASTPATH_GL_FUNC();
5045 if (GET_REAL_OBJ(GL_OBJECT_TYPE_BUFFER, buffer, &real_obj) != 1)
5047 _set_gl_error(GL_OUT_OF_MEMORY);
5051 #define STATE_PROC(gl_state, flagnum) \
5053 CURR_STATE_COMPARE(gl_state, real_obj) \
5055 IF_GL_SUCCESS(_orig_fastpath_glBindBufferRange(target, index, real_obj, offset, size)) \
5057 current_ctx->_bind_flag2 |= _BIND_FLAG2_BIT_##gl_state; \
5058 current_ctx->gl_state##_array[index] = real_obj; \
5059 current_ctx->gl_state##_array_offset[index] = offset; \
5060 current_ctx->gl_state##_array_size[index] = size; \
5069 case GL_TRANSFORM_FEEDBACK_BUFFER: STATE_PROC(gl_transform_feedback_buffer_binding, 0); break;
5070 case GL_UNIFORM_BUFFER: STATE_PROC(gl_uniform_buffer_binding, 0); break;
5071 default: _set_gl_error(GL_INVALID_ENUM); break;
5080 _COREGL_FASTPATH_FUNC_END();
5085 fastpath_glTransformFeedbackVaryings(GLuint program, GLsizei count, const GLchar* const* varyings, GLenum bufferMode)
5089 DEFINE_FASTPAH_GL_FUNC();
5090 _COREGL_FASTPATH_FUNC_BEGIN();
5091 INIT_FASTPATH_GL_FUNC();
5093 if (GET_REAL_OBJ(GL_OBJECT_TYPE_PROGRAM, program, &real_obj) != 1)
5095 _set_gl_error(GL_INVALID_VALUE);
5099 _orig_fastpath_glTransformFeedbackVaryings(real_obj, count, varyings, bufferMode);
5103 _COREGL_FASTPATH_FUNC_END();
5108 fastpath_glGetTransformFeedbackVarying(GLuint program, GLuint index, GLsizei bufSize, GLsizei* length, GLsizei* size, GLenum* type, GLchar* name)
5112 DEFINE_FASTPAH_GL_FUNC();
5113 _COREGL_FASTPATH_FUNC_BEGIN();
5114 INIT_FASTPATH_GL_FUNC();
5116 if (GET_REAL_OBJ(GL_OBJECT_TYPE_PROGRAM, program, &real_obj) != 1)
5118 _set_gl_error(GL_INVALID_VALUE);
5122 _orig_fastpath_glGetTransformFeedbackVarying(real_obj, index, bufSize, length, size, type, name);
5126 _COREGL_FASTPATH_FUNC_END();
5131 fastpath_glVertexAttribIPointer(GLuint index, GLint size, GLenum type, GLsizei stride, const GLvoid* pointer)
5133 DEFINE_FASTPAH_GL_FUNC();
5134 _COREGL_FASTPATH_FUNC_BEGIN();
5135 INIT_FASTPATH_GL_FUNC();
5137 IF_GL_SUCCESS(_orig_fastpath_glVertexAttribIPointer(index, size, type, stride, pointer))
5139 if (current_ctx->gl_vertex_array_binding[0] == 0)
5141 current_ctx->_vattrib_flag |= _VATTRIB_FLAG_BIT_gl_vertex_array;
5143 current_ctx->gl_vertex_array_buf_id[index] = current_ctx->gl_array_buffer_binding[0];
5144 current_ctx->gl_vertex_array_size[index] = size;
5145 current_ctx->gl_vertex_array_type[index] = type;
5146 current_ctx->gl_vertex_array_normalized[index] = GL_FALSE;
5147 current_ctx->gl_vertex_array_integer[index] = GL_TRUE;
5148 current_ctx->gl_vertex_array_stride[index] = stride;
5149 current_ctx->gl_vertex_array_pointer[index] = (GLvoid *)pointer;
5155 _COREGL_FASTPATH_FUNC_END();
5160 fastpath_glVertexAttribI4i(GLuint index, GLint x, GLint y, GLint z, GLint w)
5162 DEFINE_FASTPAH_GL_FUNC();
5163 _COREGL_FASTPATH_FUNC_BEGIN();
5164 INIT_FASTPATH_GL_FUNC();
5166 IF_GL_SUCCESS(_orig_fastpath_glVertexAttribI4i(index, x, y, z, w))
5168 if (current_ctx->gl_vertex_array_binding[0] == 0)
5170 current_ctx->_vattrib_flag |= _VATTRIB_FLAG_BIT_gl_vertex_attrib_value;
5171 current_ctx->gl_vertex_array_size[index] = 0;
5172 current_ctx->gl_vertex_array_integer[index] = GL_TRUE;
5174 current_ctx->gl_vertex_array_type[index] = GL_INT;
5175 current_ctx->gl_vertex_attrib_value_integer[index * 4 + 0] = x;
5176 current_ctx->gl_vertex_attrib_value_integer[index * 4 + 1] = y;
5177 current_ctx->gl_vertex_attrib_value_integer[index * 4 + 2] = z;
5178 current_ctx->gl_vertex_attrib_value_integer[index * 4 + 3] = w;
5184 _COREGL_FASTPATH_FUNC_END();
5189 fastpath_glVertexAttribI4ui(GLuint index, GLuint x, GLuint y, GLuint z, GLuint w)
5191 DEFINE_FASTPAH_GL_FUNC();
5192 _COREGL_FASTPATH_FUNC_BEGIN();
5193 INIT_FASTPATH_GL_FUNC();
5195 IF_GL_SUCCESS(_orig_fastpath_glVertexAttribI4ui(index, x, y, z, w))
5197 if (current_ctx->gl_vertex_array_binding[0] == 0)
5199 current_ctx->_vattrib_flag |= _VATTRIB_FLAG_BIT_gl_vertex_attrib_value;
5200 current_ctx->gl_vertex_array_size[index] = 0;
5201 current_ctx->gl_vertex_array_integer[index] = GL_TRUE;
5203 current_ctx->gl_vertex_array_type[index] = GL_UNSIGNED_INT;
5204 current_ctx->gl_vertex_attrib_value_unsigned_integer[index * 4 + 0] = x;
5205 current_ctx->gl_vertex_attrib_value_unsigned_integer[index * 4 + 1] = y;
5206 current_ctx->gl_vertex_attrib_value_unsigned_integer[index * 4 + 2] = z;
5207 current_ctx->gl_vertex_attrib_value_unsigned_integer[index * 4 + 3] = w;
5213 _COREGL_FASTPATH_FUNC_END();
5218 fastpath_glVertexAttribI4iv(GLuint index, const GLint* v)
5220 DEFINE_FASTPAH_GL_FUNC();
5221 _COREGL_FASTPATH_FUNC_BEGIN();
5222 INIT_FASTPATH_GL_FUNC();
5224 IF_GL_SUCCESS(_orig_fastpath_glVertexAttribI4iv(index, v))
5226 if (current_ctx->gl_vertex_array_binding[0] == 0)
5228 current_ctx->_vattrib_flag |= _VATTRIB_FLAG_BIT_gl_vertex_attrib_value;
5229 current_ctx->gl_vertex_array_size[index] = 0;
5230 current_ctx->gl_vertex_array_integer[index] = GL_TRUE;
5232 current_ctx->gl_vertex_array_type[index] = GL_INT;
5233 current_ctx->gl_vertex_attrib_value_integer[index * 4 + 0] = v[0];
5234 current_ctx->gl_vertex_attrib_value_integer[index * 4 + 1] = v[1];
5235 current_ctx->gl_vertex_attrib_value_integer[index * 4 + 2] = v[2];
5236 current_ctx->gl_vertex_attrib_value_integer[index * 4 + 3] = v[3];
5242 _COREGL_FASTPATH_FUNC_END();
5247 fastpath_glVertexAttribI4uiv(GLuint index, const GLuint* v)
5249 DEFINE_FASTPAH_GL_FUNC();
5250 _COREGL_FASTPATH_FUNC_BEGIN();
5251 INIT_FASTPATH_GL_FUNC();
5253 IF_GL_SUCCESS(_orig_fastpath_glVertexAttribI4uiv(index, v))
5255 if (current_ctx->gl_vertex_array_binding[0] == 0)
5257 current_ctx->_vattrib_flag |= _VATTRIB_FLAG_BIT_gl_vertex_attrib_value;
5258 current_ctx->gl_vertex_array_size[index] = 0;
5259 current_ctx->gl_vertex_array_integer[index] = GL_TRUE;
5261 current_ctx->gl_vertex_array_type[index] = GL_UNSIGNED_INT;
5262 current_ctx->gl_vertex_attrib_value_unsigned_integer[index * 4 + 0] = v[0];
5263 current_ctx->gl_vertex_attrib_value_unsigned_integer[index * 4 + 1] = v[1];
5264 current_ctx->gl_vertex_attrib_value_unsigned_integer[index * 4 + 2] = v[2];
5265 current_ctx->gl_vertex_attrib_value_unsigned_integer[index * 4 + 3] = v[3];
5271 _COREGL_FASTPATH_FUNC_END();
5276 fastpath_glGetUniformuiv(GLuint program, GLint location, GLuint* params)
5280 DEFINE_FASTPAH_GL_FUNC();
5281 _COREGL_FASTPATH_FUNC_BEGIN();
5282 INIT_FASTPATH_GL_FUNC();
5284 if (GET_REAL_OBJ(GL_OBJECT_TYPE_PROGRAM, program, &real_obj) != 1)
5286 _set_gl_error(GL_INVALID_VALUE);
5290 _orig_fastpath_glGetUniformuiv(real_obj, location, params);
5295 _COREGL_FASTPATH_FUNC_END();
5300 fastpath_glGetFragDataLocation(GLuint program, const GLchar *name)
5302 GLint ret = _COREGL_INT_INIT_VALUE;
5305 DEFINE_FASTPAH_GL_FUNC();
5306 _COREGL_FASTPATH_FUNC_BEGIN();
5307 INIT_FASTPATH_GL_FUNC();
5309 if (GET_REAL_OBJ(GL_OBJECT_TYPE_PROGRAM, program, &real_obj) != 1)
5311 _set_gl_error(GL_INVALID_VALUE);
5315 ret = _orig_fastpath_glGetFragDataLocation(real_obj, name);
5320 _COREGL_FASTPATH_FUNC_END();
5326 fastpath_glGetStringi(GLenum name, GLuint index)
5328 const char *ret = NULL;
5330 DEFINE_FASTPAH_GL_FUNC();
5331 _COREGL_FASTPATH_FUNC_BEGIN();
5332 INIT_FASTPATH_GL_FUNC();
5337 _set_gl_error(GL_INVALID_ENUM);
5340 _valid_extension_string();
5341 if (index < 0 || index >= gl_extension_count)
5343 _set_gl_error(GL_INVALID_VALUE);
5346 ret = string_each_extensions[index];
5349 IF_GL_SUCCESS(ret = (const char *)_orig_fastpath_glGetStringi(name, index))
5362 _COREGL_FASTPATH_FUNC_END();
5363 return (const GLubyte *)ret;
5368 fastpath_glGetUniformIndices(GLuint program, GLsizei uniformCount, const GLchar* const* uniformNames, GLuint* uniformIndices)
5372 DEFINE_FASTPAH_GL_FUNC();
5373 _COREGL_FASTPATH_FUNC_BEGIN();
5374 INIT_FASTPATH_GL_FUNC();
5376 if (GET_REAL_OBJ(GL_OBJECT_TYPE_PROGRAM, program, &real_obj) != 1)
5378 _set_gl_error(GL_INVALID_VALUE);
5382 _orig_fastpath_glGetUniformIndices(real_obj, uniformCount, uniformNames, uniformIndices);
5387 _COREGL_FASTPATH_FUNC_END();
5392 fastpath_glGetActiveUniformsiv(GLuint program, GLsizei uniformCount, const GLuint* uniformIndices, GLenum pname, GLint* params)
5396 DEFINE_FASTPAH_GL_FUNC();
5397 _COREGL_FASTPATH_FUNC_BEGIN();
5398 INIT_FASTPATH_GL_FUNC();
5400 if (GET_REAL_OBJ(GL_OBJECT_TYPE_PROGRAM, program, &real_obj) != 1)
5402 _set_gl_error(GL_INVALID_VALUE);
5406 _orig_fastpath_glGetActiveUniformsiv(real_obj, uniformCount, uniformIndices, pname, params);
5411 _COREGL_FASTPATH_FUNC_END();
5416 fastpath_glGetUniformBlockIndex(GLuint program, const GLchar* uniformBlockName)
5418 GLuint ret = _COREGL_INT_INIT_VALUE;
5421 DEFINE_FASTPAH_GL_FUNC();
5422 _COREGL_FASTPATH_FUNC_BEGIN();
5423 INIT_FASTPATH_GL_FUNC();
5425 if (GET_REAL_OBJ(GL_OBJECT_TYPE_PROGRAM, program, &real_obj) != 1)
5427 _set_gl_error(GL_INVALID_VALUE);
5431 ret = _orig_fastpath_glGetUniformBlockIndex(real_obj, uniformBlockName);
5436 _COREGL_FASTPATH_FUNC_END();
5441 fastpath_glGetActiveUniformBlockiv(GLuint program, GLuint uniformBlockIndex, GLenum pname, GLint* params)
5445 DEFINE_FASTPAH_GL_FUNC();
5446 _COREGL_FASTPATH_FUNC_BEGIN();
5447 INIT_FASTPATH_GL_FUNC();
5449 if (GET_REAL_OBJ(GL_OBJECT_TYPE_PROGRAM, program, &real_obj) != 1)
5451 _set_gl_error(GL_INVALID_VALUE);
5455 _orig_fastpath_glGetActiveUniformBlockiv(real_obj, uniformBlockIndex, pname, params);
5460 _COREGL_FASTPATH_FUNC_END();
5464 fastpath_glGetActiveUniformBlockName(GLuint program, GLuint uniformBlockIndex, GLsizei bufSize, GLsizei* length, GLchar* uniformBlockName)
5468 DEFINE_FASTPAH_GL_FUNC();
5469 _COREGL_FASTPATH_FUNC_BEGIN();
5470 INIT_FASTPATH_GL_FUNC();
5472 if (GET_REAL_OBJ(GL_OBJECT_TYPE_PROGRAM, program, &real_obj) != 1)
5474 _set_gl_error(GL_INVALID_VALUE);
5478 _orig_fastpath_glGetActiveUniformBlockName(real_obj, uniformBlockIndex, bufSize, length, uniformBlockName);
5483 _COREGL_FASTPATH_FUNC_END();
5488 fastpath_glUniformBlockBinding(GLuint program, GLuint uniformBlockIndex, GLuint uniformBlockBinding)
5492 DEFINE_FASTPAH_GL_FUNC();
5493 _COREGL_FASTPATH_FUNC_BEGIN();
5494 INIT_FASTPATH_GL_FUNC();
5496 if (GET_REAL_OBJ(GL_OBJECT_TYPE_PROGRAM, program, &real_obj) != 1)
5498 _set_gl_error(GL_INVALID_VALUE);
5502 _orig_fastpath_glUniformBlockBinding(real_obj, uniformBlockIndex, uniformBlockBinding);
5507 _COREGL_FASTPATH_FUNC_END();
5512 fastpath_glGetInteger64v(GLenum pname, GLint64* params)
5514 DEFINE_FASTPAH_GL_FUNC();
5515 _COREGL_FASTPATH_FUNC_BEGIN();
5516 INIT_FASTPATH_GL_FUNC();
5518 IF_GL_SUCCESS(_orig_fastpath_glGetInteger64v(pname, params))
5520 _modify_get_value(pname, params, GL_INT, GL_TRUE);
5525 _COREGL_FASTPATH_FUNC_END();
5530 fastpath_glGetInteger64i_v(GLenum target, GLuint index, GLint64* data)
5532 DEFINE_FASTPAH_GL_FUNC();
5533 _COREGL_FASTPATH_FUNC_BEGIN();
5534 INIT_FASTPATH_GL_FUNC();
5536 IF_GL_SUCCESS(_orig_fastpath_glGetInteger64i_v(target, index, data))
5538 _modify_get_value(target, data, GL_INT, GL_TRUE);
5543 _COREGL_FASTPATH_FUNC_END();
5547 ////////////////////////////////////////////////////////////////////////
5550 fastpath_glGenSamplers(GLsizei n, GLuint* samplers)
5553 GLuint *objid_array = NULL;
5555 DEFINE_FASTPAH_GL_FUNC();
5556 _COREGL_FASTPATH_FUNC_BEGIN();
5557 INIT_FASTPATH_GL_FUNC();
5561 _set_gl_error(GL_INVALID_VALUE);
5564 if (n == 0) goto finish;
5565 if (samplers == NULL) goto finish;
5567 AST(current_ctx->ostate.shared != NULL);
5569 objid_array = (GLuint *)calloc(1, sizeof(GLuint) * n);
5571 IF_GL_SUCCESS(_orig_fastpath_glGenSamplers(n, objid_array))
5573 for (i = 0; i < n; i++)
5575 samplers[i] = fastpath_ostate_create_object(¤t_ctx->ostate, GL_OBJECT_TYPE_SAMPLER, objid_array[i]);
5582 if (objid_array != NULL)
5587 _COREGL_FASTPATH_FUNC_END();
5592 fastpath_glBindSampler(GLuint unit, GLuint sampler)
5596 DEFINE_FASTPAH_GL_FUNC();
5597 _COREGL_FASTPATH_FUNC_BEGIN();
5598 INIT_FASTPATH_GL_FUNC();
5600 if (GET_REAL_OBJ(GL_OBJECT_TYPE_SAMPLER, sampler, &real_obj) != 1)
5602 _set_gl_error(GL_OUT_OF_MEMORY);
5606 _orig_fastpath_glBindSampler(unit, real_obj);
5610 _COREGL_FASTPATH_FUNC_END();
5615 fastpath_glIsSampler(GLuint sampler)
5617 GLboolean ret = GL_FALSE;
5620 DEFINE_FASTPAH_GL_FUNC();
5621 _COREGL_FASTPATH_FUNC_BEGIN();
5622 INIT_FASTPATH_GL_FUNC();
5624 if (GET_REAL_OBJ(GL_OBJECT_TYPE_SAMPLER, sampler, &real_obj) != 1)
5630 ret = _orig_fastpath_glIsSampler(real_obj);
5635 _COREGL_FASTPATH_FUNC_END();
5641 fastpath_glDeleteSamplers(GLsizei n, const GLuint* samplers)
5644 GLuint *objid_array = NULL;
5646 DEFINE_FASTPAH_GL_FUNC();
5647 _COREGL_FASTPATH_FUNC_BEGIN();
5648 INIT_FASTPATH_GL_FUNC();
5652 _set_gl_error(GL_INVALID_VALUE);
5655 if (n == 0) goto finish;
5656 if (samplers == NULL) goto finish;
5658 AST(current_ctx->ostate.shared != NULL);
5660 objid_array = (GLuint *)calloc(1, sizeof(GLuint) * n);
5664 for (i = 0; i < n; i++)
5666 int real_objid = _COREGL_INT_INIT_VALUE;
5667 if (samplers[i] == 0) continue;
5669 real_objid = fastpath_ostate_get_object(¤t_ctx->ostate, GL_OBJECT_TYPE_SAMPLER, samplers[i]);
5670 if (real_objid == 0) continue;
5672 AST(fastpath_ostate_remove_object(¤t_ctx->ostate, GL_OBJECT_TYPE_SAMPLER, samplers[i]) == 1);
5673 objid_array[real_n++] = real_objid;
5676 _orig_fastpath_glDeleteSamplers(real_n, objid_array);
5682 if (objid_array != NULL)
5687 _COREGL_FASTPATH_FUNC_END();
5690 ////////////////////////////////////////////////////////////////////////
5694 fastpath_glSamplerParameteri(GLuint sampler, GLenum pname, GLint param)
5698 DEFINE_FASTPAH_GL_FUNC();
5699 _COREGL_FASTPATH_FUNC_BEGIN();
5700 INIT_FASTPATH_GL_FUNC();
5702 if (GET_REAL_OBJ(GL_OBJECT_TYPE_SAMPLER, sampler, &real_obj) != 1)
5707 _orig_fastpath_glSamplerParameteri(real_obj, pname, param);
5712 _COREGL_FASTPATH_FUNC_END();
5716 fastpath_glSamplerParameteriv(GLuint sampler, GLenum pname, const GLint* param)
5720 DEFINE_FASTPAH_GL_FUNC();
5721 _COREGL_FASTPATH_FUNC_BEGIN();
5722 INIT_FASTPATH_GL_FUNC();
5724 if (GET_REAL_OBJ(GL_OBJECT_TYPE_SAMPLER, sampler, &real_obj) != 1)
5729 _orig_fastpath_glSamplerParameteriv(real_obj, pname, param);
5734 _COREGL_FASTPATH_FUNC_END();
5738 fastpath_glSamplerParameterf(GLuint sampler, GLenum pname, GLfloat param)
5742 DEFINE_FASTPAH_GL_FUNC();
5743 _COREGL_FASTPATH_FUNC_BEGIN();
5744 INIT_FASTPATH_GL_FUNC();
5746 if (GET_REAL_OBJ(GL_OBJECT_TYPE_SAMPLER, sampler, &real_obj) != 1)
5751 _orig_fastpath_glSamplerParameterf(real_obj, pname, param);
5756 _COREGL_FASTPATH_FUNC_END();
5760 fastpath_glSamplerParameterfv(GLuint sampler, GLenum pname, const GLfloat* param)
5764 DEFINE_FASTPAH_GL_FUNC();
5765 _COREGL_FASTPATH_FUNC_BEGIN();
5766 INIT_FASTPATH_GL_FUNC();
5768 if (GET_REAL_OBJ(GL_OBJECT_TYPE_SAMPLER, sampler, &real_obj) != 1)
5773 _orig_fastpath_glSamplerParameterfv(real_obj, pname, param);
5778 _COREGL_FASTPATH_FUNC_END();
5782 fastpath_glGetSamplerParameteriv(GLuint sampler, GLenum pname, GLint* params)
5786 DEFINE_FASTPAH_GL_FUNC();
5787 _COREGL_FASTPATH_FUNC_BEGIN();
5788 INIT_FASTPATH_GL_FUNC();
5790 if (GET_REAL_OBJ(GL_OBJECT_TYPE_SAMPLER, sampler, &real_obj) != 1)
5795 _orig_fastpath_glGetSamplerParameteriv(real_obj, pname, params);
5800 _COREGL_FASTPATH_FUNC_END();
5804 fastpath_glGetSamplerParameterfv(GLuint sampler, GLenum pname, GLfloat* params)
5808 DEFINE_FASTPAH_GL_FUNC();
5809 _COREGL_FASTPATH_FUNC_BEGIN();
5810 INIT_FASTPATH_GL_FUNC();
5812 if (GET_REAL_OBJ(GL_OBJECT_TYPE_SAMPLER, sampler, &real_obj) != 1)
5817 _orig_fastpath_glGetSamplerParameterfv(real_obj, pname, params);
5822 _COREGL_FASTPATH_FUNC_END();
5827 fastpath_glVertexAttribDivisor(GLuint index, GLuint divisor)
5829 DEFINE_FASTPAH_GL_FUNC();
5830 _COREGL_FASTPATH_FUNC_BEGIN();
5831 INIT_FASTPATH_GL_FUNC();
5833 IF_GL_SUCCESS(_orig_fastpath_glVertexAttribDivisor(index, divisor))
5835 if (current_ctx->gl_vertex_array_binding[0] == 0)
5837 current_ctx->_vattrib_flag |= _VATTRIB_FLAG_BIT_gl_vertex_array;
5838 current_ctx->gl_vertex_array_divisor[index] = divisor;
5844 _COREGL_FASTPATH_FUNC_END();
5849 fastpath_glProgramParameteri(GLuint program, GLenum pname, GLint value)
5853 DEFINE_FASTPAH_GL_FUNC();
5854 _COREGL_FASTPATH_FUNC_BEGIN();
5855 INIT_FASTPATH_GL_FUNC();
5857 if (GET_REAL_OBJ(GL_OBJECT_TYPE_PROGRAM, program, &real_obj) != 1)
5859 _set_gl_error(GL_INVALID_VALUE);
5863 _orig_fastpath_glProgramParameteri(real_obj, pname, value);
5868 _COREGL_FASTPATH_FUNC_END();
5874 fastpath_glCreateShaderProgramv(GLenum type, GLsizei count, const GLchar *const*strings)
5877 GLuint real_obj = 0;
5879 DEFINE_FASTPAH_GL_FUNC();
5880 _COREGL_FASTPATH_FUNC_BEGIN();
5881 INIT_FASTPATH_GL_FUNC();
5883 AST(current_ctx->ostate.shared != NULL);
5885 real_obj = _orig_fastpath_glCreateShaderProgramv(type, count, strings);
5888 ret = fastpath_ostate_create_object(¤t_ctx->ostate, GL_OBJECT_TYPE_PROGRAM, real_obj);
5890 Program_object_attached_tag *poat = NULL;
5891 poat = (Program_object_attached_tag *)calloc(1, sizeof(Program_object_attached_tag));
5894 poat->is_deleting = 0;
5895 poat->shader_count = 0;
5897 fastpath_ostate_set_object_tag(¤t_ctx->ostate, GL_OBJECT_TYPE_PROGRAM, ret, poat);
5899 _attach_program_object(¤t_ctx->ostate, real_obj);
5904 _COREGL_FASTPATH_FUNC_END();
5909 fastpath_glGenProgramPipelines( GLsizei n, GLuint *pipelines)
5912 GLuint *objid_array = NULL;
5914 DEFINE_FASTPAH_GL_FUNC();
5915 _COREGL_FASTPATH_FUNC_BEGIN();
5916 INIT_FASTPATH_GL_FUNC();
5918 if (n < 0 || pipelines == NULL)
5920 _set_gl_error(GL_INVALID_VALUE);
5924 AST(current_ctx->ostate.shared != NULL);
5926 objid_array = (GLuint *)calloc(1, sizeof(GLuint) * n);
5928 IF_GL_SUCCESS(_orig_fastpath_glGenProgramPipelines(n, objid_array))
5930 for (i = 0; i < n; i++)
5932 pipelines[i] = fastpath_ostate_create_object(¤t_ctx->ostate, GL_OBJECT_TYPE_PROGRAMPIPELINE, objid_array[i]);
5939 if (objid_array != NULL)
5944 _COREGL_FASTPATH_FUNC_END();
5948 fastpath_glBindProgramPipeline( GLuint pipeline)
5952 DEFINE_FASTPAH_GL_FUNC();
5953 _COREGL_FASTPATH_FUNC_BEGIN();
5954 INIT_FASTPATH_GL_FUNC();
5956 if (GET_REAL_OBJ(GL_OBJECT_TYPE_PROGRAMPIPELINE, pipeline, &real_obj) != 1)
5958 _set_gl_error(GL_INVALID_OPERATION);
5962 if (current_ctx->gl_program_pipeline_binding[0] != real_obj)
5964 IF_GL_SUCCESS(_orig_fastpath_glBindProgramPipeline(real_obj))
5966 current_ctx->_misc_flag3 |= _MISC_FLAG3_BIT_gl_program_pipeline_binding;
5967 current_ctx->gl_program_pipeline_binding[0] = real_obj;
5974 _COREGL_FASTPATH_FUNC_END();
5978 fastpath_glGetProgramPipelineiv(GLuint pipeline, GLenum pname, GLint *params)
5982 DEFINE_FASTPAH_GL_FUNC();
5983 _COREGL_FASTPATH_FUNC_BEGIN();
5984 INIT_FASTPATH_GL_FUNC();
5986 if (params == NULL || GET_REAL_OBJ(GL_OBJECT_TYPE_PROGRAMPIPELINE, pipeline, &real_obj) != 1)
5988 _set_gl_error(GL_INVALID_VALUE);
5994 case GL_ACTIVE_PROGRAM:
5995 case GL_VERTEX_SHADER:
5996 case GL_FRAGMENT_SHADER:
5997 case GL_COMPUTE_SHADER:
5998 case GL_INFO_LOG_LENGTH:
5999 case GL_VALIDATE_STATUS:
6000 _orig_fastpath_glGetProgramPipelineiv(real_obj, pname, params);
6003 _set_gl_error(GL_INVALID_ENUM);
6010 _COREGL_FASTPATH_FUNC_END();
6014 fastpath_glDeleteProgramPipelines(GLsizei n, GLuint const *pipelines)
6017 GLuint *objid_array = NULL;
6019 DEFINE_FASTPAH_GL_FUNC();
6020 _COREGL_FASTPATH_FUNC_BEGIN();
6021 INIT_FASTPATH_GL_FUNC();
6023 if (n < 0 || pipelines == NULL)
6025 _set_gl_error(GL_INVALID_VALUE);
6032 AST(current_ctx->ostate.shared != NULL);
6034 objid_array = (GLuint *)calloc(1, sizeof(GLuint) * n);
6038 for (i = 0; i < n; i++)
6040 int real_objid = _COREGL_INT_INIT_VALUE;
6041 if (pipelines[i] == 0) continue;
6043 real_objid = fastpath_ostate_get_object(¤t_ctx->ostate, GL_OBJECT_TYPE_PROGRAMPIPELINE, pipelines[i]);
6044 if (real_objid == 0) continue;
6046 AST(fastpath_ostate_remove_object(¤t_ctx->ostate, GL_OBJECT_TYPE_PROGRAMPIPELINE, pipelines[i]) == 1);
6047 objid_array[real_n++] = real_objid;
6050 IF_GL_SUCCESS(_orig_fastpath_glDeleteProgramPipelines(real_n, objid_array))
6052 for (i = 0; i < real_n; i++)
6054 General_Trace_List *current = NULL;
6055 current = current_ctx->ostate.shared->using_gctxs;
6057 while (current != NULL)
6059 GLGlueContext *cur_gctx = (GLGlueContext *)current->value;
6061 if (cur_gctx->gl_program_pipeline_binding[0] == objid_array[i])
6062 cur_gctx->gl_program_pipeline_binding[0] = 0;
6064 current = current->next;
6073 if (objid_array != NULL)
6078 _COREGL_FASTPATH_FUNC_END();
6082 fastpath_glIsProgramPipeline( GLuint pipeline)
6084 GLboolean ret = GL_FALSE;
6087 DEFINE_FASTPAH_GL_FUNC();
6088 _COREGL_FASTPATH_FUNC_BEGIN();
6089 INIT_FASTPATH_GL_FUNC();
6091 if (GET_REAL_OBJ(GL_OBJECT_TYPE_PROGRAMPIPELINE, pipeline, &real_obj) != 1)
6097 ret = _orig_fastpath_glIsProgramPipeline(real_obj);
6102 _COREGL_FASTPATH_FUNC_END();
6107 fastpath_glValidateProgramPipeline(GLuint pipeline)
6111 DEFINE_FASTPAH_GL_FUNC();
6112 _COREGL_FASTPATH_FUNC_BEGIN();
6113 INIT_FASTPATH_GL_FUNC();
6115 if (GET_REAL_OBJ(GL_OBJECT_TYPE_PROGRAMPIPELINE, pipeline, &real_obj) != 1)
6117 _set_gl_error(GL_INVALID_VALUE);
6121 _orig_fastpath_glValidateProgramPipeline(real_obj);
6126 _COREGL_FASTPATH_FUNC_END();
6130 fastpath_glGetProgramPipelineInfoLog(GLuint pipeline, GLsizei bufSize, GLsizei *length, GLchar *infoLog)
6134 DEFINE_FASTPAH_GL_FUNC();
6135 _COREGL_FASTPATH_FUNC_BEGIN();
6136 INIT_FASTPATH_GL_FUNC();
6138 if (NULL == infoLog || bufSize < 0 || GET_REAL_OBJ(GL_OBJECT_TYPE_PROGRAMPIPELINE, pipeline, &real_obj) != 1)
6140 _set_gl_error(GL_INVALID_VALUE);
6144 _orig_fastpath_glGetProgramPipelineInfoLog(real_obj, bufSize, length, infoLog);
6149 _COREGL_FASTPATH_FUNC_END();
6153 fastpath_glDispatchCompute(GLuint num_groups_x, GLuint num_groups_y, GLuint num_groups_z)
6155 DEFINE_FASTPAH_GL_FUNC();
6156 _COREGL_FASTPATH_FUNC_BEGIN();
6157 INIT_FASTPATH_GL_FUNC();
6159 if (num_groups_x > GL_MAX_COMPUTE_WORK_GROUP_COUNT ||
6160 num_groups_y > GL_MAX_COMPUTE_WORK_GROUP_COUNT ||
6161 num_groups_z > GL_MAX_COMPUTE_WORK_GROUP_COUNT)
6163 _set_gl_error(GL_INVALID_VALUE);
6167 if (num_groups_x == 0 || num_groups_y == 0 || num_groups_z == 0)
6172 _orig_fastpath_glDispatchCompute(num_groups_x, num_groups_y, num_groups_z);
6175 _COREGL_FASTPATH_FUNC_END();
6179 fastpath_glDispatchComputeIndirect( GLintptr indirect)
6181 DEFINE_FASTPAH_GL_FUNC();
6182 _COREGL_FASTPATH_FUNC_BEGIN();
6183 INIT_FASTPATH_GL_FUNC();
6185 if (indirect < 0 || (indirect % sizeof(GLuint)) != 0)
6187 _set_gl_error(GL_INVALID_VALUE);
6191 _orig_fastpath_glDispatchComputeIndirect(indirect);
6194 _COREGL_FASTPATH_FUNC_END();
6198 fastpath_glGetProgramInterfaceiv(GLuint program, GLenum programInterface, GLenum pname, GLint * params)
6202 DEFINE_FASTPAH_GL_FUNC();
6203 _COREGL_FASTPATH_FUNC_BEGIN();
6204 INIT_FASTPATH_GL_FUNC();
6206 if (params == NULL || GET_REAL_OBJ(GL_OBJECT_TYPE_PROGRAM, program, &real_obj) != 1)
6208 _set_gl_error(GL_INVALID_VALUE);
6212 _orig_fastpath_glGetProgramInterfaceiv(real_obj, programInterface, pname, params);
6217 _COREGL_FASTPATH_FUNC_END();
6221 fastpath_glGetProgramResourceIndex( GLuint program, GLenum programInterface, const char * name)
6224 GLuint ret = GL_INVALID_INDEX;
6226 DEFINE_FASTPAH_GL_FUNC();
6227 _COREGL_FASTPATH_FUNC_BEGIN();
6228 INIT_FASTPATH_GL_FUNC();
6230 if (name == NULL || GET_REAL_OBJ(GL_OBJECT_TYPE_PROGRAM, program, &real_obj) != 1)
6232 _set_gl_error(GL_INVALID_VALUE);
6236 ret = _orig_fastpath_glGetProgramResourceIndex(real_obj, programInterface, name);
6241 _COREGL_FASTPATH_FUNC_END();
6246 fastpath_glGetProgramResourceName(GLuint program, GLenum programInterface, GLuint index, GLsizei bufSize, GLsizei *length, GLchar *name)
6250 DEFINE_FASTPAH_GL_FUNC();
6251 _COREGL_FASTPATH_FUNC_BEGIN();
6252 INIT_FASTPATH_GL_FUNC();
6254 if ((NULL == name && 0 != bufSize) || 0 > bufSize || GET_REAL_OBJ(GL_OBJECT_TYPE_PROGRAM, program, &real_obj) != 1)
6256 _set_gl_error(GL_INVALID_VALUE);
6260 _orig_fastpath_glGetProgramResourceName(real_obj, programInterface, index, bufSize, length, name);
6265 _COREGL_FASTPATH_FUNC_END();
6269 fastpath_glGetProgramResourceiv( GLuint program, GLenum programInterface, GLuint index, GLsizei propCount, const GLenum * props, GLsizei bufSize, GLsizei * length, GLint * params)
6273 DEFINE_FASTPAH_GL_FUNC();
6274 _COREGL_FASTPATH_FUNC_BEGIN();
6275 INIT_FASTPATH_GL_FUNC();
6277 if (0 > bufSize || 0 >= propCount || NULL == props || ((NULL == params && 0 < bufSize)) || GET_REAL_OBJ(GL_OBJECT_TYPE_PROGRAM, program, &real_obj) != 1)
6279 _set_gl_error(GL_INVALID_VALUE);
6283 _orig_fastpath_glGetProgramResourceiv(real_obj, programInterface, index, propCount, props, bufSize, length, params);
6288 _COREGL_FASTPATH_FUNC_END();
6292 fastpath_glGetProgramResourceLocation(GLuint program, GLenum programInterface, GLchar const *name)
6297 DEFINE_FASTPAH_GL_FUNC();
6298 _COREGL_FASTPATH_FUNC_BEGIN();
6299 INIT_FASTPATH_GL_FUNC();
6301 if (name == NULL || GET_REAL_OBJ(GL_OBJECT_TYPE_PROGRAM, program, &real_obj) != 1)
6303 _set_gl_error(GL_INVALID_VALUE);
6307 ret = _orig_fastpath_glGetProgramResourceLocation(real_obj, programInterface, name);
6312 _COREGL_FASTPATH_FUNC_END();
6317 fastpath_glUseProgramStages(GLuint pipeline, GLbitfield stages, GLuint program)
6321 DEFINE_FASTPAH_GL_FUNC();
6322 _COREGL_FASTPATH_FUNC_BEGIN();
6323 INIT_FASTPATH_GL_FUNC();
6325 if (GET_REAL_OBJ(GL_OBJECT_TYPE_PROGRAM, program, &real_obj) != 1)
6327 _set_gl_error(GL_INVALID_VALUE);
6331 _orig_fastpath_glUseProgramStages(pipeline, stages, real_obj);
6336 _COREGL_FASTPATH_FUNC_END();
6340 fastpath_glActiveShaderProgram(GLuint pipeline, GLuint program)
6344 DEFINE_FASTPAH_GL_FUNC();
6345 _COREGL_FASTPATH_FUNC_BEGIN();
6346 INIT_FASTPATH_GL_FUNC();
6348 if (GET_REAL_OBJ(GL_OBJECT_TYPE_PROGRAM, program, &real_obj) != 1)
6350 _set_gl_error(GL_INVALID_VALUE);
6354 _orig_fastpath_glActiveShaderProgram(pipeline, real_obj);
6359 _COREGL_FASTPATH_FUNC_END();
6363 fastpath_glProgramUniform1iv(GLuint program, GLint location, GLsizei count, const GLint *value)
6367 DEFINE_FASTPAH_GL_FUNC();
6368 _COREGL_FASTPATH_FUNC_BEGIN();
6369 INIT_FASTPATH_GL_FUNC();
6371 if (GET_REAL_OBJ(GL_OBJECT_TYPE_PROGRAM, program, &real_obj) != 1)
6373 _set_gl_error(GL_INVALID_VALUE);
6377 _orig_fastpath_glProgramUniform1iv(real_obj, location, count, value);
6382 _COREGL_FASTPATH_FUNC_END();
6387 fastpath_glProgramUniform2iv(GLuint program, GLint location, GLsizei count, const GLint *value)
6391 DEFINE_FASTPAH_GL_FUNC();
6392 _COREGL_FASTPATH_FUNC_BEGIN();
6393 INIT_FASTPATH_GL_FUNC();
6395 if (GET_REAL_OBJ(GL_OBJECT_TYPE_PROGRAM, program, &real_obj) != 1)
6397 _set_gl_error(GL_INVALID_VALUE);
6401 _orig_fastpath_glProgramUniform2iv(real_obj, location, count, value);
6406 _COREGL_FASTPATH_FUNC_END();
6411 fastpath_glProgramUniform3iv(GLuint program, GLint location, GLsizei count, const GLint *value)
6415 DEFINE_FASTPAH_GL_FUNC();
6416 _COREGL_FASTPATH_FUNC_BEGIN();
6417 INIT_FASTPATH_GL_FUNC();
6419 if (GET_REAL_OBJ(GL_OBJECT_TYPE_PROGRAM, program, &real_obj) != 1)
6421 _set_gl_error(GL_INVALID_VALUE);
6425 _orig_fastpath_glProgramUniform3iv(real_obj, location, count, value);
6430 _COREGL_FASTPATH_FUNC_END();
6435 fastpath_glProgramUniform4iv(GLuint program, GLint location, GLsizei count, const GLint *value)
6439 DEFINE_FASTPAH_GL_FUNC();
6440 _COREGL_FASTPATH_FUNC_BEGIN();
6441 INIT_FASTPATH_GL_FUNC();
6443 if (GET_REAL_OBJ(GL_OBJECT_TYPE_PROGRAM, program, &real_obj) != 1)
6445 _set_gl_error(GL_INVALID_VALUE);
6449 _orig_fastpath_glProgramUniform4iv(real_obj, location, count, value);
6454 _COREGL_FASTPATH_FUNC_END();
6460 fastpath_glProgramUniform1fv(GLuint program, GLint location, GLsizei count, const GLfloat *value)
6464 DEFINE_FASTPAH_GL_FUNC();
6465 _COREGL_FASTPATH_FUNC_BEGIN();
6466 INIT_FASTPATH_GL_FUNC();
6468 if (GET_REAL_OBJ(GL_OBJECT_TYPE_PROGRAM, program, &real_obj) != 1)
6470 _set_gl_error(GL_INVALID_VALUE);
6474 _orig_fastpath_glProgramUniform1fv(real_obj, location, count, value);
6479 _COREGL_FASTPATH_FUNC_END();
6484 fastpath_glProgramUniform2fv(GLuint program, GLint location, GLsizei count, const GLfloat *value)
6488 DEFINE_FASTPAH_GL_FUNC();
6489 _COREGL_FASTPATH_FUNC_BEGIN();
6490 INIT_FASTPATH_GL_FUNC();
6492 if (GET_REAL_OBJ(GL_OBJECT_TYPE_PROGRAM, program, &real_obj) != 1)
6494 _set_gl_error(GL_INVALID_VALUE);
6498 _orig_fastpath_glProgramUniform2fv(real_obj, location, count, value);
6503 _COREGL_FASTPATH_FUNC_END();
6508 fastpath_glProgramUniform3fv(GLuint program, GLint location, GLsizei count, const GLfloat *value)
6512 DEFINE_FASTPAH_GL_FUNC();
6513 _COREGL_FASTPATH_FUNC_BEGIN();
6514 INIT_FASTPATH_GL_FUNC();
6516 if (GET_REAL_OBJ(GL_OBJECT_TYPE_PROGRAM, program, &real_obj) != 1)
6518 _set_gl_error(GL_INVALID_VALUE);
6522 _orig_fastpath_glProgramUniform3fv(real_obj, location, count, value);
6527 _COREGL_FASTPATH_FUNC_END();
6532 fastpath_glProgramUniform4fv(GLuint program, GLint location, GLsizei count, const GLfloat *value)
6536 DEFINE_FASTPAH_GL_FUNC();
6537 _COREGL_FASTPATH_FUNC_BEGIN();
6538 INIT_FASTPATH_GL_FUNC();
6540 if (GET_REAL_OBJ(GL_OBJECT_TYPE_PROGRAM, program, &real_obj) != 1)
6542 _set_gl_error(GL_INVALID_VALUE);
6546 _orig_fastpath_glProgramUniform4fv(real_obj, location, count, value);
6551 _COREGL_FASTPATH_FUNC_END();
6555 fastpath_glProgramUniformMatrix2fv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
6559 DEFINE_FASTPAH_GL_FUNC();
6560 _COREGL_FASTPATH_FUNC_BEGIN();
6561 INIT_FASTPATH_GL_FUNC();
6563 if (GET_REAL_OBJ(GL_OBJECT_TYPE_PROGRAM, program, &real_obj) != 1)
6565 _set_gl_error(GL_INVALID_VALUE);
6569 _orig_fastpath_glProgramUniformMatrix2fv(real_obj, location, count, transpose, value);
6574 _COREGL_FASTPATH_FUNC_END();
6579 fastpath_glProgramUniformMatrix3fv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
6583 DEFINE_FASTPAH_GL_FUNC();
6584 _COREGL_FASTPATH_FUNC_BEGIN();
6585 INIT_FASTPATH_GL_FUNC();
6587 if (GET_REAL_OBJ(GL_OBJECT_TYPE_PROGRAM, program, &real_obj) != 1)
6589 _set_gl_error(GL_INVALID_VALUE);
6593 _orig_fastpath_glProgramUniformMatrix3fv(real_obj, location, count, transpose, value);
6598 _COREGL_FASTPATH_FUNC_END();
6603 fastpath_glProgramUniformMatrix4fv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
6607 DEFINE_FASTPAH_GL_FUNC();
6608 _COREGL_FASTPATH_FUNC_BEGIN();
6609 INIT_FASTPATH_GL_FUNC();
6611 if (GET_REAL_OBJ(GL_OBJECT_TYPE_PROGRAM, program, &real_obj) != 1)
6613 _set_gl_error(GL_INVALID_VALUE);
6617 _orig_fastpath_glProgramUniformMatrix4fv(real_obj, location, count, transpose, value);
6622 _COREGL_FASTPATH_FUNC_END();
6627 fastpath_glProgramUniform1i(GLuint program, GLint location, GLint x)
6631 DEFINE_FASTPAH_GL_FUNC();
6632 _COREGL_FASTPATH_FUNC_BEGIN();
6633 INIT_FASTPATH_GL_FUNC();
6635 if (GET_REAL_OBJ(GL_OBJECT_TYPE_PROGRAM, program, &real_obj) != 1)
6637 _set_gl_error(GL_INVALID_VALUE);
6641 _orig_fastpath_glProgramUniform1i(real_obj, location, x);
6646 _COREGL_FASTPATH_FUNC_END();
6651 fastpath_glProgramUniform2i(GLuint program, GLint location, GLint x, GLint y)
6655 DEFINE_FASTPAH_GL_FUNC();
6656 _COREGL_FASTPATH_FUNC_BEGIN();
6657 INIT_FASTPATH_GL_FUNC();
6659 if (GET_REAL_OBJ(GL_OBJECT_TYPE_PROGRAM, program, &real_obj) != 1)
6661 _set_gl_error(GL_INVALID_VALUE);
6665 _orig_fastpath_glProgramUniform2i(real_obj, location, x, y);
6670 _COREGL_FASTPATH_FUNC_END();
6675 fastpath_glProgramUniform3i(GLuint program, GLint location, GLint x, GLint y, GLint z)
6679 DEFINE_FASTPAH_GL_FUNC();
6680 _COREGL_FASTPATH_FUNC_BEGIN();
6681 INIT_FASTPATH_GL_FUNC();
6683 if (GET_REAL_OBJ(GL_OBJECT_TYPE_PROGRAM, program, &real_obj) != 1)
6685 _set_gl_error(GL_INVALID_VALUE);
6689 _orig_fastpath_glProgramUniform3i(real_obj, location, x, y, z);
6694 _COREGL_FASTPATH_FUNC_END();
6699 fastpath_glProgramUniform4i(GLuint program, GLint location, GLint x, GLint y, GLint z, GLint w)
6703 DEFINE_FASTPAH_GL_FUNC();
6704 _COREGL_FASTPATH_FUNC_BEGIN();
6705 INIT_FASTPATH_GL_FUNC();
6707 if (GET_REAL_OBJ(GL_OBJECT_TYPE_PROGRAM, program, &real_obj) != 1)
6709 _set_gl_error(GL_INVALID_VALUE);
6713 _orig_fastpath_glProgramUniform4i(real_obj, location, x, y, z, w);
6718 _COREGL_FASTPATH_FUNC_END();
6723 fastpath_glProgramUniform1f(GLuint program, GLint location, GLfloat x)
6727 DEFINE_FASTPAH_GL_FUNC();
6728 _COREGL_FASTPATH_FUNC_BEGIN();
6729 INIT_FASTPATH_GL_FUNC();
6731 if (GET_REAL_OBJ(GL_OBJECT_TYPE_PROGRAM, program, &real_obj) != 1)
6733 _set_gl_error(GL_INVALID_VALUE);
6737 _orig_fastpath_glProgramUniform1f(real_obj, location, x);
6742 _COREGL_FASTPATH_FUNC_END();
6747 fastpath_glProgramUniform2f(GLuint program, GLint location, GLfloat x, GLfloat y)
6751 DEFINE_FASTPAH_GL_FUNC();
6752 _COREGL_FASTPATH_FUNC_BEGIN();
6753 INIT_FASTPATH_GL_FUNC();
6755 if (GET_REAL_OBJ(GL_OBJECT_TYPE_PROGRAM, program, &real_obj) != 1)
6757 _set_gl_error(GL_INVALID_VALUE);
6761 _orig_fastpath_glProgramUniform2f(real_obj, location, x, y);
6766 _COREGL_FASTPATH_FUNC_END();
6771 fastpath_glProgramUniform3f(GLuint program, GLint location, GLfloat x, GLfloat y, GLfloat z)
6775 DEFINE_FASTPAH_GL_FUNC();
6776 _COREGL_FASTPATH_FUNC_BEGIN();
6777 INIT_FASTPATH_GL_FUNC();
6779 if (GET_REAL_OBJ(GL_OBJECT_TYPE_PROGRAM, program, &real_obj) != 1)
6781 _set_gl_error(GL_INVALID_VALUE);
6785 _orig_fastpath_glProgramUniform3f(real_obj, location, x, y, z);
6790 _COREGL_FASTPATH_FUNC_END();
6795 fastpath_glProgramUniform4f(GLuint program, GLint location, GLfloat x, GLfloat y, GLfloat z, GLfloat w)
6799 DEFINE_FASTPAH_GL_FUNC();
6800 _COREGL_FASTPATH_FUNC_BEGIN();
6801 INIT_FASTPATH_GL_FUNC();
6803 if (GET_REAL_OBJ(GL_OBJECT_TYPE_PROGRAM, program, &real_obj) != 1)
6805 _set_gl_error(GL_INVALID_VALUE);
6809 _orig_fastpath_glProgramUniform4f(real_obj, location, x, y, z, w);
6814 _COREGL_FASTPATH_FUNC_END();
6818 fastpath_glProgramUniform1ui(GLuint program, GLint location, GLuint x)
6822 DEFINE_FASTPAH_GL_FUNC();
6823 _COREGL_FASTPATH_FUNC_BEGIN();
6824 INIT_FASTPATH_GL_FUNC();
6826 if (GET_REAL_OBJ(GL_OBJECT_TYPE_PROGRAM, program, &real_obj) != 1)
6828 _set_gl_error(GL_INVALID_VALUE);
6832 _orig_fastpath_glProgramUniform1ui(real_obj, location, x);
6837 _COREGL_FASTPATH_FUNC_END();
6842 fastpath_glProgramUniform2ui(GLuint program, GLint location, GLuint x, GLuint y)
6846 DEFINE_FASTPAH_GL_FUNC();
6847 _COREGL_FASTPATH_FUNC_BEGIN();
6848 INIT_FASTPATH_GL_FUNC();
6850 if (GET_REAL_OBJ(GL_OBJECT_TYPE_PROGRAM, program, &real_obj) != 1)
6852 _set_gl_error(GL_INVALID_VALUE);
6856 _orig_fastpath_glProgramUniform2ui(real_obj, location, x, y);
6861 _COREGL_FASTPATH_FUNC_END();
6866 fastpath_glProgramUniform3ui(GLuint program, GLint location, GLuint x, GLuint y, GLuint z)
6870 DEFINE_FASTPAH_GL_FUNC();
6871 _COREGL_FASTPATH_FUNC_BEGIN();
6872 INIT_FASTPATH_GL_FUNC();
6874 if (GET_REAL_OBJ(GL_OBJECT_TYPE_PROGRAM, program, &real_obj) != 1)
6876 _set_gl_error(GL_INVALID_VALUE);
6880 _orig_fastpath_glProgramUniform3ui(real_obj, location, x, y, z);
6885 _COREGL_FASTPATH_FUNC_END();
6890 fastpath_glProgramUniform4ui(GLuint program, GLint location, GLuint x, GLuint y, GLuint z, GLuint w)
6894 DEFINE_FASTPAH_GL_FUNC();
6895 _COREGL_FASTPATH_FUNC_BEGIN();
6896 INIT_FASTPATH_GL_FUNC();
6898 if (GET_REAL_OBJ(GL_OBJECT_TYPE_PROGRAM, program, &real_obj) != 1)
6900 _set_gl_error(GL_INVALID_VALUE);
6904 _orig_fastpath_glProgramUniform4ui(real_obj, location, x, y, z, w);
6909 _COREGL_FASTPATH_FUNC_END();
6913 fastpath_glProgramUniform1uiv(GLuint program, GLint location, GLsizei count, const GLuint *value)
6917 DEFINE_FASTPAH_GL_FUNC();
6918 _COREGL_FASTPATH_FUNC_BEGIN();
6919 INIT_FASTPATH_GL_FUNC();
6921 if (GET_REAL_OBJ(GL_OBJECT_TYPE_PROGRAM, program, &real_obj) != 1)
6923 _set_gl_error(GL_INVALID_VALUE);
6927 _orig_fastpath_glProgramUniform1uiv(real_obj, location, count, value);
6932 _COREGL_FASTPATH_FUNC_END();
6937 fastpath_glProgramUniform2uiv(GLuint program, GLint location, GLsizei count, const GLuint *value)
6941 DEFINE_FASTPAH_GL_FUNC();
6942 _COREGL_FASTPATH_FUNC_BEGIN();
6943 INIT_FASTPATH_GL_FUNC();
6945 if (GET_REAL_OBJ(GL_OBJECT_TYPE_PROGRAM, program, &real_obj) != 1)
6947 _set_gl_error(GL_INVALID_VALUE);
6951 _orig_fastpath_glProgramUniform2uiv(real_obj, location, count, value);
6956 _COREGL_FASTPATH_FUNC_END();
6961 fastpath_glProgramUniform3uiv(GLuint program, GLint location, GLsizei count, const GLuint *value)
6965 DEFINE_FASTPAH_GL_FUNC();
6966 _COREGL_FASTPATH_FUNC_BEGIN();
6967 INIT_FASTPATH_GL_FUNC();
6969 if (GET_REAL_OBJ(GL_OBJECT_TYPE_PROGRAM, program, &real_obj) != 1)
6971 _set_gl_error(GL_INVALID_VALUE);
6975 _orig_fastpath_glProgramUniform3uiv(real_obj, location, count, value);
6980 _COREGL_FASTPATH_FUNC_END();
6985 fastpath_glProgramUniform4uiv(GLuint program, GLint location, GLsizei count, const GLuint *value)
6989 DEFINE_FASTPAH_GL_FUNC();
6990 _COREGL_FASTPATH_FUNC_BEGIN();
6991 INIT_FASTPATH_GL_FUNC();
6993 if (GET_REAL_OBJ(GL_OBJECT_TYPE_PROGRAM, program, &real_obj) != 1)
6995 _set_gl_error(GL_INVALID_VALUE);
6999 _orig_fastpath_glProgramUniform4uiv(real_obj, location, count, value);
7004 _COREGL_FASTPATH_FUNC_END();
7008 fastpath_glProgramUniformMatrix2x3fv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
7012 DEFINE_FASTPAH_GL_FUNC();
7013 _COREGL_FASTPATH_FUNC_BEGIN();
7014 INIT_FASTPATH_GL_FUNC();
7016 if (GET_REAL_OBJ(GL_OBJECT_TYPE_PROGRAM, program, &real_obj) != 1)
7018 _set_gl_error(GL_INVALID_VALUE);
7022 _orig_fastpath_glProgramUniformMatrix2x3fv(real_obj, location, count, transpose, value);
7027 _COREGL_FASTPATH_FUNC_END();
7032 fastpath_glProgramUniformMatrix3x2fv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
7036 DEFINE_FASTPAH_GL_FUNC();
7037 _COREGL_FASTPATH_FUNC_BEGIN();
7038 INIT_FASTPATH_GL_FUNC();
7040 if (GET_REAL_OBJ(GL_OBJECT_TYPE_PROGRAM, program, &real_obj) != 1)
7042 _set_gl_error(GL_INVALID_VALUE);
7046 _orig_fastpath_glProgramUniformMatrix3x2fv(real_obj, location, count, transpose, value);
7051 _COREGL_FASTPATH_FUNC_END();
7056 fastpath_glProgramUniformMatrix4x2fv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
7060 DEFINE_FASTPAH_GL_FUNC();
7061 _COREGL_FASTPATH_FUNC_BEGIN();
7062 INIT_FASTPATH_GL_FUNC();
7064 if (GET_REAL_OBJ(GL_OBJECT_TYPE_PROGRAM, program, &real_obj) != 1)
7066 _set_gl_error(GL_INVALID_VALUE);
7070 _orig_fastpath_glProgramUniformMatrix4x2fv(real_obj, location, count, transpose, value);
7075 _COREGL_FASTPATH_FUNC_END();
7079 fastpath_glProgramUniformMatrix2x4fv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
7083 DEFINE_FASTPAH_GL_FUNC();
7084 _COREGL_FASTPATH_FUNC_BEGIN();
7085 INIT_FASTPATH_GL_FUNC();
7087 if (GET_REAL_OBJ(GL_OBJECT_TYPE_PROGRAM, program, &real_obj) != 1)
7089 _set_gl_error(GL_INVALID_VALUE);
7093 _orig_fastpath_glProgramUniformMatrix2x4fv(real_obj, location, count, transpose, value);
7098 _COREGL_FASTPATH_FUNC_END();
7103 fastpath_glProgramUniformMatrix3x4fv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
7107 DEFINE_FASTPAH_GL_FUNC();
7108 _COREGL_FASTPATH_FUNC_BEGIN();
7109 INIT_FASTPATH_GL_FUNC();
7111 if (GET_REAL_OBJ(GL_OBJECT_TYPE_PROGRAM, program, &real_obj) != 1)
7113 _set_gl_error(GL_INVALID_VALUE);
7117 _orig_fastpath_glProgramUniformMatrix3x4fv(real_obj, location, count, transpose, value);
7122 _COREGL_FASTPATH_FUNC_END();
7127 fastpath_glProgramUniformMatrix4x3fv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
7131 DEFINE_FASTPAH_GL_FUNC();
7132 _COREGL_FASTPATH_FUNC_BEGIN();
7133 INIT_FASTPATH_GL_FUNC();
7135 if (GET_REAL_OBJ(GL_OBJECT_TYPE_PROGRAM, program, &real_obj) != 1)
7137 _set_gl_error(GL_INVALID_VALUE);
7141 _orig_fastpath_glProgramUniformMatrix4x3fv(real_obj, location, count, transpose, value);
7146 _COREGL_FASTPATH_FUNC_END();
7150 fastpath_glBindImageTexture(GLuint unit, GLuint texture, GLint level, GLboolean layered, GLint layer, GLenum access, GLenum format)
7152 DEFINE_FASTPAH_GL_FUNC();
7153 _COREGL_FASTPATH_FUNC_BEGIN();
7154 INIT_FASTPATH_GL_FUNC();
7156 _orig_fastpath_glBindImageTexture(unit, texture, level, layered, layer, access, format);
7161 _COREGL_FASTPATH_FUNC_END();
7165 fastpath_glGetBooleani_v (GLenum target, GLuint index, GLboolean *data)
7167 DEFINE_FASTPAH_GL_FUNC();
7168 _COREGL_FASTPATH_FUNC_BEGIN();
7169 INIT_FASTPATH_GL_FUNC();
7171 IF_GL_SUCCESS(_orig_fastpath_glGetBooleani_v(target, index, data))
7173 _modify_get_value(target, data, GL_BOOL, GL_FALSE);
7179 _COREGL_FASTPATH_FUNC_END();
7183 fastpath_glMemoryBarrier (GLbitfield barriers)
7185 DEFINE_FASTPAH_GL_FUNC();
7186 _COREGL_FASTPATH_FUNC_BEGIN();
7187 INIT_FASTPATH_GL_FUNC();
7189 _orig_fastpath_glMemoryBarrier(barriers);
7194 _COREGL_FASTPATH_FUNC_END();
7198 fastpath_glMemoryBarrierByRegion (GLbitfield barriers)
7200 DEFINE_FASTPAH_GL_FUNC();
7201 _COREGL_FASTPATH_FUNC_BEGIN();
7202 INIT_FASTPATH_GL_FUNC();
7204 _orig_fastpath_glMemoryBarrierByRegion(barriers);
7209 _COREGL_FASTPATH_FUNC_END();
7213 fastpath_glTexStorage2DMultisample (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLboolean fixedsamplelocations)
7215 DEFINE_FASTPAH_GL_FUNC();
7216 _COREGL_FASTPATH_FUNC_BEGIN();
7217 INIT_FASTPATH_GL_FUNC();
7219 _orig_fastpath_glTexStorage2DMultisample (target, samples, internalformat, width, height, fixedsamplelocations);
7224 _COREGL_FASTPATH_FUNC_END();
7228 fastpath_glGetMultisamplefv (GLenum pname, GLuint index, GLfloat *val)
7230 DEFINE_FASTPAH_GL_FUNC();
7231 _COREGL_FASTPATH_FUNC_BEGIN();
7232 INIT_FASTPATH_GL_FUNC();
7234 _orig_fastpath_glGetMultisamplefv (pname, index, val);
7239 _COREGL_FASTPATH_FUNC_END();
7243 fastpath_glSampleMaski (GLuint maskNumber, GLbitfield mask)
7245 DEFINE_FASTPAH_GL_FUNC();
7246 _COREGL_FASTPATH_FUNC_BEGIN();
7247 INIT_FASTPATH_GL_FUNC();
7249 _orig_fastpath_glSampleMaski(maskNumber, mask);
7254 _COREGL_FASTPATH_FUNC_END();
7258 fastpath_glGetTexLevelParameteriv (GLenum target, GLint level, GLenum pname, GLint *params)
7260 DEFINE_FASTPAH_GL_FUNC();
7261 _COREGL_FASTPATH_FUNC_BEGIN();
7262 INIT_FASTPATH_GL_FUNC();
7264 _orig_fastpath_glGetTexLevelParameteriv (target, level, pname, params);
7269 _COREGL_FASTPATH_FUNC_END();
7273 fastpath_glGetTexLevelParameterfv (GLenum target, GLint level, GLenum pname, GLfloat *params)
7275 DEFINE_FASTPAH_GL_FUNC();
7276 _COREGL_FASTPATH_FUNC_BEGIN();
7277 INIT_FASTPATH_GL_FUNC();
7279 _orig_fastpath_glGetTexLevelParameterfv (target, level, pname, params);
7284 _COREGL_FASTPATH_FUNC_END();
7288 fastpath_glBindVertexBuffer (GLuint bindingindex, GLuint buffer, GLintptr offset, GLsizei stride)
7290 DEFINE_FASTPAH_GL_FUNC();
7291 _COREGL_FASTPATH_FUNC_BEGIN();
7292 INIT_FASTPATH_GL_FUNC();
7294 _orig_fastpath_glBindVertexBuffer(bindingindex, buffer, offset, stride);
7299 _COREGL_FASTPATH_FUNC_END();
7304 fastpath_glVertexAttribFormat (GLuint attribindex, GLint size, GLenum type, GLboolean normalized, GLuint relativeoffset)
7306 DEFINE_FASTPAH_GL_FUNC();
7307 _COREGL_FASTPATH_FUNC_BEGIN();
7308 INIT_FASTPATH_GL_FUNC();
7310 _orig_fastpath_glVertexAttribFormat (attribindex, size, type, normalized, relativeoffset);
7315 _COREGL_FASTPATH_FUNC_END();
7319 fastpath_glVertexAttribIFormat (GLuint attribindex, GLint size, GLenum type, GLuint relativeoffset)
7321 DEFINE_FASTPAH_GL_FUNC();
7322 _COREGL_FASTPATH_FUNC_BEGIN();
7323 INIT_FASTPATH_GL_FUNC();
7325 _orig_fastpath_glVertexAttribIFormat (attribindex, size, type, relativeoffset);
7330 _COREGL_FASTPATH_FUNC_END();
7334 fastpath_glVertexAttribBinding (GLuint attribindex, GLuint bindingindex)
7336 DEFINE_FASTPAH_GL_FUNC();
7337 _COREGL_FASTPATH_FUNC_BEGIN();
7338 INIT_FASTPATH_GL_FUNC();
7340 _orig_fastpath_glVertexAttribBinding (attribindex, bindingindex);
7345 _COREGL_FASTPATH_FUNC_END();
7349 fastpath_glVertexBindingDivisor(GLuint bindingindex, GLuint divisor)
7351 DEFINE_FASTPAH_GL_FUNC();
7352 _COREGL_FASTPATH_FUNC_BEGIN();
7353 INIT_FASTPATH_GL_FUNC();
7355 _orig_fastpath_glVertexBindingDivisor (bindingindex, divisor);
7360 _COREGL_FASTPATH_FUNC_END();
7363 fastpath_glBindFramebufferOES(GLenum target, GLuint framebuffer)
7367 DEFINE_FASTPAH_GL_FUNC();
7368 _COREGL_FASTPATH_FUNC_BEGIN();
7369 INIT_FASTPATH_GL_FUNC();
7371 if (GET_REAL_OBJ(GL_OBJECT_TYPE_FRAMEBUFFER, framebuffer, &real_obj) != 1)
7373 _set_gl_error(GL_OUT_OF_MEMORY);
7377 if (target == GL_FRAMEBUFFER)
7379 if (current_ctx->gl_framebuffer_binding_read_used == 1)
7381 CURR_STATE_COMPARE(gl_framebuffer_binding_read, real_obj)
7383 IF_GL_SUCCESS(_orig_fastpath_glBindFramebufferOES(target, real_obj))
7386 current_ctx->_bind_flag1 &= (~_BIND_FLAG1_BIT_gl_framebuffer_binding_read);
7388 current_ctx->_bind_flag1 |= _BIND_FLAG1_BIT_gl_framebuffer_binding_read;
7389 current_ctx->gl_framebuffer_binding_read[0] = real_obj;
7392 CURR_STATE_COMPARE(gl_framebuffer_binding_draw, real_obj)
7394 IF_GL_SUCCESS(_orig_fastpath_glBindFramebufferOES(target, real_obj))
7397 current_ctx->_bind_flag1 &= (~_BIND_FLAG1_BIT_gl_framebuffer_binding_draw);
7399 current_ctx->_bind_flag1 |= _BIND_FLAG1_BIT_gl_framebuffer_binding_draw;
7400 current_ctx->gl_framebuffer_binding_draw[0] = real_obj;
7406 CURR_STATE_COMPARE(gl_framebuffer_binding, real_obj)
7408 IF_GL_SUCCESS(_orig_fastpath_glBindFramebufferOES(target, real_obj))
7411 current_ctx->_bind_flag1 &= (~_BIND_FLAG1_BIT_gl_framebuffer_binding);
7413 current_ctx->_bind_flag1 |= _BIND_FLAG1_BIT_gl_framebuffer_binding;
7414 current_ctx->gl_framebuffer_binding[0] = real_obj;
7419 else if (target == GL_READ_FRAMEBUFFER && current_ctx->gl_framebuffer_binding_read_used)
7421 CURR_STATE_COMPARE(gl_framebuffer_binding_read, real_obj)
7423 IF_GL_SUCCESS(_orig_fastpath_glBindFramebufferOES(target, real_obj))
7426 current_ctx->_bind_flag1 &= (~_BIND_FLAG1_BIT_gl_framebuffer_binding_read);
7428 current_ctx->_bind_flag1 |= _BIND_FLAG1_BIT_gl_framebuffer_binding_read;
7429 current_ctx->gl_framebuffer_binding_read[0] = real_obj;
7433 else if (target == GL_DRAW_FRAMEBUFFER && current_ctx->gl_framebuffer_binding_draw_used)
7435 CURR_STATE_COMPARE(gl_framebuffer_binding_draw, real_obj)
7437 IF_GL_SUCCESS(_orig_fastpath_glBindFramebufferOES(target, real_obj))
7440 current_ctx->_bind_flag1 &= (~_BIND_FLAG1_BIT_gl_framebuffer_binding_draw);
7442 current_ctx->_bind_flag1 |= _BIND_FLAG1_BIT_gl_framebuffer_binding_draw;
7443 current_ctx->gl_framebuffer_binding_draw[0] = real_obj;
7449 _set_gl_error(GL_INVALID_ENUM);
7455 _COREGL_FASTPATH_FUNC_END();
7459 fastpath_glBindRenderbufferOES(GLenum target, GLuint renderbuffer)
7463 DEFINE_FASTPAH_GL_FUNC();
7464 _COREGL_FASTPATH_FUNC_BEGIN();
7465 INIT_FASTPATH_GL_FUNC();
7467 if (GET_REAL_OBJ(GL_OBJECT_TYPE_RENDERBUFFER, renderbuffer, &real_obj) != 1)
7469 _set_gl_error(GL_OUT_OF_MEMORY);
7473 if (target == GL_RENDERBUFFER)
7475 CURR_STATE_COMPARE(gl_renderbuffer_binding, real_obj)
7477 IF_GL_SUCCESS(_orig_fastpath_glBindRenderbufferOES(target, real_obj))
7480 current_ctx->_bind_flag1 &= (~_BIND_FLAG1_BIT_gl_renderbuffer_binding);
7482 current_ctx->_bind_flag1 |= _BIND_FLAG1_BIT_gl_renderbuffer_binding;
7483 current_ctx->gl_renderbuffer_binding[0] = real_obj;
7489 _set_gl_error(GL_INVALID_ENUM);
7496 _COREGL_FASTPATH_FUNC_END();
7501 fastpath_glClearBufferfi(GLenum buffer, GLint drawbuffer, GLfloat depth, GLint stencil)
7505 DEFINE_FASTPAH_GL_FUNC();
7506 _COREGL_FASTPATH_FUNC_BEGIN();
7507 INIT_FASTPATH_GL_FUNC();
7509 if (GET_REAL_OBJ(GL_OBJECT_TYPE_BUFFER, buffer, &real_obj) != 1)
7514 _orig_fastpath_glClearBufferfi(real_obj, drawbuffer, depth, stencil);
7519 _COREGL_FASTPATH_FUNC_END();
7523 fastpath_glClearBufferfv(GLenum buffer, GLint drawbuffer, GLfloat const *value)
7527 DEFINE_FASTPAH_GL_FUNC();
7528 _COREGL_FASTPATH_FUNC_BEGIN();
7529 INIT_FASTPATH_GL_FUNC();
7531 if (GET_REAL_OBJ(GL_OBJECT_TYPE_BUFFER, buffer, &real_obj) != 1)
7536 _orig_fastpath_glClearBufferfv(buffer, drawbuffer, value);
7541 _COREGL_FASTPATH_FUNC_END();
7545 fastpath_glClearBufferiv(GLenum buffer, GLint drawbuffer, GLint const *value)
7549 DEFINE_FASTPAH_GL_FUNC();
7550 _COREGL_FASTPATH_FUNC_BEGIN();
7551 INIT_FASTPATH_GL_FUNC();
7553 if (GET_REAL_OBJ(GL_OBJECT_TYPE_BUFFER, buffer, &real_obj) != 1)
7558 _orig_fastpath_glClearBufferiv(buffer, drawbuffer, value);
7563 _COREGL_FASTPATH_FUNC_END();
7567 fastpath_glClearBufferuiv(GLenum buffer, GLint drawbuffer, GLuint const *value)
7571 DEFINE_FASTPAH_GL_FUNC();
7572 _COREGL_FASTPATH_FUNC_BEGIN();
7573 INIT_FASTPATH_GL_FUNC();
7575 if (GET_REAL_OBJ(GL_OBJECT_TYPE_BUFFER, buffer, &real_obj) != 1)
7580 _orig_fastpath_glClearBufferuiv(buffer, drawbuffer, value);
7585 _COREGL_FASTPATH_FUNC_END();
7589 fastpath_glDeleteFramebuffersOES(GLsizei n, const GLuint* framebuffers)
7592 GLuint *objid_array = NULL;
7594 DEFINE_FASTPAH_GL_FUNC();
7595 _COREGL_FASTPATH_FUNC_BEGIN();
7596 INIT_FASTPATH_GL_FUNC();
7600 _set_gl_error(GL_INVALID_VALUE);
7603 if (n == 0) goto finish;
7604 if (framebuffers == NULL) goto finish;
7606 AST(current_ctx->ostate.shared != NULL);
7608 objid_array = (GLuint *)calloc(1, sizeof(GLuint) * n);
7612 for (i = 0; i < n; i++)
7614 int real_objid = _COREGL_INT_INIT_VALUE;
7615 if (framebuffers[i] == 0) continue;
7617 real_objid = fastpath_ostate_get_object(¤t_ctx->ostate, GL_OBJECT_TYPE_FRAMEBUFFER, framebuffers[i]);
7618 if (real_objid == 0) continue;
7620 AST(fastpath_ostate_remove_object(¤t_ctx->ostate, GL_OBJECT_TYPE_FRAMEBUFFER, framebuffers[i]) == 1);
7621 objid_array[real_n++] = real_objid;
7624 IF_GL_SUCCESS(_orig_fastpath_glDeleteFramebuffersOES(real_n, objid_array))
7626 for (i = 0; i < real_n; i++)
7628 General_Trace_List *current = NULL;
7629 current = current_ctx->ostate.shared->using_gctxs;
7631 while (current != NULL)
7633 GLGlueContext *cur_gctx = (GLGlueContext *)current->value;
7635 if (cur_gctx->gl_framebuffer_binding[0] == objid_array[i])
7637 cur_gctx->_bind_flag1 &= (~_BIND_FLAG1_BIT_gl_framebuffer_binding);
7638 cur_gctx->gl_framebuffer_binding[0] = 0;
7640 if (cur_gctx->gl_framebuffer_binding_read[0] == objid_array[i])
7642 cur_gctx->_bind_flag1 &= (~_BIND_FLAG1_BIT_gl_framebuffer_binding_read);
7643 cur_gctx->gl_framebuffer_binding_read[0] = 0;
7645 if (cur_gctx->gl_framebuffer_binding_draw[0] == objid_array[i])
7647 cur_gctx->_bind_flag1 &= (~_BIND_FLAG1_BIT_gl_framebuffer_binding_draw);
7648 cur_gctx->gl_framebuffer_binding_draw[0] = 0;
7651 current = current->next;
7660 if (objid_array != NULL)
7665 _COREGL_FASTPATH_FUNC_END();
7669 fastpath_glDeleteRenderbuffersOES(GLsizei n, const GLuint* renderbuffers)
7672 GLuint *objid_array = NULL;
7674 DEFINE_FASTPAH_GL_FUNC();
7675 _COREGL_FASTPATH_FUNC_BEGIN();
7676 INIT_FASTPATH_GL_FUNC();
7680 _set_gl_error(GL_INVALID_VALUE);
7683 if (n == 0) goto finish;
7684 if (renderbuffers == NULL) goto finish;
7686 AST(current_ctx->ostate.shared != NULL);
7688 objid_array = (GLuint *)calloc(1, sizeof(GLuint) * n);
7692 for (i = 0; i < n; i++)
7694 int real_objid = _COREGL_INT_INIT_VALUE;
7695 if (renderbuffers[i] == 0) continue;
7697 real_objid = fastpath_ostate_get_object(¤t_ctx->ostate, GL_OBJECT_TYPE_RENDERBUFFER, renderbuffers[i]);
7698 if (real_objid == 0) continue;
7700 AST(fastpath_ostate_remove_object(¤t_ctx->ostate, GL_OBJECT_TYPE_RENDERBUFFER, renderbuffers[i]) == 1);
7701 objid_array[real_n++] = real_objid;
7704 IF_GL_SUCCESS(_orig_fastpath_glDeleteRenderbuffersOES(real_n, objid_array))
7706 for (i = 0; i < real_n; i++)
7708 General_Trace_List *current = NULL;
7709 current = current_ctx->ostate.shared->using_gctxs;
7711 while (current != NULL)
7713 GLGlueContext *cur_gctx = (GLGlueContext *)current->value;
7715 if (cur_gctx->gl_renderbuffer_binding[0] == objid_array[i])
7717 cur_gctx->_bind_flag1 &= (~_BIND_FLAG1_BIT_gl_renderbuffer_binding);
7718 cur_gctx->gl_renderbuffer_binding[0] = 0;
7721 current = current->next;
7730 if (objid_array != NULL)
7735 _COREGL_FASTPATH_FUNC_END();
7739 fastpath_glDepthRangefOES(GLclampf zNear, GLclampf zFar)
7741 DEFINE_FASTPAH_GL_FUNC();
7742 _COREGL_FASTPATH_FUNC_BEGIN();
7743 INIT_FASTPATH_GL_FUNC();
7745 if ((current_ctx->gl_depth_range[0] != zNear) ||
7746 (current_ctx->gl_depth_range[1] != zFar))
7748 IF_GL_SUCCESS(_orig_fastpath_glDepthRangefOES(zNear, zFar))
7750 current_ctx->_clear_flag2 |= _CLEAR_FLAG2_BIT_gl_depth_range;
7751 current_ctx->gl_depth_range[0] = zNear;
7752 current_ctx->gl_depth_range[1] = zFar;
7758 _COREGL_FASTPATH_FUNC_END();
7762 fastpath_glDepthRangexOES(GLclampx zNear, GLclampx zFar)
7764 DEFINE_FASTPAH_GL_FUNC();
7765 _COREGL_FASTPATH_FUNC_BEGIN();
7766 INIT_FASTPATH_GL_FUNC();
7768 if ((current_ctx->gl_depth_range[0] != zNear) ||
7769 (current_ctx->gl_depth_range[1] != zFar))
7771 IF_GL_SUCCESS(_orig_fastpath_glDepthRangexOES(zNear, zFar))
7773 current_ctx->_clear_flag2 |= _CLEAR_FLAG2_BIT_gl_depth_range;
7774 current_ctx->gl_depth_range[0] = zNear;
7775 current_ctx->gl_depth_range[1] = zFar;
7781 _COREGL_FASTPATH_FUNC_END();
7785 fastpath_glFramebufferParameteri(GLenum target, GLenum pname, GLint param)
7787 GLint real_obj = 0, fa_type = 0;
7789 DEFINE_FASTPAH_GL_FUNC();
7790 _COREGL_FASTPATH_FUNC_BEGIN();
7791 INIT_FASTPATH_GL_FUNC();
7795 case GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME:
7797 _orig_fastpath_glFramebufferParameteri(target, pname, real_obj);
7798 _orig_fastpath_glFramebufferParameteri(target, GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE, fa_type);
7802 if (GET_GLUE_OBJ(GL_OBJECT_TYPE_TEXTURE, real_obj, (GLuint *)¶m) != 1)
7808 case GL_RENDERBUFFER:
7809 if (GET_GLUE_OBJ(GL_OBJECT_TYPE_RENDERBUFFER, real_obj, (GLuint *)¶m) != 1)
7818 _orig_fastpath_glFramebufferParameteri(target, pname, param);
7825 _COREGL_FASTPATH_FUNC_END();
7829 fastpath_glGetFramebufferParameteriv(GLenum target, GLenum pname, GLint *params)
7831 GLint real_obj = 0, fa_type = 0;;
7833 DEFINE_FASTPAH_GL_FUNC();
7834 _COREGL_FASTPATH_FUNC_BEGIN();
7835 INIT_FASTPATH_GL_FUNC();
7839 case GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME:
7841 _orig_fastpath_glGetFramebufferParameteriv(target, pname, &real_obj);
7842 _orig_fastpath_glGetFramebufferParameteriv(target, GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE, &fa_type);
7846 if (GET_GLUE_OBJ(GL_OBJECT_TYPE_TEXTURE, real_obj, (GLuint *)params) != 1)
7852 case GL_RENDERBUFFER:
7853 if (GET_GLUE_OBJ(GL_OBJECT_TYPE_RENDERBUFFER, real_obj, (GLuint *)params) != 1)
7862 _orig_fastpath_glGetFramebufferParameteriv(target, pname, params);
7869 _COREGL_FASTPATH_FUNC_END();
7873 fastpath_glFramebufferRenderbufferOES(GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer)
7877 DEFINE_FASTPAH_GL_FUNC();
7878 _COREGL_FASTPATH_FUNC_BEGIN();
7879 INIT_FASTPATH_GL_FUNC();
7881 if (GET_REAL_OBJ(GL_OBJECT_TYPE_RENDERBUFFER, renderbuffer, &real_obj) != 1)
7883 _set_gl_error(GL_OUT_OF_MEMORY);
7887 _orig_fastpath_glFramebufferRenderbufferOES(target, attachment, renderbuffertarget, real_obj);
7892 _COREGL_FASTPATH_FUNC_END();
7896 fastpath_glFramebufferTexture2DOES(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level)
7900 DEFINE_FASTPAH_GL_FUNC();
7901 _COREGL_FASTPATH_FUNC_BEGIN();
7902 INIT_FASTPATH_GL_FUNC();
7904 if (GET_REAL_OBJ(GL_OBJECT_TYPE_TEXTURE, texture, &real_obj) != 1)
7906 _set_gl_error(GL_OUT_OF_MEMORY);
7910 _orig_fastpath_glFramebufferTexture2DOES(target, attachment, textarget, real_obj, level);
7915 _COREGL_FASTPATH_FUNC_END();
7919 fastpath_glGenFramebuffersOES(GLsizei n, GLuint* framebuffers)
7922 GLuint *objid_array = NULL;
7924 DEFINE_FASTPAH_GL_FUNC();
7925 _COREGL_FASTPATH_FUNC_BEGIN();
7926 INIT_FASTPATH_GL_FUNC();
7930 _set_gl_error(GL_INVALID_VALUE);
7933 if (n == 0) goto finish;
7934 if (framebuffers == NULL) goto finish;
7936 AST(current_ctx->ostate.shared != NULL);
7938 objid_array = (GLuint *)calloc(1, sizeof(GLuint) * n);
7940 IF_GL_SUCCESS(_orig_fastpath_glGenFramebuffersOES(n, objid_array))
7942 for (i = 0; i < n; i++)
7944 framebuffers[i] = fastpath_ostate_create_object(¤t_ctx->ostate, GL_OBJECT_TYPE_FRAMEBUFFER, objid_array[i]);
7951 if (objid_array != NULL)
7956 _COREGL_FASTPATH_FUNC_END();
7960 fastpath_glGenRenderbuffersOES(GLsizei n, GLuint* renderbuffers)
7963 GLuint *objid_array = NULL;
7965 DEFINE_FASTPAH_GL_FUNC();
7966 _COREGL_FASTPATH_FUNC_BEGIN();
7967 INIT_FASTPATH_GL_FUNC();
7971 _set_gl_error(GL_INVALID_VALUE);
7974 if (n == 0) goto finish;
7975 if (renderbuffers == NULL) goto finish;
7977 AST(current_ctx->ostate.shared != NULL);
7979 objid_array = (GLuint *)calloc(1, sizeof(GLuint) * n);
7981 IF_GL_SUCCESS(_orig_fastpath_glGenRenderbuffersOES(n, objid_array))
7983 for (i = 0; i < n; i++)
7985 renderbuffers[i] = fastpath_ostate_create_object(¤t_ctx->ostate, GL_OBJECT_TYPE_RENDERBUFFER, objid_array[i]);
7992 if (objid_array != NULL)
7997 _COREGL_FASTPATH_FUNC_END();
8001 fastpath_glGetFramebufferAttachmentParameterivOES(GLenum target, GLenum attachment, GLenum pname, GLint *params)
8003 GLint real_obj, fa_type;
8005 DEFINE_FASTPAH_GL_FUNC();
8006 _COREGL_FASTPATH_FUNC_BEGIN();
8007 INIT_FASTPATH_GL_FUNC();
8011 case GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME:
8013 _orig_fastpath_glGetFramebufferAttachmentParameterivOES(target, attachment, pname, &real_obj);
8014 _orig_fastpath_glGetFramebufferAttachmentParameterivOES(target, attachment, GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE, &fa_type);
8018 if (GET_GLUE_OBJ(GL_OBJECT_TYPE_TEXTURE, real_obj, (GLuint *)params) != 1)
8024 case GL_RENDERBUFFER:
8025 if (GET_GLUE_OBJ(GL_OBJECT_TYPE_RENDERBUFFER, real_obj, (GLuint *)params) != 1)
8034 _orig_fastpath_glGetFramebufferAttachmentParameterivOES(target, attachment, pname, params);
8041 _COREGL_FASTPATH_FUNC_END();
8045 fastpath_glGetQueryObjecti64vEXT(GLuint id, GLenum pname, GLint64 *params)
8049 DEFINE_FASTPAH_GL_FUNC();
8050 _COREGL_FASTPATH_FUNC_BEGIN();
8051 INIT_FASTPATH_GL_FUNC();
8053 if (GET_REAL_OBJ(GL_OBJECT_TYPE_QUERY, id, &real_obj) != 1)
8055 _set_gl_error(GL_INVALID_OPERATION);
8059 _orig_fastpath_glGetQueryObjecti64vEXT(real_obj, pname, params);
8064 _COREGL_FASTPATH_FUNC_END();
8068 fastpath_glGetQueryObjectivEXT(GLuint id, GLenum pname, GLint *params)
8072 DEFINE_FASTPAH_GL_FUNC();
8073 _COREGL_FASTPATH_FUNC_BEGIN();
8074 INIT_FASTPATH_GL_FUNC();
8076 if (GET_REAL_OBJ(GL_OBJECT_TYPE_QUERY, id, &real_obj) != 1)
8078 _set_gl_error(GL_INVALID_OPERATION);
8082 _orig_fastpath_glGetQueryObjectivEXT(real_obj, pname, params);
8087 _COREGL_FASTPATH_FUNC_END();
8091 fastpath_glGetQueryObjectui64vEXT(GLuint id, GLenum pname, GLuint64 *params)
8095 DEFINE_FASTPAH_GL_FUNC();
8096 _COREGL_FASTPATH_FUNC_BEGIN();
8097 INIT_FASTPATH_GL_FUNC();
8099 if (GET_REAL_OBJ(GL_OBJECT_TYPE_QUERY, id, &real_obj) != 1)
8101 _set_gl_error(GL_INVALID_OPERATION);
8105 _orig_fastpath_glGetQueryObjectui64vEXT(real_obj, pname, params);
8110 _COREGL_FASTPATH_FUNC_END();
8114 fastpath_glGetQueryObjectuivEXT(GLuint id, GLenum pname, GLuint* params)
8118 DEFINE_FASTPAH_GL_FUNC();
8119 _COREGL_FASTPATH_FUNC_BEGIN();
8120 INIT_FASTPATH_GL_FUNC();
8122 if (GET_REAL_OBJ(GL_OBJECT_TYPE_QUERY, id, &real_obj) != 1)
8124 _set_gl_error(GL_INVALID_OPERATION);
8128 _orig_fastpath_glGetQueryObjectuivEXT(real_obj, pname, params);
8133 _COREGL_FASTPATH_FUNC_END();
8137 fastpath_glGetQueryivEXT(GLenum target, GLenum pname, GLint* params)
8139 GLuint glue_obj_id = _COREGL_INT_INIT_VALUE;
8141 DEFINE_FASTPAH_GL_FUNC();
8142 _COREGL_FASTPATH_FUNC_BEGIN();
8143 INIT_FASTPATH_GL_FUNC();
8145 _orig_fastpath_glGetQueryivEXT(target, pname, params);
8149 case GL_CURRENT_QUERY:
8152 AST(GET_GLUE_OBJ(GL_OBJECT_TYPE_QUERY, params[0], &glue_obj_id) == 1);
8153 params[0] = glue_obj_id;
8161 _COREGL_FASTPATH_FUNC_END();
8165 fastpath_glBeginQueryEXT(GLenum target, GLuint id)
8169 DEFINE_FASTPAH_GL_FUNC();
8170 _COREGL_FASTPATH_FUNC_BEGIN();
8171 INIT_FASTPATH_GL_FUNC();
8173 if (GET_REAL_OBJ(GL_OBJECT_TYPE_QUERY, id, &real_obj) != 1)
8175 // TODO : Begin - Context Switch
8176 _set_gl_error(GL_INVALID_OPERATION);
8180 _orig_fastpath_glBeginQueryEXT(target, real_obj);
8185 _COREGL_FASTPATH_FUNC_END();
8189 fastpath_glDeleteQueriesEXT(GLsizei n, const GLuint* ids)
8192 GLuint *objid_array = NULL;
8194 DEFINE_FASTPAH_GL_FUNC();
8195 _COREGL_FASTPATH_FUNC_BEGIN();
8196 INIT_FASTPATH_GL_FUNC();
8200 _set_gl_error(GL_INVALID_VALUE);
8203 if (n == 0) goto finish;
8204 if (ids == NULL) goto finish;
8206 AST(current_ctx->ostate.shared != NULL);
8208 objid_array = (GLuint *)calloc(1, sizeof(GLuint) * n);
8212 for (i = 0; i < n; i++)
8214 int real_objid = _COREGL_INT_INIT_VALUE;
8215 if (ids[i] == 0) continue;
8217 real_objid = fastpath_ostate_get_object(¤t_ctx->ostate, GL_OBJECT_TYPE_QUERY, ids[i]);
8218 if (real_objid == 0) continue;
8220 AST(fastpath_ostate_remove_object(¤t_ctx->ostate, GL_OBJECT_TYPE_QUERY, ids[i]) == 1);
8221 objid_array[real_n++] = real_objid;
8224 _orig_fastpath_glDeleteQueriesEXT(real_n, objid_array);
8230 if (objid_array != NULL)
8235 _COREGL_FASTPATH_FUNC_END();
8239 fastpath_glGenQueriesEXT(GLsizei n, GLuint* ids)
8242 GLuint *objid_array = NULL;
8244 DEFINE_FASTPAH_GL_FUNC();
8245 _COREGL_FASTPATH_FUNC_BEGIN();
8246 INIT_FASTPATH_GL_FUNC();
8250 _set_gl_error(GL_INVALID_VALUE);
8253 if (n == 0) goto finish;
8254 if (ids == NULL) goto finish;
8256 AST(current_ctx->ostate.shared != NULL);
8258 objid_array = (GLuint *)calloc(1, sizeof(GLuint) * n);
8260 IF_GL_SUCCESS(_orig_fastpath_glGenQueriesEXT(n, objid_array))
8262 for (i = 0; i < n; i++)
8264 ids[i] = fastpath_ostate_create_object(¤t_ctx->ostate, GL_OBJECT_TYPE_QUERY, objid_array[i]);
8271 if (objid_array != NULL)
8276 _COREGL_FASTPATH_FUNC_END();
8280 fastpath_glIsFramebufferOES(GLuint framebuffer)
8282 GLboolean ret = GL_FALSE;
8285 DEFINE_FASTPAH_GL_FUNC();
8286 _COREGL_FASTPATH_FUNC_BEGIN();
8287 INIT_FASTPATH_GL_FUNC();
8289 if (GET_REAL_OBJ(GL_OBJECT_TYPE_FRAMEBUFFER, framebuffer, &real_obj) != 1)
8295 ret = _orig_fastpath_glIsFramebufferOES(real_obj);
8300 _COREGL_FASTPATH_FUNC_END();
8305 fastpath_glIsQueryEXT(GLuint id)
8307 GLboolean ret = GL_FALSE;
8310 DEFINE_FASTPAH_GL_FUNC();
8311 _COREGL_FASTPATH_FUNC_BEGIN();
8312 INIT_FASTPATH_GL_FUNC();
8314 if (GET_REAL_OBJ(GL_OBJECT_TYPE_QUERY, id, &real_obj) != 1)
8320 ret = _orig_fastpath_glIsQueryEXT(real_obj);
8325 _COREGL_FASTPATH_FUNC_END();
8330 fastpath_glIsRenderbufferOES(GLuint renderbuffer)
8332 GLboolean ret = GL_FALSE;
8335 DEFINE_FASTPAH_GL_FUNC();
8336 _COREGL_FASTPATH_FUNC_BEGIN();
8337 INIT_FASTPATH_GL_FUNC();
8339 if (GET_REAL_OBJ(GL_OBJECT_TYPE_RENDERBUFFER, renderbuffer, &real_obj) != 1)
8345 ret = _orig_fastpath_glIsRenderbufferOES(real_obj);
8350 _COREGL_FASTPATH_FUNC_END();
8355 fastpath_glBlendEquationOES(GLenum mode)
8357 DEFINE_FASTPAH_GL_FUNC();
8358 _COREGL_FASTPATH_FUNC_BEGIN();
8359 INIT_FASTPATH_GL_FUNC();
8361 IF_GL_SUCCESS(_orig_fastpath_glBlendEquationOES(mode))
8363 current_ctx->_blend_flag |=
8364 _BLEND_FLAG_BIT_gl_blend_equation_rgb |
8365 _BLEND_FLAG_BIT_gl_blend_equation_alpha;
8367 _orig_fastpath_glGetIntegerv(GL_BLEND_EQUATION_RGB, (GLint*) & (current_ctx->gl_blend_equation_rgb));
8368 _orig_fastpath_glGetIntegerv(GL_BLEND_EQUATION_ALPHA, (GLint*) & (current_ctx->gl_blend_equation_alpha));
8373 _COREGL_FASTPATH_FUNC_END();
8378 fastpath_glBlendEquationSeparateOES(GLenum modeRGB, GLenum modeAlpha)
8380 DEFINE_FASTPAH_GL_FUNC();
8381 _COREGL_FASTPATH_FUNC_BEGIN();
8382 INIT_FASTPATH_GL_FUNC();
8384 if ((current_ctx->gl_blend_equation_rgb[0] != modeRGB) ||
8385 (current_ctx->gl_blend_equation_alpha[0] != modeAlpha))
8387 IF_GL_SUCCESS(_orig_fastpath_glBlendEquationSeparateOES(modeRGB, modeAlpha))
8389 current_ctx->_blend_flag |=
8390 _BLEND_FLAG_BIT_gl_blend_equation_rgb |
8391 _BLEND_FLAG_BIT_gl_blend_equation_alpha;
8393 current_ctx->gl_blend_equation_rgb[0] = modeRGB;
8394 current_ctx->gl_blend_equation_alpha[0] = modeAlpha;
8400 _COREGL_FASTPATH_FUNC_END();
8404 fastpath_glBlendFuncSeparateOES(GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha)
8406 DEFINE_FASTPAH_GL_FUNC();
8407 _COREGL_FASTPATH_FUNC_BEGIN();
8408 INIT_FASTPATH_GL_FUNC();
8410 if ((current_ctx->gl_blend_src_rgb[0] != srcRGB) ||
8411 (current_ctx->gl_blend_dst_rgb[0] != dstRGB) ||
8412 (current_ctx->gl_blend_src_alpha[0] != srcAlpha) ||
8413 (current_ctx->gl_blend_dst_alpha[0] != dstAlpha))
8415 IF_GL_SUCCESS(_orig_fastpath_glBlendFuncSeparateOES(srcRGB, dstRGB, srcAlpha, dstAlpha))
8417 current_ctx->_blend_flag |=
8418 _BLEND_FLAG_BIT_gl_blend_src_rgb |
8419 _BLEND_FLAG_BIT_gl_blend_src_alpha |
8420 _BLEND_FLAG_BIT_gl_blend_dst_rgb |
8421 _BLEND_FLAG_BIT_gl_blend_dst_alpha;
8423 current_ctx->gl_blend_src_rgb[0] = srcRGB;
8424 current_ctx->gl_blend_dst_rgb[0] = dstRGB;
8425 current_ctx->gl_blend_src_alpha[0] = srcAlpha;
8426 current_ctx->gl_blend_dst_alpha[0] = dstAlpha;
8432 _COREGL_FASTPATH_FUNC_END();
8436 fastpath_glPolygonOffsetxOES(GLfixed factor, GLfixed units)
8438 DEFINE_FASTPAH_GL_FUNC();
8439 _COREGL_FASTPATH_FUNC_BEGIN();
8440 INIT_FASTPATH_GL_FUNC();
8442 if ((current_ctx->gl_polygon_offset_factor[0] != factor) ||
8443 (current_ctx->gl_polygon_offset_units[0] != units))
8445 IF_GL_SUCCESS(_orig_fastpath_glPolygonOffsetxOES(factor, units))
8447 current_ctx->_misc_flag1 |=
8448 _MISC_FLAG1_BIT_gl_polygon_offset_factor |
8449 _MISC_FLAG1_BIT_gl_polygon_offset_units;
8451 current_ctx->gl_polygon_offset_factor[0] = factor;
8452 current_ctx->gl_polygon_offset_units[0] = units;
8458 _COREGL_FASTPATH_FUNC_END();
8462 fastpath_glLineWidthxOES(GLfixed width)
8464 DEFINE_FASTPAH_GL_FUNC();
8465 _COREGL_FASTPATH_FUNC_BEGIN();
8466 INIT_FASTPATH_GL_FUNC();
8468 CURR_STATE_COMPARE(gl_line_width, width)
8470 IF_GL_SUCCESS(_orig_fastpath_glLineWidthxOES(width))
8472 current_ctx->_misc_flag1 |= _MISC_FLAG1_BIT_gl_line_width;
8473 current_ctx->gl_line_width[0] = width;
8479 _COREGL_FASTPATH_FUNC_END();
8483 fastpath_glSampleCoveragexOES(GLclampx value, GLboolean invert)
8485 DEFINE_FASTPAH_GL_FUNC();
8486 _COREGL_FASTPATH_FUNC_BEGIN();
8487 INIT_FASTPATH_GL_FUNC();
8489 if ((current_ctx->gl_sample_coverage_value[0] != value) ||
8490 (current_ctx->gl_sample_coverage_invert[0] != invert))
8492 IF_GL_SUCCESS(_orig_fastpath_glSampleCoveragexOES(value, invert))
8494 current_ctx->_misc_flag1 |=
8495 _MISC_FLAG1_BIT_gl_sample_coverage_value |
8496 _MISC_FLAG1_BIT_gl_sample_coverage_invert;
8498 current_ctx->gl_sample_coverage_value[0] = value;
8499 current_ctx->gl_sample_coverage_invert[0] = invert;
8505 _COREGL_FASTPATH_FUNC_END();
8509 fastpath_glQueryCounterEXT(GLuint id, GLenum target)
8513 DEFINE_FASTPAH_GL_FUNC();
8514 _COREGL_FASTPATH_FUNC_BEGIN();
8515 INIT_FASTPATH_GL_FUNC();
8517 if (GET_REAL_OBJ(GL_OBJECT_TYPE_QUERY, id, &real_obj) != 1)
8519 // TODO : Begin - Context Switch
8520 _set_gl_error(GL_INVALID_OPERATION);
8524 _orig_fastpath_glQueryCounterEXT(real_obj,target);
8529 _COREGL_FASTPATH_FUNC_END();
8533 fastpath_glGenVertexArraysOES(GLsizei n, GLuint* arrays)
8536 GLuint *objid_array = NULL;
8538 DEFINE_FASTPAH_GL_FUNC();
8539 _COREGL_FASTPATH_FUNC_BEGIN();
8540 INIT_FASTPATH_GL_FUNC();
8544 _set_gl_error(GL_INVALID_VALUE);
8547 if (n == 0) goto finish;
8548 if (arrays == NULL) goto finish;
8550 AST(current_ctx->ostate.shared != NULL);
8552 objid_array = (GLuint *)calloc(1, sizeof(GLuint) * n);
8554 IF_GL_SUCCESS(_orig_fastpath_glGenVertexArraysOES(n, objid_array))
8556 for (i = 0; i < n; i++)
8558 arrays[i] = fastpath_ostate_create_object(¤t_ctx->ostate, GL_OBJECT_TYPE_VERTEXARRAY, objid_array[i]);
8565 if (objid_array != NULL)
8570 _COREGL_FASTPATH_FUNC_END();
8575 fastpath_glBindVertexArrayOES(GLuint array)
8579 DEFINE_FASTPAH_GL_FUNC();
8580 _COREGL_FASTPATH_FUNC_BEGIN();
8581 INIT_FASTPATH_GL_FUNC();
8583 if (GET_REAL_OBJ(GL_OBJECT_TYPE_VERTEXARRAY, array, &real_obj) != 1)
8585 _set_gl_error(GL_INVALID_OPERATION);
8588 if (current_ctx->gl_vertex_array_binding[0] != real_obj)
8590 IF_GL_SUCCESS(_orig_fastpath_glBindVertexArrayOES(real_obj))
8592 current_ctx->_misc_flag3 |= _MISC_FLAG3_BIT_gl_vertex_array_binding;
8593 current_ctx->gl_vertex_array_binding[0] = real_obj;
8599 _COREGL_FASTPATH_FUNC_END();
8604 fastpath_glIsVertexArrayOES(GLuint array)
8606 GLboolean ret = GL_FALSE;
8609 DEFINE_FASTPAH_GL_FUNC();
8610 _COREGL_FASTPATH_FUNC_BEGIN();
8611 INIT_FASTPATH_GL_FUNC();
8613 if (GET_REAL_OBJ(GL_OBJECT_TYPE_VERTEXARRAY, array, &real_obj) != 1)
8619 ret = _orig_fastpath_glIsVertexArrayOES(real_obj);
8624 _COREGL_FASTPATH_FUNC_END();
8630 fastpath_glDeleteVertexArraysOES(GLsizei n, const GLuint* arrays)
8633 GLuint *objid_array = NULL;
8635 DEFINE_FASTPAH_GL_FUNC();
8636 _COREGL_FASTPATH_FUNC_BEGIN();
8637 INIT_FASTPATH_GL_FUNC();
8641 _set_gl_error(GL_INVALID_VALUE);
8644 if (n == 0) goto finish;
8645 if (arrays == NULL) goto finish;
8647 AST(current_ctx->ostate.shared != NULL);
8649 objid_array = (GLuint *)calloc(1, sizeof(GLuint) * n);
8653 for (i = 0; i < n; i++)
8655 int real_objid = _COREGL_INT_INIT_VALUE;
8656 if (arrays[i] == 0) continue;
8658 real_objid = fastpath_ostate_get_object(¤t_ctx->ostate, GL_OBJECT_TYPE_VERTEXARRAY, arrays[i]);
8659 if (real_objid == 0) continue;
8661 AST(fastpath_ostate_remove_object(¤t_ctx->ostate, GL_OBJECT_TYPE_VERTEXARRAY, arrays[i]) == 1);
8662 objid_array[real_n++] = real_objid;
8665 IF_GL_SUCCESS(_orig_fastpath_glDeleteVertexArraysOES(real_n, objid_array))
8667 for (i = 0; i < real_n; i++)
8669 General_Trace_List *current = NULL;
8670 current = current_ctx->ostate.shared->using_gctxs;
8672 while (current != NULL)
8674 GLGlueContext *cur_gctx = (GLGlueContext *)current->value;
8676 if (cur_gctx->gl_vertex_array_binding[0] == objid_array[i])
8677 cur_gctx->gl_vertex_array_binding[0] = 0;
8679 current = current->next;
8688 if (objid_array != NULL)
8693 _COREGL_FASTPATH_FUNC_END();
8697 fastpath_glClearDepthfOES(GLclampf depth)
8699 DEFINE_FASTPAH_GL_FUNC();
8700 _COREGL_FASTPATH_FUNC_BEGIN();
8701 INIT_FASTPATH_GL_FUNC();
8703 CURR_STATE_COMPARE(gl_depth_clear_value, depth)
8705 IF_GL_SUCCESS(_orig_fastpath_glClearDepthfOES(depth))
8707 current_ctx->_clear_flag2 |= _CLEAR_FLAG2_BIT_gl_depth_clear_value;
8708 current_ctx->gl_depth_clear_value[0] = depth;
8714 _COREGL_FASTPATH_FUNC_END();
8718 fastpath_glClearDepthxOES(GLclampx depth)
8720 DEFINE_FASTPAH_GL_FUNC();
8721 _COREGL_FASTPATH_FUNC_BEGIN();
8722 INIT_FASTPATH_GL_FUNC();
8724 CURR_STATE_COMPARE(gl_depth_clear_value, depth)
8726 IF_GL_SUCCESS(_orig_fastpath_glClearDepthxOES(depth))
8728 current_ctx->_clear_flag2 |= _CLEAR_FLAG2_BIT_gl_depth_clear_value;
8729 current_ctx->gl_depth_clear_value[0] = depth;
8735 _COREGL_FASTPATH_FUNC_END();