From 78c5336ca9b37e59ecb3d8f44c988dc87d595b9b Mon Sep 17 00:00:00 2001 From: Karol Herbst Date: Tue, 10 Apr 2018 16:41:01 +0200 Subject: [PATCH] nouveau: fix nir and TGSI shader cache collision v9: rename variable to driver_flags use constants for shader cache flags Signed-off-by: Karol Herbst Reviewed-by: Pierre Moreau --- src/gallium/drivers/nouveau/nouveau_screen.c | 8 +++++++- src/gallium/drivers/nouveau/nouveau_screen.h | 3 +++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/src/gallium/drivers/nouveau/nouveau_screen.c b/src/gallium/drivers/nouveau/nouveau_screen.c index 98b44b7df0b..cbd45a1dc35 100644 --- a/src/gallium/drivers/nouveau/nouveau_screen.c +++ b/src/gallium/drivers/nouveau/nouveau_screen.c @@ -151,6 +151,7 @@ nouveau_disk_cache_create(struct nouveau_screen *screen) struct mesa_sha1 ctx; unsigned char sha1[20]; char cache_id[20 * 2 + 1]; + uint64_t driver_flags = 0; _mesa_sha1_init(&ctx); if (!disk_cache_get_function_identifier(nouveau_disk_cache_create, @@ -160,9 +161,14 @@ nouveau_disk_cache_create(struct nouveau_screen *screen) _mesa_sha1_final(&ctx, sha1); disk_cache_format_hex_id(cache_id, sha1, 20 * 2); + if (screen->prefer_nir) + driver_flags |= NOUVEAU_SHADER_CACHE_FLAGS_IR_NIR; + else + driver_flags |= NOUVEAU_SHADER_CACHE_FLAGS_IR_TGSI; + screen->disk_shader_cache = disk_cache_create(nouveau_screen_get_name(&screen->base), - cache_id, 0); + cache_id, driver_flags); } int diff --git a/src/gallium/drivers/nouveau/nouveau_screen.h b/src/gallium/drivers/nouveau/nouveau_screen.h index 4598d6a60e3..1302c608bec 100644 --- a/src/gallium/drivers/nouveau/nouveau_screen.h +++ b/src/gallium/drivers/nouveau/nouveau_screen.h @@ -17,6 +17,9 @@ extern int nouveau_mesa_debug; struct nouveau_bo; +#define NOUVEAU_SHADER_CACHE_FLAGS_IR_TGSI 0 << 0 +#define NOUVEAU_SHADER_CACHE_FLAGS_IR_NIR 1 << 0 + struct nouveau_screen { struct pipe_screen base; struct nouveau_drm *drm; -- 2.30.2