-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Kristian Høgsberg wrote:
> diff --git a/src/mesa/drivers/dri/intel/intel_fbo.c 
> b/src/mesa/drivers/dri/intel/intel_fbo.c
> index d58ffd9..f816d8c 100644
> --- a/src/mesa/drivers/dri/intel/intel_fbo.c
> +++ b/src/mesa/drivers/dri/intel/intel_fbo.c
> @@ -200,6 +200,35 @@ intel_alloc_renderbuffer_storage(GLcontext * ctx, struct 
> gl_renderbuffer *rb,
>  }
>  
>  
> +static void
> +intel_image_target_renderbuffer_storage(GLcontext *ctx,
> +                                     struct gl_renderbuffer *rb,
> +                                     void *image_handle)
> +{
> +   struct intel_context *intel = intel_context(ctx);
> +   struct intel_renderbuffer *irb;
> +   __DRIscreen *screen;
> +   __DRIimage *image;
> +
> +   screen = intel->intelScreen->driScrnPriv;
> +   image = screen->dri2.image->lookupImage(intel->driContext, image_handle,
> +                                        intel->driContext->loaderPrivate);
> +   if (image == NULL)
> +      return;
> +
> +   irb = intel_renderbuffer(rb);
> +   if (irb->region)
> +      intel_region_release(&irb->region);
> +   intel_region_reference(&irb->region, image->region);
> +
> +   rb->Width = image->region->width;
> +   rb->Height = image->region->height;
> +   rb->Format = image->format;
> +   rb->DataType = image->data_type;
> +   rb->_BaseFormat = _mesa_base_fbo_format(&intel->ctx,
> +                                        image->internal_format);
> +}
> +

There are a couple of failure paths here.  How does the caller of
EGLImageTargetRenderbufferStorage detect and propagate failures?  It
seems like there should be some _mesa_error calls in here.

Should this function also be under a "#if FEATURE_OES_EGL_image" block?

>  /**
>   * Called for each hardware renderbuffer when a _window_ is resized.
>   * Just update fields.
> @@ -651,4 +680,9 @@ intel_fbo_init(struct intel_context *intel)
>     intel->ctx.Driver.ResizeBuffers = intel_resize_buffers;
>     intel->ctx.Driver.ValidateFramebuffer = intel_validate_framebuffer;
>     intel->ctx.Driver.BlitFramebuffer = _mesa_meta_BlitFramebuffer;
> +
> +#if FEATURE_OES_EGL_image
> +   intel->ctx.Driver.EGLImageTargetRenderbufferStorage =
> +      intel_image_target_renderbuffer_storage;
> +#endif   
>  }
> diff --git a/src/mesa/drivers/dri/intel/intel_tex_image.c 
> b/src/mesa/drivers/dri/intel/intel_tex_image.c
> index d63292e..d9c5363 100644
> --- a/src/mesa/drivers/dri/intel/intel_tex_image.c
> +++ b/src/mesa/drivers/dri/intel/intel_tex_image.c
> @@ -812,6 +812,53 @@ intelSetTexBuffer(__DRIcontext *pDRICtx, GLint target, 
> __DRIdrawable *dPriv)
>  }
>  
>  
> +static void
> +intel_image_target_texture_2d(GLcontext *ctx, GLenum target,
> +                           struct gl_texture_object *texObj,
> +                           struct gl_texture_image *texImage,
> +                           GLeglImageOES image_handle)
> +{
> +   struct intel_context *intel = intel_context(ctx);
> +   struct intel_texture_object *intelObj = intel_texture_object(texObj);
> +   struct intel_texture_image *intelImage = intel_texture_image(texImage);
> +   struct intel_mipmap_tree *mt;
> +   __DRIscreen *screen;
> +   __DRIimage *image;
> +
> +   screen = intel->intelScreen->driScrnPriv;
> +   image = screen->dri2.image->lookupImage(intel->driContext, image_handle,
> +                                        intel->driContext->loaderPrivate);
> +   if (image == NULL)
> +      return;
> +
> +   mt = intel_miptree_create_for_region(intel, target,
> +                                     image->internal_format,
> +                                     0, 0, image->region, 1, 0);
> +   if (mt == NULL)
> +       return;
> +
> +   if (intelImage->mt) {
> +      intel_miptree_release(intel, &intelImage->mt);
> +      assert(!texImage->Data);
> +   }
> +   if (intelObj->mt)
> +      intel_miptree_release(intel, &intelObj->mt);
> +
> +   intelObj->mt = mt;
> +   _mesa_init_teximage_fields(&intel->ctx, target, texImage,
> +                           image->region->width, image->region->height, 1,
> +                           0, image->internal_format);
> +
> +   intelImage->face = target_to_face(target);
> +   intelImage->level = 0;
> +   texImage->TexFormat = image->format;
> +   texImage->RowStride = image->region->pitch;
> +   intel_miptree_reference(&intelImage->mt, intelObj->mt);
> +
> +   if (!intel_miptree_match_image(intelObj->mt, &intelImage->base))
> +      fprintf(stderr, "miptree doesn't match image\n");
> +}
> +

Same comments as for intel_image_target_renderbuffer_storage.

>  void
>  intelInitTextureImageFuncs(struct dd_function_table *functions)
>  {
> @@ -822,4 +869,8 @@ intelInitTextureImageFuncs(struct dd_function_table 
> *functions)
>  
>     functions->CompressedTexImage2D = intelCompressedTexImage2D;
>     functions->GetCompressedTexImage = intelGetCompressedTexImage;
> +
> +#if FEATURE_OES_EGL_image
> +   functions->EGLImageTargetTexture2D = intel_image_target_texture_2d;
> +#endif
>  }

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAkt1+SAACgkQX1gOwKyEAw8e0QCfTWIEn3NKmOC74ELcgNSu0pQN
1EwAn1HmdiH4SHUuc+wqgheYKYN+kJXG
=ZeUc
-----END PGP SIGNATURE-----

------------------------------------------------------------------------------
SOLARIS 10 is the OS for Data Centers - provides features such as DTrace,
Predictive Self Healing and Award Winning ZFS. Get Solaris 10 NOW
http://p.sf.net/sfu/solaris-dev2dev
_______________________________________________
Mesa3d-dev mailing list
Mesa3d-dev@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mesa3d-dev

Reply via email to