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 <kherbst@redhat.com>
Reviewed-by: Pierre Moreau <pierre.morrow@free.fr>
This commit is contained in:
Karol Herbst 2018-04-10 16:41:01 +02:00
parent f014ae3c7c
commit 78c5336ca9
2 changed files with 10 additions and 1 deletions

View File

@ -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

View File

@ -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;