// Verified extensions
_COREGL_EXT_SYMBOL_FASTPATH_PASS(eglSwapBuffersRegionEXT)
_COREGL_EXT_SYMBOL_FASTPATH_PASS(eglSwapBuffersRegionSEC)
+_COREGL_EXT_SYMBOL_FASTPATH_PASS(eglSwapBuffersWithDamageEXT)
// Blocked extensions
//_COREGL_EXT_SYMBOL_FASTPATH_BLOCK()
#define GL_FRAGMENT_SHADER_DERIVATIVE_HINT_OES 0x8B8B
#endif
+/* GL_ANGLE_framebuffer_blit */
+#ifndef GL_ANGLE_framebuffer_blit
+#define GL_READ_FRAMEBUFFER_ANGLE 0x8CA8
+#define GL_DRAW_FRAMEBUFFER_ANGLE 0x8CA9
+
+#define GL_DRAW_FRAMEBUFFER_BINDING_ANGLE 0x8CA6
+#define GL_READ_FRAMEBUFFER_BINDING_ANGLE 0x8CAA
+#endif
+
#endif
_COREGL_EXT_SYMBOL(GL_TRUE, void, glFramebufferTexture3DOES, (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLint zoffset))
_COREGL_EXT_SYMBOL_ALIAS(glFramebufferTexture3DOES, glFramebufferTexture3D)
+// ANGLE_framebuffer_blit
+_COREGL_EXT_SYMBOL(GL_TRUE, void, glBlitFramebufferANGLE, (GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter))
+
+// ANGLE_framebuffer_multisample
+_COREGL_EXT_SYMBOL(GL_TRUE, void, glRenderbufferStorageMultisampleANGLE, (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height))
+
+
/* Verified extensions */
_COREGL_EXT_SYMBOL_FASTPATH_BLOCK(glExtIsProgramBinaryQCOM)
_COREGL_EXT_SYMBOL_FASTPATH_BLOCK(glExtGetProgramBinarySourceQCOM)
-// ANGLE_framebuffer_blit
-_COREGL_EXT_SYMBOL_FASTPATH_BLOCK(glBlitFramebufferANGLE)
-
-// ANGLE_framebuffer_multisample
-_COREGL_EXT_SYMBOL_FASTPATH_BLOCK(glRenderbufferStorageMultisampleANGLE)
-
#ifdef _COREGL_EXT_SYMBOL_NOT_DEFINED
#undef _COREGL_EXT_SYMBOL_NOT_DEFINED
int try_step = 0;\
TYPE valuedata[SIZE]; \
TYPE *value = NULL; \
+ _sym_glGetError(); \
memset(valuedata, 0xcc, sizeof(TYPE) * SIZE); \
do { \
try_step++; \
SET_GLUE_VALUE(GET_STMT, DEFAULT_STMT); \
+ if (_sym_glGetError() == GL_INVALID_ENUM) \
+ { \
+ initial_ctx->NAME##_used = 0; \
+ value = valuedata; DEFAULT_STMT; value = valuedata; \
+ break; \
+ } \
+ initial_ctx->NAME##_used = 1; \
for (i = 0; i < SIZE; i++) \
{ \
if (*((char *)(&value[i])) == 0xcc) \
for (i = 0; i < SIZE; i++) \
{ \
ctx->NAME[i] = initial_ctx->NAME[i]; \
+ ctx->NAME##_used = initial_ctx->NAME##_used; \
}
# include "coregl_fastpath_state.h"
#undef GLUE_STATE
{
CHECK_GL_ERROR(_orig_fastpath_glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, newctx->gl_element_array_buffer_binding[0]))
}
- STATE_COMPARE(gl_framebuffer_binding[0])
+ // ANGLE_framebuffer_blit BEGIN
+ if (newctx->gl_framebuffer_binding_read_used == 1)
+ {
+ STATE_COMPARE(gl_framebuffer_binding_read[0])
+ {
+ CHECK_GL_ERROR(_orig_fastpath_glBindFramebuffer(GL_READ_FRAMEBUFFER_ANGLE, newctx->gl_framebuffer_binding_read[0]))
+ }
+ STATE_COMPARE(gl_framebuffer_binding_draw[0])
+ {
+ CHECK_GL_ERROR(_orig_fastpath_glBindFramebuffer(GL_DRAW_FRAMEBUFFER_ANGLE, newctx->gl_framebuffer_binding_draw[0]))
+ }
+ }
+ else
+ // ANGLE_framebuffer_blit END
{
- CHECK_GL_ERROR(_orig_fastpath_glBindFramebuffer(GL_FRAMEBUFFER, newctx->gl_framebuffer_binding[0]))
+ STATE_COMPARE(gl_framebuffer_binding[0])
+ {
+ CHECK_GL_ERROR(_orig_fastpath_glBindFramebuffer(GL_FRAMEBUFFER, newctx->gl_framebuffer_binding[0]))
+ }
}
STATE_COMPARE(gl_renderbuffer_binding[0])
{
#define GLUE_STATE(TYPE, NAME, SIZE, ARRAY_SIZE, DEFAULT_STMT, GET_STMT) TYPE NAME[ARRAY_SIZE];
# include "coregl_fastpath_state.h"
#undef GLUE_STATE
+#define GLUE_STATE(TYPE, NAME, SIZE, ARRAY_SIZE, DEFAULT_STMT, GET_STMT) unsigned char NAME##_used;
+# include "coregl_fastpath_state.h"
+#undef GLUE_STATE
} GLGlueContext;
if (target == GL_FRAMEBUFFER)
{
- CURR_STATE_COMPARE(gl_framebuffer_binding, real_obj)
+ // ANGLE_framebuffer_blit BEGIN
+ if (current_ctx->gl_framebuffer_binding_read_used == 1)
+ {
+ CURR_STATE_COMPARE(gl_framebuffer_binding_read, real_obj)
+ {
+ IF_GL_SUCCESS(_orig_fastpath_glBindFramebuffer(target, real_obj))
+ {
+ if (real_obj == 0)
+ current_ctx->_bind_flag &= (~FLAG_BIT_4);
+ else
+ current_ctx->_bind_flag |= FLAG_BIT_4;
+ current_ctx->gl_framebuffer_binding_read[0] = real_obj;
+ }
+ }
+ CURR_STATE_COMPARE(gl_framebuffer_binding_draw, real_obj)
+ {
+ IF_GL_SUCCESS(_orig_fastpath_glBindFramebuffer(target, real_obj))
+ {
+ if (real_obj == 0)
+ current_ctx->_bind_flag &= (~FLAG_BIT_5);
+ else
+ current_ctx->_bind_flag |= FLAG_BIT_5;
+ current_ctx->gl_framebuffer_binding_draw[0] = real_obj;
+ }
+ }
+ }
+ else
+ // ANGLE_framebuffer_blit END
+ {
+ CURR_STATE_COMPARE(gl_framebuffer_binding, real_obj)
+ {
+ IF_GL_SUCCESS(_orig_fastpath_glBindFramebuffer(target, real_obj))
+ {
+ if (real_obj == 0)
+ current_ctx->_bind_flag &= (~FLAG_BIT_2);
+ else
+ current_ctx->_bind_flag |= FLAG_BIT_2;
+ current_ctx->gl_framebuffer_binding[0] = real_obj;
+ }
+ }
+ }
+ }
+ // ANGLE_framebuffer_blit BEGIN
+ else if (target == GL_READ_FRAMEBUFFER_ANGLE && current_ctx->gl_framebuffer_binding_read_used)
+ {
+ CURR_STATE_COMPARE(gl_framebuffer_binding_read, real_obj)
{
IF_GL_SUCCESS(_orig_fastpath_glBindFramebuffer(target, real_obj))
{
if (real_obj == 0)
- current_ctx->_bind_flag &= (~FLAG_BIT_2);
+ current_ctx->_bind_flag &= (~FLAG_BIT_4);
else
- current_ctx->_bind_flag |= FLAG_BIT_2;
- current_ctx->gl_framebuffer_binding[0] = real_obj;
+ current_ctx->_bind_flag |= FLAG_BIT_4;
+ current_ctx->gl_framebuffer_binding_read[0] = real_obj;
}
}
}
+ else if (target == GL_DRAW_FRAMEBUFFER_ANGLE && current_ctx->gl_framebuffer_binding_read_used)
+ {
+ CURR_STATE_COMPARE(gl_framebuffer_binding_draw, real_obj)
+ {
+ IF_GL_SUCCESS(_orig_fastpath_glBindFramebuffer(target, real_obj))
+ {
+ if (real_obj == 0)
+ current_ctx->_bind_flag &= (~FLAG_BIT_5);
+ else
+ current_ctx->_bind_flag |= FLAG_BIT_5;
+ current_ctx->gl_framebuffer_binding_draw[0] = real_obj;
+ }
+ }
+ }
+ // ANGLE_framebuffer_blit END
else
{
_set_gl_error(GL_INVALID_ENUM);
{
GLGlueContext *cur_gctx = (GLGlueContext *)current->value;
- if (cur_gctx->gl_framebuffer_binding[0] == objid_array[i])
+ // ANGLE_framebuffer_blit BEGIN
+ if (cur_gctx->gl_framebuffer_binding_read_used == 1)
+ {
+ if (cur_gctx->gl_framebuffer_binding_read[0] == objid_array[i])
+ {
+ cur_gctx->_bind_flag &= (~FLAG_BIT_4);
+ cur_gctx->gl_framebuffer_binding_read[0] = 0;
+ }
+ if (cur_gctx->gl_framebuffer_binding_draw[0] == objid_array[i])
+ {
+ cur_gctx->_bind_flag &= (~FLAG_BIT_5);
+ cur_gctx->gl_framebuffer_binding_draw[0] = 0;
+ }
+ }
+ else
+ // ANGLE_framebuffer_blit END
{
- cur_gctx->_bind_flag &= (~FLAG_BIT_2);
- cur_gctx->gl_framebuffer_binding[0] = 0;
+ if (cur_gctx->gl_framebuffer_binding[0] == objid_array[i])
+ {
+ cur_gctx->_bind_flag &= (~FLAG_BIT_2);
+ cur_gctx->gl_framebuffer_binding[0] = 0;
+ }
}
current = current->next;
case GL_TEXTURE_BINDING_CUBE_MAP:
case GL_ARRAY_BUFFER_BINDING:
case GL_ELEMENT_ARRAY_BUFFER_BINDING:
- case GL_FRAMEBUFFER_BINDING:
+ case GL_FRAMEBUFFER_BINDING: // and GL_DRAW_FRAMEBUFFER_BINDING_ANGLE:
+ case GL_READ_FRAMEBUFFER_BINDING_ANGLE:
case GL_RENDERBUFFER_BINDING:
case GL_CURRENT_PROGRAM:
{
case GL_ELEMENT_ARRAY_BUFFER_BINDING:
obj_type = GL_OBJECT_TYPE_BUFFER;
break;
- case GL_FRAMEBUFFER_BINDING:
+ case GL_FRAMEBUFFER_BINDING: // and GL_DRAW_FRAMEBUFFER_BINDING_ANGLE
+ case GL_READ_FRAMEBUFFER_BINDING_ANGLE:
obj_type = GL_OBJECT_TYPE_FRAMEBUFFER;
break;
case GL_RENDERBUFFER_BINDING:
GLUE_STATE(GLuint, gl_array_buffer_binding, 1, 1, SET_1(0), _sym_glGetIntegerv(GL_ARRAY_BUFFER_BINDING, (GLint *)value);)
GLUE_STATE(GLuint, gl_element_array_buffer_binding, 1, 1, SET_1(0), _sym_glGetIntegerv(GL_ELEMENT_ARRAY_BUFFER_BINDING, (GLint *)value);)
GLUE_STATE(GLuint, gl_framebuffer_binding, 1, 1, SET_1(0), _sym_glGetIntegerv(GL_FRAMEBUFFER_BINDING, (GLint *)value);)
+// ANGLE_framebuffer_blit BEGIN (check gl_framebuffer_binding_read_used)
+GLUE_STATE(GLuint, gl_framebuffer_binding_read, 1, 1, SET_1(0), _sym_glGetIntegerv(GL_READ_FRAMEBUFFER_BINDING_ANGLE, (GLint *)value);)
+GLUE_STATE(GLuint, gl_framebuffer_binding_draw, 1, 1, SET_1(0), _sym_glGetIntegerv(GL_DRAW_FRAMEBUFFER_BINDING_ANGLE, (GLint *)value);)
+// ANGLE_framebuffer_blit END
GLUE_STATE(GLuint, gl_renderbuffer_binding, 1, 1, SET_1(0), _sym_glGetIntegerv(GL_RENDERBUFFER_BINDING, (GLint *)value);)
GLUE_STATE(GLboolean, gl_blend, 1, 1, SET_1(GL_FALSE), _sym_glGetBooleanv(GL_BLEND, (GLboolean *)value);)
_COREGL_TRACEPATH_FUNC_END();
}
+void
+tracepath_glBlitFramebufferANGLE(GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter)
+{
+ _COREGL_TRACEPATH_FUNC_BEGIN();
+ _orig_tracepath_glBlitFramebufferANGLE(srcX0, srcY0, srcX1, srcY1, dstX0, dstY0, dstX1, dstY1, mask, filter);
+
+ goto finish;
+
+finish:
+ _COREGL_TRACEPATH_FUNC_END();
+}
+
+void
+tracepath_glRenderbufferStorageMultisampleANGLE(GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height)
+{
+ _COREGL_TRACEPATH_FUNC_BEGIN();
+
+ _orig_tracepath_glRenderbufferStorageMultisampleANGLE(target, samples, internalformat, width, height);
+
+ goto finish;
+
+finish:
+ _COREGL_TRACEPATH_FUNC_END();
+#ifdef COREGL_TRACEPATH_TRACE_MEMUSE_INFO
+ if (trace_mem_flag == 1)
+ {
+ MY_MODULE_TSTATE *tstate = NULL;
+
+ GET_MY_TSTATE(tstate, get_current_thread_state());
+ AST(tstate != NULL);
+ if (tstate->ctx != NULL)
+ {
+ int objidx = _COREGL_INT_INIT_VALUE;
+ _orig_tracepath_glGetIntegerv(GL_RENDERBUFFER_BINDING, &objidx);
+ AST(objidx != _COREGL_INT_INIT_VALUE);
+
+ // Detect byte per pixel
+ int bpp = 0;
+ char formatment[80];
+ switch (internalformat)
+ {
+ case GL_ALPHA: sprintf(formatment, "ALPHA"); bpp = 1; break;
+ case GL_LUMINANCE: sprintf(formatment, "LUMINANCE"); bpp = 1; break;
+ case GL_LUMINANCE_ALPHA: sprintf(formatment, "LUMINANCE_ALPHA"); bpp = 1; break;
+ case GL_RGB: sprintf(formatment, "RGB"); bpp = 2; break;
+ case GL_RGBA: sprintf(formatment, "RGBA"); bpp = 4; break;
+ case 0x80E1: sprintf(formatment, "BGRA_EXT"); bpp = 4; break;
+ case 0x84F9: sprintf(formatment, "DEPTH_STENCIL_OES"); bpp = 4; break;
+ case GL_DEPTH_COMPONENT : sprintf(formatment, "DEPTH_COMPONENT"); bpp = 1; break;
+ case 0x81A5: sprintf(formatment, "DEPTH_COMPONENT16_ARB"); bpp = 2; break;
+ case 0x81A6: sprintf(formatment, "DEPTH_COMPONENT24_ARB"); bpp = 3; break;
+ case 0x81A7: sprintf(formatment, "DEPTH_COMPONENT32_ARB"); bpp = 4; break;
+ case 0x8D46 : sprintf(formatment, "STENCIL_INDEX1_OES"); bpp = 1; break;
+ case 0x8D47 : sprintf(formatment, "STENCIL_INDEX4_OES"); bpp = 1; break;
+ case 0x8D48 : sprintf(formatment, "STENCIL_INDEX8_OES"); bpp = 1; break;
+ default: sprintf(formatment, "0x%X", internalformat); bpp = 0; break;
+ }
+
+ _add_glbuf_object(tstate->ctx->sostate->glbuf_rb, objidx, "Renderbuffer", width, height, bpp, formatment);
+ }
+ }
+#endif // COREGL_TRACEPATH_TRACE_MEMUSE_INFO
+#ifdef COREGL_TRACEPATH_TRACE_SURFACE_INFO
+ if (trace_surface_flag == 1)
+ {
+ MY_MODULE_TSTATE *tstate = NULL;
+
+ GET_MY_TSTATE(tstate, get_current_thread_state());
+ AST(tstate != NULL);
+ if (tstate->ctx != NULL)
+ {
+ int objidx = _COREGL_INT_INIT_VALUE;
+ _orig_tracepath_glGetIntegerv(GL_RENDERBUFFER_BINDING, &objidx);
+ AST(objidx != _COREGL_INT_INIT_VALUE);
+
+ {
+ int channel = 0;
+ switch (internalformat)
+ {
+ case GL_ALPHA:
+ case GL_LUMINANCE:
+ case GL_DEPTH_COMPONENT :
+ case 0x81A5:
+ case 0x81A6:
+ case 0x81A7:
+ case 0x8D46 :
+ case 0x8D47 :
+ case 0x8D48 : channel = 1; break;
+ case GL_LUMINANCE_ALPHA:
+ case 0x84F9: channel = 2; break;
+ case GL_RGB: channel = 3; break;
+ case GL_RGBA:
+ case 0x80E1: channel = 4; break;
+ }
+
+ char name[256];
+ sprintf(name, "FBORB_%d", objidx);
+ tracepath_surface_trace_add(name, tstate->ctx->dpy, tstate->ctx->handle, tstate->surf_draw, -1, 0, objidx, width, height, channel, NULL);
+ }
+ }
+ }
+#endif // COREGL_TRACEPATH_TRACE_SURFACE_INFO
+}
+