[Mesa-dev] [PATCH] st/mesa: don't load cached TGSI shaders on demand
Marek Olšák
maraeo at gmail.com
Thu Jun 1 18:09:42 UTC 2017
From: Marek Olšák <marek.olsak at amd.com>
This fixes a performance issue with the shader cache that delayed Gallium
shader create calls until draw calls.
I'd like this in stable, but it's not a showstopper.
Cc: 17.1 <mesa-stable at lists.freedesktop.org>
---
src/mesa/state_tracker/st_shader_cache.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/src/mesa/state_tracker/st_shader_cache.c b/src/mesa/state_tracker/st_shader_cache.c
index 31c3430..305435f 100644
--- a/src/mesa/state_tracker/st_shader_cache.c
+++ b/src/mesa/state_tracker/st_shader_cache.c
@@ -15,21 +15,21 @@
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*/
#include <stdio.h>
-
+#include "st_debug.h"
#include "st_program.h"
#include "st_shader_cache.h"
#include "compiler/glsl/program.h"
#include "pipe/p_shader_tokens.h"
#include "program/ir_to_mesa.h"
#include "util/u_memory.h"
static void
write_stream_out_to_cache(struct blob *blob,
struct pipe_shader_state *tgsi)
@@ -360,20 +360,25 @@ st_load_tgsi_from_disk_cache(struct gl_context *ctx,
if (ctx->_Shader->Flags & GLSL_CACHE_INFO) {
_mesa_sha1_format(sha1_buf, sha1);
fprintf(stderr, "%s tgsi_tokens retrieved from cache: %s\n",
_mesa_shader_stage_to_string(i), sha1_buf);
}
st_set_prog_affected_state_flags(glprog);
_mesa_associate_uniform_storage(ctx, prog, glprog->Parameters,
false);
+ /* Create Gallium shaders now instead of on demand. */
+ if (ST_DEBUG & DEBUG_PRECOMPILE ||
+ st->shader_has_one_variant[glprog->info.stage])
+ st_precompile_shader_variant(st, glprog);
+
free(buffer);
} else {
/* Failed to find a matching cached shader so fallback to recompile.
*/
if (ctx->_Shader->Flags & GLSL_CACHE_INFO) {
fprintf(stderr, "TGSI cache item not found.\n");
}
goto fallback_recompile;
}
--
2.7.4
More information about the mesa-dev
mailing list