[Mesa-dev] [PATCH v2 21/73] radeonsi: bypass the shader cache for NIR shaders

Nicolai Hähnle nhaehnle at gmail.com
Wed Jul 5 10:48:05 UTC 2017


From: Nicolai Hähnle <nicolai.haehnle at amd.com>

---
 src/gallium/drivers/radeonsi/si_state_shaders.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/src/gallium/drivers/radeonsi/si_state_shaders.c b/src/gallium/drivers/radeonsi/si_state_shaders.c
index 875c337..df7ccb9 100644
--- a/src/gallium/drivers/radeonsi/si_state_shaders.c
+++ b/src/gallium/drivers/radeonsi/si_state_shaders.c
@@ -1793,31 +1793,32 @@ void si_init_shader_selector_async(void *job, int thread_index)
 	} else {
 		tm = sel->compiler_ctx_state.tm;
 	}
 
 	/* Compile the main shader part for use with a prolog and/or epilog.
 	 * If this fails, the driver will try to compile a monolithic shader
 	 * on demand.
 	 */
 	if (!sscreen->use_monolithic_shaders) {
 		struct si_shader *shader = CALLOC_STRUCT(si_shader);
-		void *tgsi_binary;
+		void *tgsi_binary = NULL;
 
 		if (!shader) {
 			fprintf(stderr, "radeonsi: can't allocate a main shader part\n");
 			return;
 		}
 
 		shader->selector = sel;
 		si_parse_next_shader_property(&sel->info, &shader->key);
 
-		tgsi_binary = si_get_tgsi_binary(sel);
+		if (sel->tokens)
+			tgsi_binary = si_get_tgsi_binary(sel);
 
 		/* Try to load the shader from the shader cache. */
 		mtx_lock(&sscreen->shader_cache_mutex);
 
 		if (tgsi_binary &&
 		    si_shader_cache_load_shader(sscreen, tgsi_binary, shader)) {
 			mtx_unlock(&sscreen->shader_cache_mutex);
 		} else {
 			mtx_unlock(&sscreen->shader_cache_mutex);
 
-- 
2.9.3



More information about the mesa-dev mailing list