[Mesa-dev] EGL_KHR_*_image extension implemention

Chia-I Wu olvaffe at gmail.com
Sun Sep 12 20:55:38 PDT 2010


On Mon, Sep 13, 2010 at 11:52 AM, Chia-I Wu <olvaffe at gmail.com> wrote:
>> +static boolean
>> +vg_context_get_resource_for_egl_image(struct st_context_iface *stctxi,
>> +                                      struct st_context_resource *stres)
>> +{
>> +   struct vg_context *ctx;
>> +   struct vg_image *img;
>> +   struct pipe_sampler_view *sampler_view;
>> +
>> +   ctx = (struct vg_context *) stctxi;
>> +   if (!ctx)
>> +      return FALSE;
> This check could be replaced by an assertion.  Calling stctxi's method
> without passing stctxi is a bug elsewhere.
>> +
>> +   img = (struct vg_image *)stres->resource;
> A check on stres->type and res->resource (!= VG_INVALID_HANDLE) would
> be good before the assignment.
>> +   if (!img)
>> +      return FALSE;
It should also return FALSE when img is a child image.
>> +   sampler_view = img->sampler_view;
>> +   if (!sampler_view)
>> +      return FALSE;
>> +
>> +   stres->texture = sampler_view->texture;
> It should be
>
>   stres->texture = NULL;
>   pipe_resource_reference(&stres->texture, sampler_view->texture);
>
> stres->texture is caller owned.
>> +
>> +   return TRUE;
>> +}


-- 
olv at LunarG.com


More information about the mesa-dev mailing list