Skip to content

Commit 7e97ada

Browse files
committed
Merge pull request godotengine#102125 from DarioSamo/ubershader-thread-priority
Mark pipeline compilation of ubershaders as high priority.
2 parents f4c2fff + d0c29fa commit 7e97ada

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

servers/rendering/renderer_rd/forward_clustered/render_forward_clustered.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4427,7 +4427,7 @@ void RenderForwardClustered::_mesh_compile_pipeline_for_surface(SceneShaderForwa
44274427
r_pipeline_key.vertex_format_id = mesh_storage->mesh_surface_get_vertex_format(p_mesh_surface, input_mask, p_instanced_surface, pipeline_motion_vectors);
44284428
r_pipeline_key.ubershader = p_ubershader;
44294429

4430-
p_shader->pipeline_hash_map.compile_pipeline(r_pipeline_key, r_pipeline_key.hash(), p_source);
4430+
p_shader->pipeline_hash_map.compile_pipeline(r_pipeline_key, r_pipeline_key.hash(), p_source, p_ubershader);
44314431

44324432
if (r_pipeline_pairs != nullptr) {
44334433
r_pipeline_pairs->push_back({ p_shader, r_pipeline_key });

servers/rendering/renderer_rd/forward_mobile/render_forward_mobile.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2987,7 +2987,7 @@ void RenderForwardMobile::_mesh_compile_pipeline_for_surface(SceneShaderForwardM
29872987
uint64_t input_mask = p_shader->get_vertex_input_mask(r_pipeline_key.version, true);
29882988
r_pipeline_key.vertex_format_id = mesh_storage->mesh_surface_get_vertex_format(p_mesh_surface, input_mask, p_instanced_surface, false);
29892989
r_pipeline_key.ubershader = true;
2990-
p_shader->pipeline_hash_map.compile_pipeline(r_pipeline_key, r_pipeline_key.hash(), p_source);
2990+
p_shader->pipeline_hash_map.compile_pipeline(r_pipeline_key, r_pipeline_key.hash(), p_source, r_pipeline_key.ubershader);
29912991

29922992
if (r_pipeline_pairs != nullptr) {
29932993
r_pipeline_pairs->push_back({ p_shader, r_pipeline_key });

servers/rendering/renderer_rd/pipeline_hash_map_rd.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ class PipelineHashMapRD {
9292
}
9393

9494
// 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.
95-
void compile_pipeline(const Key &p_key, uint32_t p_key_hash, RS::PipelineSource p_source) {
95+
void compile_pipeline(const Key &p_key, uint32_t p_key_hash, RS::PipelineSource p_source, bool p_high_priority) {
9696
DEV_ASSERT((creation_object != nullptr) && (creation_function != nullptr) && "Creation object and function was not set before attempting to compile a pipeline.");
9797

9898
MutexLock local_lock(local_mutex);
@@ -133,7 +133,7 @@ class PipelineHashMapRD {
133133
#endif
134134

135135
// Queue a background compilation task.
136-
WorkerThreadPool::TaskID task_id = WorkerThreadPool::get_singleton()->add_template_task(creation_object, creation_function, p_key, false, "PipelineCompilation");
136+
WorkerThreadPool::TaskID task_id = WorkerThreadPool::get_singleton()->add_template_task(creation_object, creation_function, p_key, p_high_priority, "PipelineCompilation");
137137
compilation_tasks.insert(p_key_hash, task_id);
138138
}
139139

@@ -165,7 +165,7 @@ class PipelineHashMapRD {
165165

166166
if (e == nullptr) {
167167
// Request compilation. The method will ignore the request if it's already being compiled.
168-
compile_pipeline(p_key, p_key_hash, p_source);
168+
compile_pipeline(p_key, p_key_hash, p_source, p_wait_for_compilation);
169169

170170
if (p_wait_for_compilation) {
171171
wait_for_pipeline(p_key_hash);

0 commit comments

Comments
 (0)