1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-26 15:46:23 +00:00

Mark pipeline compilation of ubershaders as high priority.

This commit is contained in:
Dario
2025-01-28 11:40:05 -03:00
parent 6dc78c8aa1
commit d0c29faa15
3 changed files with 5 additions and 5 deletions

View File

@@ -4427,7 +4427,7 @@ void RenderForwardClustered::_mesh_compile_pipeline_for_surface(SceneShaderForwa
r_pipeline_key.vertex_format_id = mesh_storage->mesh_surface_get_vertex_format(p_mesh_surface, input_mask, p_instanced_surface, pipeline_motion_vectors);
r_pipeline_key.ubershader = p_ubershader;
p_shader->pipeline_hash_map.compile_pipeline(r_pipeline_key, r_pipeline_key.hash(), p_source);
p_shader->pipeline_hash_map.compile_pipeline(r_pipeline_key, r_pipeline_key.hash(), p_source, p_ubershader);
if (r_pipeline_pairs != nullptr) {
r_pipeline_pairs->push_back({ p_shader, r_pipeline_key });

View File

@@ -2987,7 +2987,7 @@ void RenderForwardMobile::_mesh_compile_pipeline_for_surface(SceneShaderForwardM
uint64_t input_mask = p_shader->get_vertex_input_mask(r_pipeline_key.version, true);
r_pipeline_key.vertex_format_id = mesh_storage->mesh_surface_get_vertex_format(p_mesh_surface, input_mask, p_instanced_surface, false);
r_pipeline_key.ubershader = true;
p_shader->pipeline_hash_map.compile_pipeline(r_pipeline_key, r_pipeline_key.hash(), p_source);
p_shader->pipeline_hash_map.compile_pipeline(r_pipeline_key, r_pipeline_key.hash(), p_source, r_pipeline_key.ubershader);
if (r_pipeline_pairs != nullptr) {
r_pipeline_pairs->push_back({ p_shader, r_pipeline_key });

View File

@@ -92,7 +92,7 @@ public:
}
// Start compilation of a pipeline ahead of time in the background. Returns true if the compilation was started, false if it wasn't required. Source is only used for collecting statistics.
void compile_pipeline(const Key &p_key, uint32_t p_key_hash, RS::PipelineSource p_source) {
void compile_pipeline(const Key &p_key, uint32_t p_key_hash, RS::PipelineSource p_source, bool p_high_priority) {
DEV_ASSERT((creation_object != nullptr) && (creation_function != nullptr) && "Creation object and function was not set before attempting to compile a pipeline.");
MutexLock local_lock(local_mutex);
@@ -133,7 +133,7 @@ public:
#endif
// Queue a background compilation task.
WorkerThreadPool::TaskID task_id = WorkerThreadPool::get_singleton()->add_template_task(creation_object, creation_function, p_key, false, "PipelineCompilation");
WorkerThreadPool::TaskID task_id = WorkerThreadPool::get_singleton()->add_template_task(creation_object, creation_function, p_key, p_high_priority, "PipelineCompilation");
compilation_tasks.insert(p_key_hash, task_id);
}
@@ -165,7 +165,7 @@ public:
if (e == nullptr) {
// Request compilation. The method will ignore the request if it's already being compiled.
compile_pipeline(p_key, p_key_hash, p_source);
compile_pipeline(p_key, p_key_hash, p_source, p_wait_for_compilation);
if (p_wait_for_compilation) {
wait_for_pipeline(p_key_hash);