diff --git a/src/gallium/drivers/iris/iris_context.h b/src/gallium/drivers/iris/iris_context.h index 05d85ec9a51..c9dd66b988b 100644 --- a/src/gallium/drivers/iris/iris_context.h +++ b/src/gallium/drivers/iris/iris_context.h @@ -949,6 +949,7 @@ struct iris_compiled_shader *iris_create_shader_variant(const struct iris_screen struct iris_compiled_shader *iris_upload_shader(struct iris_screen *screen, struct iris_uncompiled_shader *, + struct iris_compiled_shader *, struct hash_table *driver_ht, struct u_upload_mgr *uploader, enum iris_program_cache_id, diff --git a/src/gallium/drivers/iris/iris_disk_cache.c b/src/gallium/drivers/iris/iris_disk_cache.c index 023db20cf89..3be0301b1ef 100644 --- a/src/gallium/drivers/iris/iris_disk_cache.c +++ b/src/gallium/drivers/iris/iris_disk_cache.c @@ -245,10 +245,12 @@ iris_disk_cache_retrieve(struct iris_screen *screen, * return it to the caller. */ struct iris_compiled_shader *shader = - iris_upload_shader(screen, ish, NULL, uploader, - cache_id, key_size, prog_key, assembly, - prog_data, so_decls, system_values, - num_system_values, kernel_input_size, num_cbufs, &bt); + iris_create_shader_variant(screen, NULL, cache_id, key_size, prog_key); + + shader = iris_upload_shader(screen, ish, shader, NULL, uploader, + cache_id, key_size, prog_key, assembly, + prog_data, so_decls, system_values, + num_system_values, kernel_input_size, num_cbufs, &bt); free(buffer); diff --git a/src/gallium/drivers/iris/iris_program.c b/src/gallium/drivers/iris/iris_program.c index 852c26a2aea..0f4c83feaf7 100644 --- a/src/gallium/drivers/iris/iris_program.c +++ b/src/gallium/drivers/iris/iris_program.c @@ -1221,10 +1221,12 @@ iris_compile_vs(struct iris_screen *screen, &vue_prog_data->vue_map); struct iris_compiled_shader *shader = - iris_upload_shader(screen, ish, NULL, uploader, - IRIS_CACHE_VS, sizeof(*key), key, program, - prog_data, so_decls, system_values, num_system_values, - 0, num_cbufs, &bt); + iris_create_shader_variant(screen, NULL, IRIS_CACHE_VS, sizeof(*key), key); + + shader = iris_upload_shader(screen, ish, shader, NULL, uploader, + IRIS_CACHE_VS, sizeof(*key), key, program, + prog_data, so_decls, system_values, num_system_values, + 0, num_cbufs, &bt); iris_disk_cache_store(screen->disk_cache, ish, shader, key, sizeof(*key)); @@ -1410,11 +1412,16 @@ iris_compile_tcs(struct iris_screen *screen, iris_debug_recompile(screen, dbg, ish, &brw_key.base); + void *passthrough_mem_ctx = (ish != NULL) ? NULL : passthrough_ht; + struct iris_compiled_shader *shader = - iris_upload_shader(screen, ish, passthrough_ht, uploader, - IRIS_CACHE_TCS, sizeof(*key), key, program, - prog_data, NULL, system_values, num_system_values, - 0, num_cbufs, &bt); + iris_create_shader_variant(screen, passthrough_mem_ctx, IRIS_CACHE_TCS, + sizeof(*key), key); + + shader = iris_upload_shader(screen, ish, shader, passthrough_ht, uploader, + IRIS_CACHE_TCS, sizeof(*key), key, program, + prog_data, NULL, system_values, num_system_values, + 0, num_cbufs, &bt); if (ish) iris_disk_cache_store(screen->disk_cache, ish, shader, key, sizeof(*key)); @@ -1546,12 +1553,13 @@ iris_compile_tes(struct iris_screen *screen, screen->vtbl.create_so_decl_list(&ish->stream_output, &vue_prog_data->vue_map); - struct iris_compiled_shader *shader = - iris_upload_shader(screen, ish, NULL, uploader, - IRIS_CACHE_TES, sizeof(*key), key, program, - prog_data, so_decls, system_values, num_system_values, - 0, num_cbufs, &bt); + iris_create_shader_variant(screen, NULL, IRIS_CACHE_TES, sizeof(*key), key); + + shader = iris_upload_shader(screen, ish, shader, NULL, uploader, + IRIS_CACHE_TES, sizeof(*key), key, program, + prog_data, so_decls, system_values, num_system_values, + 0, num_cbufs, &bt); iris_disk_cache_store(screen->disk_cache, ish, shader, key, sizeof(*key)); @@ -1674,10 +1682,12 @@ iris_compile_gs(struct iris_screen *screen, &vue_prog_data->vue_map); struct iris_compiled_shader *shader = - iris_upload_shader(screen, ish, NULL, uploader, - IRIS_CACHE_GS, sizeof(*key), key, program, - prog_data, so_decls, system_values, num_system_values, - 0, num_cbufs, &bt); + iris_create_shader_variant(screen, NULL, IRIS_CACHE_GS, sizeof(*key), key); + + shader = iris_upload_shader(screen, ish, shader, NULL, uploader, + IRIS_CACHE_GS, sizeof(*key), key, program, + prog_data, so_decls, system_values, num_system_values, + 0, num_cbufs, &bt); iris_disk_cache_store(screen->disk_cache, ish, shader, key, sizeof(*key)); @@ -1801,10 +1811,12 @@ iris_compile_fs(struct iris_screen *screen, iris_debug_recompile(screen, dbg, ish, &brw_key.base); struct iris_compiled_shader *shader = - iris_upload_shader(screen, ish, NULL, uploader, - IRIS_CACHE_FS, sizeof(*key), key, program, - prog_data, NULL, system_values, num_system_values, - 0, num_cbufs, &bt); + iris_create_shader_variant(screen, NULL, IRIS_CACHE_FS, sizeof(*key), key); + + shader = iris_upload_shader(screen, ish, shader, NULL, uploader, + IRIS_CACHE_FS, sizeof(*key), key, program, + prog_data, NULL, system_values, num_system_values, + 0, num_cbufs, &bt); iris_disk_cache_store(screen->disk_cache, ish, shader, key, sizeof(*key)); @@ -2068,10 +2080,12 @@ iris_compile_cs(struct iris_screen *screen, iris_debug_recompile(screen, dbg, ish, &brw_key.base); struct iris_compiled_shader *shader = - iris_upload_shader(screen, ish, NULL, uploader, - IRIS_CACHE_CS, sizeof(*key), key, program, - prog_data, NULL, system_values, num_system_values, - ish->kernel_input_size, num_cbufs, &bt); + iris_create_shader_variant(screen, NULL, IRIS_CACHE_CS, sizeof(*key), key); + + shader = iris_upload_shader(screen, ish, shader, NULL, uploader, + IRIS_CACHE_CS, sizeof(*key), key, program, + prog_data, NULL, system_values, num_system_values, + ish->kernel_input_size, num_cbufs, &bt); iris_disk_cache_store(screen->disk_cache, ish, shader, key, sizeof(*key)); diff --git a/src/gallium/drivers/iris/iris_program_cache.c b/src/gallium/drivers/iris/iris_program_cache.c index 4fdee1ea5d6..235cf99e8ef 100644 --- a/src/gallium/drivers/iris/iris_program_cache.c +++ b/src/gallium/drivers/iris/iris_program_cache.c @@ -146,6 +146,7 @@ iris_create_shader_variant(const struct iris_screen *screen, struct iris_compiled_shader * iris_upload_shader(struct iris_screen *screen, struct iris_uncompiled_shader *ish, + struct iris_compiled_shader *shader, struct hash_table *driver_shaders, struct u_upload_mgr *uploader, enum iris_program_cache_id cache_id, @@ -162,11 +163,6 @@ iris_upload_shader(struct iris_screen *screen, { const struct intel_device_info *devinfo = &screen->devinfo; - void *mem_ctx = ish ? NULL : (void *) driver_shaders; - - struct iris_compiled_shader *shader = - iris_create_shader_variant(screen, mem_ctx, cache_id, key_size, key); - u_upload_alloc(uploader, 0, prog_data->program_size, 64, &shader->assembly.offset, &shader->assembly.res, &shader->map); @@ -280,10 +276,13 @@ iris_blorp_upload_shader(struct blorp_batch *blorp_batch, uint32_t stage, memset(&bt, 0, sizeof(bt)); struct iris_compiled_shader *shader = - iris_upload_shader(screen, NULL, ice->shaders.cache, - ice->shaders.uploader_driver, - IRIS_CACHE_BLORP, key_size, key, kernel, - prog_data, NULL, NULL, 0, 0, 0, &bt); + iris_create_shader_variant(screen, ice->shaders.cache, IRIS_CACHE_BLORP, + key_size, key); + + iris_upload_shader(screen, NULL, shader, ice->shaders.cache, + ice->shaders.uploader_driver, + IRIS_CACHE_BLORP, key_size, key, kernel, + prog_data, NULL, NULL, 0, 0, 0, &bt); struct iris_bo *bo = iris_resource_bo(shader->assembly.res); *kernel_out =