[Mesa-dev] [PATCH V4 1/6] dri2: Create image from texture

Eric Anholt eric at anholt.net
Tue Jan 15 13:38:40 PST 2013


Abdiel Janulgue <abdiel.janulgue at linux.intel.com> writes:
> diff --git a/src/egl/drivers/dri2/egl_dri2.c b/src/egl/drivers/dri2/egl_dri2.c
> index 1f13d79..a0d4674 100644
> --- a/src/egl/drivers/dri2/egl_dri2.c
> +++ b/src/egl/drivers/dri2/egl_dri2.c
> @@ -490,6 +490,12 @@ dri2_setup_screen(_EGLDisplay *disp)
>        disp->Extensions.MESA_drm_image = EGL_TRUE;
>        disp->Extensions.KHR_image_base = EGL_TRUE;
>        disp->Extensions.KHR_gl_renderbuffer_image = EGL_TRUE;
> +      if (dri2_dpy->image->base.version >= 5 &&
> +          dri2_dpy->image->createImageFromTexture) {
> +         disp->Extensions.KHR_gl_texture_2D_image = EGL_TRUE;
> +         disp->Extensions.KHR_gl_texture_cubemap_image = EGL_TRUE;
> +         disp->Extensions.KHR_gl_texture_3D_image = EGL_TRUE;

If 3D hasn't been tested, it shouldn't be exposed yet.  See below...

> +      }
>     }
>  }
>  

> +   switch (target) {
> +   case EGL_GL_TEXTURE_2D_KHR:
> +      depth = 0;
> +      gl_target = GL_TEXTURE_2D;
> +      break;
> +   case EGL_GL_TEXTURE_3D_KHR:
> +      depth = attrs.GLTextureZOffset;
> +      gl_target = GL_TEXTURE_3D;
> +      break;
> +   case EGL_GL_TEXTURE_CUBE_MAP_POSITIVE_X_KHR:
> +   case EGL_GL_TEXTURE_CUBE_MAP_NEGATIVE_X_KHR:
> +   case EGL_GL_TEXTURE_CUBE_MAP_POSITIVE_Y_KHR:
> +   case EGL_GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_KHR:
> +   case EGL_GL_TEXTURE_CUBE_MAP_POSITIVE_Z_KHR:
> +   case EGL_GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_KHR:
> +      depth = target - EGL_GL_TEXTURE_CUBE_MAP_POSITIVE_X_KHR;
> +      gl_target = GL_TEXTURE_CUBE_MAP;
> +      break;

Report error in the default case?

> +   }

> +   dri2_img->dri_image =
> +      dri2_dpy->image->createImageFromTexture(dri2_ctx->dri_context,
> +                                                   gl_target,
> +						   texture,
> +                                                   depth,
> +                                                   attrs.GLTextureLevel,
> +						   dri2_img);

Inconsistent indentation, just use spaces.

>  dri2_create_image_khr(_EGLDriver *drv, _EGLDisplay *disp,
>  		      _EGLContext *ctx, EGLenum target,
> @@ -1218,6 +1293,14 @@ dri2_create_image_khr(_EGLDriver *drv, _EGLDisplay *disp,
>     (void) drv;
>  
>     switch (target) {
> +   case EGL_GL_TEXTURE_2D_KHR:

Add case EGL_GL_TEXTURE_3D_KHR:

> +   case EGL_GL_TEXTURE_CUBE_MAP_POSITIVE_X_KHR:
> +   case EGL_GL_TEXTURE_CUBE_MAP_NEGATIVE_X_KHR:
> +   case EGL_GL_TEXTURE_CUBE_MAP_POSITIVE_Y_KHR:
> +   case EGL_GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_KHR:
> +   case EGL_GL_TEXTURE_CUBE_MAP_POSITIVE_Z_KHR:
> +   case EGL_GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_KHR:
> +      return dri2_create_image_khr_texture(disp, ctx, target, buffer, attr_list);
>     case EGL_GL_RENDERBUFFER_KHR:
>        return dri2_create_image_khr_renderbuffer(disp, ctx, buffer, attr_list);
>     case EGL_DRM_BUFFER_MESA:
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/mesa-dev/attachments/20130115/9ca60782/attachment.pgp>


More information about the mesa-dev mailing list