[Mesa-dev] [PATCH 00/29] Use a master format convert function

Iago Toral Quiroga itoral at igalia.com
Tue Nov 18 01:23:41 PST 2014


This is the second of two series of patches to address:
https://bugs.freedesktop.org/show_bug.cgi?id=84566

This series is based on the previous series we sent for review: Auto-generate
pack/unpack functions. To ease review and testing, the combined series are
available here:

https://github.com/Igalia/mesa/tree/itoral-format-convert-review

The goal of this second series is to provide a master convert function
(_mesa_format_convert) that can handle almost all kinds of color format
conversions. To achieve this, this master convert function will operate using
the auto-generated pack/unpack functions as well as _mesa_swizzle_and_convert
(for array types).

This is based on initial work by Jason Ekstrand.

Tested on i965, classic swrast and gallium (llvmpipe, nouveau, radeon) without
regressions. We also get the following new piglit passes:

spec/!OpenGL 1.1/teximage-colors GL_RGB16_SNORM/Exact upload-download of GL_RGB16_SNORM
spec/!OpenGL 1.1/teximage-colors GL_RGB8_SNORM/Exact upload-download of GL_RGB8_SNORM
spec/ARB_copy_image/arb_copy_image-formats/Source: GL_RGB16_SNORM/Destination: GL_RGB16_SNORM
spec/ARB_copy_image/arb_copy_image-formats/Source: GL_ALPHA12/Destination: GL_ALPHA12
spec/ARB_copy_image/arb_copy_image-formats/Source: GL_RGB8I/Destination: GL_RGB8_SNORM
spec/ARB_copy_image/arb_copy_image-formats/Source: GL_RGB16UI/Destination: GL_RGB16_SNORM
spec/ARB_copy_image/arb_copy_image-formats/Source: GL_RGB8_SNORM/Destination: GL_RGB8_SNORM
spec/ARB_copy_image/arb_copy_image-formats/Source: GL_RGB8UI/Destination: GL_RGB8_SNORM
spec/ARB_copy_image/arb_copy_image-formats/Source: GL_RGB16/Destination: GL_RGB16_SNORM
spec/ARB_copy_image/arb_copy_image-formats/Source: GL_RGB8/Destination: GL_RGB8_SNORM
spec/ARB_copy_image/arb_copy_image-formats/Source: GL_INTENSITY12/Destination: GL_INTENSITY12
spec/ARB_copy_image/arb_copy_image-formats/Source: GL_LUMINANCE12/Destination: GL_LUMINANCE12
spec/ARB_copy_image/arb_copy_image-formats/Source: GL_LUMINANCE12_ALPHA12/Destination: GL_LUMINANCE12_ALPHA12
spec/ARB_copy_image/arb_copy_image-formats/Source: GL_RGB16I/Destination: GL_RGB16_SNORM

Just like in the previous series, for software drivers we worked with a
significant subset of piglit tests selected with this filter:
-t format -t color -t tex -t image -t swizzle -t clamp -t rgb -t lum -t pix
-t fbo -t frame

This series removes >3000 SLOC and together with the autogen pack/unpack series
it removes >10000 SLOC (although we would be auto-generating a good chunk of
those).

Although there are no piglit regressions and we even get some new passes,
there are thousands of format conversion combinations and piglit does not cover
every single one, so there is room for some regressions but hopefully not 
major ones. One thing we could not test is big-endian, so that's something that
should be reviewed with extra care.

Patch summary:
  * Patches 1-6, 12 implement the master convert function (_mesa_format_convert)
  * Patches 7-11 mostly add helpers that will be used by callers of
    _mesa_format_convert
  * Patches 13-17 use _mesa_format_convert in the implementation of
    glTex(Sub)Image, glDrawPixels, glGetTex(Sub)Image and glReadPixels.
  * Patches 18-29 remove a bunch of code that becomes obsolete after
    introducing _mesa_format_convert

