st/mesa: add support for GL_OES_EGL_image_external
authorChia-I Wu <olv@lunarg.com>
Sat, 22 Oct 2011 16:53:21 +0000 (00:53 +0800)
committerChia-I Wu <olvaffe@gmail.com>
Thu, 3 Nov 2011 07:09:45 +0000 (15:09 +0800)
To pipe drivers, external textures are just 2D textures.

Reviewed-by: Brian Paul <brianp@vmware.com>
Acked-by: Jakob Bornecrantz <jakob@vmware.com>
src/mesa/state_tracker/st_cb_texture.c
src/mesa/state_tracker/st_extensions.c
src/mesa/state_tracker/st_glsl_to_tgsi.cpp
src/mesa/state_tracker/st_mesa_to_tgsi.c
src/mesa/state_tracker/st_texture.c

index 06c26420495b74de6433d3bbfc6db9324fadded0..c58a9df56400eaf44c19847e04641d940160e407 100644 (file)
@@ -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;
index e5d07f6c7714abfec6fb9fa369cc442767070ad0..af8cc04767f05c396d466c4aebad0be0db41613f 100644 (file)
@@ -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;
index 67a1b513bda09196f7ba27b234c58988823e07e6..6b841f1e9951a5098acc6026ad00508d58d47a71 100644 (file)
@@ -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.");
    }
index b4111b00d68522df209ce7092353ea95772eea25..27ebb1ad7f4d2319b0a81f8ac63ba60dd6acc5f8 100644 (file)
@@ -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;
index ca8106b52412bbc54ce7a0ae722455337e67231e..3323bbbbe4cb911f8dfb14d3a220eafe68c6efb3 100644 (file)
@@ -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;