mesa: add support for GL_OES_EGL_image_external
authorChia-I Wu <olv@lunarg.com>
Sun, 23 Oct 2011 10:52:38 +0000 (18:52 +0800)
committerChia-I Wu <olvaffe@gmail.com>
Thu, 3 Nov 2011 07:09:45 +0000 (15:09 +0800)
This is an OpenGL ES specific extension.  External textures are textures that
may be sampled from, but not be updated (no glTexSubImage* and etc.).  The
image data are taken from an EGLImage.

Reviewed-by: Brian Paul <brianp@vmware.com>
Acked-by: Jakob Bornecrantz <jakob@vmware.com>
16 files changed:
src/mesa/main/APIspec.xml
src/mesa/main/attrib.c
src/mesa/main/debug.c
src/mesa/main/enable.c
src/mesa/main/ff_fragment_shader.cpp
src/mesa/main/get.c
src/mesa/main/mipmap.c
src/mesa/main/mtypes.h
src/mesa/main/shaderapi.c
src/mesa/main/shared.c
src/mesa/main/teximage.c
src/mesa/main/texobj.c
src/mesa/main/texparam.c
src/mesa/main/texstate.c
src/mesa/main/uniforms.c
src/mesa/program/ir_to_mesa.cpp

index a92bb437c91e68435b13855aa412c735aa3aef0e..99c726c83addca304a63d69a30fbcfb89a105e2a 100644 (file)
                <value name="GL_TEXTURE_CUBE_MAP" category="GLES2.0"/>
                <value name="GL_TEXTURE_CUBE_MAP_OES" category="OES_texture_cube_map"/>
                <value name="GL_TEXTURE_3D_OES" category="OES_texture_3D"/>
+               <value name="GL_TEXTURE_EXTERNAL_OES" category="OES_EGL_image_external"/>
        </desc>
 
        <desc name="pname">
                <value name="GL_MATRIX_PALETTE_OES" category="OES_matrix_palette"/>
                <value name="GL_TEXTURE_CUBE_MAP_OES" category="OES_texture_cube_map"/>
                <value name="GL_TEXTURE_GEN_STR_OES" category="OES_texture_cube_map"/>
+               <value name="GL_TEXTURE_EXTERNAL_OES" category="OES_EGL_image_external"/>
        </desc>
 
        <desc name="cap" category="GLES2.0">
                <value name="GL_MATRIX_PALETTE_OES" category="OES_matrix_palette"/>
                <value name="GL_TEXTURE_CUBE_MAP_OES" category="OES_texture_cube_map"/>
                <value name="GL_TEXTURE_GEN_STR_OES" category="OES_texture_cube_map"/>
+               <value name="GL_TEXTURE_EXTERNAL_OES" category="OES_EGL_image_external"/>
        </desc>
 
        <desc name="cap" category="GLES2.0">
                <value name="GL_TEXTURE_CUBE_MAP" category="GLES2.0"/>
                <value name="GL_TEXTURE_CUBE_MAP_OES" category="OES_texture_cube_map"/>
                <value name="GL_TEXTURE_3D_OES" category="OES_texture_3D"/>
+               <value name="GL_TEXTURE_EXTERNAL_OES" category="OES_EGL_image_external"/>
        </desc>
 
        <desc name="pname">
                <value name="GL_MATRIX_INDEX_ARRAY_OES" category="OES_matrix_palette"/>
                <value name="GL_WEIGHT_ARRAY_OES" category="OES_matrix_palette"/>
                <value name="GL_POINT_SIZE_ARRAY_OES" category="OES_point_size_array"/>
+               <value name="GL_TEXTURE_EXTERNAL_OES" category="OES_EGL_image_external"/>
        </desc>
 
        <desc name="cap" category="GLES2.0">
                <value name="GL_TEXTURE_CUBE_MAP" category="GLES2.0"/>
                <value name="GL_TEXTURE_CUBE_MAP_OES" category="OES_texture_cube_map"/>
                <value name="GL_TEXTURE_3D_OES" category="OES_texture_3D"/>
