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);
141 Program_object_attached_tag *poat = NULL;
142 poat = (Program_object_attached_tag *)calloc(1, sizeof(Program_object_attached_tag));
145 poat->is_deleting = 0;
146 poat->shader_count = 0;
148 fastpath_ostate_set_object_tag(ostate, GL_OBJECT_TYPE_PROGRAM, ret, poat);
155 _update_program_attach_info(GL_Object_State *ostate, GLuint program)
157 Program_object_attached_tag *poat = NULL;
158 GLuint real_program = _COREGL_INT_INIT_VALUE;
160 poat = (Program_object_attached_tag *)fastpath_ostate_get_object_tag(ostate, GL_OBJECT_TYPE_PROGRAM, program);
163 real_program = fastpath_ostate_get_object(ostate, GL_OBJECT_TYPE_PROGRAM, program);
164 AST(real_program > 0);
166 _orig_fastpath_glGetAttachedShaders(real_program, 10, &poat->shader_count, poat->shaders);
170 _attach_program_object(GL_Object_State *ostate, GLuint object)
174 fastpath_ostate_use_object(ostate, GL_OBJECT_TYPE_PROGRAM, object);
179 _is_deleted_program_object(GL_Object_State *ostate, GLuint glue_object)
181 Program_object_attached_tag *poat = NULL;
182 poat = (Program_object_attached_tag *)fastpath_ostate_get_object_tag(ostate, GL_OBJECT_TYPE_PROGRAM, glue_object);
184 return poat->is_deleting;
188 _detach_program_object(GL_Object_State *ostate, GLuint real_object, int is_program, int is_deleting)
190 if (real_object != 0)
192 GLuint object = _COREGL_INT_INIT_VALUE;
193 Program_object_attached_tag *poat = NULL;
195 object = fastpath_ostate_find_object(ostate, GL_OBJECT_TYPE_PROGRAM, real_object);
198 poat = (Program_object_attached_tag *)fastpath_ostate_get_object_tag(ostate, GL_OBJECT_TYPE_PROGRAM, object);
201 if (is_deleting == 1)
203 if (poat->is_deleting == 0)
205 poat->is_deleting = 1;
206 fastpath_ostate_remove_object(ostate, GL_OBJECT_TYPE_PROGRAM, object);
211 fastpath_ostate_remove_object(ostate, GL_OBJECT_TYPE_PROGRAM, object);
214 if (fastpath_ostate_get_object(ostate, GL_OBJECT_TYPE_PROGRAM, object) == 0)
216 // Is completely removed. De-referencing attached shader objects
218 for (i = 0; i < poat->shader_count; i++)
220 AST(is_program == 1);
221 _detach_program_object(ostate, poat->shaders[i], 0, 0);
228 _orig_fastpath_glDeleteProgram(real_object);
230 _orig_fastpath_glDeleteShader(real_object);
237 fastpath_release_gl_context(GLGlueContext *gctx)
240 if (gctx->gl_current_program[0] != 0)
242 _detach_program_object(&gctx->ostate, gctx->gl_current_program[0], 1, 0);
243 gctx->gl_current_program[0] = 0;
253 int vlen = _COREGL_INT_INIT_VALUE;
254 int i = _COREGL_INT_INIT_VALUE;
255 char vret_tmp[80 + 1] = { 0 };
256 IF_GL_SUCCESS(vret = (const char *)_orig_fastpath_glGetString(GL_VERSION))
258 vlen = (int)strlen(vret);
259 if (!strncmp(vret, "OpenGL ES", 9) && vlen >= 11)
264 if (vlen < 14) return 0.0f;
270 if (vret[i] == ' ' || vret[i] == 0x00 || i >= 80)
272 strncpy(vret_tmp, &vret[stp], i - stp);
273 vret_tmp[i - stp] = 0x00;
277 if (vret_tmp[0] != 0x00)
278 GLver = atof(vret_tmp);
285 Mutex extension_check_mutex = MUTEX_INITIALIZER;
286 char string_extensions[16384] = { 0x00 };
287 char string_each_extensions[128][64];
288 int gl_extension_count = 0;
292 _valid_extension_string()
294 char string_tmpbuf[2048];
295 const char *res = NULL;
297 AST(mutex_lock(&extension_check_mutex) == 1);
299 if (gl_extension_count == 0)
301 IF_GL_SUCCESS(res = (const char *)_orig_fastpath_glGetString(GL_EXTENSIONS))
303 if (string_extensions[0] == 0x00)
305 double GLver = _get_gl_version();
307 strcpy(string_tmpbuf, res);
308 char *fstr = &string_tmpbuf[0], *estr = NULL;
309 for (estr = fstr; ; estr++)
311 if (*estr == 0x00) break;
316 #define _COREGL_SYMBOL(RET_TYPE, FUNC_NAME, PARAM_LIST)
317 #define _COREGL_FASTPATH_SUPPORTED_EXTENSION(NAME, MINVER, MAXVER) \
318 if (!strcmp(fstr, NAME) && (MINVER < 0 || GLver >= MINVER) && (MAXVER < 0 || GLver <= MAXVER)) \
320 strcpy(string_each_extensions[gl_extension_count], fstr); \
321 strcat(string_extensions, fstr); \
322 strcat(string_extensions, " "); \
323 gl_extension_count++; \
326 # include "../../headers/sym_gl.h"
328 #undef _COREGL_FASTPATH_SUPPORTED_EXTENSION
329 #undef _COREGL_SYMBOL
338 AST(mutex_unlock(&extension_check_mutex) == 1);
343 fastpath_glGetError(void)
345 GLenum ret = GL_NONE;
347 DEFINE_FASTPAH_GL_FUNC();
348 _COREGL_FASTPATH_FUNC_BEGIN();
349 INIT_FASTPATH_GL_FUNC();
351 if (current_ctx->gl_error != GL_NO_ERROR)
353 ret = current_ctx->gl_error;
354 current_ctx->gl_error = GL_NO_ERROR;
355 _orig_fastpath_glGetError();
359 ret = _orig_fastpath_glGetError();
364 _COREGL_FASTPATH_FUNC_END();
370 fastpath_glGetString(GLenum name)
372 const char *ret = NULL;
373 static const char *string_gles20 = "OpenGL ES 2.0";
374 static const char *string_gles30 = "OpenGL ES 3.0";
376 DEFINE_FASTPAH_GL_FUNC();
377 _COREGL_FASTPATH_FUNC_BEGIN();
378 INIT_FASTPATH_GL_FUNC();
383 IF_GL_SUCCESS(ret = (const char *)_orig_fastpath_glGetString(name))
385 double GLver = _get_gl_version();
388 COREGL_WRN("\E[40;31;1mFastpath can't support %s (Fixed to %s)\E[0m\n", ret, string_gles30);
393 COREGL_WRN("\E[40;31;1mFastpath can't support %s (Fixed to %s)\E[0m\n", ret, string_gles20);
399 _valid_extension_string();
400 ret = string_extensions;
403 IF_GL_SUCCESS(ret = (const char *)_orig_fastpath_glGetString(name))
416 _COREGL_FASTPATH_FUNC_END();
417 return (const GLubyte *)ret;
420 ////////////////////////////////////////////////////////////////////////
423 fastpath_glActiveTexture(GLenum texture)
425 DEFINE_FASTPAH_GL_FUNC();
426 _COREGL_FASTPATH_FUNC_BEGIN();
427 INIT_FASTPATH_GL_FUNC();
429 CURR_STATE_COMPARE(gl_active_texture, texture)
431 IF_GL_SUCCESS(_orig_fastpath_glActiveTexture(texture))
433 current_ctx->_tex_flag1 |= _TEX_FLAG1_BIT_gl_active_texture;
434 current_ctx->gl_active_texture[0] = texture;
440 _COREGL_FASTPATH_FUNC_END();
445 fastpath_glGenTextures(GLsizei n, GLuint* textures)
448 GLuint *objid_array = NULL;
450 DEFINE_FASTPAH_GL_FUNC();
451 _COREGL_FASTPATH_FUNC_BEGIN();
452 INIT_FASTPATH_GL_FUNC();
456 _set_gl_error(GL_INVALID_VALUE);
459 if (n == 0) goto finish;
460 if (textures == NULL) goto finish;
462 AST(current_ctx->ostate.shared != NULL);
464 objid_array = (GLuint *)calloc(1, sizeof(GLuint) * n);
466 IF_GL_SUCCESS(_orig_fastpath_glGenTextures(n, objid_array))
468 for (i = 0; i < n; i++)
470 textures[i] = fastpath_ostate_create_object(¤t_ctx->ostate, GL_OBJECT_TYPE_TEXTURE, objid_array[i]);
477 if (objid_array != NULL)
482 _COREGL_FASTPATH_FUNC_END();
487 fastpath_glBindTexture(GLenum target, GLuint texture)
492 DEFINE_FASTPAH_GL_FUNC();
493 _COREGL_FASTPATH_FUNC_BEGIN();
494 INIT_FASTPATH_GL_FUNC();
496 active_idx = current_ctx->gl_active_texture[0] - GL_TEXTURE0;
498 if (GET_REAL_OBJ(GL_OBJECT_TYPE_TEXTURE, texture, &real_obj) != 1)
500 _set_gl_error(GL_OUT_OF_MEMORY);
505 #define STATE_PROC(gl_state, flagid, flagbit) \
506 if (current_ctx->gl_state[active_idx] != real_obj) \
508 IF_GL_SUCCESS(_orig_fastpath_glBindTexture(target, real_obj)) \
510 current_ctx->flagid |= flagbit##_##gl_state; \
511 current_ctx->gl_state[active_idx] = real_obj; \
518 STATE_PROC(gl_tex_2d_state, _tex_flag1, _TEX_FLAG1_BIT);
521 STATE_PROC_WITH_CHECK(gl_tex_3d_state, _tex_flag1, _TEX_FLAG1_BIT);
523 case GL_TEXTURE_2D_ARRAY:
524 STATE_PROC_WITH_CHECK(gl_tex_2d_array_state, _tex_flag1, _TEX_FLAG1_BIT);
526 case GL_TEXTURE_CUBE_MAP:
527 STATE_PROC(gl_tex_cube_state, _tex_flag1, _TEX_FLAG1_BIT);
529 case GL_TEXTURE_EXTERNAL_OES:
530 STATE_PROC(gl_tex_external_oes_state, _tex_flag1, _TEX_FLAG1_BIT);
533 _set_gl_error(GL_INVALID_ENUM);
543 _COREGL_FASTPATH_FUNC_END();
548 fastpath_glFramebufferTexture2D(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level)
552 DEFINE_FASTPAH_GL_FUNC();
553 _COREGL_FASTPATH_FUNC_BEGIN();
554 INIT_FASTPATH_GL_FUNC();
556 if (GET_REAL_OBJ(GL_OBJECT_TYPE_TEXTURE, texture, &real_obj) != 1)
558 _set_gl_error(GL_OUT_OF_MEMORY);
562 _orig_fastpath_glFramebufferTexture2D(target, attachment, textarget, real_obj, level);
567 _COREGL_FASTPATH_FUNC_END();
572 fastpath_glFramebufferTexture3DOES(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLint zoffset)
576 DEFINE_FASTPAH_GL_FUNC();
577 _COREGL_FASTPATH_FUNC_BEGIN();
578 INIT_FASTPATH_GL_FUNC();
580 if (GET_REAL_OBJ(GL_OBJECT_TYPE_TEXTURE, texture, &real_obj) != 1)
582 _set_gl_error(GL_OUT_OF_MEMORY);
586 _orig_fastpath_glFramebufferTexture3DOES(target, attachment, textarget, real_obj, level, zoffset);
591 _COREGL_FASTPATH_FUNC_END();
596 fastpath_glFramebufferTexture2DMultisampleEXT(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLsizei samples)
600 DEFINE_FASTPAH_GL_FUNC();
601 _COREGL_FASTPATH_FUNC_BEGIN();
602 INIT_FASTPATH_GL_FUNC();
604 if (GET_REAL_OBJ(GL_OBJECT_TYPE_TEXTURE, texture, &real_obj) != 1)
606 _set_gl_error(GL_OUT_OF_MEMORY);
610 _orig_fastpath_glFramebufferTexture2DMultisampleEXT(target, attachment, textarget, real_obj, level, samples);
615 _COREGL_FASTPATH_FUNC_END();
620 fastpath_glGetFramebufferAttachmentParameteriv(GLenum target, GLenum attachment, GLenum pname, GLint *params)
622 GLint real_obj, fa_type;
624 DEFINE_FASTPAH_GL_FUNC();
625 _COREGL_FASTPATH_FUNC_BEGIN();
626 INIT_FASTPATH_GL_FUNC();
630 case GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME:
632 _orig_fastpath_glGetFramebufferAttachmentParameteriv(target, attachment, pname, &real_obj);
633 _orig_fastpath_glGetFramebufferAttachmentParameteriv(target, attachment, GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE, &fa_type);
637 if (GET_GLUE_OBJ(GL_OBJECT_TYPE_TEXTURE, real_obj, (GLuint *)params) != 1)
643 case GL_RENDERBUFFER:
644 if (GET_GLUE_OBJ(GL_OBJECT_TYPE_RENDERBUFFER, real_obj, (GLuint *)params) != 1)
653 _orig_fastpath_glGetFramebufferAttachmentParameteriv(target, attachment, pname, params);
660 _COREGL_FASTPATH_FUNC_END();
665 fastpath_glIsTexture(GLuint texture)
667 GLboolean ret = GL_FALSE;
670 DEFINE_FASTPAH_GL_FUNC();
671 _COREGL_FASTPATH_FUNC_BEGIN();
672 INIT_FASTPATH_GL_FUNC();
674 if (GET_REAL_OBJ(GL_OBJECT_TYPE_TEXTURE, texture, &real_obj) != 1)
680 ret = _orig_fastpath_glIsTexture(real_obj);
685 _COREGL_FASTPATH_FUNC_END();
691 fastpath_glDeleteTextures(GLsizei n, const GLuint* textures)
694 GLuint *objid_array = NULL;
696 DEFINE_FASTPAH_GL_FUNC();
697 _COREGL_FASTPATH_FUNC_BEGIN();
698 INIT_FASTPATH_GL_FUNC();
702 _set_gl_error(GL_INVALID_VALUE);
705 if (n == 0) goto finish;
706 if (textures == NULL) goto finish;
708 AST(current_ctx->ostate.shared != NULL);
710 objid_array = (GLuint *)calloc(1, sizeof(GLuint) * n);
714 for (i = 0; i < n; i++)
716 int real_objid = _COREGL_INT_INIT_VALUE;
717 if (textures[i] == 0) continue;
719 real_objid = fastpath_ostate_get_object(¤t_ctx->ostate, GL_OBJECT_TYPE_TEXTURE, textures[i]);
720 if (real_objid == 0) continue;
722 AST(fastpath_ostate_remove_object(¤t_ctx->ostate, GL_OBJECT_TYPE_TEXTURE, textures[i]) == 1);
723 objid_array[real_n++] = real_objid;
726 IF_GL_SUCCESS(_orig_fastpath_glDeleteTextures(real_n, objid_array))
728 for (i = 0; i < real_n; i++)
730 General_Trace_List *current = NULL;
731 current = current_ctx->ostate.shared->using_gctxs;
733 while (current != NULL)
735 GLGlueContext *cur_gctx = (GLGlueContext *)current->value;
737 for (j = 0; j < cur_gctx->gl_num_tex_units[0]; j++)
739 if (cur_gctx->gl_tex_2d_state[j] == objid_array[i])
740 cur_gctx->gl_tex_2d_state[j] = 0;
741 if (cur_gctx->gl_tex_3d_state[j] == objid_array[i])
742 cur_gctx->gl_tex_3d_state[j] = 0;
743 if (cur_gctx->gl_tex_2d_array_state[j] == objid_array[i])
744 cur_gctx->gl_tex_2d_array_state[j] = 0;
745 if (cur_gctx->gl_tex_cube_state[j] == objid_array[i])
746 cur_gctx->gl_tex_cube_state[j] = 0;
747 if (cur_gctx->gl_tex_external_oes_state[j] == objid_array[i])
748 cur_gctx->gl_tex_external_oes_state[j] = 0;
751 current = current->next;
760 if (objid_array != NULL)
765 _COREGL_FASTPATH_FUNC_END();
768 ////////////////////////////////////////////////////////////////////////
771 fastpath_glGenBuffers(GLsizei n, GLuint* buffers)
774 GLuint *objid_array = NULL;
776 DEFINE_FASTPAH_GL_FUNC();
777 _COREGL_FASTPATH_FUNC_BEGIN();
778 INIT_FASTPATH_GL_FUNC();
782 _set_gl_error(GL_INVALID_VALUE);
785 if (n == 0) goto finish;
786 if (buffers == NULL) goto finish;
788 AST(current_ctx->ostate.shared != NULL);
790 objid_array = (GLuint *)calloc(1, sizeof(GLuint) * n);
792 IF_GL_SUCCESS(_orig_fastpath_glGenBuffers(n, objid_array))
794 for (i = 0; i < n; i++)
796 buffers[i] = fastpath_ostate_create_object(¤t_ctx->ostate, GL_OBJECT_TYPE_BUFFER, objid_array[i]);
803 if (objid_array != NULL)
808 _COREGL_FASTPATH_FUNC_END();
813 fastpath_glBindBuffer(GLenum target, GLuint buffer)
817 DEFINE_FASTPAH_GL_FUNC();
818 _COREGL_FASTPATH_FUNC_BEGIN();
819 INIT_FASTPATH_GL_FUNC();
821 if (GET_REAL_OBJ(GL_OBJECT_TYPE_BUFFER, buffer, &real_obj) != 1)
823 _set_gl_error(GL_OUT_OF_MEMORY);
828 #define STATE_PROC(gl_state, flagid, flagbit) \
829 CURR_STATE_COMPARE(gl_state, real_obj) \
831 IF_GL_SUCCESS(_orig_fastpath_glBindBuffer(target, real_obj)) \
834 current_ctx->flagid &= (~flagbit##_##gl_state); \
836 current_ctx->flagid |= flagbit##_##gl_state; \
838 current_ctx->gl_state[0] = real_obj; \
845 case GL_ARRAY_BUFFER:
846 STATE_PROC(gl_array_buffer_binding, _bind_flag1, _BIND_FLAG1_BIT);
848 case GL_COPY_READ_BUFFER:
849 STATE_PROC_WITH_CHECK(gl_copy_read_buffer_binding, _bind_flag2, _BIND_FLAG2_BIT);
851 case GL_COPY_WRITE_BUFFER:
852 STATE_PROC_WITH_CHECK(gl_copy_write_buffer_binding, _bind_flag2, _BIND_FLAG2_BIT);
854 case GL_ELEMENT_ARRAY_BUFFER:
855 STATE_PROC(gl_element_array_buffer_binding, _bind_flag1, _BIND_FLAG1_BIT);
857 case GL_PIXEL_PACK_BUFFER:
858 STATE_PROC_WITH_CHECK(gl_pixel_pack_buffer_binding, _bind_flag2, _BIND_FLAG2_BIT);
860 case GL_PIXEL_UNPACK_BUFFER:
861 STATE_PROC_WITH_CHECK(gl_pixel_unpack_buffer_binding, _bind_flag2, _BIND_FLAG2_BIT);
863 case GL_TRANSFORM_FEEDBACK_BUFFER:
864 STATE_PROC_WITH_CHECK(gl_transform_feedback_buffer_binding, _bind_flag2, _BIND_FLAG2_BIT);
866 case GL_UNIFORM_BUFFER:
867 STATE_PROC_WITH_CHECK(gl_uniform_buffer_binding, _bind_flag2, _BIND_FLAG2_BIT);
870 _set_gl_error(GL_INVALID_ENUM);
880 _COREGL_FASTPATH_FUNC_END();
885 fastpath_glIsBuffer(GLuint buffer)
887 GLboolean ret = GL_FALSE;
890 DEFINE_FASTPAH_GL_FUNC();
891 _COREGL_FASTPATH_FUNC_BEGIN();
892 INIT_FASTPATH_GL_FUNC();
894 if (GET_REAL_OBJ(GL_OBJECT_TYPE_BUFFER, buffer, &real_obj) != 1)
900 ret = _orig_fastpath_glIsBuffer(real_obj);
905 _COREGL_FASTPATH_FUNC_END();
911 fastpath_glDeleteBuffers(GLsizei n, const GLuint* buffers)
914 GLuint *objid_array = NULL;
916 DEFINE_FASTPAH_GL_FUNC();
917 _COREGL_FASTPATH_FUNC_BEGIN();
918 INIT_FASTPATH_GL_FUNC();
922 _set_gl_error(GL_INVALID_VALUE);
925 if (n == 0) goto finish;
926 if (buffers == NULL) goto finish;
928 AST(current_ctx->ostate.shared != NULL);
930 objid_array = (GLuint *)calloc(1, sizeof(GLuint) * n);
934 for (i = 0; i < n; i++)
936 int real_objid = _COREGL_INT_INIT_VALUE;
937 if (buffers[i] == 0) continue;
939 real_objid = fastpath_ostate_get_object(¤t_ctx->ostate, GL_OBJECT_TYPE_BUFFER, buffers[i]);
940 if (real_objid == 0) continue;
942 AST(fastpath_ostate_remove_object(¤t_ctx->ostate, GL_OBJECT_TYPE_BUFFER, buffers[i]) == 1);
943 objid_array[real_n++] = real_objid;
946 IF_GL_SUCCESS(_orig_fastpath_glDeleteBuffers(real_n, objid_array))
948 for (i = 0; i < real_n; i++)
950 General_Trace_List *current = NULL;
951 current = current_ctx->ostate.shared->using_gctxs;
953 while (current != NULL)
955 GLGlueContext *cur_gctx = (GLGlueContext *)current->value;
957 if (cur_gctx->gl_array_buffer_binding[0] == objid_array[i])
959 cur_gctx->_bind_flag1 &= (~_BIND_FLAG1_BIT_gl_array_buffer_binding);
960 cur_gctx->gl_array_buffer_binding[0] = 0;
962 if (cur_gctx->gl_copy_read_buffer_binding[0] == objid_array[i])
964 cur_gctx->_bind_flag2 &= (~_BIND_FLAG2_BIT_gl_copy_read_buffer_binding);
965 cur_gctx->gl_copy_read_buffer_binding[0] = 0;
967 if (cur_gctx->gl_copy_write_buffer_binding[0] == objid_array[i])
969 cur_gctx->_bind_flag2 &= (~_BIND_FLAG2_BIT_gl_copy_write_buffer_binding);
970 cur_gctx->gl_copy_write_buffer_binding[0] = 0;
972 if (cur_gctx->gl_element_array_buffer_binding[0] == objid_array[i])
974 cur_gctx->_bind_flag1 &= (~_BIND_FLAG1_BIT_gl_element_array_buffer_binding);
975 cur_gctx->gl_element_array_buffer_binding[0] = 0;
977 if (cur_gctx->gl_pixel_pack_buffer_binding[0] == objid_array[i])
979 cur_gctx->_bind_flag2 &= (~_BIND_FLAG2_BIT_gl_pixel_pack_buffer_binding);
980 cur_gctx->gl_pixel_pack_buffer_binding[0] = 0;
982 if (cur_gctx->gl_pixel_unpack_buffer_binding[0] == objid_array[i])
984 cur_gctx->_bind_flag2 &= (~_BIND_FLAG2_BIT_gl_pixel_unpack_buffer_binding);
985 cur_gctx->gl_pixel_unpack_buffer_binding[0] = 0;
987 if (cur_gctx->gl_transform_feedback_buffer_binding[0] == objid_array[i])
989 cur_gctx->_bind_flag2 &= (~_BIND_FLAG2_BIT_gl_transform_feedback_buffer_binding);
990 cur_gctx->gl_transform_feedback_buffer_binding[0] = 0;
992 if (cur_gctx->gl_uniform_buffer_binding[0] == objid_array[i])
994 cur_gctx->_bind_flag2 &= (~_BIND_FLAG2_BIT_gl_uniform_buffer_binding);
995 cur_gctx->gl_uniform_buffer_binding[0] = 0;
998 current = current->next;
1007 if (objid_array != NULL)
1012 _COREGL_FASTPATH_FUNC_END();
1015 //////////////////////////////////////////////////////////////////////////////////
1018 fastpath_glGenFramebuffers(GLsizei n, GLuint* framebuffers)
1021 GLuint *objid_array = NULL;
1023 DEFINE_FASTPAH_GL_FUNC();
1024 _COREGL_FASTPATH_FUNC_BEGIN();
1025 INIT_FASTPATH_GL_FUNC();
1029 _set_gl_error(GL_INVALID_VALUE);
1032 if (n == 0) goto finish;
1033 if (framebuffers == NULL) goto finish;
1035 AST(current_ctx->ostate.shared != NULL);
1037 objid_array = (GLuint *)calloc(1, sizeof(GLuint) * n);
1039 IF_GL_SUCCESS(_orig_fastpath_glGenFramebuffers(n, objid_array))
1041 for (i = 0; i < n; i++)
1043 framebuffers[i] = fastpath_ostate_create_object(¤t_ctx->ostate, GL_OBJECT_TYPE_FRAMEBUFFER, objid_array[i]);
1050 if (objid_array != NULL)
1055 _COREGL_FASTPATH_FUNC_END();
1060 fastpath_glBindFramebuffer(GLenum target, GLuint framebuffer)
1064 DEFINE_FASTPAH_GL_FUNC();
1065 _COREGL_FASTPATH_FUNC_BEGIN();
1066 INIT_FASTPATH_GL_FUNC();
1068 if (GET_REAL_OBJ(GL_OBJECT_TYPE_FRAMEBUFFER, framebuffer, &real_obj) != 1)
1070 _set_gl_error(GL_OUT_OF_MEMORY);
1074 if (target == GL_FRAMEBUFFER)
1076 if (current_ctx->gl_framebuffer_binding_read_used == 1)
1078 CURR_STATE_COMPARE(gl_framebuffer_binding_read, real_obj)
1080 IF_GL_SUCCESS(_orig_fastpath_glBindFramebuffer(target, real_obj))
1083 current_ctx->_bind_flag1 &= (~_BIND_FLAG1_BIT_gl_framebuffer_binding_read);
1085 current_ctx->_bind_flag1 |= _BIND_FLAG1_BIT_gl_framebuffer_binding_read;
1086 current_ctx->gl_framebuffer_binding_read[0] = real_obj;
1089 CURR_STATE_COMPARE(gl_framebuffer_binding_draw, real_obj)
1091 IF_GL_SUCCESS(_orig_fastpath_glBindFramebuffer(target, real_obj))
1094 current_ctx->_bind_flag1 &= (~_BIND_FLAG1_BIT_gl_framebuffer_binding_draw);
1096 current_ctx->_bind_flag1 |= _BIND_FLAG1_BIT_gl_framebuffer_binding_draw;
1097 current_ctx->gl_framebuffer_binding_draw[0] = real_obj;
1103 CURR_STATE_COMPARE(gl_framebuffer_binding, real_obj)
1105 IF_GL_SUCCESS(_orig_fastpath_glBindFramebuffer(target, real_obj))
1108 current_ctx->_bind_flag1 &= (~_BIND_FLAG1_BIT_gl_framebuffer_binding);
1110 current_ctx->_bind_flag1 |= _BIND_FLAG1_BIT_gl_framebuffer_binding;
1111 current_ctx->gl_framebuffer_binding[0] = real_obj;
1116 else if (target == GL_READ_FRAMEBUFFER && current_ctx->gl_framebuffer_binding_read_used)
1118 CURR_STATE_COMPARE(gl_framebuffer_binding_read, real_obj)
1120 IF_GL_SUCCESS(_orig_fastpath_glBindFramebuffer(target, real_obj))
1123 current_ctx->_bind_flag1 &= (~_BIND_FLAG1_BIT_gl_framebuffer_binding_read);
1125 current_ctx->_bind_flag1 |= _BIND_FLAG1_BIT_gl_framebuffer_binding_read;
1126 current_ctx->gl_framebuffer_binding_read[0] = real_obj;
1130 else if (target == GL_DRAW_FRAMEBUFFER && current_ctx->gl_framebuffer_binding_draw_used)
1132 CURR_STATE_COMPARE(gl_framebuffer_binding_draw, real_obj)
1134 IF_GL_SUCCESS(_orig_fastpath_glBindFramebuffer(target, real_obj))
1137 current_ctx->_bind_flag1 &= (~_BIND_FLAG1_BIT_gl_framebuffer_binding_draw);
1139 current_ctx->_bind_flag1 |= _BIND_FLAG1_BIT_gl_framebuffer_binding_draw;
1140 current_ctx->gl_framebuffer_binding_draw[0] = real_obj;
1146 _set_gl_error(GL_INVALID_ENUM);
1152 _COREGL_FASTPATH_FUNC_END();
1157 fastpath_glIsFramebuffer(GLuint framebuffer)
1159 GLboolean ret = GL_FALSE;
1162 DEFINE_FASTPAH_GL_FUNC();
1163 _COREGL_FASTPATH_FUNC_BEGIN();
1164 INIT_FASTPATH_GL_FUNC();
1166 if (GET_REAL_OBJ(GL_OBJECT_TYPE_FRAMEBUFFER, framebuffer, &real_obj) != 1)
1172 ret = _orig_fastpath_glIsFramebuffer(real_obj);
1177 _COREGL_FASTPATH_FUNC_END();
1183 fastpath_glDeleteFramebuffers(GLsizei n, const GLuint* framebuffers)
1186 GLuint *objid_array = NULL;
1188 DEFINE_FASTPAH_GL_FUNC();
1189 _COREGL_FASTPATH_FUNC_BEGIN();
1190 INIT_FASTPATH_GL_FUNC();
1194 _set_gl_error(GL_INVALID_VALUE);
1197 if (n == 0) goto finish;
1198 if (framebuffers == NULL) goto finish;
1200 AST(current_ctx->ostate.shared != NULL);
1202 objid_array = (GLuint *)calloc(1, sizeof(GLuint) * n);
1206 for (i = 0; i < n; i++)
1208 int real_objid = _COREGL_INT_INIT_VALUE;
1209 if (framebuffers[i] == 0) continue;
1211 real_objid = fastpath_ostate_get_object(¤t_ctx->ostate, GL_OBJECT_TYPE_FRAMEBUFFER, framebuffers[i]);
1212 if (real_objid == 0) continue;
1214 AST(fastpath_ostate_remove_object(¤t_ctx->ostate, GL_OBJECT_TYPE_FRAMEBUFFER, framebuffers[i]) == 1);
1215 objid_array[real_n++] = real_objid;
1218 IF_GL_SUCCESS(_orig_fastpath_glDeleteFramebuffers(real_n, objid_array))
1220 for (i = 0; i < real_n; i++)
1222 General_Trace_List *current = NULL;
1223 current = current_ctx->ostate.shared->using_gctxs;
1225 while (current != NULL)
1227 GLGlueContext *cur_gctx = (GLGlueContext *)current->value;
1229 if (cur_gctx->gl_framebuffer_binding[0] == objid_array[i])
1231 cur_gctx->_bind_flag1 &= (~_BIND_FLAG1_BIT_gl_framebuffer_binding);
1232 cur_gctx->gl_framebuffer_binding[0] = 0;
1234 if (cur_gctx->gl_framebuffer_binding_read[0] == objid_array[i])
1236 cur_gctx->_bind_flag1 &= (~_BIND_FLAG1_BIT_gl_framebuffer_binding_read);
1237 cur_gctx->gl_framebuffer_binding_read[0] = 0;
1239 if (cur_gctx->gl_framebuffer_binding_draw[0] == objid_array[i])
1241 cur_gctx->_bind_flag1 &= (~_BIND_FLAG1_BIT_gl_framebuffer_binding_draw);
1242 cur_gctx->gl_framebuffer_binding_draw[0] = 0;
1245 current = current->next;
1254 if (objid_array != NULL)
1259 _COREGL_FASTPATH_FUNC_END();
1262 //////////////////////////////////////////////////////////////////////////////////
1265 fastpath_glGenRenderbuffers(GLsizei n, GLuint* renderbuffers)
1268 GLuint *objid_array = NULL;
1270 DEFINE_FASTPAH_GL_FUNC();
1271 _COREGL_FASTPATH_FUNC_BEGIN();
1272 INIT_FASTPATH_GL_FUNC();
1276 _set_gl_error(GL_INVALID_VALUE);
1279 if (n == 0) goto finish;
1280 if (renderbuffers == NULL) goto finish;
1282 AST(current_ctx->ostate.shared != NULL);
1284 objid_array = (GLuint *)calloc(1, sizeof(GLuint) * n);
1286 IF_GL_SUCCESS(_orig_fastpath_glGenRenderbuffers(n, objid_array))
1288 for (i = 0; i < n; i++)
1290 renderbuffers[i] = fastpath_ostate_create_object(¤t_ctx->ostate, GL_OBJECT_TYPE_RENDERBUFFER, objid_array[i]);
1297 if (objid_array != NULL)
1302 _COREGL_FASTPATH_FUNC_END();
1307 fastpath_glBindRenderbuffer(GLenum target, GLuint renderbuffer)
1311 DEFINE_FASTPAH_GL_FUNC();
1312 _COREGL_FASTPATH_FUNC_BEGIN();
1313 INIT_FASTPATH_GL_FUNC();
1315 if (GET_REAL_OBJ(GL_OBJECT_TYPE_RENDERBUFFER, renderbuffer, &real_obj) != 1)
1317 _set_gl_error(GL_OUT_OF_MEMORY);
1321 if (target == GL_RENDERBUFFER)
1323 CURR_STATE_COMPARE(gl_renderbuffer_binding, real_obj)
1325 IF_GL_SUCCESS(_orig_fastpath_glBindRenderbuffer(target, real_obj))
1328 current_ctx->_bind_flag1 &= (~_BIND_FLAG1_BIT_gl_renderbuffer_binding);
1330 current_ctx->_bind_flag1 |= _BIND_FLAG1_BIT_gl_renderbuffer_binding;
1331 current_ctx->gl_renderbuffer_binding[0] = real_obj;
1337 _set_gl_error(GL_INVALID_ENUM);
1344 _COREGL_FASTPATH_FUNC_END();
1349 fastpath_glFramebufferRenderbuffer(GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer)
1353 DEFINE_FASTPAH_GL_FUNC();
1354 _COREGL_FASTPATH_FUNC_BEGIN();
1355 INIT_FASTPATH_GL_FUNC();
1357 if (GET_REAL_OBJ(GL_OBJECT_TYPE_RENDERBUFFER, renderbuffer, &real_obj) != 1)
1359 _set_gl_error(GL_OUT_OF_MEMORY);
1363 _orig_fastpath_glFramebufferRenderbuffer(target, attachment, renderbuffertarget, real_obj);
1368 _COREGL_FASTPATH_FUNC_END();
1373 fastpath_glIsRenderbuffer(GLuint renderbuffer)
1375 GLboolean ret = GL_FALSE;
1378 DEFINE_FASTPAH_GL_FUNC();
1379 _COREGL_FASTPATH_FUNC_BEGIN();
1380 INIT_FASTPATH_GL_FUNC();
1382 if (GET_REAL_OBJ(GL_OBJECT_TYPE_RENDERBUFFER, renderbuffer, &real_obj) != 1)
1388 ret = _orig_fastpath_glIsRenderbuffer(real_obj);
1393 _COREGL_FASTPATH_FUNC_END();
1399 fastpath_glDeleteRenderbuffers(GLsizei n, const GLuint* renderbuffers)
1402 GLuint *objid_array = NULL;
1404 DEFINE_FASTPAH_GL_FUNC();
1405 _COREGL_FASTPATH_FUNC_BEGIN();
1406 INIT_FASTPATH_GL_FUNC();
1410 _set_gl_error(GL_INVALID_VALUE);
1413 if (n == 0) goto finish;
1414 if (renderbuffers == NULL) goto finish;
1416 AST(current_ctx->ostate.shared != NULL);
1418 objid_array = (GLuint *)calloc(1, sizeof(GLuint) * n);
1422 for (i = 0; i < n; i++)
1424 int real_objid = _COREGL_INT_INIT_VALUE;
1425 if (renderbuffers[i] == 0) continue;
1427 real_objid = fastpath_ostate_get_object(¤t_ctx->ostate, GL_OBJECT_TYPE_RENDERBUFFER, renderbuffers[i]);
1428 if (real_objid == 0) continue;
1430 AST(fastpath_ostate_remove_object(¤t_ctx->ostate, GL_OBJECT_TYPE_RENDERBUFFER, renderbuffers[i]) == 1);
1431 objid_array[real_n++] = real_objid;
1434 IF_GL_SUCCESS(_orig_fastpath_glDeleteRenderbuffers(real_n, objid_array))
1436 for (i = 0; i < real_n; i++)
1438 General_Trace_List *current = NULL;
1439 current = current_ctx->ostate.shared->using_gctxs;
1441 while (current != NULL)
1443 GLGlueContext *cur_gctx = (GLGlueContext *)current->value;
1445 if (cur_gctx->gl_renderbuffer_binding[0] == objid_array[i])
1447 cur_gctx->_bind_flag1 &= (~_BIND_FLAG1_BIT_gl_renderbuffer_binding);
1448 cur_gctx->gl_renderbuffer_binding[0] = 0;
1451 current = current->next;
1460 if (objid_array != NULL)
1465 _COREGL_FASTPATH_FUNC_END();
1469 //////////////////////////////////////////////////////////////////////////////////
1472 fastpath_glCreateProgram(void)
1476 DEFINE_FASTPAH_GL_FUNC();
1477 _COREGL_FASTPATH_FUNC_BEGIN();
1478 INIT_FASTPATH_GL_FUNC();
1480 AST(current_ctx->ostate.shared != NULL);
1482 ret = _create_program_object(¤t_ctx->ostate, 1, GL_NONE);
1484 _attach_program_object(¤t_ctx->ostate, ret);
1489 _COREGL_FASTPATH_FUNC_END();
1495 fastpath_glCreateShader(GLenum type)
1499 DEFINE_FASTPAH_GL_FUNC();
1500 _COREGL_FASTPATH_FUNC_BEGIN();
1501 INIT_FASTPATH_GL_FUNC();
1503 AST(current_ctx->ostate.shared != NULL);
1505 ret = _create_program_object(¤t_ctx->ostate, 0, type);
1507 _attach_program_object(¤t_ctx->ostate, ret);
1512 _COREGL_FASTPATH_FUNC_END();
1518 fastpath_glShaderSource(GLuint shader, GLsizei count, const char** string, const GLint* length)
1522 DEFINE_FASTPAH_GL_FUNC();
1523 _COREGL_FASTPATH_FUNC_BEGIN();
1524 INIT_FASTPATH_GL_FUNC();
1526 if (GET_REAL_OBJ(GL_OBJECT_TYPE_PROGRAM, shader, &real_obj) != 1)
1528 _set_gl_error(GL_INVALID_VALUE);
1531 _orig_fastpath_glShaderSource(real_obj, count, string, length);
1536 _COREGL_FASTPATH_FUNC_END();
1541 fastpath_glShaderBinary(GLsizei n, const GLuint* shaders, GLenum binaryformat, const void* binary, GLsizei length)
1544 GLuint *objid_array = NULL;
1546 DEFINE_FASTPAH_GL_FUNC();
1547 _COREGL_FASTPATH_FUNC_BEGIN();
1548 INIT_FASTPATH_GL_FUNC();
1552 _set_gl_error(GL_INVALID_VALUE);
1555 if (n == 0) goto finish;
1556 if (shaders == NULL) goto finish;
1558 AST(current_ctx->ostate.shared != NULL);
1560 objid_array = (GLuint *)calloc(1, sizeof(GLuint) * n);
1562 for (i = 0; i < n; i++)
1564 if (shaders[i] == 0) continue;
1565 objid_array[i] = fastpath_ostate_get_object(¤t_ctx->ostate, GL_OBJECT_TYPE_PROGRAM, shaders[i]);
1568 _orig_fastpath_glShaderBinary(n, objid_array, binaryformat, binary, length);
1573 if (objid_array != NULL)
1579 _COREGL_FASTPATH_FUNC_END();
1584 fastpath_glCompileShader(GLuint shader)
1588 DEFINE_FASTPAH_GL_FUNC();
1589 _COREGL_FASTPATH_FUNC_BEGIN();
1590 INIT_FASTPATH_GL_FUNC();
1592 if (GET_REAL_OBJ(GL_OBJECT_TYPE_PROGRAM, shader, &real_obj) != 1)
1594 _set_gl_error(GL_INVALID_VALUE);
1598 _orig_fastpath_glCompileShader(real_obj);
1603 _COREGL_FASTPATH_FUNC_END();
1608 fastpath_glBindAttribLocation(GLuint program, GLuint index, const char* name)
1612 DEFINE_FASTPAH_GL_FUNC();
1613 _COREGL_FASTPATH_FUNC_BEGIN();
1614 INIT_FASTPATH_GL_FUNC();
1616 if (GET_REAL_OBJ(GL_OBJECT_TYPE_PROGRAM, program, &real_obj) != 1)
1618 _set_gl_error(GL_INVALID_VALUE);
1622 _orig_fastpath_glBindAttribLocation(real_obj, index, name);
1627 _COREGL_FASTPATH_FUNC_END();
1632 fastpath_glAttachShader(GLuint program, GLuint shader)
1634 GLuint real_obj_program;
1635 GLuint real_obj_shader;
1637 DEFINE_FASTPAH_GL_FUNC();
1638 _COREGL_FASTPATH_FUNC_BEGIN();
1639 INIT_FASTPATH_GL_FUNC();
1641 if (GET_REAL_OBJ(GL_OBJECT_TYPE_PROGRAM, program, &real_obj_program) != 1 ||
1642 GET_REAL_OBJ(GL_OBJECT_TYPE_PROGRAM, shader, &real_obj_shader) != 1)
1644 _set_gl_error(GL_INVALID_VALUE);
1648 IF_GL_SUCCESS(_orig_fastpath_glAttachShader(real_obj_program, real_obj_shader))
1650 _update_program_attach_info(¤t_ctx->ostate, program);
1651 _attach_program_object(¤t_ctx->ostate, shader);
1657 _COREGL_FASTPATH_FUNC_END();
1662 fastpath_glDetachShader(GLuint program, GLuint shader)
1664 GLuint real_obj_program;
1665 GLuint real_obj_shader;
1667 DEFINE_FASTPAH_GL_FUNC();
1668 _COREGL_FASTPATH_FUNC_BEGIN();
1669 INIT_FASTPATH_GL_FUNC();
1671 if (GET_REAL_OBJ(GL_OBJECT_TYPE_PROGRAM, program, &real_obj_program) != 1 ||
1672 GET_REAL_OBJ(GL_OBJECT_TYPE_PROGRAM, shader, &real_obj_shader) != 1)
1674 _set_gl_error(GL_INVALID_VALUE);
1678 IF_GL_SUCCESS(_orig_fastpath_glDetachShader(real_obj_program, real_obj_shader))
1680 _update_program_attach_info(¤t_ctx->ostate, program);
1681 _detach_program_object(¤t_ctx->ostate, real_obj_shader, 0, 0);
1687 _COREGL_FASTPATH_FUNC_END();
1692 fastpath_glIsShader(GLuint shader)
1694 GLboolean ret = GL_FALSE;
1697 DEFINE_FASTPAH_GL_FUNC();
1698 _COREGL_FASTPATH_FUNC_BEGIN();
1699 INIT_FASTPATH_GL_FUNC();
1701 if (GET_REAL_OBJ(GL_OBJECT_TYPE_PROGRAM, shader, &real_obj) != 1)
1707 ret = _orig_fastpath_glIsShader(real_obj);
1712 _COREGL_FASTPATH_FUNC_END();
1718 fastpath_glIsProgram(GLuint program)
1720 GLboolean ret = GL_FALSE;
1723 DEFINE_FASTPAH_GL_FUNC();
1724 _COREGL_FASTPATH_FUNC_BEGIN();
1725 INIT_FASTPATH_GL_FUNC();
1727 if (GET_REAL_OBJ(GL_OBJECT_TYPE_PROGRAM, program, &real_obj) != 1)
1733 ret = _orig_fastpath_glIsProgram(real_obj);
1738 _COREGL_FASTPATH_FUNC_END();
1744 fastpath_glLinkProgram(GLuint program)
1748 DEFINE_FASTPAH_GL_FUNC();
1749 _COREGL_FASTPATH_FUNC_BEGIN();
1750 INIT_FASTPATH_GL_FUNC();
1752 if (GET_REAL_OBJ(GL_OBJECT_TYPE_PROGRAM, program, &real_obj) != 1)
1754 _set_gl_error(GL_INVALID_VALUE);
1758 _orig_fastpath_glLinkProgram(real_obj);
1763 _COREGL_FASTPATH_FUNC_END();
1768 fastpath_glValidateProgram(GLuint program)
1772 DEFINE_FASTPAH_GL_FUNC();
1773 _COREGL_FASTPATH_FUNC_BEGIN();
1774 INIT_FASTPATH_GL_FUNC();
1776 if (GET_REAL_OBJ(GL_OBJECT_TYPE_PROGRAM, program, &real_obj) != 1)
1778 _set_gl_error(GL_INVALID_VALUE);
1782 _orig_fastpath_glValidateProgram(real_obj);
1787 _COREGL_FASTPATH_FUNC_END();
1792 fastpath_glUseProgram(GLuint program)
1796 DEFINE_FASTPAH_GL_FUNC();
1797 _COREGL_FASTPATH_FUNC_BEGIN();
1798 INIT_FASTPATH_GL_FUNC();
1800 if (GET_REAL_OBJ(GL_OBJECT_TYPE_PROGRAM, program, &real_obj) != 1)
1802 _set_gl_error(GL_INVALID_VALUE);
1806 CURR_STATE_COMPARE(gl_current_program, real_obj)
1808 IF_GL_SUCCESS(_orig_fastpath_glUseProgram(real_obj))
1810 _attach_program_object(¤t_ctx->ostate, program);
1811 _detach_program_object(¤t_ctx->ostate, current_ctx->gl_current_program[0], 1, 0);
1813 current_ctx->_clear_flag1 |= _CLEAR_FLAG1_BIT_gl_current_program;
1814 current_ctx->gl_current_program[0] = real_obj;
1820 _COREGL_FASTPATH_FUNC_END();
1825 fastpath_glGetActiveAttrib(GLuint program, GLuint index, GLsizei bufsize, GLsizei* length, GLint* size, GLenum* type, char* name)
1829 DEFINE_FASTPAH_GL_FUNC();
1830 _COREGL_FASTPATH_FUNC_BEGIN();
1831 INIT_FASTPATH_GL_FUNC();
1833 if (GET_REAL_OBJ(GL_OBJECT_TYPE_PROGRAM, program, &real_obj) != 1)
1835 _set_gl_error(GL_INVALID_VALUE);
1839 _orig_fastpath_glGetActiveAttrib(real_obj, index, bufsize, length, size, type, name);
1844 _COREGL_FASTPATH_FUNC_END();
1849 fastpath_glGetActiveUniform(GLuint program, GLuint index, GLsizei bufsize, GLsizei* length, GLint* size, GLenum* type, char* name)
1853 DEFINE_FASTPAH_GL_FUNC();
1854 _COREGL_FASTPATH_FUNC_BEGIN();
1855 INIT_FASTPATH_GL_FUNC();
1857 if (GET_REAL_OBJ(GL_OBJECT_TYPE_PROGRAM, program, &real_obj) != 1)
1859 _set_gl_error(GL_INVALID_VALUE);
1863 _orig_fastpath_glGetActiveUniform(real_obj, index, bufsize, length, size, type, name);
1868 _COREGL_FASTPATH_FUNC_END();
1873 fastpath_glGetAttachedShaders(GLuint program, GLsizei maxcount, GLsizei* count, GLuint* shaders)
1876 GLsizei real_count = _COREGL_INT_INIT_VALUE;
1879 DEFINE_FASTPAH_GL_FUNC();
1880 _COREGL_FASTPATH_FUNC_BEGIN();
1881 INIT_FASTPATH_GL_FUNC();
1883 if (GET_REAL_OBJ(GL_OBJECT_TYPE_PROGRAM, program, &real_obj) != 1)
1885 _set_gl_error(GL_INVALID_VALUE);
1889 IF_GL_SUCCESS(_orig_fastpath_glGetAttachedShaders(real_obj, maxcount, &real_count, shaders))
1891 for (i = 0; i < real_count; i++)
1893 if (shaders[i] != 0)
1894 shaders[i] = fastpath_ostate_find_object(¤t_ctx->ostate, GL_OBJECT_TYPE_PROGRAM, shaders[i]);
1896 if (count != NULL) *count = real_count;
1902 _COREGL_FASTPATH_FUNC_END();
1907 fastpath_glGetAttribLocation(GLuint program, const char* name)
1909 int ret = _COREGL_INT_INIT_VALUE;
1912 DEFINE_FASTPAH_GL_FUNC();
1913 _COREGL_FASTPATH_FUNC_BEGIN();
1914 INIT_FASTPATH_GL_FUNC();
1916 if (GET_REAL_OBJ(GL_OBJECT_TYPE_PROGRAM, program, &real_obj) != 1)
1918 _set_gl_error(GL_INVALID_VALUE);
1922 ret = _orig_fastpath_glGetAttribLocation(real_obj, name);
1927 _COREGL_FASTPATH_FUNC_END();
1933 fastpath_glGetShaderiv(GLuint shader, GLenum pname, GLint* params)
1937 DEFINE_FASTPAH_GL_FUNC();
1938 _COREGL_FASTPATH_FUNC_BEGIN();
1939 INIT_FASTPATH_GL_FUNC();
1941 if (GET_REAL_OBJ(GL_OBJECT_TYPE_PROGRAM, shader, &real_obj) != 1)
1943 _set_gl_error(GL_INVALID_VALUE);
1949 case GL_DELETE_STATUS:
1951 if (_is_deleted_program_object(¤t_ctx->ostate, shader) == 1)
1955 _orig_fastpath_glGetShaderiv(real_obj, pname, params);
1962 _COREGL_FASTPATH_FUNC_END();
1967 fastpath_glGetShaderInfoLog(GLuint shader, GLsizei bufsize, GLsizei* length, char* infolog)
1971 DEFINE_FASTPAH_GL_FUNC();
1972 _COREGL_FASTPATH_FUNC_BEGIN();
1973 INIT_FASTPATH_GL_FUNC();
1975 if (GET_REAL_OBJ(GL_OBJECT_TYPE_PROGRAM, shader, &real_obj) != 1)
1977 _set_gl_error(GL_INVALID_VALUE);
1981 _orig_fastpath_glGetShaderInfoLog(real_obj, bufsize, length, infolog);
1986 _COREGL_FASTPATH_FUNC_END();
1991 fastpath_glGetProgramiv(GLuint program, GLenum pname, GLint* params)
1995 DEFINE_FASTPAH_GL_FUNC();
1996 _COREGL_FASTPATH_FUNC_BEGIN();
1997 INIT_FASTPATH_GL_FUNC();
1999 if (GET_REAL_OBJ(GL_OBJECT_TYPE_PROGRAM, program, &real_obj) != 1)
2001 _set_gl_error(GL_INVALID_VALUE);
2007 case GL_DELETE_STATUS:
2009 if (_is_deleted_program_object(¤t_ctx->ostate, program) == 1)
2013 _orig_fastpath_glGetProgramiv(real_obj, pname, params);
2020 _COREGL_FASTPATH_FUNC_END();
2025 fastpath_glGetProgramInfoLog(GLuint program, GLsizei bufsize, GLsizei* length, char* infolog)
2029 DEFINE_FASTPAH_GL_FUNC();
2030 _COREGL_FASTPATH_FUNC_BEGIN();
2031 INIT_FASTPATH_GL_FUNC();
2033 if (GET_REAL_OBJ(GL_OBJECT_TYPE_PROGRAM, program, &real_obj) != 1)
2035 _set_gl_error(GL_INVALID_VALUE);
2039 _orig_fastpath_glGetProgramInfoLog(real_obj, bufsize, length, infolog);
2044 _COREGL_FASTPATH_FUNC_END();
2049 fastpath_glGetShaderSource(GLuint shader, GLsizei bufsize, GLsizei* length, char* source)
2053 DEFINE_FASTPAH_GL_FUNC();
2054 _COREGL_FASTPATH_FUNC_BEGIN();
2055 INIT_FASTPATH_GL_FUNC();
2057 if (GET_REAL_OBJ(GL_OBJECT_TYPE_PROGRAM, shader, &real_obj) != 1)
2059 _set_gl_error(GL_INVALID_VALUE);
2063 _orig_fastpath_glGetShaderSource(real_obj, bufsize, length, source);
2068 _COREGL_FASTPATH_FUNC_END();
2073 fastpath_glGetUniformfv(GLuint program, GLint location, GLfloat* params)
2077 DEFINE_FASTPAH_GL_FUNC();
2078 _COREGL_FASTPATH_FUNC_BEGIN();
2079 INIT_FASTPATH_GL_FUNC();
2081 if (GET_REAL_OBJ(GL_OBJECT_TYPE_PROGRAM, program, &real_obj) != 1)
2083 _set_gl_error(GL_INVALID_VALUE);
2087 _orig_fastpath_glGetUniformfv(real_obj, location, params);
2092 _COREGL_FASTPATH_FUNC_END();
2097 fastpath_glGetUniformiv(GLuint program, GLint location, GLint* params)
2101 DEFINE_FASTPAH_GL_FUNC();
2102 _COREGL_FASTPATH_FUNC_BEGIN();
2103 INIT_FASTPATH_GL_FUNC();
2105 if (GET_REAL_OBJ(GL_OBJECT_TYPE_PROGRAM, program, &real_obj) != 1)
2107 _set_gl_error(GL_INVALID_VALUE);
2111 _orig_fastpath_glGetUniformiv(real_obj, location, params);
2116 _COREGL_FASTPATH_FUNC_END();
2121 fastpath_glUseProgramStagesEXT(GLuint pipeline, GLbitfield stages, GLuint program)
2125 DEFINE_FASTPAH_GL_FUNC();
2126 _COREGL_FASTPATH_FUNC_BEGIN();
2127 INIT_FASTPATH_GL_FUNC();
2129 if (GET_REAL_OBJ(GL_OBJECT_TYPE_PROGRAM, program, &real_obj) != 1)
2131 _set_gl_error(GL_INVALID_VALUE);
2135 _orig_fastpath_glUseProgramStagesEXT(pipeline, stages, real_obj);
2140 _COREGL_FASTPATH_FUNC_END();
2145 fastpath_glActiveShaderProgramEXT(GLuint pipeline, GLuint program)
2149 DEFINE_FASTPAH_GL_FUNC();
2150 _COREGL_FASTPATH_FUNC_BEGIN();
2151 INIT_FASTPATH_GL_FUNC();
2153 if (GET_REAL_OBJ(GL_OBJECT_TYPE_PROGRAM, program, &real_obj) != 1)
2155 _set_gl_error(GL_INVALID_VALUE);
2159 _orig_fastpath_glActiveShaderProgramEXT(pipeline, real_obj);
2164 _COREGL_FASTPATH_FUNC_END();
2169 fastpath_glProgramParameteriEXT(GLuint program, GLenum pname, GLint value)
2173 DEFINE_FASTPAH_GL_FUNC();
2174 _COREGL_FASTPATH_FUNC_BEGIN();
2175 INIT_FASTPATH_GL_FUNC();
2177 if (GET_REAL_OBJ(GL_OBJECT_TYPE_PROGRAM, program, &real_obj) != 1)
2179 _set_gl_error(GL_INVALID_VALUE);
2183 _orig_fastpath_glProgramParameteriEXT(real_obj, pname, value);
2188 _COREGL_FASTPATH_FUNC_END();
2193 fastpath_glProgramUniform1iEXT(GLuint program, GLint location, GLint x)
2197 DEFINE_FASTPAH_GL_FUNC();
2198 _COREGL_FASTPATH_FUNC_BEGIN();
2199 INIT_FASTPATH_GL_FUNC();
2201 if (GET_REAL_OBJ(GL_OBJECT_TYPE_PROGRAM, program, &real_obj) != 1)
2203 _set_gl_error(GL_INVALID_VALUE);
2207 _orig_fastpath_glProgramUniform1iEXT(real_obj, location, x);
2212 _COREGL_FASTPATH_FUNC_END();
2217 fastpath_glProgramUniform2iEXT(GLuint program, GLint location, GLint x, GLint y)
2221 DEFINE_FASTPAH_GL_FUNC();
2222 _COREGL_FASTPATH_FUNC_BEGIN();
2223 INIT_FASTPATH_GL_FUNC();
2225 if (GET_REAL_OBJ(GL_OBJECT_TYPE_PROGRAM, program, &real_obj) != 1)
2227 _set_gl_error(GL_INVALID_VALUE);
2231 _orig_fastpath_glProgramUniform2iEXT(real_obj, location, x, y);
2236 _COREGL_FASTPATH_FUNC_END();
2241 fastpath_glProgramUniform3iEXT(GLuint program, GLint location, GLint x, GLint y, GLint z)
2245 DEFINE_FASTPAH_GL_FUNC();
2246 _COREGL_FASTPATH_FUNC_BEGIN();
2247 INIT_FASTPATH_GL_FUNC();
2249 if (GET_REAL_OBJ(GL_OBJECT_TYPE_PROGRAM, program, &real_obj) != 1)
2251 _set_gl_error(GL_INVALID_VALUE);
2255 _orig_fastpath_glProgramUniform3iEXT(real_obj, location, x, y, z);
2260 _COREGL_FASTPATH_FUNC_END();
2265 fastpath_glProgramUniform4iEXT(GLuint program, GLint location, GLint x, GLint y, GLint z, GLint w)
2269 DEFINE_FASTPAH_GL_FUNC();
2270 _COREGL_FASTPATH_FUNC_BEGIN();
2271 INIT_FASTPATH_GL_FUNC();
2273 if (GET_REAL_OBJ(GL_OBJECT_TYPE_PROGRAM, program, &real_obj) != 1)
2275 _set_gl_error(GL_INVALID_VALUE);
2279 _orig_fastpath_glProgramUniform4iEXT(real_obj, location, x, y, z, w);
2284 _COREGL_FASTPATH_FUNC_END();
2289 fastpath_glProgramUniform1fEXT(GLuint program, GLint location, GLfloat x)
2293 DEFINE_FASTPAH_GL_FUNC();
2294 _COREGL_FASTPATH_FUNC_BEGIN();
2295 INIT_FASTPATH_GL_FUNC();
2297 if (GET_REAL_OBJ(GL_OBJECT_TYPE_PROGRAM, program, &real_obj) != 1)
2299 _set_gl_error(GL_INVALID_VALUE);
2303 _orig_fastpath_glProgramUniform1fEXT(real_obj, location, x);
2308 _COREGL_FASTPATH_FUNC_END();
2313 fastpath_glProgramUniform2fEXT(GLuint program, GLint location, GLfloat x, GLfloat y)
2317 DEFINE_FASTPAH_GL_FUNC();
2318 _COREGL_FASTPATH_FUNC_BEGIN();
2319 INIT_FASTPATH_GL_FUNC();
2321 if (GET_REAL_OBJ(GL_OBJECT_TYPE_PROGRAM, program, &real_obj) != 1)
2323 _set_gl_error(GL_INVALID_VALUE);
2327 _orig_fastpath_glProgramUniform2fEXT(real_obj, location, x, y);
2332 _COREGL_FASTPATH_FUNC_END();
2337 fastpath_glProgramUniform3fEXT(GLuint program, GLint location, GLfloat x, GLfloat y, GLfloat z)
2341 DEFINE_FASTPAH_GL_FUNC();
2342 _COREGL_FASTPATH_FUNC_BEGIN();
2343 INIT_FASTPATH_GL_FUNC();
2345 if (GET_REAL_OBJ(GL_OBJECT_TYPE_PROGRAM, program, &real_obj) != 1)
2347 _set_gl_error(GL_INVALID_VALUE);
2351 _orig_fastpath_glProgramUniform3fEXT(real_obj, location, x, y, z);
2356 _COREGL_FASTPATH_FUNC_END();
2361 fastpath_glProgramUniform4fEXT(GLuint program, GLint location, GLfloat x, GLfloat y, GLfloat z, GLfloat w)
2365 DEFINE_FASTPAH_GL_FUNC();
2366 _COREGL_FASTPATH_FUNC_BEGIN();
2367 INIT_FASTPATH_GL_FUNC();
2369 if (GET_REAL_OBJ(GL_OBJECT_TYPE_PROGRAM, program, &real_obj) != 1)
2371 _set_gl_error(GL_INVALID_VALUE);
2375 _orig_fastpath_glProgramUniform4fEXT(real_obj, location, x, y, z, w);
2380 _COREGL_FASTPATH_FUNC_END();
2385 fastpath_glProgramUniform1ivEXT(GLuint program, GLint location, GLsizei count, const GLint *value)
2389 DEFINE_FASTPAH_GL_FUNC();
2390 _COREGL_FASTPATH_FUNC_BEGIN();
2391 INIT_FASTPATH_GL_FUNC();
2393 if (GET_REAL_OBJ(GL_OBJECT_TYPE_PROGRAM, program, &real_obj) != 1)
2395 _set_gl_error(GL_INVALID_VALUE);
2399 _orig_fastpath_glProgramUniform1ivEXT(real_obj, location, count, value);
2404 _COREGL_FASTPATH_FUNC_END();
2409 fastpath_glProgramUniform2ivEXT(GLuint program, GLint location, GLsizei count, const GLint *value)
2413 DEFINE_FASTPAH_GL_FUNC();
2414 _COREGL_FASTPATH_FUNC_BEGIN();
2415 INIT_FASTPATH_GL_FUNC();
2417 if (GET_REAL_OBJ(GL_OBJECT_TYPE_PROGRAM, program, &real_obj) != 1)
2419 _set_gl_error(GL_INVALID_VALUE);
2423 _orig_fastpath_glProgramUniform2ivEXT(real_obj, location, count, value);
2428 _COREGL_FASTPATH_FUNC_END();
2433 fastpath_glProgramUniform3ivEXT(GLuint program, GLint location, GLsizei count, const GLint *value)
2437 DEFINE_FASTPAH_GL_FUNC();
2438 _COREGL_FASTPATH_FUNC_BEGIN();
2439 INIT_FASTPATH_GL_FUNC();
2441 if (GET_REAL_OBJ(GL_OBJECT_TYPE_PROGRAM, program, &real_obj) != 1)
2443 _set_gl_error(GL_INVALID_VALUE);
2447 _orig_fastpath_glProgramUniform3ivEXT(real_obj, location, count, value);
2452 _COREGL_FASTPATH_FUNC_END();
2457 fastpath_glProgramUniform4ivEXT(GLuint program, GLint location, GLsizei count, const GLint *value)
2461 DEFINE_FASTPAH_GL_FUNC();
2462 _COREGL_FASTPATH_FUNC_BEGIN();
2463 INIT_FASTPATH_GL_FUNC();
2465 if (GET_REAL_OBJ(GL_OBJECT_TYPE_PROGRAM, program, &real_obj) != 1)
2467 _set_gl_error(GL_INVALID_VALUE);
2471 _orig_fastpath_glProgramUniform4ivEXT(real_obj, location, count, value);
2476 _COREGL_FASTPATH_FUNC_END();
2481 fastpath_glProgramUniform1fvEXT(GLuint program, GLint location, GLsizei count, const GLfloat *value)
2485 DEFINE_FASTPAH_GL_FUNC();
2486 _COREGL_FASTPATH_FUNC_BEGIN();
2487 INIT_FASTPATH_GL_FUNC();
2489 if (GET_REAL_OBJ(GL_OBJECT_TYPE_PROGRAM, program, &real_obj) != 1)
2491 _set_gl_error(GL_INVALID_VALUE);
2495 _orig_fastpath_glProgramUniform1fvEXT(real_obj, location, count, value);
2500 _COREGL_FASTPATH_FUNC_END();
2505 fastpath_glProgramUniform2fvEXT(GLuint program, GLint location, GLsizei count, const GLfloat *value)
2509 DEFINE_FASTPAH_GL_FUNC();
2510 _COREGL_FASTPATH_FUNC_BEGIN();
2511 INIT_FASTPATH_GL_FUNC();
2513 if (GET_REAL_OBJ(GL_OBJECT_TYPE_PROGRAM, program, &real_obj) != 1)
2515 _set_gl_error(GL_INVALID_VALUE);
2519 _orig_fastpath_glProgramUniform2fvEXT(real_obj, location, count, value);
2524 _COREGL_FASTPATH_FUNC_END();
2529 fastpath_glProgramUniform3fvEXT(GLuint program, GLint location, GLsizei count, const GLfloat *value)
2533 DEFINE_FASTPAH_GL_FUNC();
2534 _COREGL_FASTPATH_FUNC_BEGIN();
2535 INIT_FASTPATH_GL_FUNC();
2537 if (GET_REAL_OBJ(GL_OBJECT_TYPE_PROGRAM, program, &real_obj) != 1)
2539 _set_gl_error(GL_INVALID_VALUE);
2543 _orig_fastpath_glProgramUniform3fvEXT(real_obj, location, count, value);
2548 _COREGL_FASTPATH_FUNC_END();
2553 fastpath_glProgramUniform4fvEXT(GLuint program, GLint location, GLsizei count, const GLfloat *value)
2557 DEFINE_FASTPAH_GL_FUNC();
2558 _COREGL_FASTPATH_FUNC_BEGIN();
2559 INIT_FASTPATH_GL_FUNC();
2561 if (GET_REAL_OBJ(GL_OBJECT_TYPE_PROGRAM, program, &real_obj) != 1)
2563 _set_gl_error(GL_INVALID_VALUE);
2567 _orig_fastpath_glProgramUniform4fvEXT(real_obj, location, count, value);
2572 _COREGL_FASTPATH_FUNC_END();
2577 fastpath_glProgramUniformMatrix2fvEXT(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
2581 DEFINE_FASTPAH_GL_FUNC();
2582 _COREGL_FASTPATH_FUNC_BEGIN();
2583 INIT_FASTPATH_GL_FUNC();
2585 if (GET_REAL_OBJ(GL_OBJECT_TYPE_PROGRAM, program, &real_obj) != 1)
2587 _set_gl_error(GL_INVALID_VALUE);
2591 _orig_fastpath_glProgramUniformMatrix2fvEXT(real_obj, location, count, transpose, value);
2596 _COREGL_FASTPATH_FUNC_END();
2601 fastpath_glProgramUniformMatrix3fvEXT(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
2605 DEFINE_FASTPAH_GL_FUNC();
2606 _COREGL_FASTPATH_FUNC_BEGIN();
2607 INIT_FASTPATH_GL_FUNC();
2609 if (GET_REAL_OBJ(GL_OBJECT_TYPE_PROGRAM, program, &real_obj) != 1)
2611 _set_gl_error(GL_INVALID_VALUE);
2615 _orig_fastpath_glProgramUniformMatrix3fvEXT(real_obj, location, count, transpose, value);
2620 _COREGL_FASTPATH_FUNC_END();
2625 fastpath_glProgramUniformMatrix4fvEXT(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
2629 DEFINE_FASTPAH_GL_FUNC();
2630 _COREGL_FASTPATH_FUNC_BEGIN();
2631 INIT_FASTPATH_GL_FUNC();
2633 if (GET_REAL_OBJ(GL_OBJECT_TYPE_PROGRAM, program, &real_obj) != 1)
2635 _set_gl_error(GL_INVALID_VALUE);
2639 _orig_fastpath_glProgramUniformMatrix4fvEXT(real_obj, location, count, transpose, value);
2644 _COREGL_FASTPATH_FUNC_END();
2649 fastpath_glGetUniformLocation(GLuint program, const char* name)
2651 int ret = _COREGL_INT_INIT_VALUE;
2654 DEFINE_FASTPAH_GL_FUNC();
2655 _COREGL_FASTPATH_FUNC_BEGIN();
2656 INIT_FASTPATH_GL_FUNC();
2658 if (GET_REAL_OBJ(GL_OBJECT_TYPE_PROGRAM, program, &real_obj) != 1)
2660 _set_gl_error(GL_INVALID_VALUE);
2665 ret = _orig_fastpath_glGetUniformLocation(real_obj, name);
2670 _COREGL_FASTPATH_FUNC_END();
2675 fastpath_glDeleteShader(GLuint shader)
2679 DEFINE_FASTPAH_GL_FUNC();
2680 _COREGL_FASTPATH_FUNC_BEGIN();
2681 INIT_FASTPATH_GL_FUNC();
2683 if (GET_REAL_OBJ(GL_OBJECT_TYPE_PROGRAM, shader, &real_obj) != 1)
2685 _set_gl_error(GL_INVALID_VALUE);
2689 _detach_program_object(¤t_ctx->ostate, real_obj, 0, 1);
2694 _COREGL_FASTPATH_FUNC_END();
2698 fastpath_glDeleteProgram(GLuint program)
2702 DEFINE_FASTPAH_GL_FUNC();
2703 _COREGL_FASTPATH_FUNC_BEGIN();
2704 INIT_FASTPATH_GL_FUNC();
2706 if (GET_REAL_OBJ(GL_OBJECT_TYPE_PROGRAM, program, &real_obj) != 1)
2708 _set_gl_error(GL_INVALID_VALUE);
2712 _detach_program_object(¤t_ctx->ostate, real_obj, 1, 1);
2717 _COREGL_FASTPATH_FUNC_END();
2722 //////////////////////////////////////////////////////////////////////////////////
2725 fastpath_glBlendColor(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha)
2727 DEFINE_FASTPAH_GL_FUNC();
2728 _COREGL_FASTPATH_FUNC_BEGIN();
2729 INIT_FASTPATH_GL_FUNC();
2731 if ((current_ctx->gl_blend_color[0] != red) ||
2732 (current_ctx->gl_blend_color[1] != green) ||
2733 (current_ctx->gl_blend_color[2] != blue) ||
2734 (current_ctx->gl_blend_color[3] != alpha))
2736 IF_GL_SUCCESS(_orig_fastpath_glBlendColor(red, green, blue, alpha))
2738 current_ctx->_blend_flag |= _BLEND_FLAG_BIT_gl_blend_color;
2739 current_ctx->gl_blend_color[0] = red;
2740 current_ctx->gl_blend_color[1] = green;
2741 current_ctx->gl_blend_color[2] = blue;
2742 current_ctx->gl_blend_color[3] = alpha;
2748 _COREGL_FASTPATH_FUNC_END();
2753 fastpath_glBlendEquation(GLenum mode)
2755 DEFINE_FASTPAH_GL_FUNC();
2756 _COREGL_FASTPATH_FUNC_BEGIN();
2757 INIT_FASTPATH_GL_FUNC();
2759 IF_GL_SUCCESS(_orig_fastpath_glBlendEquation(mode))
2761 current_ctx->_blend_flag |=
2762 _BLEND_FLAG_BIT_gl_blend_equation_rgb |
2763 _BLEND_FLAG_BIT_gl_blend_equation_alpha;
2765 _orig_fastpath_glGetIntegerv(GL_BLEND_EQUATION_RGB, (GLint*) & (current_ctx->gl_blend_equation_rgb));
2766 _orig_fastpath_glGetIntegerv(GL_BLEND_EQUATION_ALPHA, (GLint*) & (current_ctx->gl_blend_equation_alpha));
2771 _COREGL_FASTPATH_FUNC_END();
2776 fastpath_glBlendEquationSeparate(GLenum modeRGB, GLenum modeAlpha)
2778 DEFINE_FASTPAH_GL_FUNC();
2779 _COREGL_FASTPATH_FUNC_BEGIN();
2780 INIT_FASTPATH_GL_FUNC();
2782 if ((current_ctx->gl_blend_equation_rgb[0] != modeRGB) ||
2783 (current_ctx->gl_blend_equation_alpha[0] != modeAlpha))
2785 IF_GL_SUCCESS(_orig_fastpath_glBlendEquationSeparate(modeRGB, modeAlpha))
2787 current_ctx->_blend_flag |=
2788 _BLEND_FLAG_BIT_gl_blend_equation_rgb |
2789 _BLEND_FLAG_BIT_gl_blend_equation_alpha;
2791 current_ctx->gl_blend_equation_rgb[0] = modeRGB;
2792 current_ctx->gl_blend_equation_alpha[0] = modeAlpha;
2798 _COREGL_FASTPATH_FUNC_END();
2803 fastpath_glBlendFunc(GLenum sfactor, GLenum dfactor)
2805 DEFINE_FASTPAH_GL_FUNC();
2806 _COREGL_FASTPATH_FUNC_BEGIN();
2807 INIT_FASTPATH_GL_FUNC();
2809 IF_GL_SUCCESS(_orig_fastpath_glBlendFunc(sfactor, dfactor))
2811 current_ctx->_blend_flag |=
2812 _BLEND_FLAG_BIT_gl_blend_src_rgb |
2813 _BLEND_FLAG_BIT_gl_blend_src_alpha |
2814 _BLEND_FLAG_BIT_gl_blend_dst_rgb |
2815 _BLEND_FLAG_BIT_gl_blend_dst_alpha;
2817 _orig_fastpath_glGetIntegerv(GL_BLEND_SRC_RGB, (GLint*) & (current_ctx->gl_blend_src_rgb));
2818 _orig_fastpath_glGetIntegerv(GL_BLEND_SRC_ALPHA, (GLint*) & (current_ctx->gl_blend_src_alpha));
2819 _orig_fastpath_glGetIntegerv(GL_BLEND_DST_RGB, (GLint*) & (current_ctx->gl_blend_dst_rgb));
2820 _orig_fastpath_glGetIntegerv(GL_BLEND_DST_ALPHA, (GLint*) & (current_ctx->gl_blend_dst_alpha));
2825 _COREGL_FASTPATH_FUNC_END();
2830 fastpath_glBlendFuncSeparate(GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha)
2832 DEFINE_FASTPAH_GL_FUNC();
2833 _COREGL_FASTPATH_FUNC_BEGIN();
2834 INIT_FASTPATH_GL_FUNC();
2836 if ((current_ctx->gl_blend_src_rgb[0] != srcRGB) ||
2837 (current_ctx->gl_blend_dst_rgb[0] != dstRGB) ||
2838 (current_ctx->gl_blend_src_alpha[0] != srcAlpha) ||
2839 (current_ctx->gl_blend_dst_alpha[0] != dstAlpha))
2841 IF_GL_SUCCESS(_orig_fastpath_glBlendFuncSeparate(srcRGB, dstRGB, srcAlpha, dstAlpha))
2843 current_ctx->_blend_flag |=
2844 _BLEND_FLAG_BIT_gl_blend_src_rgb |
2845 _BLEND_FLAG_BIT_gl_blend_src_alpha |
2846 _BLEND_FLAG_BIT_gl_blend_dst_rgb |
2847 _BLEND_FLAG_BIT_gl_blend_dst_alpha;
2849 current_ctx->gl_blend_src_rgb[0] = srcRGB;
2850 current_ctx->gl_blend_dst_rgb[0] = dstRGB;
2851 current_ctx->gl_blend_src_alpha[0] = srcAlpha;
2852 current_ctx->gl_blend_dst_alpha[0] = dstAlpha;
2858 _COREGL_FASTPATH_FUNC_END();
2863 fastpath_glClearColor(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha)
2865 DEFINE_FASTPAH_GL_FUNC();
2866 _COREGL_FASTPATH_FUNC_BEGIN();
2867 INIT_FASTPATH_GL_FUNC();
2869 if ((current_ctx->gl_color_clear_value[0] != red) ||
2870 (current_ctx->gl_color_clear_value[1] != green) ||
2871 (current_ctx->gl_color_clear_value[2] != blue) ||
2872 (current_ctx->gl_color_clear_value[3] != alpha))
2874 IF_GL_SUCCESS(_orig_fastpath_glClearColor(red, green, blue, alpha))
2876 current_ctx->_clear_flag1 |= _CLEAR_FLAG1_BIT_gl_color_clear_value;
2877 current_ctx->gl_color_clear_value[0] = red;
2878 current_ctx->gl_color_clear_value[1] = green;
2879 current_ctx->gl_color_clear_value[2] = blue;
2880 current_ctx->gl_color_clear_value[3] = alpha;
2886 _COREGL_FASTPATH_FUNC_END();
2891 fastpath_glClearDepthf(GLclampf depth)
2893 DEFINE_FASTPAH_GL_FUNC();
2894 _COREGL_FASTPATH_FUNC_BEGIN();
2895 INIT_FASTPATH_GL_FUNC();
2897 CURR_STATE_COMPARE(gl_depth_clear_value, depth)
2899 IF_GL_SUCCESS(_orig_fastpath_glClearDepthf(depth))
2901 current_ctx->_clear_flag2 |= _CLEAR_FLAG2_BIT_gl_depth_clear_value;
2902 current_ctx->gl_depth_clear_value[0] = depth;
2908 _COREGL_FASTPATH_FUNC_END();
2913 fastpath_glClearStencil(GLint s)
2915 DEFINE_FASTPAH_GL_FUNC();
2916 _COREGL_FASTPATH_FUNC_BEGIN();
2917 INIT_FASTPATH_GL_FUNC();
2919 CURR_STATE_COMPARE(gl_stencil_clear_value, s)
2921 IF_GL_SUCCESS(_orig_fastpath_glClearStencil(s))
2923 current_ctx->_stencil_flag2 |= _STENCIL_FLAG2_BIT_gl_stencil_clear_value;
2924 current_ctx->gl_stencil_clear_value[0] = s;
2930 _COREGL_FASTPATH_FUNC_END();
2935 fastpath_glColorMask(GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha)
2937 DEFINE_FASTPAH_GL_FUNC();
2938 _COREGL_FASTPATH_FUNC_BEGIN();
2939 INIT_FASTPATH_GL_FUNC();
2941 if ((current_ctx->gl_color_writemask[0] != red) ||
2942 (current_ctx->gl_color_writemask[1] != green) ||
2943 (current_ctx->gl_color_writemask[2] != blue) ||
2944 (current_ctx->gl_color_writemask[3] != alpha))
2946 IF_GL_SUCCESS(_orig_fastpath_glColorMask(red, green, blue, alpha))
2948 current_ctx->_clear_flag2 |= _CLEAR_FLAG2_BIT_gl_color_writemask;
2949 current_ctx->gl_color_writemask[0] = red;
2950 current_ctx->gl_color_writemask[1] = green;
2951 current_ctx->gl_color_writemask[2] = blue;
2952 current_ctx->gl_color_writemask[3] = alpha;
2958 _COREGL_FASTPATH_FUNC_END();
2963 fastpath_glCullFace(GLenum mode)
2965 DEFINE_FASTPAH_GL_FUNC();
2966 _COREGL_FASTPATH_FUNC_BEGIN();
2967 INIT_FASTPATH_GL_FUNC();
2969 CURR_STATE_COMPARE(gl_cull_face_mode, mode)
2971 IF_GL_SUCCESS(_orig_fastpath_glCullFace(mode))
2973 current_ctx->_clear_flag2 |= _CLEAR_FLAG2_BIT_gl_cull_face_mode;
2974 current_ctx->gl_cull_face_mode[0] = mode;
2980 _COREGL_FASTPATH_FUNC_END();
2985 fastpath_glDepthFunc(GLenum func)
2987 DEFINE_FASTPAH_GL_FUNC();
2988 _COREGL_FASTPATH_FUNC_BEGIN();
2989 INIT_FASTPATH_GL_FUNC();
2991 CURR_STATE_COMPARE(gl_depth_func, func)
2993 IF_GL_SUCCESS(_orig_fastpath_glDepthFunc(func))
2995 current_ctx->_clear_flag2 |= _CLEAR_FLAG2_BIT_gl_depth_func;
2996 current_ctx->gl_depth_func[0] = func;
3002 _COREGL_FASTPATH_FUNC_END();
3007 fastpath_glDepthMask(GLboolean flag)
3009 DEFINE_FASTPAH_GL_FUNC();
3010 _COREGL_FASTPATH_FUNC_BEGIN();
3011 INIT_FASTPATH_GL_FUNC();
3013 CURR_STATE_COMPARE(gl_depth_writemask, flag)
3015 IF_GL_SUCCESS(_orig_fastpath_glDepthMask(flag))
3017 current_ctx->_clear_flag2 |= _CLEAR_FLAG2_BIT_gl_depth_writemask;
3018 current_ctx->gl_depth_writemask[0] = flag;
3024 _COREGL_FASTPATH_FUNC_END();
3029 fastpath_glDepthRangef(GLclampf zNear, GLclampf zFar)
3031 DEFINE_FASTPAH_GL_FUNC();
3032 _COREGL_FASTPATH_FUNC_BEGIN();
3033 INIT_FASTPATH_GL_FUNC();
3035 if ((current_ctx->gl_depth_range[0] != zNear) ||
3036 (current_ctx->gl_depth_range[1] != zFar))
3038 IF_GL_SUCCESS(_orig_fastpath_glDepthRangef(zNear, zFar))
3040 current_ctx->_clear_flag2 |= _CLEAR_FLAG2_BIT_gl_depth_range;
3041 current_ctx->gl_depth_range[0] = zNear;
3042 current_ctx->gl_depth_range[1] = zFar;
3048 _COREGL_FASTPATH_FUNC_END();
3053 fastpath_glDisable(GLenum cap)
3055 DEFINE_FASTPAH_GL_FUNC();
3056 _COREGL_FASTPATH_FUNC_BEGIN();
3057 INIT_FASTPATH_GL_FUNC();
3059 #define STATE_PROC(gl_state, flagid, flagbit) \
3060 CURR_STATE_COMPARE(gl_state, GL_FALSE) \
3062 _orig_fastpath_glDisable(cap); \
3063 current_ctx->flagid &= (~flagbit##_##gl_state); \
3064 current_ctx->gl_state[0] = GL_FALSE; \
3071 STATE_PROC(gl_blend, _enable_flag1, _ENABLE_FLAG1_BIT);
3074 STATE_PROC(gl_cull_face, _enable_flag1, _ENABLE_FLAG1_BIT);
3077 STATE_PROC(gl_depth_test, _enable_flag1, _ENABLE_FLAG1_BIT);
3080 STATE_PROC(gl_dither, _enable_flag1, _ENABLE_FLAG1_BIT);
3082 case GL_POLYGON_OFFSET_FILL:
3083 STATE_PROC(gl_polygon_offset_fill, _enable_flag2, _ENABLE_FLAG2_BIT);
3085 case GL_PRIMITIVE_RESTART_FIXED_INDEX:
3086 STATE_PROC_WITH_CHECK(gl_primitive_restart_fixed_index, _enable_flag3, _ENABLE_FLAG3_BIT);
3088 case GL_RASTERIZER_DISCARD:
3089 STATE_PROC_WITH_CHECK(gl_rasterizer_discard, _enable_flag3, _ENABLE_FLAG3_BIT);
3091 case GL_SAMPLE_ALPHA_TO_COVERAGE:
3092 STATE_PROC(gl_sample_alpha_to_coverage, _enable_flag2, _ENABLE_FLAG2_BIT);
3094 case GL_SAMPLE_COVERAGE:
3095 STATE_PROC(gl_sample_coverage, _enable_flag2, _ENABLE_FLAG2_BIT);
3097 case GL_SCISSOR_TEST:
3098 STATE_PROC(gl_scissor_test, _enable_flag2, _ENABLE_FLAG2_BIT);
3100 case GL_STENCIL_TEST:
3101 STATE_PROC(gl_stencil_test, _enable_flag2, _ENABLE_FLAG2_BIT);
3104 _set_gl_error(GL_INVALID_ENUM);
3115 _COREGL_FASTPATH_FUNC_END();
3120 fastpath_glDisableVertexAttribArray(GLuint index)
3122 DEFINE_FASTPAH_GL_FUNC();
3123 _COREGL_FASTPATH_FUNC_BEGIN();
3124 INIT_FASTPATH_GL_FUNC();
3126 IF_GL_SUCCESS(_orig_fastpath_glDisableVertexAttribArray(index))
3128 if (current_ctx->gl_vertex_array_binding[0] == 0)
3130 current_ctx->_vattrib_flag |= _VATTRIB_FLAG_BIT_gl_vertex_array;
3131 current_ctx->gl_vertex_array_enabled[index] = GL_FALSE;
3138 _COREGL_FASTPATH_FUNC_END();
3142 fastpath_glEnable(GLenum cap)
3144 DEFINE_FASTPAH_GL_FUNC();
3145 _COREGL_FASTPATH_FUNC_BEGIN();
3146 INIT_FASTPATH_GL_FUNC();
3148 #define STATE_PROC(gl_state, flagid, flagbit) \
3149 CURR_STATE_COMPARE(gl_state, GL_TRUE) \
3151 _orig_fastpath_glEnable(cap); \
3152 current_ctx->flagid |= flagbit##_##gl_state; \
3153 current_ctx->gl_state[0] = GL_TRUE; \
3160 STATE_PROC(gl_blend, _enable_flag1, _ENABLE_FLAG1_BIT);
3163 STATE_PROC(gl_cull_face, _enable_flag1, _ENABLE_FLAG1_BIT);
3166 STATE_PROC(gl_depth_test, _enable_flag1, _ENABLE_FLAG1_BIT);
3169 STATE_PROC(gl_dither, _enable_flag1, _ENABLE_FLAG1_BIT);
3171 case GL_POLYGON_OFFSET_FILL:
3172 STATE_PROC(gl_polygon_offset_fill, _enable_flag2, _ENABLE_FLAG2_BIT);
3174 case GL_PRIMITIVE_RESTART_FIXED_INDEX:
3175 STATE_PROC_WITH_CHECK(gl_primitive_restart_fixed_index, _enable_flag3, _ENABLE_FLAG3_BIT);
3177 case GL_RASTERIZER_DISCARD:
3178 STATE_PROC_WITH_CHECK(gl_rasterizer_discard, _enable_flag3, _ENABLE_FLAG3_BIT);
3180 case GL_SAMPLE_ALPHA_TO_COVERAGE:
3181 STATE_PROC(gl_sample_alpha_to_coverage, _enable_flag2, _ENABLE_FLAG2_BIT);
3183 case GL_SAMPLE_COVERAGE:
3184 STATE_PROC(gl_sample_coverage, _enable_flag2, _ENABLE_FLAG2_BIT);
3186 case GL_SCISSOR_TEST:
3187 STATE_PROC(gl_scissor_test, _enable_flag2, _ENABLE_FLAG2_BIT);
3189 case GL_STENCIL_TEST:
3190 STATE_PROC(gl_stencil_test, _enable_flag2, _ENABLE_FLAG2_BIT);
3193 _set_gl_error(GL_INVALID_ENUM);
3202 _COREGL_FASTPATH_FUNC_END();
3207 fastpath_glEnableVertexAttribArray(GLuint index)
3209 DEFINE_FASTPAH_GL_FUNC();
3210 _COREGL_FASTPATH_FUNC_BEGIN();
3211 INIT_FASTPATH_GL_FUNC();
3213 IF_GL_SUCCESS(_orig_fastpath_glEnableVertexAttribArray(index))
3215 if (current_ctx->gl_vertex_array_binding[0] == 0)
3217 current_ctx->_vattrib_flag |= _VATTRIB_FLAG_BIT_gl_vertex_array;
3218 current_ctx->gl_vertex_array_enabled[index] = GL_TRUE;
3225 _COREGL_FASTPATH_FUNC_END();
3230 fastpath_glFrontFace(GLenum mode)
3232 DEFINE_FASTPAH_GL_FUNC();
3233 _COREGL_FASTPATH_FUNC_BEGIN();
3234 INIT_FASTPATH_GL_FUNC();
3236 CURR_STATE_COMPARE(gl_front_face, mode)
3238 IF_GL_SUCCESS(_orig_fastpath_glFrontFace(mode))
3240 current_ctx->_misc_flag1 |= _MISC_FLAG1_BIT_gl_front_face;
3241 current_ctx->gl_front_face[0] = mode;
3247 _COREGL_FASTPATH_FUNC_END();
3251 fastpath_glHint(GLenum target, GLenum mode)
3253 DEFINE_FASTPAH_GL_FUNC();
3254 _COREGL_FASTPATH_FUNC_BEGIN();
3255 INIT_FASTPATH_GL_FUNC();
3258 #define STATE_PROC(gl_state, flagid, flagbit) \
3259 CURR_STATE_COMPARE(gl_state, mode) \
3261 IF_GL_SUCCESS(_orig_fastpath_glHint(target, mode)) \
3263 current_ctx->flagid |= flagbit##_##gl_state; \
3264 current_ctx->gl_state[0] = mode; \
3271 case GL_FRAGMENT_SHADER_DERIVATIVE_HINT:
3272 STATE_PROC_WITH_CHECK(gl_fragment_shader_derivative_hint, _misc_flag1, _MISC_FLAG1_BIT);
3274 case GL_GENERATE_MIPMAP_HINT:
3275 STATE_PROC(gl_generate_mipmap_hint, _tex_flag1, _TEX_FLAG1_BIT);
3278 _set_gl_error(GL_INVALID_ENUM);
3287 _COREGL_FASTPATH_FUNC_END();
3292 fastpath_glLineWidth(GLfloat width)
3294 DEFINE_FASTPAH_GL_FUNC();
3295 _COREGL_FASTPATH_FUNC_BEGIN();
3296 INIT_FASTPATH_GL_FUNC();
3298 CURR_STATE_COMPARE(gl_line_width, width)
3300 IF_GL_SUCCESS(_orig_fastpath_glLineWidth(width))
3302 current_ctx->_misc_flag1 |= _MISC_FLAG1_BIT_gl_line_width;
3303 current_ctx->gl_line_width[0] = width;
3309 _COREGL_FASTPATH_FUNC_END();
3314 fastpath_glPixelStorei(GLenum pname, GLint param)
3316 DEFINE_FASTPAH_GL_FUNC();
3317 _COREGL_FASTPATH_FUNC_BEGIN();
3318 INIT_FASTPATH_GL_FUNC();
3320 #define STATE_PROC(gl_state, flagid, flagbit) \
3321 CURR_STATE_COMPARE(gl_state, param) \
3323 IF_GL_SUCCESS(_orig_fastpath_glPixelStorei(pname, param)) \
3325 current_ctx->flagid |= flagbit##_##gl_state; \
3326 current_ctx->gl_state[0] = param; \
3333 case GL_PACK_ROW_LENGTH:
3334 STATE_PROC_WITH_CHECK(gl_pack_row_length, _pixel_flag1, _PIXEL_FLAG1_BIT);
3336 case GL_PACK_SKIP_PIXELS:
3337 STATE_PROC_WITH_CHECK(gl_pack_skip_pixels, _pixel_flag1, _PIXEL_FLAG1_BIT);
3339 case GL_PACK_SKIP_ROWS:
3340 STATE_PROC_WITH_CHECK(gl_pack_skip_rows, _pixel_flag1, _PIXEL_FLAG1_BIT);
3342 case GL_PACK_ALIGNMENT:
3343 STATE_PROC(gl_pack_alignment, _pixel_flag1, _PIXEL_FLAG1_BIT);
3345 case GL_UNPACK_ROW_LENGTH:
3346 STATE_PROC_WITH_CHECK(gl_unpack_row_length, _pixel_flag2, _PIXEL_FLAG2_BIT);
3348 case GL_UNPACK_IMAGE_HEIGHT:
3349 STATE_PROC_WITH_CHECK(gl_unpack_image_height, _pixel_flag2, _PIXEL_FLAG2_BIT);
3351 case GL_UNPACK_SKIP_PIXELS:
3352 STATE_PROC_WITH_CHECK(gl_unpack_skip_pixels, _pixel_flag2, _PIXEL_FLAG2_BIT);
3354 case GL_UNPACK_SKIP_IMAGES:
3355 STATE_PROC_WITH_CHECK(gl_unpack_skip_images, _pixel_flag2, _PIXEL_FLAG2_BIT);
3357 case GL_UNPACK_ALIGNMENT:
3358 STATE_PROC(gl_unpack_alignment, _pixel_flag2, _PIXEL_FLAG2_BIT);
3361 _set_gl_error(GL_INVALID_ENUM);
3371 _COREGL_FASTPATH_FUNC_END();
3376 fastpath_glPolygonOffset(GLfloat factor, GLfloat units)
3378 DEFINE_FASTPAH_GL_FUNC();
3379 _COREGL_FASTPATH_FUNC_BEGIN();
3380 INIT_FASTPATH_GL_FUNC();
3382 if ((current_ctx->gl_polygon_offset_factor[0] != factor) ||
3383 (current_ctx->gl_polygon_offset_units[0] != units))
3385 IF_GL_SUCCESS(_orig_fastpath_glPolygonOffset(factor, units))
3387 current_ctx->_misc_flag1 |=
3388 _MISC_FLAG1_BIT_gl_polygon_offset_factor |
3389 _MISC_FLAG1_BIT_gl_polygon_offset_units;
3391 current_ctx->gl_polygon_offset_factor[0] = factor;
3392 current_ctx->gl_polygon_offset_units[0] = units;
3398 _COREGL_FASTPATH_FUNC_END();
3403 fastpath_glSampleCoverage(GLclampf value, GLboolean invert)
3405 DEFINE_FASTPAH_GL_FUNC();
3406 _COREGL_FASTPATH_FUNC_BEGIN();
3407 INIT_FASTPATH_GL_FUNC();
3409 if ((current_ctx->gl_sample_coverage_value[0] != value) ||
3410 (current_ctx->gl_sample_coverage_invert[0] != invert))
3412 IF_GL_SUCCESS(_orig_fastpath_glSampleCoverage(value, invert))
3414 current_ctx->_misc_flag1 |=
3415 _MISC_FLAG1_BIT_gl_sample_coverage_value |
3416 _MISC_FLAG1_BIT_gl_sample_coverage_invert;
3418 current_ctx->gl_sample_coverage_value[0] = value;
3419 current_ctx->gl_sample_coverage_invert[0] = invert;
3425 _COREGL_FASTPATH_FUNC_END();
3430 fastpath_glScissor(GLint x, GLint y, GLsizei width, GLsizei height)
3432 DEFINE_FASTPAH_GL_FUNC();
3433 _COREGL_FASTPATH_FUNC_BEGIN();
3434 INIT_FASTPATH_GL_FUNC();
3436 if ((current_ctx->gl_scissor_box[0] != x) ||
3437 (current_ctx->gl_scissor_box[1] != y) ||
3438 (current_ctx->gl_scissor_box[2] != width) ||
3439 (current_ctx->gl_scissor_box[3] != height))
3441 IF_GL_SUCCESS(_orig_fastpath_glScissor(x, y, width, height))
3443 current_ctx->_misc_flag2 |= _MISC_FLAG2_BIT_gl_scissor_box;
3444 current_ctx->gl_scissor_box[0] = x;
3445 current_ctx->gl_scissor_box[1] = y;
3446 current_ctx->gl_scissor_box[2] = width;
3447 current_ctx->gl_scissor_box[3] = height;
3453 _COREGL_FASTPATH_FUNC_END();
3458 fastpath_glStencilFunc(GLenum func, GLint ref, GLuint mask)
3460 DEFINE_FASTPAH_GL_FUNC();
3461 _COREGL_FASTPATH_FUNC_BEGIN();
3462 INIT_FASTPATH_GL_FUNC();
3464 if ((current_ctx->gl_stencil_func[0] != func) ||
3465 (current_ctx->gl_stencil_ref[0] != ref) ||
3466 (current_ctx->gl_stencil_value_mask[0] != mask) ||
3467 (current_ctx->gl_stencil_back_func[0] != func) ||
3468 (current_ctx->gl_stencil_back_ref[0] != ref) ||
3469 (current_ctx->gl_stencil_back_value_mask[0] != mask))
3471 IF_GL_SUCCESS(_orig_fastpath_glStencilFunc(func, ref, mask))
3473 current_ctx->_stencil_flag1 |=
3474 _STENCIL_FLAG1_BIT_gl_stencil_func |
3475 _STENCIL_FLAG1_BIT_gl_stencil_ref |
3476 _STENCIL_FLAG1_BIT_gl_stencil_value_mask;
3478 current_ctx->gl_stencil_func[0] = func;
3479 current_ctx->gl_stencil_ref[0] = ref;
3480 current_ctx->gl_stencil_value_mask[0] = mask;
3482 current_ctx->_stencil_flag2 |=
3483 _STENCIL_FLAG2_BIT_gl_stencil_back_func |
3484 _STENCIL_FLAG2_BIT_gl_stencil_back_ref |
3485 _STENCIL_FLAG2_BIT_gl_stencil_back_value_mask;
3487 current_ctx->gl_stencil_back_func[0] = func;
3488 current_ctx->gl_stencil_back_ref[0] = ref;
3489 current_ctx->gl_stencil_back_value_mask[0] = mask;
3495 _COREGL_FASTPATH_FUNC_END();
3500 fastpath_glStencilFuncSeparate(GLenum face, GLenum func, GLint ref, GLuint mask)
3502 DEFINE_FASTPAH_GL_FUNC();
3503 _COREGL_FASTPATH_FUNC_BEGIN();
3504 INIT_FASTPATH_GL_FUNC();
3506 if ((face == GL_FRONT) || (face == GL_FRONT_AND_BACK))
3508 if ((current_ctx->gl_stencil_func[0] != func) ||
3509 (current_ctx->gl_stencil_ref[0] != ref) ||
3510 (current_ctx->gl_stencil_value_mask[0] != mask))
3512 IF_GL_SUCCESS(_orig_fastpath_glStencilFuncSeparate(face, func, ref, mask))
3514 current_ctx->_stencil_flag1 |=
3515 _STENCIL_FLAG1_BIT_gl_stencil_func |
3516 _STENCIL_FLAG1_BIT_gl_stencil_ref |
3517 _STENCIL_FLAG1_BIT_gl_stencil_value_mask;
3519 current_ctx->gl_stencil_func[0] = func;
3520 current_ctx->gl_stencil_ref[0] = ref;
3521 current_ctx->gl_stencil_value_mask[0] = mask;
3525 else if ((face == GL_BACK) || (face == GL_FRONT_AND_BACK))
3527 if ((current_ctx->gl_stencil_back_func[0] != func) ||
3528 (current_ctx->gl_stencil_back_ref[0] != ref) ||
3529 (current_ctx->gl_stencil_back_value_mask[0] != mask))
3531 IF_GL_SUCCESS(_orig_fastpath_glStencilFuncSeparate(face, func, ref, mask))
3533 current_ctx->_stencil_flag2 |=
3534 _STENCIL_FLAG2_BIT_gl_stencil_back_func |
3535 _STENCIL_FLAG2_BIT_gl_stencil_back_ref |
3536 _STENCIL_FLAG2_BIT_gl_stencil_back_value_mask;
3538 current_ctx->gl_stencil_back_func[0] = func;
3539 current_ctx->gl_stencil_back_ref[0] = ref;
3540 current_ctx->gl_stencil_back_value_mask[0] = mask;
3546 _set_gl_error(GL_INVALID_ENUM);
3552 _COREGL_FASTPATH_FUNC_END();
3557 fastpath_glStencilMask(GLuint mask)
3559 DEFINE_FASTPAH_GL_FUNC();
3560 _COREGL_FASTPATH_FUNC_BEGIN();
3561 INIT_FASTPATH_GL_FUNC();
3563 if ((current_ctx->gl_stencil_writemask[0] != mask) ||
3564 (current_ctx->gl_stencil_back_writemask[0] != mask))
3566 IF_GL_SUCCESS(_orig_fastpath_glStencilMask(mask))
3568 current_ctx->_stencil_flag1 |= _STENCIL_FLAG1_BIT_gl_stencil_writemask;
3569 current_ctx->_stencil_flag2 |= _STENCIL_FLAG2_BIT_gl_stencil_back_writemask;
3571 current_ctx->gl_stencil_writemask[0] = mask;
3572 current_ctx->gl_stencil_back_writemask[0] = mask;
3578 _COREGL_FASTPATH_FUNC_END();
3583 fastpath_glStencilMaskSeparate(GLenum face, GLuint mask)
3585 DEFINE_FASTPAH_GL_FUNC();
3586 _COREGL_FASTPATH_FUNC_BEGIN();
3587 INIT_FASTPATH_GL_FUNC();
3589 if ((face == GL_FRONT) || (face == GL_FRONT_AND_BACK))
3591 if (current_ctx->gl_stencil_writemask[0] != mask)
3593 IF_GL_SUCCESS(_orig_fastpath_glStencilMaskSeparate(face, mask))
3595 current_ctx->_stencil_flag1 |= _STENCIL_FLAG1_BIT_gl_stencil_writemask;
3596 current_ctx->gl_stencil_writemask[0] = mask;
3600 else if ((face == GL_BACK) || (face == GL_FRONT_AND_BACK))
3602 if (current_ctx->gl_stencil_back_writemask[0] != mask)
3604 IF_GL_SUCCESS(_orig_fastpath_glStencilMaskSeparate(face, mask))
3606 current_ctx->_stencil_flag2 |= _STENCIL_FLAG2_BIT_gl_stencil_back_writemask;
3607 current_ctx->gl_stencil_back_writemask[0] = mask;
3613 _set_gl_error(GL_INVALID_ENUM);
3619 _COREGL_FASTPATH_FUNC_END();
3624 fastpath_glStencilOp(GLenum fail, GLenum zfail, GLenum zpass)
3626 DEFINE_FASTPAH_GL_FUNC();
3627 _COREGL_FASTPATH_FUNC_BEGIN();
3628 INIT_FASTPATH_GL_FUNC();
3630 if ((current_ctx->gl_stencil_fail[0] != fail) ||
3631 (current_ctx->gl_stencil_pass_depth_fail[0] != zfail) ||
3632 (current_ctx->gl_stencil_pass_depth_pass[0] != zpass) ||
3633 (current_ctx->gl_stencil_back_fail[0] != fail) ||
3634 (current_ctx->gl_stencil_back_pass_depth_fail[0] != zfail) ||
3635 (current_ctx->gl_stencil_back_pass_depth_pass[0] != zpass))
3637 IF_GL_SUCCESS(_orig_fastpath_glStencilOp(fail, zfail, zpass))
3639 current_ctx->_stencil_flag1 |=
3640 _STENCIL_FLAG1_BIT_gl_stencil_fail |
3641 _STENCIL_FLAG1_BIT_gl_stencil_pass_depth_fail |
3642 _STENCIL_FLAG1_BIT_gl_stencil_pass_depth_pass;
3644 current_ctx->gl_stencil_fail[0] = fail;
3645 current_ctx->gl_stencil_pass_depth_fail[0] = zfail;
3646 current_ctx->gl_stencil_pass_depth_pass[0] = zpass;
3648 current_ctx->_stencil_flag2 |=
3649 _STENCIL_FLAG2_BIT_gl_stencil_back_fail |
3650 _STENCIL_FLAG2_BIT_gl_stencil_back_pass_depth_fail |
3651 _STENCIL_FLAG2_BIT_gl_stencil_back_pass_depth_pass;
3653 current_ctx->gl_stencil_back_fail[0] = fail;
3654 current_ctx->gl_stencil_back_pass_depth_fail[0] = zfail;
3655 current_ctx->gl_stencil_back_pass_depth_pass[0] = zpass;
3661 _COREGL_FASTPATH_FUNC_END();
3666 fastpath_glStencilOpSeparate(GLenum face, GLenum fail, GLenum zfail, GLenum zpass)
3668 DEFINE_FASTPAH_GL_FUNC();
3669 _COREGL_FASTPATH_FUNC_BEGIN();
3670 INIT_FASTPATH_GL_FUNC();
3672 if ((face == GL_FRONT) || (face == GL_FRONT_AND_BACK))
3674 if ((current_ctx->gl_stencil_fail[0] != fail) ||
3675 (current_ctx->gl_stencil_pass_depth_fail[0] != zfail) ||
3676 (current_ctx->gl_stencil_pass_depth_pass[0] != zpass))
3678 IF_GL_SUCCESS(_orig_fastpath_glStencilOpSeparate(face, fail, zfail, zpass))
3680 current_ctx->_stencil_flag1 |=
3681 _STENCIL_FLAG1_BIT_gl_stencil_fail |
3682 _STENCIL_FLAG1_BIT_gl_stencil_pass_depth_fail |
3683 _STENCIL_FLAG1_BIT_gl_stencil_pass_depth_pass;
3685 current_ctx->gl_stencil_fail[0] = fail;
3686 current_ctx->gl_stencil_pass_depth_fail[0] = zfail;
3687 current_ctx->gl_stencil_pass_depth_pass[0] = zpass;
3691 else if ((face == GL_BACK) || (face == GL_FRONT_AND_BACK))
3693 if ((current_ctx->gl_stencil_back_fail[0] != fail) ||
3694 (current_ctx->gl_stencil_back_pass_depth_fail[0] != zfail) ||
3695 (current_ctx->gl_stencil_back_pass_depth_pass[0] != zpass))
3697 IF_GL_SUCCESS(_orig_fastpath_glStencilOpSeparate(face, fail, zfail, zpass))
3699 current_ctx->_stencil_flag2 |=
3700 _STENCIL_FLAG2_BIT_gl_stencil_back_fail |
3701 _STENCIL_FLAG2_BIT_gl_stencil_back_pass_depth_fail |
3702 _STENCIL_FLAG2_BIT_gl_stencil_back_pass_depth_pass;
3704 current_ctx->gl_stencil_back_fail[0] = fail;
3705 current_ctx->gl_stencil_back_pass_depth_fail[0] = zfail;
3706 current_ctx->gl_stencil_back_pass_depth_pass[0] = zpass;
3712 _set_gl_error(GL_INVALID_ENUM);
3718 _COREGL_FASTPATH_FUNC_END();
3723 fastpath_glVertexAttrib1f(GLuint index, GLfloat x)
3725 DEFINE_FASTPAH_GL_FUNC();
3726 _COREGL_FASTPATH_FUNC_BEGIN();
3727 INIT_FASTPATH_GL_FUNC();
3729 IF_GL_SUCCESS(_orig_fastpath_glVertexAttrib1f(index, x))
3731 if (current_ctx->gl_vertex_array_binding[0] == 0)
3733 current_ctx->_vattrib_flag |= _VATTRIB_FLAG_BIT_gl_vertex_attrib_value;
3734 current_ctx->gl_vertex_array_size[index] = 0;
3735 current_ctx->gl_vertex_array_integer[index] = GL_FALSE;
3737 current_ctx->gl_vertex_attrib_value[index * 4 + 0] = x;
3738 current_ctx->gl_vertex_attrib_value[index * 4 + 1] = 0;
3739 current_ctx->gl_vertex_attrib_value[index * 4 + 2] = 0;
3740 current_ctx->gl_vertex_attrib_value[index * 4 + 3] = 1;
3746 _COREGL_FASTPATH_FUNC_END();
3751 fastpath_glVertexAttrib1fv(GLuint index, const GLfloat* values)
3753 DEFINE_FASTPAH_GL_FUNC();
3754 _COREGL_FASTPATH_FUNC_BEGIN();
3755 INIT_FASTPATH_GL_FUNC();
3757 IF_GL_SUCCESS(_orig_fastpath_glVertexAttrib1fv(index, values))
3759 if (current_ctx->gl_vertex_array_binding[0] == 0)
3761 current_ctx->_vattrib_flag |= _VATTRIB_FLAG_BIT_gl_vertex_attrib_value;
3762 current_ctx->gl_vertex_array_size[index] = 0;
3763 current_ctx->gl_vertex_array_integer[index] = GL_FALSE;
3765 current_ctx->gl_vertex_attrib_value[index * 4 + 0] = values[0];
3766 current_ctx->gl_vertex_attrib_value[index * 4 + 1] = 0;
3767 current_ctx->gl_vertex_attrib_value[index * 4 + 2] = 0;
3768 current_ctx->gl_vertex_attrib_value[index * 4 + 3] = 1;
3774 _COREGL_FASTPATH_FUNC_END();
3779 fastpath_glVertexAttrib2f(GLuint index, GLfloat x, GLfloat y)
3781 DEFINE_FASTPAH_GL_FUNC();
3782 _COREGL_FASTPATH_FUNC_BEGIN();
3783 INIT_FASTPATH_GL_FUNC();
3785 IF_GL_SUCCESS(_orig_fastpath_glVertexAttrib2f(index, x, y))
3787 if (current_ctx->gl_vertex_array_binding[0] == 0)
3789 current_ctx->_vattrib_flag |= _VATTRIB_FLAG_BIT_gl_vertex_attrib_value;
3790 current_ctx->gl_vertex_array_size[index] = 0;
3791 current_ctx->gl_vertex_array_integer[index] = GL_FALSE;
3793 current_ctx->gl_vertex_attrib_value[index * 4 + 0] = x;
3794 current_ctx->gl_vertex_attrib_value[index * 4 + 1] = y;
3795 current_ctx->gl_vertex_attrib_value[index * 4 + 2] = 0;
3796 current_ctx->gl_vertex_attrib_value[index * 4 + 3] = 1;
3802 _COREGL_FASTPATH_FUNC_END();
3807 fastpath_glVertexAttrib2fv(GLuint index, const GLfloat* values)
3809 DEFINE_FASTPAH_GL_FUNC();
3810 _COREGL_FASTPATH_FUNC_BEGIN();
3811 INIT_FASTPATH_GL_FUNC();
3813 IF_GL_SUCCESS(_orig_fastpath_glVertexAttrib2fv(index, values))
3815 if (current_ctx->gl_vertex_array_binding[0] == 0)
3817 current_ctx->_vattrib_flag |= _VATTRIB_FLAG_BIT_gl_vertex_attrib_value;
3818 current_ctx->gl_vertex_array_size[index] = 0;
3819 current_ctx->gl_vertex_array_integer[index] = GL_FALSE;
3821 current_ctx->gl_vertex_attrib_value[index * 4 + 0] = values[0];
3822 current_ctx->gl_vertex_attrib_value[index * 4 + 1] = values[1];
3823 current_ctx->gl_vertex_attrib_value[index * 4 + 2] = 0;
3824 current_ctx->gl_vertex_attrib_value[index * 4 + 3] = 1;
3830 _COREGL_FASTPATH_FUNC_END();
3835 fastpath_glVertexAttrib3f(GLuint index, GLfloat x, GLfloat y, GLfloat z)
3837 DEFINE_FASTPAH_GL_FUNC();
3838 _COREGL_FASTPATH_FUNC_BEGIN();
3839 INIT_FASTPATH_GL_FUNC();
3841 IF_GL_SUCCESS(_orig_fastpath_glVertexAttrib3f(index, x, y, z))
3843 if (current_ctx->gl_vertex_array_binding[0] == 0)
3845 current_ctx->_vattrib_flag |= _VATTRIB_FLAG_BIT_gl_vertex_attrib_value;
3846 current_ctx->gl_vertex_array_size[index] = 0;
3847 current_ctx->gl_vertex_array_integer[index] = GL_FALSE;
3849 current_ctx->gl_vertex_attrib_value[index * 4 + 0] = x;
3850 current_ctx->gl_vertex_attrib_value[index * 4 + 1] = y;
3851 current_ctx->gl_vertex_attrib_value[index * 4 + 2] = z;
3852 current_ctx->gl_vertex_attrib_value[index * 4 + 3] = 1;
3858 _COREGL_FASTPATH_FUNC_END();
3863 fastpath_glVertexAttrib3fv(GLuint index, const GLfloat* values)
3865 DEFINE_FASTPAH_GL_FUNC();
3866 _COREGL_FASTPATH_FUNC_BEGIN();
3867 INIT_FASTPATH_GL_FUNC();
3869 IF_GL_SUCCESS(_orig_fastpath_glVertexAttrib3fv(index, values))
3871 if (current_ctx->gl_vertex_array_binding[0] == 0)
3873 current_ctx->_vattrib_flag |= _VATTRIB_FLAG_BIT_gl_vertex_attrib_value;
3874 current_ctx->gl_vertex_array_size[index] = 0;
3875 current_ctx->gl_vertex_array_integer[index] = GL_FALSE;
3877 current_ctx->gl_vertex_attrib_value[index * 4 + 0] = values[0];
3878 current_ctx->gl_vertex_attrib_value[index * 4 + 1] = values[1];
3879 current_ctx->gl_vertex_attrib_value[index * 4 + 2] = values[2];
3880 current_ctx->gl_vertex_attrib_value[index * 4 + 3] = 1;
3886 _COREGL_FASTPATH_FUNC_END();
3891 fastpath_glVertexAttrib4f(GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w)
3893 DEFINE_FASTPAH_GL_FUNC();
3894 _COREGL_FASTPATH_FUNC_BEGIN();
3895 INIT_FASTPATH_GL_FUNC();
3897 IF_GL_SUCCESS(_orig_fastpath_glVertexAttrib4f(index, x, y, z, w))
3899 if (current_ctx->gl_vertex_array_binding[0] == 0)
3901 current_ctx->_vattrib_flag |= _VATTRIB_FLAG_BIT_gl_vertex_attrib_value;
3902 current_ctx->gl_vertex_array_size[index] = 0;
3903 current_ctx->gl_vertex_array_integer[index] = GL_FALSE;
3905 current_ctx->gl_vertex_attrib_value[index * 4 + 0] = x;
3906 current_ctx->gl_vertex_attrib_value[index * 4 + 1] = y;
3907 current_ctx->gl_vertex_attrib_value[index * 4 + 2] = z;
3908 current_ctx->gl_vertex_attrib_value[index * 4 + 3] = w;
3914 _COREGL_FASTPATH_FUNC_END();
3919 fastpath_glVertexAttrib4fv(GLuint index, const GLfloat* values)
3921 DEFINE_FASTPAH_GL_FUNC();
3922 _COREGL_FASTPATH_FUNC_BEGIN();
3923 INIT_FASTPATH_GL_FUNC();
3925 IF_GL_SUCCESS(_orig_fastpath_glVertexAttrib4fv(index, values))
3927 if (current_ctx->gl_vertex_array_binding[0] == 0)
3929 current_ctx->_vattrib_flag |= _VATTRIB_FLAG_BIT_gl_vertex_attrib_value;
3930 current_ctx->gl_vertex_array_size[index] = 0;
3931 current_ctx->gl_vertex_array_integer[index] = GL_FALSE;
3933 current_ctx->gl_vertex_attrib_value[index * 4 + 0] = values[0];
3934 current_ctx->gl_vertex_attrib_value[index * 4 + 1] = values[1];
3935 current_ctx->gl_vertex_attrib_value[index * 4 + 2] = values[2];
3936 current_ctx->gl_vertex_attrib_value[index * 4 + 3] = values[3];
3942 _COREGL_FASTPATH_FUNC_END();
3947 fastpath_glVertexAttribPointer(GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const void* pointer)
3949 DEFINE_FASTPAH_GL_FUNC();
3950 _COREGL_FASTPATH_FUNC_BEGIN();
3951 INIT_FASTPATH_GL_FUNC();
3953 IF_GL_SUCCESS(_orig_fastpath_glVertexAttribPointer(index, size, type, normalized, stride, pointer))
3955 if (current_ctx->gl_vertex_array_binding[0] == 0)
3957 current_ctx->_vattrib_flag |= _VATTRIB_FLAG_BIT_gl_vertex_array;
3959 current_ctx->gl_vertex_array_buf_id[index] = current_ctx->gl_array_buffer_binding[0];
3960 current_ctx->gl_vertex_array_size[index] = size;
3961 current_ctx->gl_vertex_array_type[index] = type;
3962 current_ctx->gl_vertex_array_normalized[index] = normalized;
3963 current_ctx->gl_vertex_array_integer[index] = GL_FALSE;
3964 current_ctx->gl_vertex_array_stride[index] = stride;
3965 current_ctx->gl_vertex_array_pointer[index] = (GLvoid *)pointer;
3971 _COREGL_FASTPATH_FUNC_END();
3976 fastpath_glViewport(GLint x, GLint y, GLsizei width, GLsizei height)
3978 DEFINE_FASTPAH_GL_FUNC();
3979 _COREGL_FASTPATH_FUNC_BEGIN();
3980 INIT_FASTPATH_GL_FUNC();
3982 if ((current_ctx->gl_viewport[0] != x) ||
3983 (current_ctx->gl_viewport[1] != y) ||
3984 (current_ctx->gl_viewport[2] != width) ||
3985 (current_ctx->gl_viewport[3] != height))
3987 IF_GL_SUCCESS(_orig_fastpath_glViewport(x, y, width, height))
3989 current_ctx->_clear_flag1 |= _CLEAR_FLAG1_BIT_gl_viewport;
3990 current_ctx->gl_viewport[0] = x;
3991 current_ctx->gl_viewport[1] = y;
3992 current_ctx->gl_viewport[2] = width;
3993 current_ctx->gl_viewport[3] = height;
4000 _COREGL_FASTPATH_FUNC_END();
4003 #define TRANS_VALUE(index, value) \
4007 case GL_INT: if (!is64) ((GLint *)ptr)[index] = value; else ((GLint64 *)ptr)[index] = value; break; \
4008 case GL_FLOAT: ((GLfloat *)ptr)[index] = (GLfloat)value; break; \
4009 case GL_BOOL: ((GLboolean *)ptr)[index] = (value == 0) ? GL_FALSE : GL_TRUE; break; \
4013 #define EXTRACT_VALUE(index, value) \
4017 case GL_INT: if (!is64) value = ((GLint *)ptr)[index]; else value = ((GLint64 *)ptr)[index]; break; \
4018 case GL_FLOAT: value = ((GLfloat *)ptr)[index]; break; \
4019 case GL_BOOL: value = ((GLboolean *)ptr)[index]; break; \
4024 _modify_get_value(GLenum pname, GLvoid *ptr, GLenum get_type, GLboolean is64)
4026 GLboolean ret = GL_FALSE;
4028 DEFINE_FASTPAH_GL_FUNC();
4029 INIT_FASTPATH_GL_FUNC();
4033 case GL_NUM_EXTENSIONS:
4034 _valid_extension_string();
4035 TRANS_VALUE(0, gl_extension_count);
4038 case GL_TEXTURE_BINDING_2D:
4039 case GL_TEXTURE_BINDING_CUBE_MAP:
4040 case GL_ARRAY_BUFFER_BINDING:
4041 case GL_ELEMENT_ARRAY_BUFFER_BINDING:
4042 case GL_COPY_READ_BUFFER_BINDING:
4043 case GL_COPY_WRITE_BUFFER_BINDING:
4044 case GL_PIXEL_PACK_BUFFER_BINDING:
4045 case GL_PIXEL_UNPACK_BUFFER_BINDING:
4046 case GL_TRANSFORM_FEEDBACK_BUFFER_BINDING:
4047 case GL_UNIFORM_BUFFER_BINDING:
4048 case GL_DRAW_FRAMEBUFFER_BINDING:
4049 case GL_READ_FRAMEBUFFER_BINDING:
4050 case GL_RENDERBUFFER_BINDING:
4051 case GL_CURRENT_PROGRAM:
4052 case GL_VERTEX_ARRAY_BINDING:
4053 case GL_SAMPLER_BINDING:
4054 case GL_TRANSFORM_FEEDBACK_BINDING:
4055 case GL_PROGRAM_PIPELINE_BINDING:
4057 GLint real_obj_id = _COREGL_INT_INIT_VALUE;
4058 GLuint glue_obj_id = _COREGL_INT_INIT_VALUE;
4059 GL_Object_Type obj_type = GL_OBJECT_TYPE_UNKNOWN;
4060 EXTRACT_VALUE(0, real_obj_id);
4064 case GL_TEXTURE_BINDING_2D:
4065 case GL_TEXTURE_BINDING_CUBE_MAP:
4066 obj_type = GL_OBJECT_TYPE_TEXTURE;
4068 case GL_ARRAY_BUFFER_BINDING:
4069 case GL_ELEMENT_ARRAY_BUFFER_BINDING:
4070 case GL_COPY_READ_BUFFER_BINDING:
4071 case GL_COPY_WRITE_BUFFER_BINDING:
4072 case GL_PIXEL_PACK_BUFFER_BINDING:
4073 case GL_PIXEL_UNPACK_BUFFER_BINDING:
4074 case GL_TRANSFORM_FEEDBACK_BUFFER_BINDING:
4075 case GL_UNIFORM_BUFFER_BINDING:
4076 obj_type = GL_OBJECT_TYPE_BUFFER;
4078 case GL_DRAW_FRAMEBUFFER_BINDING:
4079 case GL_READ_FRAMEBUFFER_BINDING:
4080 obj_type = GL_OBJECT_TYPE_FRAMEBUFFER;
4082 case GL_RENDERBUFFER_BINDING:
4083 obj_type = GL_OBJECT_TYPE_RENDERBUFFER;
4085 case GL_CURRENT_PROGRAM:
4086 obj_type = GL_OBJECT_TYPE_PROGRAM;
4088 case GL_VERTEX_ARRAY_BINDING:
4089 obj_type = GL_OBJECT_TYPE_VERTEXARRAY;
4091 case GL_SAMPLER_BINDING:
4092 obj_type = GL_OBJECT_TYPE_SAMPLER;
4094 case GL_TRANSFORM_FEEDBACK_BINDING:
4095 obj_type = GL_OBJECT_TYPE_TRANSFORMFEEDBACK;
4097 case GL_PROGRAM_PIPELINE_BINDING:
4098 obj_type = GL_OBJECT_TYPE_PROGRAMPIPELINE;
4100 AST(obj_type != GL_OBJECT_TYPE_UNKNOWN);
4101 AST(GET_GLUE_OBJ(obj_type, real_obj_id, &glue_obj_id) == 1);
4102 TRANS_VALUE(0, glue_obj_id);
4115 fastpath_glGetBooleanv(GLenum pname, GLboolean* params)
4117 DEFINE_FASTPAH_GL_FUNC();
4118 _COREGL_FASTPATH_FUNC_BEGIN();
4119 INIT_FASTPATH_GL_FUNC();
4121 IF_GL_SUCCESS(_orig_fastpath_glGetBooleanv(pname, params))
4123 _modify_get_value(pname, params, GL_BOOL, GL_FALSE);
4128 _COREGL_FASTPATH_FUNC_END();
4132 fastpath_glGetFloatv(GLenum pname, GLfloat* params)
4134 DEFINE_FASTPAH_GL_FUNC();
4135 _COREGL_FASTPATH_FUNC_BEGIN();
4136 INIT_FASTPATH_GL_FUNC();
4138 IF_GL_SUCCESS(_orig_fastpath_glGetFloatv(pname, params))
4140 _modify_get_value(pname, params, GL_FLOAT, GL_FALSE);
4145 _COREGL_FASTPATH_FUNC_END();
4149 fastpath_glGetIntegerv(GLenum pname, GLint* params)
4151 DEFINE_FASTPAH_GL_FUNC();
4152 _COREGL_FASTPATH_FUNC_BEGIN();
4153 INIT_FASTPATH_GL_FUNC();
4155 IF_GL_SUCCESS(_orig_fastpath_glGetIntegerv(pname, params))
4157 _modify_get_value(pname, params, GL_INT, GL_FALSE);
4162 _COREGL_FASTPATH_FUNC_END();
4167 /* ES 3.0 PASS (SUPPORT) */
4169 fastpath_glGetProgramBinary(GLuint program, GLsizei bufsize, GLsizei* length, GLenum* binaryFormat, void* binary)
4173 DEFINE_FASTPAH_GL_FUNC();
4174 _COREGL_FASTPATH_FUNC_BEGIN();
4175 INIT_FASTPATH_GL_FUNC();
4177 if (GET_REAL_OBJ(GL_OBJECT_TYPE_PROGRAM, program, &real_obj) != 1)
4179 _set_gl_error(GL_INVALID_VALUE);
4183 _orig_fastpath_glGetProgramBinary(real_obj, bufsize, length, binaryFormat, binary);
4188 _COREGL_FASTPATH_FUNC_END();
4193 fastpath_glGetProgramBinaryOES(GLuint program, GLsizei bufsize, GLsizei* length, GLenum* binaryFormat, void* binary)
4197 DEFINE_FASTPAH_GL_FUNC();
4198 _COREGL_FASTPATH_FUNC_BEGIN();
4199 INIT_FASTPATH_GL_FUNC();
4201 if (GET_REAL_OBJ(GL_OBJECT_TYPE_PROGRAM, program, &real_obj) != 1)
4203 _set_gl_error(GL_INVALID_VALUE);
4207 _orig_fastpath_glGetProgramBinaryOES(real_obj, bufsize, length, binaryFormat, binary);
4212 _COREGL_FASTPATH_FUNC_END();
4217 fastpath_glProgramBinary(GLuint program, GLenum binaryFormat, const void* binary, GLint length)
4221 DEFINE_FASTPAH_GL_FUNC();
4222 _COREGL_FASTPATH_FUNC_BEGIN();
4223 INIT_FASTPATH_GL_FUNC();
4225 if (GET_REAL_OBJ(GL_OBJECT_TYPE_PROGRAM, program, &real_obj) != 1)
4227 _set_gl_error(GL_INVALID_VALUE);
4231 _orig_fastpath_glProgramBinary(real_obj, binaryFormat, binary, length);
4236 _COREGL_FASTPATH_FUNC_END();
4241 fastpath_glProgramBinaryOES(GLuint program, GLenum binaryFormat, const void* binary, GLint length)
4245 DEFINE_FASTPAH_GL_FUNC();
4246 _COREGL_FASTPATH_FUNC_BEGIN();
4247 INIT_FASTPATH_GL_FUNC();
4249 if (GET_REAL_OBJ(GL_OBJECT_TYPE_PROGRAM, program, &real_obj) != 1)
4251 _set_gl_error(GL_INVALID_VALUE);
4255 _orig_fastpath_glProgramBinaryOES(real_obj, binaryFormat, binary, length);
4260 _COREGL_FASTPATH_FUNC_END();
4265 fastpath_glReadBuffer(GLenum mode)
4267 DEFINE_FASTPAH_GL_FUNC();
4268 _COREGL_FASTPATH_FUNC_BEGIN();
4269 INIT_FASTPATH_GL_FUNC();
4271 CURR_STATE_COMPARE(gl_read_buffer, mode)
4273 IF_GL_SUCCESS(_orig_fastpath_glReadBuffer(mode))
4275 current_ctx->_misc_flag3 |= _MISC_FLAG3_BIT_gl_read_buffer;
4276 current_ctx->gl_read_buffer[0] = mode;
4283 _COREGL_FASTPATH_FUNC_END();
4288 fastpath_glGenQueries(GLsizei n, GLuint* ids)
4291 GLuint *objid_array = NULL;
4293 DEFINE_FASTPAH_GL_FUNC();
4294 _COREGL_FASTPATH_FUNC_BEGIN();
4295 INIT_FASTPATH_GL_FUNC();
4299 _set_gl_error(GL_INVALID_VALUE);
4302 if (n == 0) goto finish;
4303 if (ids == NULL) goto finish;
4305 AST(current_ctx->ostate.shared != NULL);
4307 objid_array = (GLuint *)calloc(1, sizeof(GLuint) * n);
4309 IF_GL_SUCCESS(_orig_fastpath_glGenQueries(n, objid_array))
4311 for (i = 0; i < n; i++)
4313 ids[i] = fastpath_ostate_create_object(¤t_ctx->ostate, GL_OBJECT_TYPE_QUERY, objid_array[i]);
4320 if (objid_array != NULL)
4325 _COREGL_FASTPATH_FUNC_END();
4330 fastpath_glDeleteQueries(GLsizei n, const GLuint* ids)
4333 GLuint *objid_array = NULL;
4335 DEFINE_FASTPAH_GL_FUNC();
4336 _COREGL_FASTPATH_FUNC_BEGIN();
4337 INIT_FASTPATH_GL_FUNC();
4341 _set_gl_error(GL_INVALID_VALUE);
4344 if (n == 0) goto finish;
4345 if (ids == NULL) goto finish;
4347 AST(current_ctx->ostate.shared != NULL);
4349 objid_array = (GLuint *)calloc(1, sizeof(GLuint) * n);
4353 for (i = 0; i < n; i++)
4355 int real_objid = _COREGL_INT_INIT_VALUE;
4356 if (ids[i] == 0) continue;
4358 real_objid = fastpath_ostate_get_object(¤t_ctx->ostate, GL_OBJECT_TYPE_QUERY, ids[i]);
4359 if (real_objid == 0) continue;
4361 AST(fastpath_ostate_remove_object(¤t_ctx->ostate, GL_OBJECT_TYPE_QUERY, ids[i]) == 1);
4362 objid_array[real_n++] = real_objid;
4365 _orig_fastpath_glDeleteQueries(real_n, objid_array);
4371 if (objid_array != NULL)
4376 _COREGL_FASTPATH_FUNC_END();
4381 fastpath_glIsQuery(GLuint id)
4383 GLboolean ret = GL_FALSE;
4386 DEFINE_FASTPAH_GL_FUNC();
4387 _COREGL_FASTPATH_FUNC_BEGIN();
4388 INIT_FASTPATH_GL_FUNC();
4390 if (GET_REAL_OBJ(GL_OBJECT_TYPE_QUERY, id, &real_obj) != 1)
4396 ret = _orig_fastpath_glIsQuery(real_obj);
4401 _COREGL_FASTPATH_FUNC_END();
4407 fastpath_glBeginQuery(GLenum target, GLuint id)
4411 DEFINE_FASTPAH_GL_FUNC();
4412 _COREGL_FASTPATH_FUNC_BEGIN();
4413 INIT_FASTPATH_GL_FUNC();
4415 if (GET_REAL_OBJ(GL_OBJECT_TYPE_QUERY, id, &real_obj) != 1)
4417 // TODO : Begin - Context Switch
4418 _set_gl_error(GL_INVALID_OPERATION);
4422 _orig_fastpath_glBeginQuery(target, real_obj);
4427 _COREGL_FASTPATH_FUNC_END();
4432 fastpath_glGetQueryiv(GLenum target, GLenum pname, GLint* params)
4434 GLuint glue_obj_id = _COREGL_INT_INIT_VALUE;
4436 DEFINE_FASTPAH_GL_FUNC();
4437 _COREGL_FASTPATH_FUNC_BEGIN();
4438 INIT_FASTPATH_GL_FUNC();
4440 _orig_fastpath_glGetQueryiv(target, pname, params);
4444 case GL_CURRENT_QUERY:
4447 AST(GET_GLUE_OBJ(GL_OBJECT_TYPE_QUERY, params[0], &glue_obj_id) == 1);
4448 params[0] = glue_obj_id;
4456 _COREGL_FASTPATH_FUNC_END();
4461 fastpath_glGetQueryObjectuiv(GLuint id, GLenum pname, GLuint* params)
4465 DEFINE_FASTPAH_GL_FUNC();
4466 _COREGL_FASTPATH_FUNC_BEGIN();
4467 INIT_FASTPATH_GL_FUNC();
4469 if (GET_REAL_OBJ(GL_OBJECT_TYPE_QUERY, id, &real_obj) != 1)
4471 _set_gl_error(GL_INVALID_OPERATION);
4475 _orig_fastpath_glGetQueryObjectuiv(real_obj, pname, params);
4480 _COREGL_FASTPATH_FUNC_END();
4485 fastpath_glDrawBuffers(GLsizei n, const GLenum* bufs)
4487 DEFINE_FASTPAH_GL_FUNC();
4488 _COREGL_FASTPATH_FUNC_BEGIN();
4489 INIT_FASTPATH_GL_FUNC();
4491 IF_GL_SUCCESS(_orig_fastpath_glDrawBuffers(n, bufs))
4493 current_ctx->_misc_flag3 |= _MISC_FLAG3_BIT_gl_draw_buffers;
4494 fastpath_state_get_draw_buffers(current_ctx->gl_draw_buffers);
4500 _COREGL_FASTPATH_FUNC_END();
4505 fastpath_glFramebufferTextureLayer(GLenum target, GLenum attachment, GLuint texture, GLint level, GLint layer)
4509 DEFINE_FASTPAH_GL_FUNC();
4510 _COREGL_FASTPATH_FUNC_BEGIN();
4511 INIT_FASTPATH_GL_FUNC();
4513 if (GET_REAL_OBJ(GL_OBJECT_TYPE_TEXTURE, texture, &real_obj) != 1)
4515 _set_gl_error(GL_OUT_OF_MEMORY);
4519 _orig_fastpath_glFramebufferTextureLayer(target, attachment, texture, level, layer);
4524 _COREGL_FASTPATH_FUNC_END();
4528 ////////////////////////////////////////////////////////////////////////
4531 fastpath_glGenVertexArrays(GLsizei n, GLuint* arrays)
4534 GLuint *objid_array = NULL;
4536 DEFINE_FASTPAH_GL_FUNC();
4537 _COREGL_FASTPATH_FUNC_BEGIN();
4538 INIT_FASTPATH_GL_FUNC();
4542 _set_gl_error(GL_INVALID_VALUE);
4545 if (n == 0) goto finish;
4546 if (arrays == NULL) goto finish;
4548 AST(current_ctx->ostate.shared != NULL);
4550 objid_array = (GLuint *)calloc(1, sizeof(GLuint) * n);
4552 IF_GL_SUCCESS(_orig_fastpath_glGenVertexArrays(n, objid_array))
4554 for (i = 0; i < n; i++)
4556 arrays[i] = fastpath_ostate_create_object(¤t_ctx->ostate, GL_OBJECT_TYPE_VERTEXARRAY, objid_array[i]);
4563 if (objid_array != NULL)
4568 _COREGL_FASTPATH_FUNC_END();
4573 fastpath_glBindVertexArray(GLuint array)
4577 DEFINE_FASTPAH_GL_FUNC();
4578 _COREGL_FASTPATH_FUNC_BEGIN();
4579 INIT_FASTPATH_GL_FUNC();
4581 if (GET_REAL_OBJ(GL_OBJECT_TYPE_VERTEXARRAY, array, &real_obj) != 1)
4583 _set_gl_error(GL_INVALID_OPERATION);
4587 if (current_ctx->gl_vertex_array_binding[0] != real_obj)
4589 IF_GL_SUCCESS(_orig_fastpath_glBindVertexArray(real_obj))
4591 current_ctx->_misc_flag3 |= _MISC_FLAG3_BIT_gl_vertex_array_binding;
4592 current_ctx->gl_vertex_array_binding[0] = real_obj;
4598 _COREGL_FASTPATH_FUNC_END();
4603 fastpath_glIsVertexArray(GLuint array)
4605 GLboolean ret = GL_FALSE;
4608 DEFINE_FASTPAH_GL_FUNC();
4609 _COREGL_FASTPATH_FUNC_BEGIN();
4610 INIT_FASTPATH_GL_FUNC();
4612 if (GET_REAL_OBJ(GL_OBJECT_TYPE_VERTEXARRAY, array, &real_obj) != 1)
4618 ret = _orig_fastpath_glIsVertexArray(real_obj);
4623 _COREGL_FASTPATH_FUNC_END();
4629 fastpath_glDeleteVertexArrays(GLsizei n, const GLuint* arrays)
4632 GLuint *objid_array = NULL;
4634 DEFINE_FASTPAH_GL_FUNC();
4635 _COREGL_FASTPATH_FUNC_BEGIN();
4636 INIT_FASTPATH_GL_FUNC();
4640 _set_gl_error(GL_INVALID_VALUE);
4643 if (n == 0) goto finish;
4644 if (arrays == NULL) goto finish;
4646 AST(current_ctx->ostate.shared != NULL);
4648 objid_array = (GLuint *)calloc(1, sizeof(GLuint) * n);
4652 for (i = 0; i < n; i++)
4654 int real_objid = _COREGL_INT_INIT_VALUE;
4655 if (arrays[i] == 0) continue;
4657 real_objid = fastpath_ostate_get_object(¤t_ctx->ostate, GL_OBJECT_TYPE_VERTEXARRAY, arrays[i]);
4658 if (real_objid == 0) continue;
4660 AST(fastpath_ostate_remove_object(¤t_ctx->ostate, GL_OBJECT_TYPE_VERTEXARRAY, arrays[i]) == 1);
4661 objid_array[real_n++] = real_objid;
4664 IF_GL_SUCCESS(_orig_fastpath_glDeleteVertexArrays(real_n, objid_array))
4666 for (i = 0; i < real_n; i++)
4668 General_Trace_List *current = NULL;
4669 current = current_ctx->ostate.shared->using_gctxs;
4671 while (current != NULL)
4673 GLGlueContext *cur_gctx = (GLGlueContext *)current->value;
4675 if (cur_gctx->gl_vertex_array_binding[0] == objid_array[i])
4676 cur_gctx->gl_vertex_array_binding[0] = 0;
4678 current = current->next;
4687 if (objid_array != NULL)
4692 _COREGL_FASTPATH_FUNC_END();
4695 ////////////////////////////////////////////////////////////////////////
4698 fastpath_glGetIntegeri_v(GLenum target, GLuint index, GLint* data)
4700 DEFINE_FASTPAH_GL_FUNC();
4701 _COREGL_FASTPATH_FUNC_BEGIN();
4702 INIT_FASTPATH_GL_FUNC();
4704 IF_GL_SUCCESS(_orig_fastpath_glGetIntegeri_v(target, index, data))
4706 _modify_get_value(target, data, GL_INT, GL_FALSE);
4711 _COREGL_FASTPATH_FUNC_END();
4714 ////////////////////////////////////////////////////////////////////////
4717 fastpath_glGenTransformFeedbacks(GLsizei n, GLuint* ids)
4720 GLuint *objid_array = NULL;
4722 DEFINE_FASTPAH_GL_FUNC();
4723 _COREGL_FASTPATH_FUNC_BEGIN();
4724 INIT_FASTPATH_GL_FUNC();
4728 _set_gl_error(GL_INVALID_VALUE);
4731 if (n == 0) goto finish;
4732 if (ids == NULL) goto finish;
4734 AST(current_ctx->ostate.shared != NULL);
4736 objid_array = (GLuint *)calloc(1, sizeof(GLuint) * n);
4738 IF_GL_SUCCESS(_orig_fastpath_glGenTransformFeedbacks(n, objid_array))
4740 for (i = 0; i < n; i++)
4742 ids[i] = fastpath_ostate_create_object(¤t_ctx->ostate, GL_OBJECT_TYPE_TRANSFORMFEEDBACK, objid_array[i]);
4749 if (objid_array != NULL)
4754 _COREGL_FASTPATH_FUNC_END();
4759 fastpath_glBindTransformFeedback(GLenum target, GLuint id)
4763 DEFINE_FASTPAH_GL_FUNC();
4764 _COREGL_FASTPATH_FUNC_BEGIN();
4765 INIT_FASTPATH_GL_FUNC();
4767 if (GET_REAL_OBJ(GL_OBJECT_TYPE_TRANSFORMFEEDBACK, id, &real_obj) != 1)
4769 _set_gl_error(GL_OUT_OF_MEMORY);
4773 if (current_ctx->gl_transform_feedback_binding[0] != real_obj)
4775 IF_GL_SUCCESS(_orig_fastpath_glBindTransformFeedback(target, real_obj))
4777 current_ctx->_misc_flag3 |= _MISC_FLAG3_BIT_gl_transform_feedback_binding;
4778 current_ctx->gl_transform_feedback_binding[0] = real_obj;
4784 _COREGL_FASTPATH_FUNC_END();
4789 fastpath_glBeginTransformFeedback(GLenum primitiveMode)
4791 DEFINE_FASTPAH_GL_FUNC();
4792 _COREGL_FASTPATH_FUNC_BEGIN();
4793 INIT_FASTPATH_GL_FUNC();
4795 IF_GL_SUCCESS(_orig_fastpath_glBeginTransformFeedback(primitiveMode))
4797 current_ctx->_misc_flag3 |= _MISC_FLAG3_BIT_gl_transform_feedback;
4799 current_ctx->gl_transform_feedback_active[0] = GL_TRUE;
4800 current_ctx->gl_transform_feedback_paused[0] = GL_FALSE;
4806 _COREGL_FASTPATH_FUNC_END();
4811 fastpath_glEndTransformFeedback()
4813 DEFINE_FASTPAH_GL_FUNC();
4814 _COREGL_FASTPATH_FUNC_BEGIN();
4815 INIT_FASTPATH_GL_FUNC();
4817 IF_GL_SUCCESS(_orig_fastpath_glEndTransformFeedback())
4819 current_ctx->_misc_flag3 |= _MISC_FLAG3_BIT_gl_transform_feedback;
4821 current_ctx->gl_transform_feedback_active[0] = GL_FALSE;
4822 current_ctx->gl_transform_feedback_paused[0] = GL_FALSE;
4828 _COREGL_FASTPATH_FUNC_END();
4833 fastpath_glPauseTransformFeedback()
4835 DEFINE_FASTPAH_GL_FUNC();
4836 _COREGL_FASTPATH_FUNC_BEGIN();
4837 INIT_FASTPATH_GL_FUNC();
4839 IF_GL_SUCCESS(_orig_fastpath_glPauseTransformFeedback())
4841 current_ctx->_misc_flag3 |= _MISC_FLAG3_BIT_gl_transform_feedback;
4843 current_ctx->gl_transform_feedback_active[0] = GL_TRUE;
4844 current_ctx->gl_transform_feedback_paused[0] = GL_TRUE;
4850 _COREGL_FASTPATH_FUNC_END();
4854 fastpath_glResumeTransformFeedback()
4856 DEFINE_FASTPAH_GL_FUNC();
4857 _COREGL_FASTPATH_FUNC_BEGIN();
4858 INIT_FASTPATH_GL_FUNC();
4860 IF_GL_SUCCESS(_orig_fastpath_glResumeTransformFeedback())
4862 current_ctx->_misc_flag3 |= _MISC_FLAG3_BIT_gl_transform_feedback;
4864 current_ctx->gl_transform_feedback_active[0] = GL_TRUE;
4865 current_ctx->gl_transform_feedback_paused[0] = GL_FALSE;
4871 _COREGL_FASTPATH_FUNC_END();
4876 fastpath_glIsTransformFeedback(GLuint id)
4878 GLboolean ret = GL_FALSE;
4881 DEFINE_FASTPAH_GL_FUNC();
4882 _COREGL_FASTPATH_FUNC_BEGIN();
4883 INIT_FASTPATH_GL_FUNC();
4885 if (GET_REAL_OBJ(GL_OBJECT_TYPE_TRANSFORMFEEDBACK, id, &real_obj) != 1)
4891 ret = _orig_fastpath_glIsTransformFeedback(real_obj);
4896 _COREGL_FASTPATH_FUNC_END();
4902 fastpath_glDeleteTransformFeedbacks(GLsizei n, const GLuint* ids)
4905 GLuint *objid_array = NULL;
4907 DEFINE_FASTPAH_GL_FUNC();
4908 _COREGL_FASTPATH_FUNC_BEGIN();
4909 INIT_FASTPATH_GL_FUNC();
4913 _set_gl_error(GL_INVALID_VALUE);
4916 if (n == 0) goto finish;
4917 if (ids == NULL) goto finish;
4919 AST(current_ctx->ostate.shared != NULL);
4921 objid_array = (GLuint *)calloc(1, sizeof(GLuint) * n);
4925 for (i = 0; i < n; i++)
4927 int real_objid = _COREGL_INT_INIT_VALUE;
4928 if (ids[i] == 0) continue;
4930 real_objid = fastpath_ostate_get_object(¤t_ctx->ostate, GL_OBJECT_TYPE_TRANSFORMFEEDBACK, ids[i]);
4931 if (real_objid == 0) continue;
4933 AST(fastpath_ostate_remove_object(¤t_ctx->ostate, GL_OBJECT_TYPE_TRANSFORMFEEDBACK, ids[i]) == 1);
4934 objid_array[real_n++] = real_objid;
4937 IF_GL_SUCCESS(_orig_fastpath_glDeleteTransformFeedbacks(real_n, objid_array))
4939 for (i = 0; i < real_n; i++)
4941 General_Trace_List *current = NULL;
4942 current = current_ctx->ostate.shared->using_gctxs;
4944 while (current != NULL)
4946 GLGlueContext *cur_gctx = (GLGlueContext *)current->value;
4948 if (cur_gctx->gl_transform_feedback_binding[0] == objid_array[i])
4949 cur_gctx->gl_transform_feedback_binding[0] = 0;
4951 current = current->next;
4960 if (objid_array != NULL)
4965 _COREGL_FASTPATH_FUNC_END();
4968 ////////////////////////////////////////////////////////////////////////
4972 fastpath_glBindBufferBase(GLenum target, GLuint index, GLuint buffer)
4976 DEFINE_FASTPAH_GL_FUNC();
4977 _COREGL_FASTPATH_FUNC_BEGIN();
4978 INIT_FASTPATH_GL_FUNC();
4980 if (GET_REAL_OBJ(GL_OBJECT_TYPE_BUFFER, buffer, &real_obj) != 1)
4982 _set_gl_error(GL_OUT_OF_MEMORY);
4986 #define STATE_PROC(gl_state, flagid, flagbit) \
4988 CURR_STATE_COMPARE(gl_state, real_obj) \
4990 IF_GL_SUCCESS(_orig_fastpath_glBindBufferBase(target, index, real_obj)) \
4992 current_ctx->flagid |= flagbit##_##gl_state; \
4993 current_ctx->gl_state##_array[index] = real_obj; \
4994 current_ctx->gl_state##_array_offset[index] = 0; \
4995 current_ctx->gl_state##_array_size[index] = 0; \
5004 case GL_TRANSFORM_FEEDBACK_BUFFER:
5005 STATE_PROC(gl_transform_feedback_buffer_binding, _bind_flag2, _BIND_FLAG2_BIT);
5007 case GL_UNIFORM_BUFFER:
5008 STATE_PROC(gl_uniform_buffer_binding, _bind_flag2, _BIND_FLAG2_BIT);
5011 _set_gl_error(GL_INVALID_ENUM);
5021 _COREGL_FASTPATH_FUNC_END();
5027 fastpath_glBindBufferRange(GLenum target, GLuint index, GLuint buffer, GLintptr offset, GLsizeiptr size)
5031 DEFINE_FASTPAH_GL_FUNC();
5032 _COREGL_FASTPATH_FUNC_BEGIN();
5033 INIT_FASTPATH_GL_FUNC();
5035 if (GET_REAL_OBJ(GL_OBJECT_TYPE_BUFFER, buffer, &real_obj) != 1)
5037 _set_gl_error(GL_OUT_OF_MEMORY);
5041 #define STATE_PROC(gl_state, flagnum) \
5043 CURR_STATE_COMPARE(gl_state, real_obj) \
5045 IF_GL_SUCCESS(_orig_fastpath_glBindBufferRange(target, index, real_obj, offset, size)) \
5047 current_ctx->_bind_flag2 |= _BIND_FLAG2_BIT_##gl_state; \
5048 current_ctx->gl_state##_array[index] = real_obj; \
5049 current_ctx->gl_state##_array_offset[index] = offset; \
5050 current_ctx->gl_state##_array_size[index] = size; \
5059 case GL_TRANSFORM_FEEDBACK_BUFFER: STATE_PROC(gl_transform_feedback_buffer_binding, 0); break;
5060 case GL_UNIFORM_BUFFER: STATE_PROC(gl_uniform_buffer_binding, 0); break;
5061 default: _set_gl_error(GL_INVALID_ENUM); break;
5070 _COREGL_FASTPATH_FUNC_END();
5075 fastpath_glTransformFeedbackVaryings(GLuint program, GLsizei count, const GLchar* const* varyings, GLenum bufferMode)
5079 DEFINE_FASTPAH_GL_FUNC();
5080 _COREGL_FASTPATH_FUNC_BEGIN();
5081 INIT_FASTPATH_GL_FUNC();
5083 if (GET_REAL_OBJ(GL_OBJECT_TYPE_PROGRAM, program, &real_obj) != 1)
5085 _set_gl_error(GL_INVALID_VALUE);
5089 _orig_fastpath_glTransformFeedbackVaryings(real_obj, count, varyings, bufferMode);
5093 _COREGL_FASTPATH_FUNC_END();
5098 fastpath_glGetTransformFeedbackVarying(GLuint program, GLuint index, GLsizei bufSize, GLsizei* length, GLsizei* size, GLenum* type, GLchar* name)
5102 DEFINE_FASTPAH_GL_FUNC();
5103 _COREGL_FASTPATH_FUNC_BEGIN();
5104 INIT_FASTPATH_GL_FUNC();
5106 if (GET_REAL_OBJ(GL_OBJECT_TYPE_PROGRAM, program, &real_obj) != 1)
5108 _set_gl_error(GL_INVALID_VALUE);
5112 _orig_fastpath_glGetTransformFeedbackVarying(real_obj, index, bufSize, length, size, type, name);
5116 _COREGL_FASTPATH_FUNC_END();
5121 fastpath_glVertexAttribIPointer(GLuint index, GLint size, GLenum type, GLsizei stride, const GLvoid* pointer)
5123 DEFINE_FASTPAH_GL_FUNC();
5124 _COREGL_FASTPATH_FUNC_BEGIN();
5125 INIT_FASTPATH_GL_FUNC();
5127 IF_GL_SUCCESS(_orig_fastpath_glVertexAttribIPointer(index, size, type, stride, pointer))
5129 if (current_ctx->gl_vertex_array_binding[0] == 0)
5131 current_ctx->_vattrib_flag |= _VATTRIB_FLAG_BIT_gl_vertex_array;
5133 current_ctx->gl_vertex_array_buf_id[index] = current_ctx->gl_array_buffer_binding[0];
5134 current_ctx->gl_vertex_array_size[index] = size;
5135 current_ctx->gl_vertex_array_type[index] = type;
5136 current_ctx->gl_vertex_array_normalized[index] = GL_FALSE;
5137 current_ctx->gl_vertex_array_integer[index] = GL_TRUE;
5138 current_ctx->gl_vertex_array_stride[index] = stride;
5139 current_ctx->gl_vertex_array_pointer[index] = (GLvoid *)pointer;
5145 _COREGL_FASTPATH_FUNC_END();
5150 fastpath_glVertexAttribI4i(GLuint index, GLint x, GLint y, GLint z, GLint w)
5152 DEFINE_FASTPAH_GL_FUNC();
5153 _COREGL_FASTPATH_FUNC_BEGIN();
5154 INIT_FASTPATH_GL_FUNC();
5156 IF_GL_SUCCESS(_orig_fastpath_glVertexAttribI4i(index, x, y, z, w))
5158 if (current_ctx->gl_vertex_array_binding[0] == 0)
5160 current_ctx->_vattrib_flag |= _VATTRIB_FLAG_BIT_gl_vertex_attrib_value;
5161 current_ctx->gl_vertex_array_size[index] = 0;
5162 current_ctx->gl_vertex_array_integer[index] = GL_TRUE;
5164 current_ctx->gl_vertex_array_type[index] = GL_INT;
5165 current_ctx->gl_vertex_attrib_value_integer[index * 4 + 0] = x;
5166 current_ctx->gl_vertex_attrib_value_integer[index * 4 + 1] = y;
5167 current_ctx->gl_vertex_attrib_value_integer[index * 4 + 2] = z;
5168 current_ctx->gl_vertex_attrib_value_integer[index * 4 + 3] = w;
5174 _COREGL_FASTPATH_FUNC_END();
5179 fastpath_glVertexAttribI4ui(GLuint index, GLuint x, GLuint y, GLuint z, GLuint w)
5181 DEFINE_FASTPAH_GL_FUNC();
5182 _COREGL_FASTPATH_FUNC_BEGIN();
5183 INIT_FASTPATH_GL_FUNC();
5185 IF_GL_SUCCESS(_orig_fastpath_glVertexAttribI4ui(index, x, y, z, w))
5187 if (current_ctx->gl_vertex_array_binding[0] == 0)
5189 current_ctx->_vattrib_flag |= _VATTRIB_FLAG_BIT_gl_vertex_attrib_value;
5190 current_ctx->gl_vertex_array_size[index] = 0;
5191 current_ctx->gl_vertex_array_integer[index] = GL_TRUE;
5193 current_ctx->gl_vertex_array_type[index] = GL_UNSIGNED_INT;
5194 current_ctx->gl_vertex_attrib_value_unsigned_integer[index * 4 + 0] = x;
5195 current_ctx->gl_vertex_attrib_value_unsigned_integer[index * 4 + 1] = y;
5196 current_ctx->gl_vertex_attrib_value_unsigned_integer[index * 4 + 2] = z;
5197 current_ctx->gl_vertex_attrib_value_unsigned_integer[index * 4 + 3] = w;
5203 _COREGL_FASTPATH_FUNC_END();
5208 fastpath_glVertexAttribI4iv(GLuint index, const GLint* v)
5210 DEFINE_FASTPAH_GL_FUNC();
5211 _COREGL_FASTPATH_FUNC_BEGIN();
5212 INIT_FASTPATH_GL_FUNC();
5214 IF_GL_SUCCESS(_orig_fastpath_glVertexAttribI4iv(index, v))
5216 if (current_ctx->gl_vertex_array_binding[0] == 0)
5218 current_ctx->_vattrib_flag |= _VATTRIB_FLAG_BIT_gl_vertex_attrib_value;
5219 current_ctx->gl_vertex_array_size[index] = 0;
5220 current_ctx->gl_vertex_array_integer[index] = GL_TRUE;
5222 current_ctx->gl_vertex_array_type[index] = GL_INT;
5223 current_ctx->gl_vertex_attrib_value_integer[index * 4 + 0] = v[0];
5224 current_ctx->gl_vertex_attrib_value_integer[index * 4 + 1] = v[1];
5225 current_ctx->gl_vertex_attrib_value_integer[index * 4 + 2] = v[2];
5226 current_ctx->gl_vertex_attrib_value_integer[index * 4 + 3] = v[3];
5232 _COREGL_FASTPATH_FUNC_END();
5237 fastpath_glVertexAttribI4uiv(GLuint index, const GLuint* v)
5239 DEFINE_FASTPAH_GL_FUNC();
5240 _COREGL_FASTPATH_FUNC_BEGIN();
5241 INIT_FASTPATH_GL_FUNC();
5243 IF_GL_SUCCESS(_orig_fastpath_glVertexAttribI4uiv(index, v))
5245 if (current_ctx->gl_vertex_array_binding[0] == 0)
5247 current_ctx->_vattrib_flag |= _VATTRIB_FLAG_BIT_gl_vertex_attrib_value;
5248 current_ctx->gl_vertex_array_size[index] = 0;
5249 current_ctx->gl_vertex_array_integer[index] = GL_TRUE;
5251 current_ctx->gl_vertex_array_type[index] = GL_UNSIGNED_INT;
5252 current_ctx->gl_vertex_attrib_value_unsigned_integer[index * 4 + 0] = v[0];
5253 current_ctx->gl_vertex_attrib_value_unsigned_integer[index * 4 + 1] = v[1];
5254 current_ctx->gl_vertex_attrib_value_unsigned_integer[index * 4 + 2] = v[2];
5255 current_ctx->gl_vertex_attrib_value_unsigned_integer[index * 4 + 3] = v[3];
5261 _COREGL_FASTPATH_FUNC_END();
5266 fastpath_glGetUniformuiv(GLuint program, GLint location, GLuint* params)
5270 DEFINE_FASTPAH_GL_FUNC();
5271 _COREGL_FASTPATH_FUNC_BEGIN();
5272 INIT_FASTPATH_GL_FUNC();
5274 if (GET_REAL_OBJ(GL_OBJECT_TYPE_PROGRAM, program, &real_obj) != 1)
5276 _set_gl_error(GL_INVALID_VALUE);
5280 _orig_fastpath_glGetUniformuiv(real_obj, location, params);
5285 _COREGL_FASTPATH_FUNC_END();
5290 fastpath_glGetFragDataLocation(GLuint program, const GLchar *name)
5292 GLint ret = _COREGL_INT_INIT_VALUE;
5295 DEFINE_FASTPAH_GL_FUNC();
5296 _COREGL_FASTPATH_FUNC_BEGIN();
5297 INIT_FASTPATH_GL_FUNC();
5299 if (GET_REAL_OBJ(GL_OBJECT_TYPE_PROGRAM, program, &real_obj) != 1)
5301 _set_gl_error(GL_INVALID_VALUE);
5305 ret = _orig_fastpath_glGetFragDataLocation(real_obj, name);
5310 _COREGL_FASTPATH_FUNC_END();
5316 fastpath_glGetStringi(GLenum name, GLuint index)
5318 const char *ret = NULL;
5320 DEFINE_FASTPAH_GL_FUNC();
5321 _COREGL_FASTPATH_FUNC_BEGIN();
5322 INIT_FASTPATH_GL_FUNC();
5327 _set_gl_error(GL_INVALID_ENUM);
5330 _valid_extension_string();
5331 if (index < 0 || index >= gl_extension_count)
5333 _set_gl_error(GL_INVALID_VALUE);
5336 ret = string_each_extensions[index];
5339 IF_GL_SUCCESS(ret = (const char *)_orig_fastpath_glGetStringi(name, index))
5352 _COREGL_FASTPATH_FUNC_END();
5353 return (const GLubyte *)ret;
5358 fastpath_glGetUniformIndices(GLuint program, GLsizei uniformCount, const GLchar* const* uniformNames, GLuint* uniformIndices)
5362 DEFINE_FASTPAH_GL_FUNC();
5363 _COREGL_FASTPATH_FUNC_BEGIN();
5364 INIT_FASTPATH_GL_FUNC();
5366 if (GET_REAL_OBJ(GL_OBJECT_TYPE_PROGRAM, program, &real_obj) != 1)
5368 _set_gl_error(GL_INVALID_VALUE);
5372 _orig_fastpath_glGetUniformIndices(real_obj, uniformCount, uniformNames, uniformIndices);
5377 _COREGL_FASTPATH_FUNC_END();
5382 fastpath_glGetActiveUniformsiv(GLuint program, GLsizei uniformCount, const GLuint* uniformIndices, GLenum pname, GLint* params)
5386 DEFINE_FASTPAH_GL_FUNC();
5387 _COREGL_FASTPATH_FUNC_BEGIN();
5388 INIT_FASTPATH_GL_FUNC();
5390 if (GET_REAL_OBJ(GL_OBJECT_TYPE_PROGRAM, program, &real_obj) != 1)
5392 _set_gl_error(GL_INVALID_VALUE);
5396 _orig_fastpath_glGetActiveUniformsiv(real_obj, uniformCount, uniformIndices, pname, params);
5401 _COREGL_FASTPATH_FUNC_END();
5406 fastpath_glGetUniformBlockIndex(GLuint program, const GLchar* uniformBlockName)
5408 GLuint ret = _COREGL_INT_INIT_VALUE;
5411 DEFINE_FASTPAH_GL_FUNC();
5412 _COREGL_FASTPATH_FUNC_BEGIN();
5413 INIT_FASTPATH_GL_FUNC();
5415 if (GET_REAL_OBJ(GL_OBJECT_TYPE_PROGRAM, program, &real_obj) != 1)
5417 _set_gl_error(GL_INVALID_VALUE);
5421 ret = _orig_fastpath_glGetUniformBlockIndex(real_obj, uniformBlockName);
5426 _COREGL_FASTPATH_FUNC_END();
5431 fastpath_glGetActiveUniformBlockiv(GLuint program, GLuint uniformBlockIndex, GLenum pname, GLint* params)
5435 DEFINE_FASTPAH_GL_FUNC();
5436 _COREGL_FASTPATH_FUNC_BEGIN();
5437 INIT_FASTPATH_GL_FUNC();
5439 if (GET_REAL_OBJ(GL_OBJECT_TYPE_PROGRAM, program, &real_obj) != 1)
5441 _set_gl_error(GL_INVALID_VALUE);
5445 _orig_fastpath_glGetActiveUniformBlockiv(real_obj, uniformBlockIndex, pname, params);
5450 _COREGL_FASTPATH_FUNC_END();
5454 fastpath_glGetActiveUniformBlockName(GLuint program, GLuint uniformBlockIndex, GLsizei bufSize, GLsizei* length, GLchar* uniformBlockName)
5458 DEFINE_FASTPAH_GL_FUNC();
5459 _COREGL_FASTPATH_FUNC_BEGIN();
5460 INIT_FASTPATH_GL_FUNC();
5462 if (GET_REAL_OBJ(GL_OBJECT_TYPE_PROGRAM, program, &real_obj) != 1)
5464 _set_gl_error(GL_INVALID_VALUE);
5468 _orig_fastpath_glGetActiveUniformBlockName(real_obj, uniformBlockIndex, bufSize, length, uniformBlockName);
5473 _COREGL_FASTPATH_FUNC_END();
5478 fastpath_glUniformBlockBinding(GLuint program, GLuint uniformBlockIndex, GLuint uniformBlockBinding)
5482 DEFINE_FASTPAH_GL_FUNC();
5483 _COREGL_FASTPATH_FUNC_BEGIN();
5484 INIT_FASTPATH_GL_FUNC();
5486 if (GET_REAL_OBJ(GL_OBJECT_TYPE_PROGRAM, program, &real_obj) != 1)
5488 _set_gl_error(GL_INVALID_VALUE);
5492 _orig_fastpath_glUniformBlockBinding(real_obj, uniformBlockIndex, uniformBlockBinding);
5497 _COREGL_FASTPATH_FUNC_END();
5502 fastpath_glGetInteger64v(GLenum pname, GLint64* params)
5504 DEFINE_FASTPAH_GL_FUNC();
5505 _COREGL_FASTPATH_FUNC_BEGIN();
5506 INIT_FASTPATH_GL_FUNC();
5508 IF_GL_SUCCESS(_orig_fastpath_glGetInteger64v(pname, params))
5510 _modify_get_value(pname, params, GL_INT, GL_TRUE);
5515 _COREGL_FASTPATH_FUNC_END();
5520 fastpath_glGetInteger64i_v(GLenum target, GLuint index, GLint64* data)
5522 DEFINE_FASTPAH_GL_FUNC();
5523 _COREGL_FASTPATH_FUNC_BEGIN();
5524 INIT_FASTPATH_GL_FUNC();
5526 IF_GL_SUCCESS(_orig_fastpath_glGetInteger64i_v(target, index, data))
5528 _modify_get_value(target, data, GL_INT, GL_TRUE);
5533 _COREGL_FASTPATH_FUNC_END();
5537 ////////////////////////////////////////////////////////////////////////
5540 fastpath_glGenSamplers(GLsizei n, GLuint* samplers)
5543 GLuint *objid_array = NULL;
5545 DEFINE_FASTPAH_GL_FUNC();
5546 _COREGL_FASTPATH_FUNC_BEGIN();
5547 INIT_FASTPATH_GL_FUNC();
5551 _set_gl_error(GL_INVALID_VALUE);
5554 if (n == 0) goto finish;
5555 if (samplers == NULL) goto finish;
5557 AST(current_ctx->ostate.shared != NULL);
5559 objid_array = (GLuint *)calloc(1, sizeof(GLuint) * n);
5561 IF_GL_SUCCESS(_orig_fastpath_glGenSamplers(n, objid_array))
5563 for (i = 0; i < n; i++)
5565 samplers[i] = fastpath_ostate_create_object(¤t_ctx->ostate, GL_OBJECT_TYPE_SAMPLER, objid_array[i]);
5572 if (objid_array != NULL)
5577 _COREGL_FASTPATH_FUNC_END();
5582 fastpath_glBindSampler(GLuint unit, GLuint sampler)
5586 DEFINE_FASTPAH_GL_FUNC();
5587 _COREGL_FASTPATH_FUNC_BEGIN();
5588 INIT_FASTPATH_GL_FUNC();
5590 if (GET_REAL_OBJ(GL_OBJECT_TYPE_SAMPLER, sampler, &real_obj) != 1)
5592 _set_gl_error(GL_OUT_OF_MEMORY);
5596 _orig_fastpath_glBindSampler(unit, real_obj);
5600 _COREGL_FASTPATH_FUNC_END();
5605 fastpath_glIsSampler(GLuint sampler)
5607 GLboolean ret = GL_FALSE;
5610 DEFINE_FASTPAH_GL_FUNC();
5611 _COREGL_FASTPATH_FUNC_BEGIN();
5612 INIT_FASTPATH_GL_FUNC();
5614 if (GET_REAL_OBJ(GL_OBJECT_TYPE_SAMPLER, sampler, &real_obj) != 1)
5620 ret = _orig_fastpath_glIsSampler(real_obj);
5625 _COREGL_FASTPATH_FUNC_END();
5631 fastpath_glDeleteSamplers(GLsizei n, const GLuint* samplers)
5634 GLuint *objid_array = NULL;
5636 DEFINE_FASTPAH_GL_FUNC();
5637 _COREGL_FASTPATH_FUNC_BEGIN();
5638 INIT_FASTPATH_GL_FUNC();
5642 _set_gl_error(GL_INVALID_VALUE);
5645 if (n == 0) goto finish;
5646 if (samplers == NULL) goto finish;
5648 AST(current_ctx->ostate.shared != NULL);
5650 objid_array = (GLuint *)calloc(1, sizeof(GLuint) * n);
5654 for (i = 0; i < n; i++)
5656 int real_objid = _COREGL_INT_INIT_VALUE;
5657 if (samplers[i] == 0) continue;
5659 real_objid = fastpath_ostate_get_object(¤t_ctx->ostate, GL_OBJECT_TYPE_SAMPLER, samplers[i]);
5660 if (real_objid == 0) continue;
5662 AST(fastpath_ostate_remove_object(¤t_ctx->ostate, GL_OBJECT_TYPE_SAMPLER, samplers[i]) == 1);
5663 objid_array[real_n++] = real_objid;
5666 _orig_fastpath_glDeleteSamplers(real_n, objid_array);
5672 if (objid_array != NULL)
5677 _COREGL_FASTPATH_FUNC_END();
5680 ////////////////////////////////////////////////////////////////////////
5684 fastpath_glSamplerParameteri(GLuint sampler, GLenum pname, GLint param)
5688 DEFINE_FASTPAH_GL_FUNC();
5689 _COREGL_FASTPATH_FUNC_BEGIN();
5690 INIT_FASTPATH_GL_FUNC();
5692 if (GET_REAL_OBJ(GL_OBJECT_TYPE_SAMPLER, sampler, &real_obj) != 1)
5697 _orig_fastpath_glSamplerParameteri(real_obj, pname, param);
5702 _COREGL_FASTPATH_FUNC_END();
5706 fastpath_glSamplerParameteriv(GLuint sampler, GLenum pname, const GLint* param)
5710 DEFINE_FASTPAH_GL_FUNC();
5711 _COREGL_FASTPATH_FUNC_BEGIN();
5712 INIT_FASTPATH_GL_FUNC();
5714 if (GET_REAL_OBJ(GL_OBJECT_TYPE_SAMPLER, sampler, &real_obj) != 1)
5719 _orig_fastpath_glSamplerParameteriv(real_obj, pname, param);
5724 _COREGL_FASTPATH_FUNC_END();
5728 fastpath_glSamplerParameterf(GLuint sampler, GLenum pname, GLfloat param)
5732 DEFINE_FASTPAH_GL_FUNC();
5733 _COREGL_FASTPATH_FUNC_BEGIN();
5734 INIT_FASTPATH_GL_FUNC();
5736 if (GET_REAL_OBJ(GL_OBJECT_TYPE_SAMPLER, sampler, &real_obj) != 1)
5741 _orig_fastpath_glSamplerParameterf(real_obj, pname, param);
5746 _COREGL_FASTPATH_FUNC_END();
5750 fastpath_glSamplerParameterfv(GLuint sampler, GLenum pname, const GLfloat* param)
5754 DEFINE_FASTPAH_GL_FUNC();
5755 _COREGL_FASTPATH_FUNC_BEGIN();
5756 INIT_FASTPATH_GL_FUNC();
5758 if (GET_REAL_OBJ(GL_OBJECT_TYPE_SAMPLER, sampler, &real_obj) != 1)
5763 _orig_fastpath_glSamplerParameterfv(real_obj, pname, param);
5768 _COREGL_FASTPATH_FUNC_END();
5772 fastpath_glGetSamplerParameteriv(GLuint sampler, GLenum pname, GLint* params)
5776 DEFINE_FASTPAH_GL_FUNC();
5777 _COREGL_FASTPATH_FUNC_BEGIN();
5778 INIT_FASTPATH_GL_FUNC();
5780 if (GET_REAL_OBJ(GL_OBJECT_TYPE_SAMPLER, sampler, &real_obj) != 1)
5785 _orig_fastpath_glGetSamplerParameteriv(real_obj, pname, params);
5790 _COREGL_FASTPATH_FUNC_END();
5794 fastpath_glGetSamplerParameterfv(GLuint sampler, GLenum pname, GLfloat* params)
5798 DEFINE_FASTPAH_GL_FUNC();
5799 _COREGL_FASTPATH_FUNC_BEGIN();
5800 INIT_FASTPATH_GL_FUNC();
5802 if (GET_REAL_OBJ(GL_OBJECT_TYPE_SAMPLER, sampler, &real_obj) != 1)
5807 _orig_fastpath_glGetSamplerParameterfv(real_obj, pname, params);
5812 _COREGL_FASTPATH_FUNC_END();
5817 fastpath_glVertexAttribDivisor(GLuint index, GLuint divisor)
5819 DEFINE_FASTPAH_GL_FUNC();
5820 _COREGL_FASTPATH_FUNC_BEGIN();
5821 INIT_FASTPATH_GL_FUNC();
5823 IF_GL_SUCCESS(_orig_fastpath_glVertexAttribDivisor(index, divisor))
5825 if (current_ctx->gl_vertex_array_binding[0] == 0)
5827 current_ctx->_vattrib_flag |= _VATTRIB_FLAG_BIT_gl_vertex_array;
5828 current_ctx->gl_vertex_array_divisor[index] = divisor;
5834 _COREGL_FASTPATH_FUNC_END();
5839 fastpath_glProgramParameteri(GLuint program, GLenum pname, GLint value)
5843 DEFINE_FASTPAH_GL_FUNC();
5844 _COREGL_FASTPATH_FUNC_BEGIN();
5845 INIT_FASTPATH_GL_FUNC();
5847 if (GET_REAL_OBJ(GL_OBJECT_TYPE_PROGRAM, program, &real_obj) != 1)
5849 _set_gl_error(GL_INVALID_VALUE);
5853 _orig_fastpath_glProgramParameteri(real_obj, pname, value);
5858 _COREGL_FASTPATH_FUNC_END();
5864 fastpath_glCreateShaderProgramv(GLenum type, GLsizei count, const GLchar *const*strings)
5867 GLuint real_obj = 0;
5869 DEFINE_FASTPAH_GL_FUNC();
5870 _COREGL_FASTPATH_FUNC_BEGIN();
5871 INIT_FASTPATH_GL_FUNC();
5873 AST(current_ctx->ostate.shared != NULL);
5875 real_obj = _orig_fastpath_glCreateShaderProgramv(type, count, strings);
5878 ret = fastpath_ostate_create_object(¤t_ctx->ostate, GL_OBJECT_TYPE_PROGRAM, real_obj);
5880 Program_object_attached_tag *poat = NULL;
5881 poat = (Program_object_attached_tag *)calloc(1, sizeof(Program_object_attached_tag));
5884 poat->is_deleting = 0;
5885 poat->shader_count = 0;
5887 fastpath_ostate_set_object_tag(¤t_ctx->ostate, GL_OBJECT_TYPE_PROGRAM, ret, poat);
5889 _attach_program_object(¤t_ctx->ostate, real_obj);
5894 _COREGL_FASTPATH_FUNC_END();
5899 fastpath_glGenProgramPipelines( GLsizei n, GLuint *pipelines)
5902 GLuint *objid_array = NULL;
5904 DEFINE_FASTPAH_GL_FUNC();
5905 _COREGL_FASTPATH_FUNC_BEGIN();
5906 INIT_FASTPATH_GL_FUNC();
5908 if (n < 0 || pipelines == NULL)
5910 _set_gl_error(GL_INVALID_VALUE);
5914 AST(current_ctx->ostate.shared != NULL);
5916 objid_array = (GLuint *)calloc(1, sizeof(GLuint) * n);
5918 IF_GL_SUCCESS(_orig_fastpath_glGenProgramPipelines(n, objid_array))
5920 for (i = 0; i < n; i++)
5922 pipelines[i] = fastpath_ostate_create_object(¤t_ctx->ostate, GL_OBJECT_TYPE_PROGRAMPIPELINE, objid_array[i]);
5929 if (objid_array != NULL)
5934 _COREGL_FASTPATH_FUNC_END();
5938 fastpath_glBindProgramPipeline( GLuint pipeline)
5942 DEFINE_FASTPAH_GL_FUNC();
5943 _COREGL_FASTPATH_FUNC_BEGIN();
5944 INIT_FASTPATH_GL_FUNC();
5946 if (GET_REAL_OBJ(GL_OBJECT_TYPE_PROGRAMPIPELINE, pipeline, &real_obj) != 1)
5948 _set_gl_error(GL_INVALID_OPERATION);
5952 if (current_ctx->gl_program_pipeline_binding[0] != real_obj)
5954 IF_GL_SUCCESS(_orig_fastpath_glBindProgramPipeline(real_obj))
5956 current_ctx->_misc_flag3 |= _MISC_FLAG3_BIT_gl_program_pipeline_binding;
5957 current_ctx->gl_program_pipeline_binding[0] = real_obj;
5964 _COREGL_FASTPATH_FUNC_END();
5968 fastpath_glGetProgramPipelineiv(GLuint pipeline, GLenum pname, GLint *params)
5972 DEFINE_FASTPAH_GL_FUNC();
5973 _COREGL_FASTPATH_FUNC_BEGIN();
5974 INIT_FASTPATH_GL_FUNC();
5976 if (params == NULL || GET_REAL_OBJ(GL_OBJECT_TYPE_PROGRAMPIPELINE, pipeline, &real_obj) != 1)
5978 _set_gl_error(GL_INVALID_VALUE);
5984 case GL_ACTIVE_PROGRAM:
5985 case GL_VERTEX_SHADER:
5986 case GL_FRAGMENT_SHADER:
5987 case GL_COMPUTE_SHADER:
5988 case GL_INFO_LOG_LENGTH:
5989 case GL_VALIDATE_STATUS:
5990 _orig_fastpath_glGetProgramPipelineiv(real_obj, pname, params);
5993 _set_gl_error(GL_INVALID_ENUM);
6000 _COREGL_FASTPATH_FUNC_END();
6004 fastpath_glDeleteProgramPipelines(GLsizei n, GLuint const *pipelines)
6007 GLuint *objid_array = NULL;
6009 DEFINE_FASTPAH_GL_FUNC();
6010 _COREGL_FASTPATH_FUNC_BEGIN();
6011 INIT_FASTPATH_GL_FUNC();
6013 if (n < 0 || pipelines == NULL)
6015 _set_gl_error(GL_INVALID_VALUE);
6022 AST(current_ctx->ostate.shared != NULL);
6024 objid_array = (GLuint *)calloc(1, sizeof(GLuint) * n);
6028 for (i = 0; i < n; i++)
6030 int real_objid = _COREGL_INT_INIT_VALUE;
6031 if (pipelines[i] == 0) continue;
6033 real_objid = fastpath_ostate_get_object(¤t_ctx->ostate, GL_OBJECT_TYPE_PROGRAMPIPELINE, pipelines[i]);
6034 if (real_objid == 0) continue;
6036 AST(fastpath_ostate_remove_object(¤t_ctx->ostate, GL_OBJECT_TYPE_PROGRAMPIPELINE, pipelines[i]) == 1);
6037 objid_array[real_n++] = real_objid;
6040 IF_GL_SUCCESS(_orig_fastpath_glDeleteProgramPipelines(real_n, objid_array))
6042 for (i = 0; i < real_n; i++)
6044 General_Trace_List *current = NULL;
6045 current = current_ctx->ostate.shared->using_gctxs;
6047 while (current != NULL)
6049 GLGlueContext *cur_gctx = (GLGlueContext *)current->value;
6051 if (cur_gctx->gl_program_pipeline_binding[0] == objid_array[i])
6052 cur_gctx->gl_program_pipeline_binding[0] = 0;
6054 current = current->next;
6063 if (objid_array != NULL)
6068 _COREGL_FASTPATH_FUNC_END();
6072 fastpath_glIsProgramPipeline( GLuint pipeline)
6074 GLboolean ret = GL_FALSE;
6077 DEFINE_FASTPAH_GL_FUNC();
6078 _COREGL_FASTPATH_FUNC_BEGIN();
6079 INIT_FASTPATH_GL_FUNC();
6081 if (GET_REAL_OBJ(GL_OBJECT_TYPE_PROGRAMPIPELINE, pipeline, &real_obj) != 1)
6087 ret = _orig_fastpath_glIsProgramPipeline(real_obj);
6092 _COREGL_FASTPATH_FUNC_END();
6097 fastpath_glValidateProgramPipeline(GLuint pipeline)
6101 DEFINE_FASTPAH_GL_FUNC();
6102 _COREGL_FASTPATH_FUNC_BEGIN();
6103 INIT_FASTPATH_GL_FUNC();
6105 if (GET_REAL_OBJ(GL_OBJECT_TYPE_PROGRAMPIPELINE, pipeline, &real_obj) != 1)
6107 _set_gl_error(GL_INVALID_VALUE);
6111 _orig_fastpath_glValidateProgramPipeline(real_obj);
6116 _COREGL_FASTPATH_FUNC_END();
6120 fastpath_glGetProgramPipelineInfoLog(GLuint pipeline, GLsizei bufSize, GLsizei *length, GLchar *infoLog)
6124 DEFINE_FASTPAH_GL_FUNC();
6125 _COREGL_FASTPATH_FUNC_BEGIN();
6126 INIT_FASTPATH_GL_FUNC();
6128 if (NULL == infoLog || bufSize < 0 || GET_REAL_OBJ(GL_OBJECT_TYPE_PROGRAMPIPELINE, pipeline, &real_obj) != 1)
6130 _set_gl_error(GL_INVALID_VALUE);
6134 _orig_fastpath_glGetProgramPipelineInfoLog(real_obj, bufSize, length, infoLog);
6139 _COREGL_FASTPATH_FUNC_END();
6143 fastpath_glDispatchCompute(GLuint num_groups_x, GLuint num_groups_y, GLuint num_groups_z)
6145 DEFINE_FASTPAH_GL_FUNC();
6146 _COREGL_FASTPATH_FUNC_BEGIN();
6147 INIT_FASTPATH_GL_FUNC();
6149 if (num_groups_x > GL_MAX_COMPUTE_WORK_GROUP_COUNT ||
6150 num_groups_y > GL_MAX_COMPUTE_WORK_GROUP_COUNT ||
6151 num_groups_z > GL_MAX_COMPUTE_WORK_GROUP_COUNT)
6153 _set_gl_error(GL_INVALID_VALUE);
6157 if (num_groups_x == 0 || num_groups_y == 0 || num_groups_z == 0)
6162 _orig_fastpath_glDispatchCompute(num_groups_x, num_groups_y, num_groups_z);
6165 _COREGL_FASTPATH_FUNC_END();
6169 fastpath_glDispatchComputeIndirect( GLintptr indirect)
6171 DEFINE_FASTPAH_GL_FUNC();
6172 _COREGL_FASTPATH_FUNC_BEGIN();
6173 INIT_FASTPATH_GL_FUNC();
6175 if (indirect < 0 || (indirect % sizeof(GLuint)) != 0)
6177 _set_gl_error(GL_INVALID_VALUE);
6181 _orig_fastpath_glDispatchComputeIndirect(indirect);
6184 _COREGL_FASTPATH_FUNC_END();
6188 fastpath_glGetProgramInterfaceiv(GLuint program, GLenum programInterface, GLenum pname, GLint * params)
6192 DEFINE_FASTPAH_GL_FUNC();
6193 _COREGL_FASTPATH_FUNC_BEGIN();
6194 INIT_FASTPATH_GL_FUNC();
6196 if (params == NULL || GET_REAL_OBJ(GL_OBJECT_TYPE_PROGRAM, program, &real_obj) != 1)
6198 _set_gl_error(GL_INVALID_VALUE);
6202 _orig_fastpath_glGetProgramInterfaceiv(real_obj, programInterface, pname, params);
6207 _COREGL_FASTPATH_FUNC_END();
6211 fastpath_glGetProgramResourceIndex( GLuint program, GLenum programInterface, const char * name)
6214 GLuint ret = GL_INVALID_INDEX;
6216 DEFINE_FASTPAH_GL_FUNC();
6217 _COREGL_FASTPATH_FUNC_BEGIN();
6218 INIT_FASTPATH_GL_FUNC();
6220 if (name == NULL || GET_REAL_OBJ(GL_OBJECT_TYPE_PROGRAM, program, &real_obj) != 1)
6222 _set_gl_error(GL_INVALID_VALUE);
6226 ret = _orig_fastpath_glGetProgramResourceIndex(real_obj, programInterface, name);
6231 _COREGL_FASTPATH_FUNC_END();
6236 fastpath_glGetProgramResourceName(GLuint program, GLenum programInterface, GLuint index, GLsizei bufSize, GLsizei *length, GLchar *name)
6240 DEFINE_FASTPAH_GL_FUNC();
6241 _COREGL_FASTPATH_FUNC_BEGIN();
6242 INIT_FASTPATH_GL_FUNC();
6244 if ((NULL == name && 0 != bufSize) || 0 > bufSize || GET_REAL_OBJ(GL_OBJECT_TYPE_PROGRAM, program, &real_obj) != 1)
6246 _set_gl_error(GL_INVALID_VALUE);
6250 _orig_fastpath_glGetProgramResourceName(real_obj, programInterface, index, bufSize, length, name);
6255 _COREGL_FASTPATH_FUNC_END();
6259 fastpath_glGetProgramResourceiv( GLuint program, GLenum programInterface, GLuint index, GLsizei propCount, const GLenum * props, GLsizei bufSize, GLsizei * length, GLint * params)
6263 DEFINE_FASTPAH_GL_FUNC();
6264 _COREGL_FASTPATH_FUNC_BEGIN();
6265 INIT_FASTPATH_GL_FUNC();
6267 if (0 > bufSize || 0 >= propCount || NULL == props || ((NULL == params && 0 < bufSize)) || GET_REAL_OBJ(GL_OBJECT_TYPE_PROGRAM, program, &real_obj) != 1)
6269 _set_gl_error(GL_INVALID_VALUE);
6273 _orig_fastpath_glGetProgramResourceiv(real_obj, programInterface, index, propCount, props, bufSize, length, params);
6278 _COREGL_FASTPATH_FUNC_END();
6282 fastpath_glGetProgramResourceLocation(GLuint program, GLenum programInterface, GLchar const *name)
6287 DEFINE_FASTPAH_GL_FUNC();
6288 _COREGL_FASTPATH_FUNC_BEGIN();
6289 INIT_FASTPATH_GL_FUNC();
6291 if (name == NULL || GET_REAL_OBJ(GL_OBJECT_TYPE_PROGRAM, program, &real_obj) != 1)
6293 _set_gl_error(GL_INVALID_VALUE);
6297 ret = _orig_fastpath_glGetProgramResourceLocation(real_obj, programInterface, name);
6302 _COREGL_FASTPATH_FUNC_END();
6307 fastpath_glUseProgramStages(GLuint pipeline, GLbitfield stages, GLuint program)
6311 DEFINE_FASTPAH_GL_FUNC();
6312 _COREGL_FASTPATH_FUNC_BEGIN();
6313 INIT_FASTPATH_GL_FUNC();
6315 if (GET_REAL_OBJ(GL_OBJECT_TYPE_PROGRAM, program, &real_obj) != 1)
6317 _set_gl_error(GL_INVALID_VALUE);
6321 _orig_fastpath_glUseProgramStages(pipeline, stages, real_obj);
6326 _COREGL_FASTPATH_FUNC_END();
6330 fastpath_glActiveShaderProgram(GLuint pipeline, GLuint program)
6334 DEFINE_FASTPAH_GL_FUNC();
6335 _COREGL_FASTPATH_FUNC_BEGIN();
6336 INIT_FASTPATH_GL_FUNC();
6338 if (GET_REAL_OBJ(GL_OBJECT_TYPE_PROGRAM, program, &real_obj) != 1)
6340 _set_gl_error(GL_INVALID_VALUE);
6344 _orig_fastpath_glActiveShaderProgram(pipeline, real_obj);
6349 _COREGL_FASTPATH_FUNC_END();
6353 fastpath_glProgramUniform1iv(GLuint program, GLint location, GLsizei count, const GLint *value)
6357 DEFINE_FASTPAH_GL_FUNC();
6358 _COREGL_FASTPATH_FUNC_BEGIN();
6359 INIT_FASTPATH_GL_FUNC();
6361 if (GET_REAL_OBJ(GL_OBJECT_TYPE_PROGRAM, program, &real_obj) != 1)
6363 _set_gl_error(GL_INVALID_VALUE);
6367 _orig_fastpath_glProgramUniform1iv(real_obj, location, count, value);
6372 _COREGL_FASTPATH_FUNC_END();
6377 fastpath_glProgramUniform2iv(GLuint program, GLint location, GLsizei count, const GLint *value)
6381 DEFINE_FASTPAH_GL_FUNC();
6382 _COREGL_FASTPATH_FUNC_BEGIN();
6383 INIT_FASTPATH_GL_FUNC();
6385 if (GET_REAL_OBJ(GL_OBJECT_TYPE_PROGRAM, program, &real_obj) != 1)
6387 _set_gl_error(GL_INVALID_VALUE);
6391 _orig_fastpath_glProgramUniform2iv(real_obj, location, count, value);
6396 _COREGL_FASTPATH_FUNC_END();
6401 fastpath_glProgramUniform3iv(GLuint program, GLint location, GLsizei count, const GLint *value)
6405 DEFINE_FASTPAH_GL_FUNC();
6406 _COREGL_FASTPATH_FUNC_BEGIN();
6407 INIT_FASTPATH_GL_FUNC();
6409 if (GET_REAL_OBJ(GL_OBJECT_TYPE_PROGRAM, program, &real_obj) != 1)
6411 _set_gl_error(GL_INVALID_VALUE);
6415 _orig_fastpath_glProgramUniform3iv(real_obj, location, count, value);
6420 _COREGL_FASTPATH_FUNC_END();
6425 fastpath_glProgramUniform4iv(GLuint program, GLint location, GLsizei count, const GLint *value)
6429 DEFINE_FASTPAH_GL_FUNC();
6430 _COREGL_FASTPATH_FUNC_BEGIN();
6431 INIT_FASTPATH_GL_FUNC();
6433 if (GET_REAL_OBJ(GL_OBJECT_TYPE_PROGRAM, program, &real_obj) != 1)
6435 _set_gl_error(GL_INVALID_VALUE);
6439 _orig_fastpath_glProgramUniform4iv(real_obj, location, count, value);
6444 _COREGL_FASTPATH_FUNC_END();
6450 fastpath_glProgramUniform1fv(GLuint program, GLint location, GLsizei count, const GLfloat *value)
6454 DEFINE_FASTPAH_GL_FUNC();
6455 _COREGL_FASTPATH_FUNC_BEGIN();
6456 INIT_FASTPATH_GL_FUNC();
6458 if (GET_REAL_OBJ(GL_OBJECT_TYPE_PROGRAM, program, &real_obj) != 1)
6460 _set_gl_error(GL_INVALID_VALUE);
6464 _orig_fastpath_glProgramUniform1fv(real_obj, location, count, value);
6469 _COREGL_FASTPATH_FUNC_END();
6474 fastpath_glProgramUniform2fv(GLuint program, GLint location, GLsizei count, const GLfloat *value)
6478 DEFINE_FASTPAH_GL_FUNC();
6479 _COREGL_FASTPATH_FUNC_BEGIN();
6480 INIT_FASTPATH_GL_FUNC();
6482 if (GET_REAL_OBJ(GL_OBJECT_TYPE_PROGRAM, program, &real_obj) != 1)
6484 _set_gl_error(GL_INVALID_VALUE);
6488 _orig_fastpath_glProgramUniform2fv(real_obj, location, count, value);
6493 _COREGL_FASTPATH_FUNC_END();
6498 fastpath_glProgramUniform3fv(GLuint program, GLint location, GLsizei count, const GLfloat *value)
6502 DEFINE_FASTPAH_GL_FUNC();
6503 _COREGL_FASTPATH_FUNC_BEGIN();
6504 INIT_FASTPATH_GL_FUNC();
6506 if (GET_REAL_OBJ(GL_OBJECT_TYPE_PROGRAM, program, &real_obj) != 1)
6508 _set_gl_error(GL_INVALID_VALUE);
6512 _orig_fastpath_glProgramUniform3fv(real_obj, location, count, value);
6517 _COREGL_FASTPATH_FUNC_END();
6522 fastpath_glProgramUniform4fv(GLuint program, GLint location, GLsizei count, const GLfloat *value)
6526 DEFINE_FASTPAH_GL_FUNC();
6527 _COREGL_FASTPATH_FUNC_BEGIN();
6528 INIT_FASTPATH_GL_FUNC();
6530 if (GET_REAL_OBJ(GL_OBJECT_TYPE_PROGRAM, program, &real_obj) != 1)
6532 _set_gl_error(GL_INVALID_VALUE);
6536 _orig_fastpath_glProgramUniform4fv(real_obj, location, count, value);
6541 _COREGL_FASTPATH_FUNC_END();
6545 fastpath_glProgramUniformMatrix2fv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
6549 DEFINE_FASTPAH_GL_FUNC();
6550 _COREGL_FASTPATH_FUNC_BEGIN();
6551 INIT_FASTPATH_GL_FUNC();
6553 if (GET_REAL_OBJ(GL_OBJECT_TYPE_PROGRAM, program, &real_obj) != 1)
6555 _set_gl_error(GL_INVALID_VALUE);
6559 _orig_fastpath_glProgramUniformMatrix2fv(real_obj, location, count, transpose, value);
6564 _COREGL_FASTPATH_FUNC_END();
6569 fastpath_glProgramUniformMatrix3fv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
6573 DEFINE_FASTPAH_GL_FUNC();
6574 _COREGL_FASTPATH_FUNC_BEGIN();
6575 INIT_FASTPATH_GL_FUNC();
6577 if (GET_REAL_OBJ(GL_OBJECT_TYPE_PROGRAM, program, &real_obj) != 1)
6579 _set_gl_error(GL_INVALID_VALUE);
6583 _orig_fastpath_glProgramUniformMatrix3fv(real_obj, location, count, transpose, value);
6588 _COREGL_FASTPATH_FUNC_END();
6593 fastpath_glProgramUniformMatrix4fv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
6597 DEFINE_FASTPAH_GL_FUNC();
6598 _COREGL_FASTPATH_FUNC_BEGIN();
6599 INIT_FASTPATH_GL_FUNC();
6601 if (GET_REAL_OBJ(GL_OBJECT_TYPE_PROGRAM, program, &real_obj) != 1)
6603 _set_gl_error(GL_INVALID_VALUE);
6607 _orig_fastpath_glProgramUniformMatrix4fv(real_obj, location, count, transpose, value);
6612 _COREGL_FASTPATH_FUNC_END();
6617 fastpath_glProgramUniform1i(GLuint program, GLint location, GLint x)
6621 DEFINE_FASTPAH_GL_FUNC();
6622 _COREGL_FASTPATH_FUNC_BEGIN();
6623 INIT_FASTPATH_GL_FUNC();
6625 if (GET_REAL_OBJ(GL_OBJECT_TYPE_PROGRAM, program, &real_obj) != 1)
6627 _set_gl_error(GL_INVALID_VALUE);
6631 _orig_fastpath_glProgramUniform1i(real_obj, location, x);
6636 _COREGL_FASTPATH_FUNC_END();
6641 fastpath_glProgramUniform2i(GLuint program, GLint location, GLint x, GLint y)
6645 DEFINE_FASTPAH_GL_FUNC();
6646 _COREGL_FASTPATH_FUNC_BEGIN();
6647 INIT_FASTPATH_GL_FUNC();
6649 if (GET_REAL_OBJ(GL_OBJECT_TYPE_PROGRAM, program, &real_obj) != 1)
6651 _set_gl_error(GL_INVALID_VALUE);
6655 _orig_fastpath_glProgramUniform2i(real_obj, location, x, y);
6660 _COREGL_FASTPATH_FUNC_END();
6665 fastpath_glProgramUniform3i(GLuint program, GLint location, GLint x, GLint y, GLint z)
6669 DEFINE_FASTPAH_GL_FUNC();
6670 _COREGL_FASTPATH_FUNC_BEGIN();
6671 INIT_FASTPATH_GL_FUNC();
6673 if (GET_REAL_OBJ(GL_OBJECT_TYPE_PROGRAM, program, &real_obj) != 1)
6675 _set_gl_error(GL_INVALID_VALUE);
6679 _orig_fastpath_glProgramUniform3i(real_obj, location, x, y, z);
6684 _COREGL_FASTPATH_FUNC_END();
6689 fastpath_glProgramUniform4i(GLuint program, GLint location, GLint x, GLint y, GLint z, GLint w)
6693 DEFINE_FASTPAH_GL_FUNC();
6694 _COREGL_FASTPATH_FUNC_BEGIN();
6695 INIT_FASTPATH_GL_FUNC();
6697 if (GET_REAL_OBJ(GL_OBJECT_TYPE_PROGRAM, program, &real_obj) != 1)
6699 _set_gl_error(GL_INVALID_VALUE);
6703 _orig_fastpath_glProgramUniform4i(real_obj, location, x, y, z, w);
6708 _COREGL_FASTPATH_FUNC_END();
6713 fastpath_glProgramUniform1f(GLuint program, GLint location, GLfloat x)
6717 DEFINE_FASTPAH_GL_FUNC();
6718 _COREGL_FASTPATH_FUNC_BEGIN();
6719 INIT_FASTPATH_GL_FUNC();
6721 if (GET_REAL_OBJ(GL_OBJECT_TYPE_PROGRAM, program, &real_obj) != 1)
6723 _set_gl_error(GL_INVALID_VALUE);
6727 _orig_fastpath_glProgramUniform1f(real_obj, location, x);
6732 _COREGL_FASTPATH_FUNC_END();
6737 fastpath_glProgramUniform2f(GLuint program, GLint location, GLfloat x, GLfloat y)
6741 DEFINE_FASTPAH_GL_FUNC();
6742 _COREGL_FASTPATH_FUNC_BEGIN();
6743 INIT_FASTPATH_GL_FUNC();
6745 if (GET_REAL_OBJ(GL_OBJECT_TYPE_PROGRAM, program, &real_obj) != 1)
6747 _set_gl_error(GL_INVALID_VALUE);
6751 _orig_fastpath_glProgramUniform2f(real_obj, location, x, y);
6756 _COREGL_FASTPATH_FUNC_END();
6761 fastpath_glProgramUniform3f(GLuint program, GLint location, GLfloat x, GLfloat y, GLfloat z)
6765 DEFINE_FASTPAH_GL_FUNC();
6766 _COREGL_FASTPATH_FUNC_BEGIN();
6767 INIT_FASTPATH_GL_FUNC();
6769 if (GET_REAL_OBJ(GL_OBJECT_TYPE_PROGRAM, program, &real_obj) != 1)
6771 _set_gl_error(GL_INVALID_VALUE);
6775 _orig_fastpath_glProgramUniform3f(real_obj, location, x, y, z);
6780 _COREGL_FASTPATH_FUNC_END();
6785 fastpath_glProgramUniform4f(GLuint program, GLint location, GLfloat x, GLfloat y, GLfloat z, GLfloat w)
6789 DEFINE_FASTPAH_GL_FUNC();
6790 _COREGL_FASTPATH_FUNC_BEGIN();
6791 INIT_FASTPATH_GL_FUNC();
6793 if (GET_REAL_OBJ(GL_OBJECT_TYPE_PROGRAM, program, &real_obj) != 1)
6795 _set_gl_error(GL_INVALID_VALUE);
6799 _orig_fastpath_glProgramUniform4f(real_obj, location, x, y, z, w);
6804 _COREGL_FASTPATH_FUNC_END();
6808 fastpath_glProgramUniform1ui(GLuint program, GLint location, GLuint x)
6812 DEFINE_FASTPAH_GL_FUNC();
6813 _COREGL_FASTPATH_FUNC_BEGIN();
6814 INIT_FASTPATH_GL_FUNC();
6816 if (GET_REAL_OBJ(GL_OBJECT_TYPE_PROGRAM, program, &real_obj) != 1)
6818 _set_gl_error(GL_INVALID_VALUE);
6822 _orig_fastpath_glProgramUniform1ui(real_obj, location, x);
6827 _COREGL_FASTPATH_FUNC_END();
6832 fastpath_glProgramUniform2ui(GLuint program, GLint location, GLuint x, GLuint y)
6836 DEFINE_FASTPAH_GL_FUNC();
6837 _COREGL_FASTPATH_FUNC_BEGIN();
6838 INIT_FASTPATH_GL_FUNC();
6840 if (GET_REAL_OBJ(GL_OBJECT_TYPE_PROGRAM, program, &real_obj) != 1)
6842 _set_gl_error(GL_INVALID_VALUE);
6846 _orig_fastpath_glProgramUniform2ui(real_obj, location, x, y);
6851 _COREGL_FASTPATH_FUNC_END();
6856 fastpath_glProgramUniform3ui(GLuint program, GLint location, GLuint x, GLuint y, GLuint z)
6860 DEFINE_FASTPAH_GL_FUNC();
6861 _COREGL_FASTPATH_FUNC_BEGIN();
6862 INIT_FASTPATH_GL_FUNC();
6864 if (GET_REAL_OBJ(GL_OBJECT_TYPE_PROGRAM, program, &real_obj) != 1)
6866 _set_gl_error(GL_INVALID_VALUE);
6870 _orig_fastpath_glProgramUniform3ui(real_obj, location, x, y, z);
6875 _COREGL_FASTPATH_FUNC_END();
6880 fastpath_glProgramUniform4ui(GLuint program, GLint location, GLuint x, GLuint y, GLuint z, GLuint w)
6884 DEFINE_FASTPAH_GL_FUNC();
6885 _COREGL_FASTPATH_FUNC_BEGIN();
6886 INIT_FASTPATH_GL_FUNC();
6888 if (GET_REAL_OBJ(GL_OBJECT_TYPE_PROGRAM, program, &real_obj) != 1)
6890 _set_gl_error(GL_INVALID_VALUE);
6894 _orig_fastpath_glProgramUniform4ui(real_obj, location, x, y, z, w);
6899 _COREGL_FASTPATH_FUNC_END();
6903 fastpath_glProgramUniform1uiv(GLuint program, GLint location, GLsizei count, const GLuint *value)
6907 DEFINE_FASTPAH_GL_FUNC();
6908 _COREGL_FASTPATH_FUNC_BEGIN();
6909 INIT_FASTPATH_GL_FUNC();
6911 if (GET_REAL_OBJ(GL_OBJECT_TYPE_PROGRAM, program, &real_obj) != 1)
6913 _set_gl_error(GL_INVALID_VALUE);
6917 _orig_fastpath_glProgramUniform1uiv(real_obj, location, count, value);
6922 _COREGL_FASTPATH_FUNC_END();
6927 fastpath_glProgramUniform2uiv(GLuint program, GLint location, GLsizei count, const GLuint *value)
6931 DEFINE_FASTPAH_GL_FUNC();
6932 _COREGL_FASTPATH_FUNC_BEGIN();
6933 INIT_FASTPATH_GL_FUNC();
6935 if (GET_REAL_OBJ(GL_OBJECT_TYPE_PROGRAM, program, &real_obj) != 1)
6937 _set_gl_error(GL_INVALID_VALUE);
6941 _orig_fastpath_glProgramUniform2uiv(real_obj, location, count, value);
6946 _COREGL_FASTPATH_FUNC_END();
6951 fastpath_glProgramUniform3uiv(GLuint program, GLint location, GLsizei count, const GLuint *value)
6955 DEFINE_FASTPAH_GL_FUNC();
6956 _COREGL_FASTPATH_FUNC_BEGIN();
6957 INIT_FASTPATH_GL_FUNC();
6959 if (GET_REAL_OBJ(GL_OBJECT_TYPE_PROGRAM, program, &real_obj) != 1)
6961 _set_gl_error(GL_INVALID_VALUE);
6965 _orig_fastpath_glProgramUniform3uiv(real_obj, location, count, value);
6970 _COREGL_FASTPATH_FUNC_END();
6975 fastpath_glProgramUniform4uiv(GLuint program, GLint location, GLsizei count, const GLuint *value)
6979 DEFINE_FASTPAH_GL_FUNC();
6980 _COREGL_FASTPATH_FUNC_BEGIN();
6981 INIT_FASTPATH_GL_FUNC();
6983 if (GET_REAL_OBJ(GL_OBJECT_TYPE_PROGRAM, program, &real_obj) != 1)
6985 _set_gl_error(GL_INVALID_VALUE);
6989 _orig_fastpath_glProgramUniform4uiv(real_obj, location, count, value);
6994 _COREGL_FASTPATH_FUNC_END();
6998 fastpath_glProgramUniformMatrix2x3fv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
7002 DEFINE_FASTPAH_GL_FUNC();
7003 _COREGL_FASTPATH_FUNC_BEGIN();
7004 INIT_FASTPATH_GL_FUNC();
7006 if (GET_REAL_OBJ(GL_OBJECT_TYPE_PROGRAM, program, &real_obj) != 1)
7008 _set_gl_error(GL_INVALID_VALUE);
7012 _orig_fastpath_glProgramUniformMatrix2x3fv(real_obj, location, count, transpose, value);
7017 _COREGL_FASTPATH_FUNC_END();
7022 fastpath_glProgramUniformMatrix3x2fv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
7026 DEFINE_FASTPAH_GL_FUNC();
7027 _COREGL_FASTPATH_FUNC_BEGIN();
7028 INIT_FASTPATH_GL_FUNC();
7030 if (GET_REAL_OBJ(GL_OBJECT_TYPE_PROGRAM, program, &real_obj) != 1)
7032 _set_gl_error(GL_INVALID_VALUE);
7036 _orig_fastpath_glProgramUniformMatrix3x2fv(real_obj, location, count, transpose, value);
7041 _COREGL_FASTPATH_FUNC_END();
7046 fastpath_glProgramUniformMatrix4x2fv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
7050 DEFINE_FASTPAH_GL_FUNC();
7051 _COREGL_FASTPATH_FUNC_BEGIN();
7052 INIT_FASTPATH_GL_FUNC();
7054 if (GET_REAL_OBJ(GL_OBJECT_TYPE_PROGRAM, program, &real_obj) != 1)
7056 _set_gl_error(GL_INVALID_VALUE);
7060 _orig_fastpath_glProgramUniformMatrix4x2fv(real_obj, location, count, transpose, value);
7065 _COREGL_FASTPATH_FUNC_END();
7069 fastpath_glProgramUniformMatrix2x4fv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
7073 DEFINE_FASTPAH_GL_FUNC();
7074 _COREGL_FASTPATH_FUNC_BEGIN();
7075 INIT_FASTPATH_GL_FUNC();
7077 if (GET_REAL_OBJ(GL_OBJECT_TYPE_PROGRAM, program, &real_obj) != 1)
7079 _set_gl_error(GL_INVALID_VALUE);
7083 _orig_fastpath_glProgramUniformMatrix2x4fv(real_obj, location, count, transpose, value);
7088 _COREGL_FASTPATH_FUNC_END();
7093 fastpath_glProgramUniformMatrix3x4fv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
7097 DEFINE_FASTPAH_GL_FUNC();
7098 _COREGL_FASTPATH_FUNC_BEGIN();
7099 INIT_FASTPATH_GL_FUNC();
7101 if (GET_REAL_OBJ(GL_OBJECT_TYPE_PROGRAM, program, &real_obj) != 1)
7103 _set_gl_error(GL_INVALID_VALUE);
7107 _orig_fastpath_glProgramUniformMatrix3x4fv(real_obj, location, count, transpose, value);
7112 _COREGL_FASTPATH_FUNC_END();
7117 fastpath_glProgramUniformMatrix4x3fv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
7121 DEFINE_FASTPAH_GL_FUNC();
7122 _COREGL_FASTPATH_FUNC_BEGIN();
7123 INIT_FASTPATH_GL_FUNC();
7125 if (GET_REAL_OBJ(GL_OBJECT_TYPE_PROGRAM, program, &real_obj) != 1)
7127 _set_gl_error(GL_INVALID_VALUE);
7131 _orig_fastpath_glProgramUniformMatrix4x3fv(real_obj, location, count, transpose, value);
7136 _COREGL_FASTPATH_FUNC_END();
7140 fastpath_glBindImageTexture(GLuint unit, GLuint texture, GLint level, GLboolean layered, GLint layer, GLenum access, GLenum format)
7142 DEFINE_FASTPAH_GL_FUNC();
7143 _COREGL_FASTPATH_FUNC_BEGIN();
7144 INIT_FASTPATH_GL_FUNC();
7146 _orig_fastpath_glBindImageTexture(unit, texture, level, layered, layer, access, format);
7151 _COREGL_FASTPATH_FUNC_END();
7155 fastpath_glGetBooleani_v (GLenum target, GLuint index, GLboolean *data)
7157 DEFINE_FASTPAH_GL_FUNC();
7158 _COREGL_FASTPATH_FUNC_BEGIN();
7159 INIT_FASTPATH_GL_FUNC();
7161 IF_GL_SUCCESS(_orig_fastpath_glGetBooleani_v(target, index, data))
7163 _modify_get_value(target, data, GL_BOOL, GL_FALSE);
7169 _COREGL_FASTPATH_FUNC_END();
7173 fastpath_glMemoryBarrier (GLbitfield barriers)
7175 DEFINE_FASTPAH_GL_FUNC();
7176 _COREGL_FASTPATH_FUNC_BEGIN();
7177 INIT_FASTPATH_GL_FUNC();
7179 _orig_fastpath_glMemoryBarrier(barriers);
7184 _COREGL_FASTPATH_FUNC_END();
7188 fastpath_glMemoryBarrierByRegion (GLbitfield barriers)
7190 DEFINE_FASTPAH_GL_FUNC();
7191 _COREGL_FASTPATH_FUNC_BEGIN();
7192 INIT_FASTPATH_GL_FUNC();
7194 _orig_fastpath_glMemoryBarrierByRegion(barriers);
7199 _COREGL_FASTPATH_FUNC_END();
7203 fastpath_glTexStorage2DMultisample (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLboolean fixedsamplelocations)
7205 DEFINE_FASTPAH_GL_FUNC();
7206 _COREGL_FASTPATH_FUNC_BEGIN();
7207 INIT_FASTPATH_GL_FUNC();
7209 _orig_fastpath_glTexStorage2DMultisample (target, samples, internalformat, width, height, fixedsamplelocations);
7214 _COREGL_FASTPATH_FUNC_END();
7218 fastpath_glGetMultisamplefv (GLenum pname, GLuint index, GLfloat *val)
7220 DEFINE_FASTPAH_GL_FUNC();
7221 _COREGL_FASTPATH_FUNC_BEGIN();
7222 INIT_FASTPATH_GL_FUNC();
7224 _orig_fastpath_glGetMultisamplefv (pname, index, val);
7229 _COREGL_FASTPATH_FUNC_END();
7233 fastpath_glSampleMaski (GLuint maskNumber, GLbitfield mask)
7235 DEFINE_FASTPAH_GL_FUNC();
7236 _COREGL_FASTPATH_FUNC_BEGIN();
7237 INIT_FASTPATH_GL_FUNC();
7239 _orig_fastpath_glSampleMaski(maskNumber, mask);
7244 _COREGL_FASTPATH_FUNC_END();
7248 fastpath_glGetTexLevelParameteriv (GLenum target, GLint level, GLenum pname, GLint *params)
7250 DEFINE_FASTPAH_GL_FUNC();
7251 _COREGL_FASTPATH_FUNC_BEGIN();
7252 INIT_FASTPATH_GL_FUNC();
7254 _orig_fastpath_glGetTexLevelParameteriv (target, level, pname, params);
7259 _COREGL_FASTPATH_FUNC_END();
7263 fastpath_glGetTexLevelParameterfv (GLenum target, GLint level, GLenum pname, GLfloat *params)
7265 DEFINE_FASTPAH_GL_FUNC();
7266 _COREGL_FASTPATH_FUNC_BEGIN();
7267 INIT_FASTPATH_GL_FUNC();
7269 _orig_fastpath_glGetTexLevelParameterfv (target, level, pname, params);
7274 _COREGL_FASTPATH_FUNC_END();
7278 fastpath_glBindVertexBuffer (GLuint bindingindex, GLuint buffer, GLintptr offset, GLsizei stride)
7280 DEFINE_FASTPAH_GL_FUNC();
7281 _COREGL_FASTPATH_FUNC_BEGIN();
7282 INIT_FASTPATH_GL_FUNC();
7284 _orig_fastpath_glBindVertexBuffer(bindingindex, buffer, offset, stride);
7289 _COREGL_FASTPATH_FUNC_END();
7294 fastpath_glVertexAttribFormat (GLuint attribindex, GLint size, GLenum type, GLboolean normalized, GLuint relativeoffset)
7296 DEFINE_FASTPAH_GL_FUNC();
7297 _COREGL_FASTPATH_FUNC_BEGIN();
7298 INIT_FASTPATH_GL_FUNC();
7300 _orig_fastpath_glVertexAttribFormat (attribindex, size, type, normalized, relativeoffset);
7305 _COREGL_FASTPATH_FUNC_END();
7309 fastpath_glVertexAttribIFormat (GLuint attribindex, GLint size, GLenum type, GLuint relativeoffset)
7311 DEFINE_FASTPAH_GL_FUNC();
7312 _COREGL_FASTPATH_FUNC_BEGIN();
7313 INIT_FASTPATH_GL_FUNC();
7315 _orig_fastpath_glVertexAttribIFormat (attribindex, size, type, relativeoffset);
7320 _COREGL_FASTPATH_FUNC_END();
7324 fastpath_glVertexAttribBinding (GLuint attribindex, GLuint bindingindex)
7326 DEFINE_FASTPAH_GL_FUNC();
7327 _COREGL_FASTPATH_FUNC_BEGIN();
7328 INIT_FASTPATH_GL_FUNC();
7330 _orig_fastpath_glVertexAttribBinding (attribindex, bindingindex);
7335 _COREGL_FASTPATH_FUNC_END();
7339 fastpath_glVertexBindingDivisor(GLuint bindingindex, GLuint divisor)
7341 DEFINE_FASTPAH_GL_FUNC();
7342 _COREGL_FASTPATH_FUNC_BEGIN();
7343 INIT_FASTPATH_GL_FUNC();
7345 _orig_fastpath_glVertexBindingDivisor (bindingindex, divisor);
7350 _COREGL_FASTPATH_FUNC_END();