iris: Expose the disk cache to the state tracker as well.
authorKenneth Graunke <kenneth@whitecape.org>
Tue, 21 May 2019 19:06:02 +0000 (12:06 -0700)
committerKenneth Graunke <kenneth@whitecape.org>
Tue, 21 May 2019 22:05:38 +0000 (15:05 -0700)
This lets st/nir cache the NIR for shaders, based on the shader source
string hash, allowing us to skip initial compiles altogether, and also
letting us start from there should we need to recompile for NOS.

Reviewed-by: Dylan Baker <dylan@pnwbakers.com>
src/gallium/drivers/iris/iris_screen.c

index fcd1bf7..4a62f15 100644 (file)
@@ -532,6 +532,13 @@ iris_get_compiler_options(struct pipe_screen *pscreen,
    return screen->compiler->glsl_compiler_options[stage].NirOptions;
 }
 
+static struct disk_cache *
+iris_get_disk_shader_cache(struct pipe_screen *pscreen)
+{
+   struct iris_screen *screen = (struct iris_screen *) pscreen;
+   return screen->disk_cache;
+}
+
 static int
 iris_getparam(struct iris_screen *screen, int param, int *value)
 {
@@ -661,6 +668,7 @@ iris_screen_create(int fd, const struct pipe_screen_config *config)
    pscreen->get_compute_param = iris_get_compute_param;
    pscreen->get_paramf = iris_get_paramf;
    pscreen->get_compiler_options = iris_get_compiler_options;
+   pscreen->get_disk_shader_cache = iris_get_disk_shader_cache;
    pscreen->is_format_supported = iris_is_format_supported;
    pscreen->context_create = iris_create_context;
    pscreen->flush_frontbuffer = iris_flush_frontbuffer;