Eduardo Lima Mitev (1):
  mesa: Replace _mesa_unpack_bitmap with _mesa_unpack_image()

Iago Toral Quiroga (24):
  mesa: Set normalized=true for float array formats.
  mesa: Do not assert on integer<->non-integer direct pack/unpack fast
    paths
  mesa: Expose compute_component_mapping as
    _mesa_compute_component_mapping
  mesa: Consider internal base format in _mesa_format_convert
  mesa: Avoid pack/unpack fast paths if base internal format != base
    format
  mesa: Add helper to convert a GL format and type to a mesa (array)
    format.
  mesa: Add _mesa_swap2_copy and _mesa_swap4_copy
  mesa: Add RGBA to Luminance conversion helpers
  mesa: Add helpers to extract GL_COLOR_INDEX to RGBA float/ubyte
  mesa: Fix RGBA8888_UINT direct unpack path in _mesa_format_convert.
  mesa: Use _mesa_format_convert to implement texstore_rgba.
  mesa: use _mesa_format_convert to implement glReadPixels.
  mesa: Let _mesa_get_format_base_format also handle mesa_array_format
  mesa: Unify rebase logic for glReadPixels and glGetTexImage.
  mesa: Remove _mesa_unpack_color_span_uint
  mesa: Remove _mesa_make_temp_ubyte_image
  mesa: Remove _mesa_make_temp_float_image
  mesa: Remove _mesa_unpack_color_span_ubyte
  mesa: Remove (signed) integer pack and span functions.
  swrast: Replace _mesa_unpack_color_span_float with
    _mesa_format_convert
  mesa: Remove _mesa_unpack_color_span_float
  mesa: Replace _mesa_pack_rgba_span_float with _mesa_format_convert
  mesa: Remove _mesa_pack_rgba_span_float and tmp_pack.h
  mesa: Remove _mesa_(un)pack_index_span

Jason Ekstrand (1):
  mesa: Add an implementation of a master convert function.

Samuel Iglesias Gonsalvez (3):
  mesa/pack: use _mesa_format_from_format_and_type in
    _mesa_pack_rgba_span_from_*
  mesa: use master conversion function to implement
    get_tex_rgba_uncompressed()
  mesa: Remove _mesa_pack_int_rgba_row() and auxiliary functions

 src/mesa/main/dlist.c                  |   14 +-
 src/mesa/main/format_info.py           |    3 +-
 src/mesa/main/format_pack.c.mako       |  121 --
 src/mesa/main/format_pack.h            |    4 -
 src/mesa/main/format_utils.c           |  641 ++++++
 src/mesa/main/format_utils.h           |   13 +
 src/mesa/main/formats.c                |  354 +++-
 src/mesa/main/formats.h                |   20 +-
 src/mesa/main/image.c                  |   25 +-
 src/mesa/main/image.h                  |   10 +-
 src/mesa/main/pack.c                   | 3493 +++-----------------------------
 src/mesa/main/pack.h                   |   89 +-
 src/mesa/main/pack_tmp.h               |  196 --
 src/mesa/main/readpix.c                |  308 +--
 src/mesa/main/texcompress_bptc.c       |   39 +-
 src/mesa/main/texcompress_fxt1.c       |   34 +-
 src/mesa/main/texcompress_rgtc.c       |   80 +-
 src/mesa/main/texcompress_s3tc.c       |   68 +-
 src/mesa/main/texgetimage.c            |  257 +--
 src/mesa/main/texstore.c               | 1137 +----------
 src/mesa/main/texstore.h               |   19 -
 src/mesa/state_tracker/st_cb_texture.c |   14 +-
 src/mesa/swrast/s_drawpix.c            |   39 +-
 23 files changed, 1923 insertions(+), 5055 deletions(-)
 delete mode 100644 src/mesa/main/pack_tmp.h

-- 
1.9.1



More information about the mesa-dev mailing list