[Mesa-dev] State tracker pipe_surface woes...

Marek Olšák maraeo at gmail.com
Thu Sep 8 00:08:09 PDT 2011


2011/9/7 Roland Scheidegger <sroland at vmware.com>:
> That said I'm not really sure why pipe_sampler_view and pipe_surface
> actually have a context pointer in them, since they are only supposed to
> be used with the context in which they were created I think those
> shouldn't actually exist - surface_destroy and sampler_view_destroy will
> have context as a parameter, and if they aren't shared between contexts
> it's pointless to store the context pointer. Might be a relic from when
> those structs were created/destroyed using screen functions...

The ctx pointer is there because of pipe_surface_reference and
pipe_sampler_view_reference. When the refcount becomes 0, the
corresponding pipe...reference function uses the ctx pointer to do
ctx->...destroy(ctx, ...

So that we can destroy objects just by:
pipe_surface_reference(&surface, NULL);

This ctx pointer also ensures that the destroy function is called with
the right context.

Marek


More information about the mesa-dev mailing list