[Mesa-dev] [PATCH 1/3] gallium: add resource normalization flags (v4)

Luca Barbieri luca at luca-barbieri.com
Wed Aug 18 07:24:04 PDT 2010


> Hmm this is indeed rather complicated, though I guess it could work.

A possibly less complicated simplified restatement, from the state
tracker point of view:
- If PIPE_CAP_FLEXIBLE_SAMPLER is supported, you can do anything and
PIPE_RESOURCE_FLAG_TEXTURE_RECT_SEMANTICS is ignored
- If you use PIPE_RESOURCE_FLAG_TEXTURE_RECT_SEMANTICS, then it's like
GL_TEXTURE_RECTANGLE, except normalized coordinates are supported and
preferred if PIPE_RESOURCE_FLAG_PREFER_NORMALIZED_COORDS gets set by
the driver
- If you don't use PIPE_RESOURCE_FLAG_TEXTURE_RECT_SEMANTICS, then:
A. If NPOT and no PIPE_CAP_NPOT_TEXTURES, then you must respect the
driver normalization preference
B. If POT or NPOT with PIPE_CAP_NPOT_TEXTURES, then it's like
GL_TEXTURE_2D, except that unnormalized coordinates are supported and
preferred (but only with clamp wrap modes) if
PIPE_RESOURCE_FLAG_PREFER_UNNORMALIZED_COORDS gets set by the driver.

For internal drawing, respect the driver preference if any, and
otherwise choose yourself. Don't attempt to use non-clamp wrap modes
for internal drawing (we should introduce an "I guarantee the
coordinate is in bounds" mode for this).
If you really need non-clamp modes, either require
PIPE_CAP_FLEXIBLE_SAMPLING or always use normalized coordinates and
either use POT textures or require PIPE_CAP_NPOT_TEXTURES.

If you don't respect the driver preference for internal drawing and
always use normalized, then you must either only use POT textures or
require PIPE_CAP_NPOT_TEXTURES.
If you don't respect the driver preference for internal drawing and
always use unnormalized, then you must either use
PIPE_RESOURCE_FLAG_TEXTURE_RECT_SEMANTICS or require
PIPE_CAP_FLEXIBLE_SAMPLING.


And from the driver point of view:
- If you have two texture layouts tied to normalization, use the
unnormalized one if either PIPE_RESOURCE_FLAG_TEXTURE_RECT_SEMANTICS
or the texture is NPOT, otherwise use the normalized one. Don't expose
PIPE_CAP_NPOT_TEXTURES.
- If you have only one texture layout, do nothing and ignore
PIPE_RESOURCE_FLAG_TEXTURE_RECT_SEMANTICS.
- If only one normalization is supported for the given layout, or if
one of them is faster, set the preference flag for that one, otherwise
do nothing.


More information about the mesa-dev mailing list