From 8cd0873d319cefce74164147c9855e81f051d1e1 Mon Sep 17 00:00:00 2001 From: Chia-I Wu Date: Sun, 23 Oct 2011 00:53:21 +0800 Subject: st/mesa: add support for GL_OES_EGL_image_external To pipe drivers, external textures are just 2D textures. Reviewed-by: Brian Paul Acked-by: Jakob Bornecrantz --- src/mesa/state_tracker/st_cb_texture.c | 2 ++ src/mesa/state_tracker/st_extensions.c | 2 ++ src/mesa/state_tracker/st_glsl_to_tgsi.cpp | 3 +++ src/mesa/state_tracker/st_mesa_to_tgsi.c | 1 + src/mesa/state_tracker/st_texture.c | 1 + 5 files changed, 9 insertions(+) (limited to 'src/mesa') diff --git a/src/mesa/state_tracker/st_cb_texture.c b/src/mesa/state_tracker/st_cb_texture.c index 06c26420495..c58a9df5640 100644 --- a/src/mesa/state_tracker/st_cb_texture.c +++ b/src/mesa/state_tracker/st_cb_texture.c @@ -75,6 +75,7 @@ gl_target_to_pipe(GLenum target) case GL_TEXTURE_1D: return PIPE_TEXTURE_1D; case GL_TEXTURE_2D: + case GL_TEXTURE_EXTERNAL_OES: return PIPE_TEXTURE_2D; case GL_TEXTURE_RECTANGLE_NV: return PIPE_TEXTURE_RECT; @@ -310,6 +311,7 @@ get_texture_dims(GLenum target) case GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB: case GL_TEXTURE_RECTANGLE_NV: case GL_TEXTURE_2D_ARRAY_EXT: + case GL_TEXTURE_EXTERNAL_OES: return 2; case GL_TEXTURE_3D: return 3; diff --git a/src/mesa/state_tracker/st_extensions.c b/src/mesa/state_tracker/st_extensions.c index e5d07f6c771..af8cc04767f 100644 --- a/src/mesa/state_tracker/st_extensions.c +++ b/src/mesa/state_tracker/st_extensions.c @@ -303,6 +303,8 @@ void st_init_extensions(struct st_context *st) #if FEATURE_OES_EGL_image ctx->Extensions.OES_EGL_image = GL_TRUE; + if (ctx->API != API_OPENGL) + ctx->Extensions.OES_EGL_image_external = GL_TRUE; #endif #if FEATURE_OES_draw_texture ctx->Extensions.OES_draw_texture = GL_TRUE; diff --git a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp index 67a1b513bda..6b841f1e995 100644 --- a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp +++ b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp @@ -2725,6 +2725,9 @@ glsl_to_tgsi_visitor::visit(ir_texture *ir) case GLSL_SAMPLER_DIM_BUF: assert(!"FINISHME: Implement ARB_texture_buffer_object"); break; + case GLSL_SAMPLER_DIM_EXTERNAL: + inst->tex_target = TEXTURE_EXTERNAL_INDEX; + break; default: assert(!"Should not get here."); } diff --git a/src/mesa/state_tracker/st_mesa_to_tgsi.c b/src/mesa/state_tracker/st_mesa_to_tgsi.c index b4111b00d68..27ebb1ad7f4 100644 --- a/src/mesa/state_tracker/st_mesa_to_tgsi.c +++ b/src/mesa/state_tracker/st_mesa_to_tgsi.c @@ -290,6 +290,7 @@ translate_texture_target( GLuint textarget, case TEXTURE_RECT_INDEX: return TGSI_TEXTURE_RECT; case TEXTURE_1D_ARRAY_INDEX: return TGSI_TEXTURE_1D_ARRAY; case TEXTURE_2D_ARRAY_INDEX: return TGSI_TEXTURE_2D_ARRAY; + case TEXTURE_EXTERNAL_INDEX: return TGSI_TEXTURE_2D; default: debug_assert( 0 ); return TGSI_TEXTURE_1D; diff --git a/src/mesa/state_tracker/st_texture.c b/src/mesa/state_tracker/st_texture.c index ca8106b5241..3323bbbbe4c 100644 --- a/src/mesa/state_tracker/st_texture.c +++ b/src/mesa/state_tracker/st_texture.c @@ -133,6 +133,7 @@ st_gl_texture_dims_to_pipe_dims(GLenum texture, break; case GL_TEXTURE_2D: case GL_TEXTURE_RECTANGLE: + case GL_TEXTURE_EXTERNAL_OES: assert(depthIn == 1); *widthOut = widthIn; *heightOut = heightIn; -- cgit v1.2.3