EEVEE: Default Startup Speedup

Low hanging fruit optimizations for improving default
startup time.

Went from 7.2sec to 4sec on my system.

Pull Request: https://projects.blender.org/blender/blender/pulls/139278
This commit is contained in:
Clément Foucault
2025-05-22 15:57:41 +02:00
committed by Clément Foucault
parent a4a60959b0
commit d955ebce30
8 changed files with 42 additions and 20 deletions

View File

@@ -1275,7 +1275,7 @@ void DeferredProbePipeline::begin_sync()
void DeferredProbePipeline::end_sync()
{
{
if (!opaque_layer_.prepass_ps_.is_empty()) {
PassSimple &pass = eval_light_ps_;
pass.init();
/* Use depth test to reject background pixels. */
@@ -1388,7 +1388,13 @@ void PlanarProbePipeline::begin_sync()
this->gbuffer_pass_sync(inst_);
{
closure_bits_ = CLOSURE_NONE;
closure_count_ = 0;
}
void PlanarProbePipeline::end_sync()
{
if (!prepass_ps_.is_empty()) {
PassSimple &pass = eval_light_ps_;
pass.init();
pass.state_set(DRW_STATE_WRITE_COLOR | DRW_STATE_BLEND_ADD_FULL);
@@ -1405,14 +1411,6 @@ void PlanarProbePipeline::begin_sync()
pass.barrier(GPU_BARRIER_TEXTURE_FETCH | GPU_BARRIER_SHADER_IMAGE_ACCESS);
pass.draw_procedural(GPU_PRIM_TRIS, 1, 3);
}
closure_bits_ = CLOSURE_NONE;
closure_count_ = 0;
}
void PlanarProbePipeline::end_sync()
{
/* No-op for now. */
}
PassMain::Sub *PlanarProbePipeline::prepass_add(::Material *blender_mat, GPUMaterial *gpumat)

View File

@@ -252,6 +252,11 @@ struct DeferredLayerBase {
return count;
}
eClosureBits closure_bits_get() const
{
return closure_bits_;
}
void gbuffer_pass_sync(Instance &inst);
};
@@ -406,6 +411,11 @@ class DeferredPipeline {
return opaque_layer_.is_empty() && refraction_layer_.is_empty();
}
eClosureBits closure_bits_get() const
{
return opaque_layer_.closure_bits_get() | refraction_layer_.closure_bits_get();
}
private:
void debug_pass_sync();
};

View File

@@ -21,6 +21,10 @@ void SubsurfaceModule::end_sync()
{
data_.sample_len = 16;
if (!(inst_.pipelines.deferred.closure_bits_get() & CLOSURE_SSS)) {
return;
}
{
PassSimple &pass = setup_ps_;
pass.init();

View File

@@ -69,8 +69,8 @@ IMAGE_FREQ(4, DEFERRED_RADIANCE_FORMAT, write, uimage2D, direct_radiance_3_img,
IMAGE_FREQ(5, RAYTRACE_RADIANCE_FORMAT, write, image2D, indirect_radiance_1_img, PASS)
IMAGE_FREQ(6, RAYTRACE_RADIANCE_FORMAT, write, image2D, indirect_radiance_2_img, PASS)
IMAGE_FREQ(7, RAYTRACE_RADIANCE_FORMAT, write, image2D, indirect_radiance_3_img, PASS)
SPECIALIZATION_CONSTANT(bool, use_split_indirect, false)
SPECIALIZATION_CONSTANT(bool, use_lightprobe_eval, false)
SPECIALIZATION_CONSTANT(bool, use_split_indirect, true)
SPECIALIZATION_CONSTANT(bool, use_lightprobe_eval, true)
SPECIALIZATION_CONSTANT(bool, use_transmission, false)
SPECIALIZATION_CONSTANT(int, render_pass_shadow_id, -1)
DEFINE("SPECIALIZED_SHADOW_PARAMS")
@@ -127,11 +127,11 @@ ADDITIONAL_INFO(gpu_fullscreen)
FRAGMENT_SOURCE("eevee_deferred_combine_frag.glsl")
/* NOTE: Both light IDs have a valid specialized assignment of '-1' so only when default is
* present will we instead dynamically look-up ID from the uniform buffer. */
SPECIALIZATION_CONSTANT(bool, render_pass_diffuse_light_enabled, true)
SPECIALIZATION_CONSTANT(bool, render_pass_specular_light_enabled, true)
SPECIALIZATION_CONSTANT(bool, render_pass_normal_enabled, true)
SPECIALIZATION_CONSTANT(bool, render_pass_diffuse_light_enabled, false)
SPECIALIZATION_CONSTANT(bool, render_pass_specular_light_enabled, false)
SPECIALIZATION_CONSTANT(bool, render_pass_normal_enabled, false)
SPECIALIZATION_CONSTANT(bool, use_radiance_feedback, false)
SPECIALIZATION_CONSTANT(bool, use_split_radiance, false)
SPECIALIZATION_CONSTANT(bool, use_split_radiance, true)
DO_STATIC_COMPILATION()
GPU_SHADER_CREATE_END()

View File

@@ -27,9 +27,9 @@ SAMPLER(5, sampler2D, in_combined_tx)
SAMPLER(6, sampler2D, cryptomatte_tx)
IMAGE(0, GPU_R32F, read, image2DArray, in_weight_img)
IMAGE(1, GPU_R32F, write, image2DArray, out_weight_img)
SPECIALIZATION_CONSTANT(uint, enabled_categories, 0)
SPECIALIZATION_CONSTANT(int, samples_len, 0)
SPECIALIZATION_CONSTANT(bool, use_reprojection, false)
SPECIALIZATION_CONSTANT(uint, enabled_categories, 1)
SPECIALIZATION_CONSTANT(int, samples_len, 9)
SPECIALIZATION_CONSTANT(bool, use_reprojection, true)
SPECIALIZATION_CONSTANT(int, scaling_factor, 1)
SPECIALIZATION_CONSTANT(int, combined_id, 0)
SPECIALIZATION_CONSTANT(int, display_id, -1)

View File

@@ -62,6 +62,7 @@
#pragma once
#define GPU_DEBUG_SHADER_COMPILATION_GROUP "Shader Compilation"
#define GPU_DEBUG_SHADER_SPECIALIZATION_GROUP "Shader Specialization"
void GPU_debug_group_begin(const char *name);
void GPU_debug_group_end();

View File

@@ -92,7 +92,9 @@ static void APIENTRY debug_callback(GLenum /*source*/,
GPU_debug_get_groups_names(sizeof(debug_groups), debug_groups);
CLG_Severity clog_severity;
if (GPU_debug_group_match(GPU_DEBUG_SHADER_COMPILATION_GROUP)) {
if (GPU_debug_group_match(GPU_DEBUG_SHADER_COMPILATION_GROUP) ||
GPU_debug_group_match(GPU_DEBUG_SHADER_SPECIALIZATION_GROUP))
{
/* Do not duplicate shader compilation error/warnings. */
return;
}

View File

@@ -19,6 +19,7 @@
#include BLI_SYSTEM_PID_H
#include "GPU_capabilities.hh"
#include "GPU_debug.hh"
#include "GPU_platform.hh"
#include "gpu_capabilities_private.hh"
#include "gpu_shader_dependency_private.hh"
@@ -1617,8 +1618,14 @@ GLShader::GLProgram &GLShader::program_get(const shader::SpecializationConstants
return program;
}
GPU_debug_group_begin(GPU_DEBUG_SHADER_SPECIALIZATION_GROUP);
GPU_debug_group_begin(this->name);
program.program_link(name);
GPU_debug_group_end();
GPU_debug_group_end();
return program;
}