Mesa (master): llvmpipe: add cache for compressed textures

Roland Scheidegger sroland at kemper.freedesktop.org
Wed Nov 4 01:52:34 UTC 2015


Module: Mesa
Branch: master
Commit: 9285ed98f7557722fbb94f47c5bc138ef5dd9c70
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=9285ed98f7557722fbb94f47c5bc138ef5dd9c70

Author: Roland Scheidegger <sroland at vmware.com>
Date:   Tue Oct 27 05:34:00 2015 +0100

llvmpipe: add cache for compressed textures

compressed textures are very slow because decoding is rather complex
(and because there's no jit code code to decode them too for non-technical
reasons).
Thus, add some texture cache which holds a couple of decoded blocks.
Right now this handles only s3tc format albeit it could be extended to work
with other formats rather trivially as long as the result of decode fits into
32bit per texel (ideally, rgtc actually would decode to more than 8 bits
per channel, but even then making it work for it shouldn't be too difficult).
This can improve performance noticeably but don't expect wonders (uncompressed
is unsurprisingly still faster). It's also possible it might be slower in
some cases (using nearest filtering for example or if there's otherwise not
many cache hits, the cache is only direct mapped which isn't great).
Also, actual decode of a block relies on util code, thus even though always
full blocks are decoded it is done texel by texel - this could obviously
benefit greatly from simd-optimized code decoding full blocks at once...
Note the cache is per (raster) thread, and currently only used for fragment
shaders.

Reviewed-by: Jose Fonseca <jfonseca at vmware.com>

---

 src/gallium/auxiliary/Makefile.sources             |    2 +
 src/gallium/auxiliary/draw/draw_llvm.c             |    5 +-
 src/gallium/auxiliary/gallivm/lp_bld_format.c      |   56 +++
 src/gallium/auxiliary/gallivm/lp_bld_format.h      |   56 ++-
 src/gallium/auxiliary/gallivm/lp_bld_format_aos.c  |   31 +-
 .../auxiliary/gallivm/lp_bld_format_cached.c       |  374 ++++++++++++++++++++
 src/gallium/auxiliary/gallivm/lp_bld_format_soa.c  |   37 +-
 src/gallium/auxiliary/gallivm/lp_bld_sample.h      |   13 +
 src/gallium/auxiliary/gallivm/lp_bld_sample_aos.c  |    6 +-
 src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c  |   42 +++
 src/gallium/auxiliary/gallivm/lp_bld_tgsi.h        |    2 +
 src/gallium/auxiliary/gallivm/lp_bld_tgsi_soa.c    |    5 +
 src/gallium/drivers/llvmpipe/lp_jit.c              |    3 +
 src/gallium/drivers/llvmpipe/lp_jit.h              |    8 +-
 src/gallium/drivers/llvmpipe/lp_rast.c             |   44 ++-
 src/gallium/drivers/llvmpipe/lp_state_fs.c         |    4 +-
 src/gallium/drivers/llvmpipe/lp_test_format.c      |   36 +-
 src/gallium/drivers/llvmpipe/lp_tex_sample.c       |   19 +
 src/gallium/drivers/llvmpipe/lp_tex_sample.h       |    5 +-
 19 files changed, 730 insertions(+), 18 deletions(-)

Diff:   http://cgit.freedesktop.org/mesa/mesa/diff/?id=9285ed98f7557722fbb94f47c5bc138ef5dd9c70



More information about the mesa-commit mailing list