From 7af6649e884f4ba9fa3fde0333090b93f62a13c0 Mon Sep 17 00:00:00 2001 From: Laszlo Agocs Date: Tue, 3 Sep 2019 11:59:24 +0200 Subject: rhi: gl, metal, d3d: Reuse shader objects when source is the same MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Now that Qt Quick's batch renderer misses one level of shader source caching due to the nature of pipeline state objects, it can be useful to keep and reuse shader objects when the hash of the source code matches. The goal here is to allow Qt Quick to be on par with what the direct OpenGL path has when it comes to caching shader sources and compilation results. The program binary disk cache is not in scope in this patch. Also adds QRhi::releaseCachedResources(), similarly to what the scenegraph has. This can be called to clear caches such as the shader object cache we keep here. Change-Id: Ie3d81d823f61fa65ec814439e882c498f7774d43 Reviewed-by: Christian Strømme --- src/gui/rhi/qrhi_p.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/gui/rhi/qrhi_p.h') diff --git a/src/gui/rhi/qrhi_p.h b/src/gui/rhi/qrhi_p.h index 2d36c19e99..928d1f8fa7 100644 --- a/src/gui/rhi/qrhi_p.h +++ b/src/gui/rhi/qrhi_p.h @@ -1420,6 +1420,8 @@ public: static const int MAX_LAYERS = 6; // cubemaps only static const int MAX_LEVELS = 16; // a width and/or height of 65536 should be enough for everyone + void releaseCachedResources(); + protected: QRhi(); -- cgit v1.2.3