+               <value name="GL_TEXTURE_EXTERNAL_OES" category="OES_EGL_image_external"/>
        </desc>
 </template>
 
 
        <desc name="target">
                <value name="GL_TEXTURE_2D"/>
+               <value name="GL_TEXTURE_EXTERNAL_OES" category="OES_EGL_image_external"/>
        </desc>
 </template>
 
        <category name="EXT_blend_minmax"/>
        <category name="EXT_multi_draw_arrays"/>
        <category name="OES_EGL_image"/>
+       <category name="OES_EGL_image_external"/>
 
        <category name="OES_matrix_palette"/>
 
        <category name="EXT_blend_minmax"/>
        <category name="EXT_multi_draw_arrays"/>
        <category name="OES_EGL_image"/>
+       <category name="OES_EGL_image_external"/>
 
        <category name="NV_draw_buffers"/>
        <function name="DrawBuffersNV" template="DrawBuffers"/>
index 1dc1c1b9706e5edb94b5423a35dcfd27f86351f8..f368eecc1b24a06f1cb37503c76b35f2fed235aa 100644 (file)
@@ -764,6 +764,8 @@ pop_texture_group(struct gl_context *ctx, struct texture_state *texstate)
          }
          else if (obj->Target == GL_TEXTURE_BUFFER)
             continue;
+         else if (obj->Target == GL_TEXTURE_EXTERNAL_OES)
+            continue;
 
          target = obj->Target;
 
index 6e695d1474c1a14930eb5f790da1ba59d049f6a4..72aa8cb4f79affa077ee464e86df7e6d8fe8851a 100644 (file)
@@ -50,7 +50,8 @@ tex_target_name(GLenum tgt)
       { GL_TEXTURE_CUBE_MAP, "GL_TEXTURE_CUBE_MAP" },
       { GL_TEXTURE_RECTANGLE, "GL_TEXTURE_RECTANGLE" },
       { GL_TEXTURE_1D_ARRAY_EXT, "GL_TEXTURE_1D_ARRAY" },
-      { GL_TEXTURE_2D_ARRAY_EXT, "GL_TEXTURE_2D_ARRAY" }
+      { GL_TEXTURE_2D_ARRAY_EXT, "GL_TEXTURE_2D_ARRAY" },
+      { GL_TEXTURE_EXTERNAL_OES, "GL_TEXTURE_EXTERNAL_OES" }
    };
    GLuint i;
    for (i = 0; i < Elements(tex_targets); i++) {
index 689dc8a99ec5d572f9cf25d151fce8cb10bbdaef..b2c77243b504c8e0b048acb015b835be9fb3c7c1 100644 (file)
@@ -916,6 +916,14 @@ _mesa_set_enable(struct gl_context *ctx, GLenum cap, GLboolean state)
          ctx->Color.sRGBEnabled = state;
          break;
 
+      /* GL_OES_EGL_image_external */
+      case GL_TEXTURE_EXTERNAL_OES:
+         CHECK_EXTENSION(OES_EGL_image_external, cap);
+         if (!enable_texture(ctx, state, TEXTURE_EXTERNAL_BIT)) {
+            return;
+         }
+         break;
+
       default:
          goto invalid_enum_error;
    }
@@ -1417,6 +1425,11 @@ _mesa_IsEnabled( GLenum cap )
         CHECK_EXTENSION(EXT_framebuffer_sRGB);
         return ctx->Color.sRGBEnabled;
 
+      /* GL_OES_EGL_image_external */
+      case GL_TEXTURE_EXTERNAL_OES:
+        CHECK_EXTENSION(OES_EGL_image_external);
+         return is_texture_enabled(ctx, TEXTURE_EXTERNAL_BIT);
+
       default:
          goto invalid_enum_error;
    }
