[Mesa-dev] When is a sampler object not a sampler object?

Matt Turner mattst88 at gmail.com
Tue Jan 1 09:20:41 PST 2013


On Wed, Dec 19, 2012 at 8:40 PM, Matt Turner <mattst88 at gmail.com> wrote:
> The ES 3.0 and GL 3.3+ specs say:
>
> A new sampler object is created by binding an unused name to a
> texture unit.
>
> [...]
>
> The names are marked as used, for the purposes of GenSamplers only,
> but they acquire state only when they are first used as a parameter
> to BindSampler, SamplerParameter*, GetSamplerParameter*, or IsSampler.
> When a sampler object is first used in one of these functions, the
> resulting sampler object is initialized with a new state vector,
> comprising all the state and with the same initial values listed in
> table 6.10.
>
> We're not handling the requirement to initialize the object specified
> in the 2nd paragraph, but my real question is --
>
> Can IsSampler ever return false if given a name returned by
> GenSamplers? Does 'acquire state' mean becomes a sampler object? These
> paragraphs seem contradictory.

So to close the loop on this, I think we're handling everything
properly after all. At least, it's impossible to tell that we're doing
it wrong, which is indistinguishable from doing it right. :)

Please someone confirm my logic:

The spec says that sampler objects only "acquire state" when used as a
parameter to BindSampler, SamplerParameter*, GetSamplerParameter*, or
IsSampler. But these are the only functions that in which a sampler id
returned from GenSamplers can be used, and since the functions used to
detect if sampler objects have state have the side-effect of causing
them to acquire state, it's safe to just do initialization in
GenSamplers (which is what we do).

Maybe there's some other case we're not handling properly? Hardly
seems worth finding.


More information about the mesa-dev mailing list