From 4093e2bbdd8ecc73ca094973f22e3c9c721347ef Mon Sep 17 00:00:00 2001 From: "mythri.venugopal" Date: Thu, 19 Dec 2013 11:11:57 +0900 Subject: [PATCH] Added support for GL_TEXTURE_EXTERNAL_OES target in CoreGL. Removed extra whitespace. --- src/headers/gl.h | 1 + src/modules/fastpath/coregl_fastpath.c | 5 +++++ src/modules/fastpath/coregl_fastpath.h | 1 + src/modules/fastpath/coregl_fastpath_gl.c | 8 ++++++++ src/modules/fastpath/coregl_fastpath_state.h | 3 +++ 5 files changed, 18 insertions(+) diff --git a/src/headers/gl.h b/src/headers/gl.h index 460f87e..3ceab22 100644 --- a/src/headers/gl.h +++ b/src/headers/gl.h @@ -733,6 +733,7 @@ typedef struct __GLsync *GLsync; #define GL_TIMEOUT_IGNORED 0xFFFFFFFFFFFFFFFFull #define GL_VERTEX_ATTRIB_ARRAY_DIVISOR 0x88FE #define GL_ANY_SAMPLES_PASSED 0x8C2F +#define GL_TEXTURE_EXTERNAL_OES 0x8D65 #define GL_ANY_SAMPLES_PASSED_CONSERVATIVE 0x8D6A #define GL_SAMPLER_BINDING 0x8919 #define GL_RGB10_A2UI 0x906F diff --git a/src/modules/fastpath/coregl_fastpath.c b/src/modules/fastpath/coregl_fastpath.c index 41af949..feb958d 100644 --- a/src/modules/fastpath/coregl_fastpath.c +++ b/src/modules/fastpath/coregl_fastpath.c @@ -1849,6 +1849,11 @@ fastpath_make_context_current(GLGlueContext *oldctx, GLGlueContext *newctx) CHECK_GL_ERROR(_orig_fastpath_glActiveTexture(GL_TEXTURE0 + i)) CHECK_GL_ERROR(_orig_fastpath_glBindTexture(GL_TEXTURE_CUBE_MAP, newctx->gl_tex_cube_state[i])) } + STATE_COMPARE(gl_tex_external_oes_state[i]) + { + CHECK_GL_ERROR(_orig_fastpath_glActiveTexture(GL_TEXTURE0 + i)) + CHECK_GL_ERROR(_orig_fastpath_glBindTexture(GL_TEXTURE_EXTERNAL_OES, newctx->gl_tex_external_oes_state[i])) + } } // Restore active texture diff --git a/src/modules/fastpath/coregl_fastpath.h b/src/modules/fastpath/coregl_fastpath.h index 0e0684a..dbc902b 100644 --- a/src/modules/fastpath/coregl_fastpath.h +++ b/src/modules/fastpath/coregl_fastpath.h @@ -269,6 +269,7 @@ typedef struct _GLGlueContext #define _TEX_FLAG1_BIT_gl_tex_3d_state FLAG_BIT_3 #define _TEX_FLAG1_BIT_gl_tex_2d_array_state FLAG_BIT_4 #define _TEX_FLAG1_BIT_gl_tex_cube_state FLAG_BIT_5 +#define _TEX_FLAG1_BIT_gl_tex_external_oes_state FLAG_BIT_6 unsigned char _blend_flag; #define _BLEND_FLAG_BIT_gl_blend_color FLAG_BIT_0 diff --git a/src/modules/fastpath/coregl_fastpath_gl.c b/src/modules/fastpath/coregl_fastpath_gl.c index 774214b..ca2ac85 100644 --- a/src/modules/fastpath/coregl_fastpath_gl.c +++ b/src/modules/fastpath/coregl_fastpath_gl.c @@ -526,6 +526,9 @@ fastpath_glBindTexture(GLenum target, GLuint texture) case GL_TEXTURE_CUBE_MAP: STATE_PROC(gl_tex_cube_state, _tex_flag1, _TEX_FLAG1_BIT); break; + case GL_TEXTURE_EXTERNAL_OES: + STATE_PROC(gl_tex_external_oes_state, _tex_flag1, _TEX_FLAG1_BIT); + break; default: _set_gl_error(GL_INVALID_ENUM); break; @@ -741,6 +744,8 @@ fastpath_glDeleteTextures(GLsizei n, const GLuint* textures) cur_gctx->gl_tex_2d_array_state[j] = 0; if (cur_gctx->gl_tex_cube_state[j] == objid_array[i]) cur_gctx->gl_tex_cube_state[j] = 0; + if (cur_gctx->gl_tex_external_oes_state[j] == objid_array[i]) + cur_gctx->gl_tex_external_oes_state[j] = 0; } current = current->next; @@ -4014,6 +4019,9 @@ fastpath_glEGLImageTargetTexture2DOES(GLenum target, GLeglImageOES image) case GL_TEXTURE_CUBE_MAP: current_ctx->gl_tex_cube_state[tex_idx] = -1; break; + case GL_TEXTURE_EXTERNAL_OES: + current_ctx->gl_tex_external_oes_state[tex_idx] = -1; + break; default: _set_gl_error(GL_INVALID_ENUM); goto finish; diff --git a/src/modules/fastpath/coregl_fastpath_state.h b/src/modules/fastpath/coregl_fastpath_state.h index 76fda11..6f2080b 100644 --- a/src/modules/fastpath/coregl_fastpath_state.h +++ b/src/modules/fastpath/coregl_fastpath_state.h @@ -114,6 +114,9 @@ GLUE_STATE(GLuint, gl_tex_2d_array_state, INITIAL_CTX->gl_num_tex_units[0], MAX_ GLUE_STATE(GLuint, gl_tex_cube_state, INITIAL_CTX->gl_num_tex_units[0], MAX_TEXTURE_UNITS, SET_N(INITIAL_CTX->gl_num_tex_units[0], 1, SET_1(0)), _state_get_texture_states(GL_TEXTURE_BINDING_CUBE_MAP, (GLint *)value);) +GLUE_STATE(GLuint, gl_tex_external_oes_state, INITIAL_CTX->gl_num_tex_units[0], MAX_TEXTURE_UNITS, + SET_N(INITIAL_CTX->gl_num_tex_units[0], 1, SET_1(0)), + _state_get_texture_states(GL_TEXTURE_EXTERNAL_OES, (GLint *)value);) GLUE_STATE(GLenum, gl_active_texture, 1, 1, SET_1(GL_TEXTURE0), _sym_glGetIntegerv(GL_ACTIVE_TEXTURE, (GLint *)value)) GLUE_STATE(GLenum, gl_generate_mipmap_hint, 1, 1, SET_1(GL_DONT_CARE), _sym_glGetIntegerv(GL_GENERATE_MIPMAP_HINT, (GLint *)value)) -- 2.34.1