EEVEE: Parallel specialization constants compilation
Convert `Renderbuffers::sync` into `RenderBuffers::init`. Use `GPU_shaders_precompile_specializations` in EEVEE. Pull Request: https://projects.blender.org/blender/blender/pulls/122798
This commit is contained in:
@@ -95,6 +95,7 @@ void Instance::init(const int2 &output_res,
|
||||
sampling.init(scene);
|
||||
camera.init();
|
||||
film.init(output_res, output_rect);
|
||||
render_buffers.init();
|
||||
ambient_occlusion.init();
|
||||
velocity.init();
|
||||
raytracing.init();
|
||||
@@ -135,6 +136,7 @@ void Instance::init_light_bake(Depsgraph *depsgraph, draw::Manager *manager)
|
||||
/* Film isn't used but init to avoid side effects in other module. */
|
||||
rcti empty_rect{0, 0, 0, 0};
|
||||
film.init(int2(1), &empty_rect);
|
||||
render_buffers.init();
|
||||
velocity.init();
|
||||
depth_of_field.init();
|
||||
shadows.init();
|
||||
@@ -207,7 +209,6 @@ void Instance::begin_sync()
|
||||
hiz_buffer.sync();
|
||||
main_view.sync();
|
||||
film.sync();
|
||||
render_buffers.sync();
|
||||
ambient_occlusion.sync();
|
||||
volume_probes.sync();
|
||||
lookdev.sync();
|
||||
|
||||
@@ -501,6 +501,30 @@ void DeferredLayerBase::gbuffer_pass_sync(Instance &inst)
|
||||
|
||||
void DeferredLayer::begin_sync()
|
||||
{
|
||||
if (GPU_use_parallel_compilation()) {
|
||||
/* Pre-compile specialization constants in parallel. */
|
||||
Vector<ShaderSpecialization> specializations;
|
||||
for (int i = 0; i < 3; i++) {
|
||||
GPUShader *sh = inst_.shaders.static_shader_get(eShaderType(DEFERRED_LIGHT_SINGLE + i));
|
||||
for (bool use_split_indirect : {false, true}) {
|
||||
for (bool use_lightprobe_eval : {false, true}) {
|
||||
for (bool use_transmission : {false, true}) {
|
||||
specializations.append(
|
||||
{sh,
|
||||
{{"render_pass_shadow_id", inst_.render_buffers.data.shadow_id},
|
||||
{"use_split_indirect", use_split_indirect},
|
||||
{"use_lightprobe_eval", use_lightprobe_eval},
|
||||
{"use_transmission", use_transmission},
|
||||
{"shadow_ray_count", inst_.shadows.get_data().ray_count},
|
||||
{"shadow_ray_step_count", inst_.shadows.get_data().step_count}}});
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
GPU_shaders_precompile_specializations(specializations);
|
||||
}
|
||||
|
||||
{
|
||||
prepass_ps_.init();
|
||||
/* Textures. */
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
|
||||
namespace blender::eevee {
|
||||
|
||||
void RenderBuffers::sync()
|
||||
void RenderBuffers::init()
|
||||
{
|
||||
const eViewLayerEEVEEPassType enabled_passes = inst_.film.enabled_passes_get();
|
||||
|
||||
|
||||
@@ -63,7 +63,7 @@ class RenderBuffers {
|
||||
}
|
||||
}
|
||||
|
||||
void sync();
|
||||
void init();
|
||||
|
||||
/* Acquires (also ensures) the render buffer before rendering to them. */
|
||||
void acquire(int2 extent);
|
||||
|
||||
Reference in New Issue
Block a user