i965: enable image external sampling for imported dma-buffers
authorTopi Pohjolainen <topi.pohjolainen@intel.com>
Mon, 12 Nov 2012 11:38:08 +0000 (13:38 +0200)
committerTopi Pohjolainen <topi.pohjolainen@intel.com>
Fri, 2 Aug 2013 05:56:03 +0000 (08:56 +0300)
Signed-off-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
Reviewed-by: Chad Versace <chad.versace@linux.intel.com>
src/mesa/drivers/dri/i965/intel_extensions.c
src/mesa/drivers/dri/i965/intel_tex_image.c

index 409d40b2740d4ffb12f2a82d54db8a8d740a2982..655467c3cfb63234322763044ae9fa517a148e73 100644 (file)
@@ -122,6 +122,7 @@ intelInitExtensions(struct gl_context *ctx)
    ctx->Extensions.OES_EGL_image = true;
    ctx->Extensions.OES_draw_texture = true;
    ctx->Extensions.OES_standard_derivatives = true;
+   ctx->Extensions.OES_EGL_image_external = true;
 
    if (brw->gen >= 6)
       ctx->Const.GLSLVersion = 140;
index 178541d89bd0456369e64e7bcfd48f2ae399a3d1..7db0deb50dbaa3b12c8cf6b2b5a3fda4e19aa055 100644 (file)
@@ -379,6 +379,13 @@ intel_image_target_texture_2d(struct gl_context *ctx, GLenum target,
       return;
    }
 
+   if (target == GL_TEXTURE_EXTERNAL_OES && !image->dma_buf_imported) {
+      _mesa_error(ctx, GL_INVALID_OPERATION,
+            "glEGLImageTargetTexture2DOES(external target is enabled only "
+               "for images created with EGL_EXT_image_dma_buf_import");
+      return;
+   }
+
    /* Disallow depth/stencil textures: we don't have a way to pass the
     * separate stencil miptree of a GL_DEPTH_STENCIL texture through.
     */