[Mesa-dev] [RFC] [PATCH 0/3] Make Gallium aware of GL_TEXTURE_RECTANGLE

Luca Barbieri luca at luca-barbieri.com
Wed Aug 11 04:44:44 PDT 2010


Currently Gallium doesn't know about GL_TEXTURE_RECTANGLE textures, except
for the normalized coordinates bit in the sampler state.
Also, internal code always use normalized coordinates.

This works fine on new hardware, but on older hardware like nv30, coordinate
normalization is coupled to the resource layout, and rectangular textures cannot
be used with normalized coordinates in any way.

This makes it impossible to write an efficient nv30 driver (and, in practice, it's also
impossible to write a correct one without significant work).

The proposed solution is as follows:
1. Add a new PIPE_RESOURCE_FLAG_UNNORMALIZED_COORDS_HINT resource flag,
   which tells Gallium that the resource is going to be used with unnormalized
   coordinates. This allows to distinguish GL_TEXTURE_RECTANGLE from
   GL_TEXTURE_2D in the case of POT texture.
   This is supposed in theory to be only an hint, but in practice drivers
   might not even work with the other normalization.
2. Make all internal drawing done by Mesa and Gallium support use of both
   unnormalized and normalized coordinates (e.g. blitter module)
3. Set the flag for GL_TEXTURE_RECTANGLE textures

A previous revision was already sent a while ago to this list, when it was not
opposed, but also didn't get a definitive signoff from Brian or Keith.

Luca Barbieri (3):
  gallium: add PIPE_RESOURCE_FLAG_UNNORMALIZED_COORDS_HINT
  gallium: use unnormalized coords internally for NPOT textures
  st/mesa: set PIPE_RESOURCE_FLAG_UNNORMALIZED_COORDS_HINT for
    GL_TEXTURE_RECTANGLE

 src/gallium/auxiliary/util/u_blit.c            |   38 ++++++++++++++----
 src/gallium/auxiliary/util/u_blitter.c         |   48 +++++++++++++++--------
 src/gallium/include/pipe/p_defines.h           |    6 +++
 src/mesa/state_tracker/st_atom_pixeltransfer.c |    2 +-
 src/mesa/state_tracker/st_cb_bitmap.c          |    4 +-
 src/mesa/state_tracker/st_cb_drawpixels.c      |    2 +-
 src/mesa/state_tracker/st_cb_texture.c         |   18 +++++++-
 src/mesa/state_tracker/st_gen_mipmap.c         |    8 +++-
 src/mesa/state_tracker/st_texture.c            |    5 +-
 src/mesa/state_tracker/st_texture.h            |    3 +-
 10 files changed, 96 insertions(+), 38 deletions(-)



More information about the mesa-dev mailing list