From: Michel Dänzer <michel.daen...@amd.com> It turned out to be slightly more complicated than I'd expected, but I think I've found a good solution with low (hopefully insignificant) additional overhead. In fact, thanks to the optimization in patch 3, the overhead may be slightly lower in general than before the series.
While working on this, I stumbled over the bug fixed in patch 1. Tested with piglit gpu.py (no regressions on Kaveri) and: * Enabling the testing code in cso_create_context which sets the maximum CSO cache size to 4 entries. * Adding assertions in delete_sampler_state that the state being deleted isn't currently bound. * Running demos/textures from mesa-demos and hitting the f key dozens of times, cycling through different texture filtering modes. The assertions in delete_sampler_state failed quickly without patch 5. Michel Dänzer (6): cso: Don't restore nr_samplers in cso_restore_fragment_samplers cso: Store pointers to struct cso_sampler in struct sampler_info cso: Optimize cso_save/restore_fragment_samplers cso: Store hash key in struct cso_sampler cso: Make sanitize_hash safe for samplers Revert "cso: don't release sampler states that are bound" src/gallium/auxiliary/cso_cache/cso_cache.c | 4 +- src/gallium/auxiliary/cso_cache/cso_cache.h | 1 + src/gallium/auxiliary/cso_cache/cso_context.c | 92 ++++++++++++++++++++++----- 3 files changed, 77 insertions(+), 20 deletions(-) -- 2.11.0 _______________________________________________ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev