X-Git-Url: https://git.libre-soc.org/?a=blobdiff_plain;f=src%2Fgallium%2Fdrivers%2Firis%2Firis_disk_cache.c;h=4913f309d0c3026faaa5af12ccf3ee9d16c73718;hb=43429efc61e836b3a1eda5b2290153c20ec099b2;hp=2b5889c49e9005e13ce675041c73734fe0823fd8;hpb=0c4e89ad5b9cc9a3e2afdab86602f643e69e9412;p=mesa.git diff --git a/src/gallium/drivers/iris/iris_disk_cache.c b/src/gallium/drivers/iris/iris_disk_cache.c index 2b5889c49e9..4913f309d0c 100644 --- a/src/gallium/drivers/iris/iris_disk_cache.c +++ b/src/gallium/drivers/iris/iris_disk_cache.c @@ -111,9 +111,10 @@ iris_disk_cache_store(struct disk_cache *cache, */ blob_write_bytes(&blob, shader->prog_data, brw_prog_data_size(stage)); blob_write_bytes(&blob, shader->map, shader->prog_data->program_size); - blob_write_bytes(&blob, &shader->num_system_values, sizeof(unsigned)); + blob_write_uint32(&blob, shader->num_system_values); blob_write_bytes(&blob, shader->system_values, shader->num_system_values * sizeof(enum brw_param_builtin)); + blob_write_uint32(&blob, shader->kernel_input_size); blob_write_bytes(&blob, prog_data->param, prog_data->nr_params * sizeof(uint32_t)); blob_write_bytes(&blob, &shader->bt, sizeof(shader->bt)); @@ -123,6 +124,15 @@ iris_disk_cache_store(struct disk_cache *cache, #endif } +static const enum iris_program_cache_id cache_id_for_stage[] = { + [MESA_SHADER_VERTEX] = IRIS_CACHE_VS, + [MESA_SHADER_TESS_CTRL] = IRIS_CACHE_TCS, + [MESA_SHADER_TESS_EVAL] = IRIS_CACHE_TES, + [MESA_SHADER_GEOMETRY] = IRIS_CACHE_GS, + [MESA_SHADER_FRAGMENT] = IRIS_CACHE_FS, + [MESA_SHADER_COMPUTE] = IRIS_CACHE_CS, +}; + /** * Search for a compiled shader in the disk cache. If found, upload it * to the in-memory program cache so we can use it. @@ -164,6 +174,7 @@ iris_disk_cache_retrieve(struct iris_context *ice, struct brw_stage_prog_data *prog_data = ralloc_size(NULL, prog_data_size); const void *assembly; uint32_t num_system_values; + uint32_t kernel_input_size; uint32_t *system_values = NULL; uint32_t *so_decls = NULL; @@ -179,6 +190,8 @@ iris_disk_cache_retrieve(struct iris_context *ice, num_system_values * sizeof(enum brw_param_builtin)); } + kernel_input_size = blob_read_uint32(&blob); + prog_data->param = NULL; prog_data->pull_param = NULL; assert(prog_data->nr_pull_params == 0); @@ -196,7 +209,7 @@ iris_disk_cache_retrieve(struct iris_context *ice, stage == MESA_SHADER_TESS_EVAL || stage == MESA_SHADER_GEOMETRY) { struct brw_vue_prog_data *vue_prog_data = (void *) prog_data; - so_decls = ice->vtbl.create_so_decl_list(&ish->stream_output, + so_decls = screen->vtbl.create_so_decl_list(&ish->stream_output, &vue_prog_data->vue_map); } @@ -212,13 +225,16 @@ iris_disk_cache_retrieve(struct iris_context *ice, if (num_system_values) num_cbufs++; + assert(stage < ARRAY_SIZE(cache_id_for_stage)); + enum iris_program_cache_id cache_id = cache_id_for_stage[stage]; + /* Upload our newly read shader to the in-memory program cache and * return it to the caller. */ struct iris_compiled_shader *shader = - iris_upload_shader(ice, stage, key_size, prog_key, assembly, + iris_upload_shader(ice, cache_id, key_size, prog_key, assembly, prog_data, so_decls, system_values, - num_system_values, num_cbufs, &bt); + num_system_values, kernel_input_size, num_cbufs, &bt); free(buffer);