index f612325192de9a1a6fcdae553cc58f7f0e58f00f..2ce81fef61e67820a681f8a6da3cc5d257112aa5 100644 (file)
@@ -1041,6 +1041,11 @@ static void load_texture( struct texenv_fragment_program *p, GLuint unit )
         sampler_type = p->shader->symbols->get_type("samplerCube");
       coords = 3;
       break;
+   case TEXTURE_EXTERNAL_INDEX:
+      assert(!p->state->unit[unit].shadow);
+      sampler_type = p->shader->symbols->get_type("samplerExternalOES");
+      coords = 2;
+      break;
    }
 
    p->src_texture[unit] = new(p->mem_ctx) ir_variable(glsl_type::vec4_type,
@@ -1437,6 +1442,8 @@ create_new_program(struct gl_context *ctx, struct state_key *key)
    p.shader_program->InternalSeparateShader = GL_TRUE;
 
    state->language_version = 130;
+   if (ctx->Extensions.OES_EGL_image_external)
+      state->OES_EGL_image_external_enable = true;
    _mesa_glsl_initialize_types(state);
    _mesa_glsl_initialize_variables(p.instructions, state);
 
index 8925b75ebee408174713b8071cf4e8bc8f59c0fc..d8a063876d8db0466cf2071351f38e948e6064ab 100644 (file)
@@ -332,6 +332,7 @@ EXTRA_EXT(ARB_color_buffer_float);
 EXTRA_EXT(ARB_copy_buffer);
 EXTRA_EXT(EXT_framebuffer_sRGB);
 EXTRA_EXT(ARB_texture_buffer_object);
+EXTRA_EXT(OES_EGL_image_external);
 
 static const int
 extra_ARB_vertex_program_ARB_fragment_program_NV_vertex_program[] = {
@@ -762,6 +763,12 @@ static const struct value_desc values[] = {
    { GL_SHADER_BINARY_FORMATS, CONST(0), NO_EXTRA },
 #endif /* FEATURE_ES2 */
 
+   /* GL_OES_EGL_image_external */
+   { GL_TEXTURE_BINDING_EXTERNAL_OES, LOC_CUSTOM,
+     TYPE_INT, TEXTURE_EXTERNAL_INDEX, extra_OES_EGL_image_external },
+   { GL_TEXTURE_EXTERNAL_OES, LOC_CUSTOM,
+     TYPE_BOOLEAN, 0, extra_OES_EGL_image_external },
+
 #if FEATURE_GL
    /* Remaining enums are only in OpenGL */
    { 0, 0, TYPE_API_MASK, API_OPENGL_BIT, NO_EXTRA },
@@ -1419,6 +1426,7 @@ find_custom_value(struct gl_context *ctx, const struct value_desc *d, union valu
    case GL_TEXTURE_2D_ARRAY_EXT:
    case GL_TEXTURE_CUBE_MAP_ARB:
    case GL_TEXTURE_RECTANGLE_NV:
+   case GL_TEXTURE_EXTERNAL_OES:
       v->value_bool = _mesa_IsEnabled(d->pname);
       break;
 
@@ -1596,6 +1604,7 @@ find_custom_value(struct gl_context *ctx, const struct value_desc *d, union valu
    case GL_TEXTURE_BINDING_2D_ARRAY_EXT:
    case GL_TEXTURE_BINDING_CUBE_MAP_ARB:
    case GL_TEXTURE_BINDING_RECTANGLE_NV:
+   case GL_TEXTURE_BINDING_EXTERNAL_OES:
       unit = ctx->Texture.CurrentUnit;
       v->value_int =
         ctx->Texture.Unit[unit].CurrentTex[d->offset]->Name;
index 46d71bb22181c1074bbca993c0f8ba0b2fba2c68..461de9d1bb24ac1fd259ec7fcd623b37c9ee4e4f 100644 (file)
@@ -1751,6 +1751,7 @@ _mesa_generate_mipmap_level(GLenum target,
       }
       break;
    case GL_TEXTURE_RECTANGLE_NV:
+   case GL_TEXTURE_EXTERNAL_OES:
       /* no mipmaps, do nothing */
       break;
    default:
index 9a0f3cfb90f749c6fb395571ef1421afb6273b0e..61909727d1652f6a8413bf85e1f421e950ac8cbb 100644 (file)
@@ -1166,6 +1166,7 @@ typedef enum
    TEXTURE_BUFFER_INDEX,
    TEXTURE_2D_ARRAY_INDEX,
    TEXTURE_1D_ARRAY_INDEX,
+   TEXTURE_EXTERNAL_INDEX,
    TEXTURE_CUBE_INDEX,
    TEXTURE_3D_INDEX,
    TEXTURE_RECT_INDEX,
@@ -1183,6 +1184,7 @@ typedef enum
 #define TEXTURE_BUFFER_BIT   (1 << TEXTURE_BUFFER_INDEX)
 #define TEXTURE_2D_ARRAY_BIT (1 << TEXTURE_2D_ARRAY_INDEX)
 #define TEXTURE_1D_ARRAY_BIT (1 << TEXTURE_1D_ARRAY_INDEX)
+#define TEXTURE_EXTERNAL_BIT (1 << TEXTURE_EXTERNAL_INDEX)
 #define TEXTURE_CUBE_BIT     (1 << TEXTURE_CUBE_INDEX)
 #define TEXTURE_3D_BIT       (1 << TEXTURE_3D_INDEX)
 #define TEXTURE_RECT_BIT     (1 << TEXTURE_RECT_INDEX)
@@ -1344,6 +1346,9 @@ struct gl_texture_object
    struct gl_buffer_object *BufferObject;
    GLenum BufferObjectFormat;
 
+   /** GL_OES_EGL_image_external */
+   GLint RequiredTextureImageUnits;
+
    /**
     * \name For device driver.
     * Note: instead of attaching driver data to this pointer, it's preferable
index 6868dfab09ee90fbab320e8728bf3570f01a5d7b..56d955c5397220952a03f14b9bfbf1cfe8248a41 100644 (file)
@@ -152,6 +152,7 @@ _mesa_sizeof_glsl_type(GLenum type)
    case GL_SAMPLER_1D_ARRAY_SHADOW_EXT:
    case GL_SAMPLER_2D_ARRAY_SHADOW_EXT:
    case GL_SAMPLER_CUBE_SHADOW_EXT:
+   case GL_SAMPLER_EXTERNAL_OES:
       return 1;
    case GL_FLOAT_VEC2:
    case GL_INT_VEC2:
@@ -918,6 +919,7 @@ validate_samplers(const struct gl_program *prog, char *errMsg)
       "TEXTURE_BUFFER",
       "TEXTURE_2D_ARRAY",
       "TEXTURE_1D_ARRAY",
+      "TEXTURE_EXTERNAL",
       "TEXTURE_CUBE",
       "TEXTURE_3D",
       "TEXTURE_RECT",
index 8b7159db09cd507a946186509e73f8c480f4c9b5..caa6132d4abaa2554116846009bd5ac788819164 100644 (file)
@@ -108,6 +108,7 @@ _mesa_alloc_shared_state(struct gl_context *ctx)
          GL_TEXTURE_BUFFER,
          GL_TEXTURE_2D_ARRAY_EXT,
          GL_TEXTURE_1D_ARRAY_EXT,
+         GL_TEXTURE_EXTERNAL_OES,
          GL_TEXTURE_CUBE_MAP,
          GL_TEXTURE_3D,
          GL_TEXTURE_RECTANGLE_NV,
index 58b0e5d089c12ac2ebb600d50bbe60e91c5add99..a84d6873d3d8f0043aff97ee347094a68157d714 100644 (file)
@@ -549,7 +549,8 @@ _mesa_set_tex_image(struct gl_texture_object *tObj,
 
    ASSERT(tObj);
    ASSERT(texImage);
-   ASSERT(target != GL_TEXTURE_RECTANGLE_NV || level == 0);
+   if (target == GL_TEXTURE_RECTANGLE_NV || target == GL_TEXTURE_EXTERNAL_OES)
+      assert(level == 0);
 
    tObj->Image[face][level] = texImage;
 
@@ -607,10 +608,11 @@ _mesa_delete_texture_image(struct gl_context *ctx,
 GLboolean
 _mesa_is_proxy_texture(GLenum target)
 {
-   /* NUM_TEXTURE_TARGETS should match number of terms below,
-    * except there's no proxy for GL_TEXTURE_BUFFER.
+   /*
+    * NUM_TEXTURE_TARGETS should match number of terms below, except there's no
+    * proxy for GL_TEXTURE_BUFFER and GL_TEXTURE_EXTERNAL_OES.
     */
-   assert(NUM_TEXTURE_TARGETS == 8);
+   assert(NUM_TEXTURE_TARGETS == 7 + 2);
 
    return (target == GL_PROXY_TEXTURE_1D ||
            target == GL_PROXY_TEXTURE_2D ||
@@ -723,6 +725,9 @@ _mesa_select_tex_object(struct gl_context *ctx,
       case GL_TEXTURE_BUFFER:
          return ctx->Extensions.ARB_texture_buffer_object
             ? texUnit->CurrentTex[TEXTURE_BUFFER_INDEX] : NULL;
+      case GL_TEXTURE_EXTERNAL_OES:
+         return ctx->Extensions.OES_EGL_image_external
+            ? texUnit->CurrentTex[TEXTURE_EXTERNAL_INDEX] : NULL;
       default:
          _mesa_problem(NULL, "bad target in _mesa_select_tex_object()");
          return NULL;
@@ -911,6 +916,7 @@ _mesa_max_texture_levels(struct gl_context *ctx, GLenum target)
               ctx->Extensions.EXT_texture_array)
          ? ctx->Const.MaxTextureLevels : 0;
    case GL_TEXTURE_BUFFER:
+   case GL_TEXTURE_EXTERNAL_OES:
       /* fall-through */
    default:
       return 0; /* bad target */
@@ -942,6 +948,7 @@ _mesa_get_texture_dimensions(GLenum target)
    case GL_TEXTURE_CUBE_MAP_NEGATIVE_Z:
    case GL_TEXTURE_1D_ARRAY:
    case GL_PROXY_TEXTURE_1D_ARRAY:
+   case GL_TEXTURE_EXTERNAL_OES:
       return 2;
    case GL_TEXTURE_3D:
    case GL_PROXY_TEXTURE_3D:
@@ -2533,13 +2540,10 @@ _mesa_EGLImageTargetTexture2DOES (GLenum target, GLeglImageOES image)
    GET_CURRENT_CONTEXT(ctx);
    ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
 
-   if (!ctx->Extensions.OES_EGL_image) {
-      _mesa_error(ctx, GL_INVALID_OPERATION,
-                  "glEGLImageTargetTexture2DOES(unsupported)");
-      return;
-   }
-
-   if (target != GL_TEXTURE_2D) {
+   if ((target == GL_TEXTURE_2D &&
+        !ctx->Extensions.OES_EGL_image) ||
+       (target == GL_TEXTURE_EXTERNAL_OES &&
+        !ctx->Extensions.OES_EGL_image_external)) {
       _mesa_error(ctx, GL_INVALID_ENUM,
                  "glEGLImageTargetTexture2D(target=%d)", target);
       return;
index a8c0b8ee8b958283e5c597953b8e61ab5346f98a..e2f0dc8b64350899d0e64b8296501d413b4a345f 100644 (file)
@@ -107,6 +107,7 @@ _mesa_initialize_texture_object( struct gl_texture_object *obj,
           target == GL_TEXTURE_RECTANGLE_NV ||
           target == GL_TEXTURE_1D_ARRAY_EXT ||
           target == GL_TEXTURE_2D_ARRAY_EXT ||
+          target == GL_TEXTURE_EXTERNAL_OES ||
           target == GL_TEXTURE_BUFFER);
 
    memset(obj, 0, sizeof(*obj));
@@ -119,8 +120,12 @@ _mesa_initialize_texture_object( struct gl_texture_object *obj,
    obj->BaseLevel = 0;
    obj->MaxLevel = 1000;
 
+   /* must be one; no support for (YUV) planes in separate buffers */
+   obj->RequiredTextureImageUnits = 1;
+
    /* sampler state */
-   if (target == GL_TEXTURE_RECTANGLE_NV) {
+   if (target == GL_TEXTURE_RECTANGLE_NV ||
+       target == GL_TEXTURE_EXTERNAL_OES) {
       obj->Sampler.WrapS = GL_CLAMP_TO_EDGE;
       obj->Sampler.WrapT = GL_CLAMP_TO_EDGE;
       obj->Sampler.WrapR = GL_CLAMP_TO_EDGE;
@@ -161,7 +166,8 @@ finish_texture_init(struct gl_context *ctx, GLenum target,
 {
    assert(obj->Target == 0);
 
-   if (target == GL_TEXTURE_RECTANGLE_NV) {
+   if (target == GL_TEXTURE_RECTANGLE_NV ||
+       target == GL_TEXTURE_EXTERNAL_OES) {
       /* have to init wrap and filter state here - kind of klunky */
       obj->Sampler.WrapS = GL_CLAMP_TO_EDGE;
       obj->Sampler.WrapT = GL_CLAMP_TO_EDGE;
@@ -259,6 +265,8 @@ _mesa_copy_texture_object( struct gl_texture_object *dest,
    dest->_Complete = src->_Complete;
    COPY_4V(dest->Swizzle, src->Swizzle);
    dest->_Swizzle = src->_Swizzle;
+
+   dest->RequiredTextureImageUnits = src->RequiredTextureImageUnits;
 }
 
 
@@ -306,6 +314,7 @@ valid_texture_object(const struct gl_texture_object *tex)
    case GL_TEXTURE_1D_ARRAY_EXT:
    case GL_TEXTURE_2D_ARRAY_EXT:
    case GL_TEXTURE_BUFFER:
+   case GL_TEXTURE_EXTERNAL_OES:
       return GL_TRUE;
    case 0x99:
       _mesa_problem(NULL, "invalid reference to a deleted texture object");
@@ -470,7 +479,8 @@ _mesa_test_texobj_completeness( const struct gl_context *ctx,
                      t->Image[0][baseLevel]->HeightLog2);
       maxLevels = ctx->Const.MaxCubeTextureLevels;
    }
-   else if (t->Target == GL_TEXTURE_RECTANGLE_NV) {
+   else if (t->Target == GL_TEXTURE_RECTANGLE_NV ||
+            t->Target == GL_TEXTURE_EXTERNAL_OES) {
       maxLog2 = 0;  /* not applicable */
       maxLevels = 1;  /* no mipmapping */
    }
@@ -1005,6 +1015,8 @@ target_enum_to_index(GLenum target)
       return TEXTURE_2D_ARRAY_INDEX;
    case GL_TEXTURE_BUFFER_ARB:
       return TEXTURE_BUFFER_INDEX;
+   case GL_TEXTURE_EXTERNAL_OES:
+      return TEXTURE_EXTERNAL_INDEX;
    default:
       return -1;
    }
index 226aba0376964097537e7b8b617af5561db536b4..17eac5fc996c91179451e2571365d76f60da6c68 100644 (file)
@@ -60,6 +60,10 @@ validate_texture_wrap_mode(struct gl_context * ctx, GLenum target, GLenum wrap)
           (wrap == GL_CLAMP_TO_BORDER && e->ARB_texture_border_clamp))
          return GL_TRUE;
    }
+   else if (target == GL_TEXTURE_EXTERNAL_OES) {
+      if (wrap == GL_CLAMP_TO_EDGE)
+         return GL_TRUE;
+   }
    else {
       switch (wrap) {
       case GL_CLAMP:
@@ -139,6 +143,11 @@ get_texobj(struct gl_context *ctx, GLenum target, GLboolean get)
          return texUnit->CurrentTex[TEXTURE_2D_ARRAY_INDEX];
       }
       break;
+   case GL_TEXTURE_EXTERNAL_OES:
+      if (ctx->Extensions.OES_EGL_image_external) {
+         return texUnit->CurrentTex[TEXTURE_EXTERNAL_INDEX];
+      }
+      break;
    default:
       ;
    }
@@ -238,7 +247,8 @@ set_tex_parameteri(struct gl_context *ctx,
       case GL_LINEAR_MIPMAP_NEAREST:
       case GL_NEAREST_MIPMAP_LINEAR:
       case GL_LINEAR_MIPMAP_LINEAR:
-         if (texObj->Target != GL_TEXTURE_RECTANGLE_NV) {
+         if (texObj->Target != GL_TEXTURE_RECTANGLE_NV &&
+             texObj->Target != GL_TEXTURE_EXTERNAL_OES) {
             incomplete(ctx, texObj);
             texObj->Sampler.MinFilter = params[0];
             return GL_TRUE;
@@ -319,6 +329,8 @@ set_tex_parameteri(struct gl_context *ctx,
       return GL_TRUE;
 
    case GL_GENERATE_MIPMAP_SGIS:
+      if (params[0] && texObj->Target == GL_TEXTURE_EXTERNAL_OES)
+         goto invalid_param;
       if (texObj->GenerateMipmap != params[0]) {
          /* no flush() */
         texObj->GenerateMipmap = params[0] ? GL_TRUE : GL_FALSE;
@@ -1388,6 +1400,12 @@ _mesa_GetTexParameteriv( GLenum target, GLenum pname, GLint *params )
          *params = (GLint) obj->Immutable;
          break;
 
+      case GL_REQUIRED_TEXTURE_IMAGE_UNITS_OES:
+         if (!ctx->Extensions.OES_EGL_image_external)
+            goto invalid_pname;
+         *params = obj->RequiredTextureImageUnits;
+         break;
+
       default:
          goto invalid_pname;
    }
index 9f14d8a0d17a46f9d10a5b70838e336bd6b4f726..7cd285803d5d99a7b57fb0f0cb2bbb3f9ca82c90 100644 (file)
@@ -690,7 +690,8 @@ alloc_proxy_textures( struct gl_context *ctx )
       GL_TEXTURE_RECTANGLE_NV,
       GL_TEXTURE_1D_ARRAY_EXT,
       GL_TEXTURE_2D_ARRAY_EXT,
-      GL_TEXTURE_BUFFER
+      GL_TEXTURE_BUFFER,
+      GL_TEXTURE_EXTERNAL_OES
    };
    GLint tgt;
 
index ccaedf9f1d69fe01d205676b5768ce7814f072ec..68e44b272445fbc0b408ec63226ae14433debe24 100644 (file)
@@ -148,6 +148,7 @@ is_sampler_type(GLenum type)
    case GL_SAMPLER_2D_MULTISAMPLE_ARRAY:
    case GL_INT_SAMPLER_2D_MULTISAMPLE_ARRAY:
    case GL_UNSIGNED_INT_SAMPLER_2D_MULTISAMPLE_ARRAY:
+   case GL_SAMPLER_EXTERNAL_OES:
       return GL_TRUE;
    default:
       return GL_FALSE;
index 3bf2cc725b9be7fd90ca056b4300b45e3f8e7625..3c2eb5707493c228442dbcc5c0f8d09b0a5c476b 100644 (file)
@@ -2273,6 +2273,9 @@ ir_to_mesa_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.");
    }