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

Kenneth Graunke kenneth at whitecape.org
Tue Jan 1 12:02:24 PST 2013


On 01/01/2013 09:20 AM, Matt Turner wrote:
> 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.
>>
>> [...]

vvvvvvvv

>> 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.

The paragraph above seems crystal clear to me: IsSampler should always 
return true for a name created by GenSamplers, since it isn't a 
different kind of object, and calling IsSampler causes it to be 
created/initialized (at which point it *is* a sampler object).

So I think initializing it in GenSamplers is fine.


More information about the mesa-dev mailing list