[Mesa-dev] Merging translate and unnormalized-coords-hint?

Roland Scheidegger sroland at vmware.com
Tue Aug 17 09:12:55 PDT 2010


On 17.08.2010 17:43, Luca Barbieri wrote:
>> I'm not sure it's really worth bothering about all those cases to
>> optimize some divs or muls away.
> Yes, the gain might be marginal, but once you change internal code to
> support either normalization, supporting fine grained preferences is a
> tiny change.
> 
>> Hence one flag (for tex rect) would be
>> sufficient, otherwise just use normalized.
> 
> Yes (for the needs of nv30, with loss of generality).
> 
> However this way you have the following weird check:
> use_normalized_coords = (texture->target != PIPE_TEXTURE_RECT) ||
> screen->get_param(PIPE_CAP_PREFER_NORMALIZED_EVEN_FOR_RECT);

Well I'd have preferred a slightly easier (imho) to read version:
nonnormalized coords = (texture->target == PIPE_TEXTURE_RECT) &&
!screen->get_param(PIPE_CAP_SUPPORTS_NPOT_NORMALIZED).
Plus the parameter should probably be stored somewhere not requeried
when needed multiple times.


> 
> With a per-resource cap, you have this natural one instead:
> use_normalized_coords = (texture->flags &
> PIPE_RESOURCE_FLAG_PREFER_NORMALIZED_COORDS);
> 
> And if you have two flags, you can also do this
> use_normalized_coords = !(texture->flags &
> PIPE_RESOURCE_FLAG_PREFER_UNNORMALIZED_COORDS);
> 
> depending on the preference of the state tracker itself (they differ
> if neither flag is set).
> 
> It seems to me that the second and third checks are way cleaner than
> the first, and I can't think of anything that would negatively balance
> this significant gain.

They are less complex, that much is true. Doesn't look that significant
to me, and needs a bit less code elsewhere. It is true this is more a
special case for nvfx, but I just don't see it as very useful to have
these hints used by other drivers. Especially because APIs always use
normalized anyway for rendering (except for the special RECT case) and
newer hw needs to support both anyway, the gains in internal code look
minimal to me.


Roland


More information about the mesa-dev mailing list