Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
bevyengine
GitHub Repository: bevyengine/bevy
Path: blob/main/crates/bevy_solari/src/realtime/node.rs
9367 views
1
use super::{
2
prepare::{SolariLightingResources, LIGHT_TILE_BLOCKS, WORLD_CACHE_SIZE},
3
SolariLighting,
4
};
5
use crate::scene::RaytracingSceneBindings;
6
#[cfg(all(feature = "dlss", not(feature = "force_disable_dlss")))]
7
use bevy_anti_alias::dlss::ViewDlssRayReconstructionTextures;
8
use bevy_asset::{load_embedded_asset, AssetServer, Handle};
9
use bevy_core_pipeline::prepass::{
10
PreviousViewData, PreviousViewUniformOffset, PreviousViewUniforms, ViewPrepassTextures,
11
};
12
use bevy_diagnostic::FrameCount;
13
use bevy_ecs::{prelude::*, resource::Resource, system::Commands};
14
use bevy_render::{
15
diagnostic::RecordDiagnostics as _,
16
render_resource::{
17
binding_types::{
18
storage_buffer_sized, texture_2d, texture_depth_2d, texture_storage_2d, uniform_buffer,
19
},
20
BindGroupEntries, BindGroupLayoutDescriptor, BindGroupLayoutEntries,
21
CachedComputePipelineId, ComputePassDescriptor, ComputePipelineDescriptor, LoadOp,
22
PipelineCache, RenderPassDescriptor, ShaderStages, StorageTextureAccess, TextureFormat,
23
TextureSampleType,
24
},
25
renderer::{RenderContext, RenderDevice, ViewQuery},
26
view::{ViewTarget, ViewUniform, ViewUniformOffset, ViewUniforms},
27
};
28
use bevy_shader::{Shader, ShaderDefVal};
29
use bevy_utils::default;
30
31
/// Resource holding the Solari lighting pipeline configuration.
32
#[derive(Resource)]
33
pub struct SolariLightingPipelines {
34
bind_group_layout: BindGroupLayoutDescriptor,
35
bind_group_layout_world_cache_active_cells_dispatch: BindGroupLayoutDescriptor,
36
#[cfg(all(feature = "dlss", not(feature = "force_disable_dlss")))]
37
bind_group_layout_resolve_dlss_rr_textures: BindGroupLayoutDescriptor,
38
decay_world_cache_pipeline: CachedComputePipelineId,
39
compact_world_cache_single_block_pipeline: CachedComputePipelineId,
40
compact_world_cache_blocks_pipeline: CachedComputePipelineId,
41
compact_world_cache_write_active_cells_pipeline: CachedComputePipelineId,
42
sample_di_for_world_cache_pipeline: CachedComputePipelineId,
43
sample_gi_for_world_cache_pipeline: CachedComputePipelineId,
44
blend_new_world_cache_samples_pipeline: CachedComputePipelineId,
45
presample_light_tiles_pipeline: CachedComputePipelineId,
46
di_initial_and_temporal_pipeline: CachedComputePipelineId,
47
di_spatial_and_shade_pipeline: CachedComputePipelineId,
48
gi_initial_and_temporal_pipeline: CachedComputePipelineId,
49
gi_spatial_and_shade_pipeline: CachedComputePipelineId,
50
specular_gi_pipeline: CachedComputePipelineId,
51
#[cfg(all(feature = "dlss", not(feature = "force_disable_dlss")))]
52
specular_gi_with_psr_pipeline: CachedComputePipelineId,
53
#[cfg(all(feature = "dlss", not(feature = "force_disable_dlss")))]
54
resolve_dlss_rr_textures_pipeline: CachedComputePipelineId,
55
}
56
57
#[cfg(any(not(feature = "dlss"), feature = "force_disable_dlss"))]
58
type SolariLightingViewQuery = (
59
&'static SolariLighting,
60
&'static SolariLightingResources,
61
&'static ViewTarget,
62
&'static ViewPrepassTextures,
63
&'static ViewUniformOffset,
64
&'static PreviousViewUniformOffset,
65
);
66
67
#[cfg(all(feature = "dlss", not(feature = "force_disable_dlss")))]
68
type SolariLightingViewQuery = (
69
&'static SolariLighting,
70
&'static SolariLightingResources,
71
&'static ViewTarget,
72
&'static ViewPrepassTextures,
73
&'static ViewUniformOffset,
74
&'static PreviousViewUniformOffset,
75
Option<&'static ViewDlssRayReconstructionTextures>,
76
);
77
78
pub fn solari_lighting(
79
view: ViewQuery<SolariLightingViewQuery>,
80
solari_pipelines: Option<Res<SolariLightingPipelines>>,
81
pipeline_cache: Res<PipelineCache>,
82
scene_bindings: Res<RaytracingSceneBindings>,
83
view_uniforms: Res<ViewUniforms>,
84
previous_view_uniforms: Res<PreviousViewUniforms>,
85
frame_count: Res<FrameCount>,
86
render_device: Res<RenderDevice>,
87
mut ctx: RenderContext,
88
) {
89
#[cfg(any(not(feature = "dlss"), feature = "force_disable_dlss"))]
90
let (
91
solari_lighting,
92
solari_lighting_resources,
93
view_target,
94
view_prepass_textures,
95
view_uniform_offset,
96
previous_view_uniform_offset,
97
) = view.into_inner();
98
99
#[cfg(all(feature = "dlss", not(feature = "force_disable_dlss")))]
100
let (
101
solari_lighting,
102
solari_lighting_resources,
103
view_target,
104
view_prepass_textures,
105
view_uniform_offset,
106
previous_view_uniform_offset,
107
view_dlss_rr_textures,
108
) = view.into_inner();
109
110
let Some(pipelines) = solari_pipelines else {
111
return;
112
};
113
114
#[cfg(not(all(feature = "dlss", not(feature = "force_disable_dlss"))))]
115
let specular_gi_pipeline = pipelines.specular_gi_pipeline;
116
#[cfg(all(feature = "dlss", not(feature = "force_disable_dlss")))]
117
let specular_gi_pipeline = if view_dlss_rr_textures.is_some() {
118
pipelines.specular_gi_with_psr_pipeline
119
} else {
120
pipelines.specular_gi_pipeline
121
};
122
123
let (
124
Some(decay_world_cache_pipeline),
125
Some(compact_world_cache_single_block_pipeline),
126
Some(compact_world_cache_blocks_pipeline),
127
Some(compact_world_cache_write_active_cells_pipeline),
128
Some(sample_di_for_world_cache_pipeline),
129
Some(sample_gi_for_world_cache_pipeline),
130
Some(blend_new_world_cache_samples_pipeline),
131
Some(presample_light_tiles_pipeline),
132
Some(di_initial_and_temporal_pipeline),
133
Some(di_spatial_and_shade_pipeline),
134
Some(gi_initial_and_temporal_pipeline),
135
Some(gi_spatial_and_shade_pipeline),
136
Some(specular_gi_pipeline),
137
Some(scene_bind_group),
138
Some(gbuffer),
139
Some(depth_buffer),
140
Some(motion_vectors),
141
Some(previous_gbuffer),
142
Some(previous_depth_buffer),
143
Some(view_uniforms_binding),
144
Some(previous_view_uniforms_binding),
145
) = (
146
pipeline_cache.get_compute_pipeline(pipelines.decay_world_cache_pipeline),
147
pipeline_cache.get_compute_pipeline(pipelines.compact_world_cache_single_block_pipeline),
148
pipeline_cache.get_compute_pipeline(pipelines.compact_world_cache_blocks_pipeline),
149
pipeline_cache
150
.get_compute_pipeline(pipelines.compact_world_cache_write_active_cells_pipeline),
151
pipeline_cache.get_compute_pipeline(pipelines.sample_di_for_world_cache_pipeline),
152
pipeline_cache.get_compute_pipeline(pipelines.sample_gi_for_world_cache_pipeline),
153
pipeline_cache.get_compute_pipeline(pipelines.blend_new_world_cache_samples_pipeline),
154
pipeline_cache.get_compute_pipeline(pipelines.presample_light_tiles_pipeline),
155
pipeline_cache.get_compute_pipeline(pipelines.di_initial_and_temporal_pipeline),
156
pipeline_cache.get_compute_pipeline(pipelines.di_spatial_and_shade_pipeline),
157
pipeline_cache.get_compute_pipeline(pipelines.gi_initial_and_temporal_pipeline),
158
pipeline_cache.get_compute_pipeline(pipelines.gi_spatial_and_shade_pipeline),
159
pipeline_cache.get_compute_pipeline(specular_gi_pipeline),
160
&scene_bindings.bind_group,
161
view_prepass_textures.deferred_view(),
162
view_prepass_textures.depth_view(),
163
view_prepass_textures.motion_vectors_view(),
164
view_prepass_textures.previous_deferred_view(),
165
view_prepass_textures.previous_depth_view(),
166
view_uniforms.uniforms.binding(),
167
previous_view_uniforms.uniforms.binding(),
168
)
169
else {
170
return;
171
};
172
173
#[cfg(all(feature = "dlss", not(feature = "force_disable_dlss")))]
174
let Some(resolve_dlss_rr_textures_pipeline) =
175
pipeline_cache.get_compute_pipeline(pipelines.resolve_dlss_rr_textures_pipeline)
176
else {
177
return;
178
};
179
180
let view_target_attachment = view_target.get_unsampled_color_attachment();
181
182
let s = solari_lighting_resources;
183
let bind_group = render_device.create_bind_group(
184
"solari_lighting_bind_group",
185
&pipeline_cache.get_bind_group_layout(&pipelines.bind_group_layout),
186
&BindGroupEntries::sequential((
187
view_target_attachment.view,
188
s.light_tile_samples.as_entire_binding(),
189
s.light_tile_resolved_samples.as_entire_binding(),
190
&s.di_reservoirs_a,
191
&s.di_reservoirs_b,
192
s.gi_reservoirs_a.as_entire_binding(),
193
s.gi_reservoirs_b.as_entire_binding(),
194
gbuffer,
195
depth_buffer,
196
motion_vectors,
197
previous_gbuffer,
198
previous_depth_buffer,
199
view_uniforms_binding,
200
previous_view_uniforms_binding,
201
s.world_cache_checksums.as_entire_binding(),
202
s.world_cache_life.as_entire_binding(),
203
s.world_cache_radiance.as_entire_binding(),
204
s.world_cache_geometry_data.as_entire_binding(),
205
s.world_cache_luminance_deltas.as_entire_binding(),
206
s.world_cache_active_cells_new_radiance.as_entire_binding(),
207
s.world_cache_a.as_entire_binding(),
208
s.world_cache_b.as_entire_binding(),
209
s.world_cache_active_cell_indices.as_entire_binding(),
210
s.world_cache_active_cells_count.as_entire_binding(),
211
)),
212
);
213
let bind_group_world_cache_active_cells_dispatch = render_device.create_bind_group(
214
"solari_lighting_bind_group_world_cache_active_cells_dispatch",
215
&pipeline_cache
216
.get_bind_group_layout(&pipelines.bind_group_layout_world_cache_active_cells_dispatch),
217
&BindGroupEntries::single(s.world_cache_active_cells_dispatch.as_entire_binding()),
218
);
219
220
#[cfg(all(feature = "dlss", not(feature = "force_disable_dlss")))]
221
let bind_group_resolve_dlss_rr_textures = view_dlss_rr_textures.map(|d| {
222
render_device.create_bind_group(
223
"solari_lighting_bind_group_resolve_dlss_rr_textures",
224
&pipeline_cache
225
.get_bind_group_layout(&pipelines.bind_group_layout_resolve_dlss_rr_textures),
226
&BindGroupEntries::sequential((
227
&d.diffuse_albedo.default_view,
228
&d.specular_albedo.default_view,
229
&d.normal_roughness.default_view,
230
&d.specular_motion_vectors.default_view,
231
)),
232
)
233
});
234
235
// Choice of number here is arbitrary
236
let frame_index = frame_count.0.wrapping_mul(5782582);
237
238
let diagnostics = ctx.diagnostic_recorder();
239
let diagnostics = diagnostics.as_deref();
240
241
let command_encoder = ctx.command_encoder();
242
243
// Clear the view target if we're the first node to write to it
244
if matches!(view_target_attachment.ops.load, LoadOp::Clear(_)) {
245
command_encoder.begin_render_pass(&RenderPassDescriptor {
246
label: Some("solari_lighting_clear"),
247
color_attachments: &[Some(view_target_attachment)],
248
depth_stencil_attachment: None,
249
timestamp_writes: None,
250
occlusion_query_set: None,
251
multiview_mask: None,
252
});
253
}
254
255
let mut pass = command_encoder.begin_compute_pass(&ComputePassDescriptor {
256
label: Some("solari_lighting"),
257
timestamp_writes: None,
258
});
259
260
let dx = solari_lighting_resources.view_size.x.div_ceil(8);
261
let dy = solari_lighting_resources.view_size.y.div_ceil(8);
262
263
pass.set_bind_group(0, scene_bind_group, &[]);
264
pass.set_bind_group(
265
1,
266
&bind_group,
267
&[
268
view_uniform_offset.offset,
269
previous_view_uniform_offset.offset,
270
],
271
);
272
273
#[cfg(all(feature = "dlss", not(feature = "force_disable_dlss")))]
274
if let Some(bind_group_resolve_dlss_rr_textures) = &bind_group_resolve_dlss_rr_textures {
275
pass.set_bind_group(2, bind_group_resolve_dlss_rr_textures, &[]);
276
pass.set_pipeline(resolve_dlss_rr_textures_pipeline);
277
pass.dispatch_workgroups(dx, dy, 1);
278
}
279
280
let d = diagnostics.time_span(&mut pass, "solari_lighting/presample_light_tiles");
281
pass.set_pipeline(presample_light_tiles_pipeline);
282
pass.set_immediates(
283
0,
284
bytemuck::cast_slice(&[frame_index, solari_lighting.reset as u32]),
285
);
286
pass.dispatch_workgroups(LIGHT_TILE_BLOCKS as u32, 1, 1);
287
d.end(&mut pass);
288
289
let d = diagnostics.time_span(&mut pass, "solari_lighting/world_cache");
290
291
pass.set_bind_group(2, &bind_group_world_cache_active_cells_dispatch, &[]);
292
293
pass.set_pipeline(decay_world_cache_pipeline);
294
pass.dispatch_workgroups((WORLD_CACHE_SIZE / 1024) as u32, 1, 1);
295
296
pass.set_pipeline(compact_world_cache_single_block_pipeline);
297
pass.dispatch_workgroups((WORLD_CACHE_SIZE / 1024) as u32, 1, 1);
298
299
pass.set_pipeline(compact_world_cache_blocks_pipeline);
300
pass.dispatch_workgroups(1, 1, 1);
301
302
pass.set_pipeline(compact_world_cache_write_active_cells_pipeline);
303
pass.dispatch_workgroups((WORLD_CACHE_SIZE / 1024) as u32, 1, 1);
304
305
pass.set_bind_group(2, None, &[]);
306
307
pass.set_pipeline(sample_di_for_world_cache_pipeline);
308
pass.set_immediates(
309
0,
310
bytemuck::cast_slice(&[frame_index, solari_lighting.reset as u32]),
311
);
312
pass.dispatch_workgroups_indirect(
313
&solari_lighting_resources.world_cache_active_cells_dispatch,
314
0,
315
);
316
317
pass.set_pipeline(sample_gi_for_world_cache_pipeline);
318
pass.set_immediates(
319
0,
320
bytemuck::cast_slice(&[frame_index, solari_lighting.reset as u32]),
321
);
322
pass.dispatch_workgroups_indirect(
323
&solari_lighting_resources.world_cache_active_cells_dispatch,
324
0,
325
);
326
327
pass.set_pipeline(blend_new_world_cache_samples_pipeline);
328
pass.dispatch_workgroups_indirect(
329
&solari_lighting_resources.world_cache_active_cells_dispatch,
330
0,
331
);
332
333
d.end(&mut pass);
334
335
let d = diagnostics.time_span(&mut pass, "solari_lighting/direct_lighting");
336
337
pass.set_pipeline(di_initial_and_temporal_pipeline);
338
pass.set_immediates(
339
0,
340
bytemuck::cast_slice(&[frame_index, solari_lighting.reset as u32]),
341
);
342
pass.dispatch_workgroups(dx, dy, 1);
343
344
pass.set_pipeline(di_spatial_and_shade_pipeline);
345
pass.set_immediates(
346
0,
347
bytemuck::cast_slice(&[frame_index, solari_lighting.reset as u32]),
348
);
349
pass.dispatch_workgroups(dx, dy, 1);
350
351
d.end(&mut pass);
352
353
let d = diagnostics.time_span(&mut pass, "solari_lighting/diffuse_indirect_lighting");
354
355
pass.set_pipeline(gi_initial_and_temporal_pipeline);
356
pass.set_immediates(
357
0,
358
bytemuck::cast_slice(&[frame_index, solari_lighting.reset as u32]),
359
);
360
pass.dispatch_workgroups(dx, dy, 1);
361
362
pass.set_pipeline(gi_spatial_and_shade_pipeline);
363
pass.set_immediates(
364
0,
365
bytemuck::cast_slice(&[frame_index, solari_lighting.reset as u32]),
366
);
367
pass.dispatch_workgroups(dx, dy, 1);
368
369
d.end(&mut pass);
370
371
let d = diagnostics.time_span(&mut pass, "solari_lighting/specular_indirect_lighting");
372
#[cfg(all(feature = "dlss", not(feature = "force_disable_dlss")))]
373
if let Some(bind_group_resolve_dlss_rr_textures) = &bind_group_resolve_dlss_rr_textures {
374
pass.set_bind_group(2, bind_group_resolve_dlss_rr_textures, &[]);
375
}
376
pass.set_pipeline(specular_gi_pipeline);
377
pass.set_immediates(
378
0,
379
bytemuck::cast_slice(&[frame_index, solari_lighting.reset as u32]),
380
);
381
pass.dispatch_workgroups(dx, dy, 1);
382
d.end(&mut pass);
383
384
drop(pass);
385
386
diagnostics.record_u32(
387
ctx.command_encoder(),
388
&s.world_cache_active_cells_count.slice(..),
389
"solari_lighting/world_cache_active_cells_count",
390
);
391
}
392
393
/// Initializes the Solari lighting pipelines at render startup.
394
pub fn init_solari_lighting_pipelines(
395
mut commands: Commands,
396
pipeline_cache: Res<PipelineCache>,
397
scene_bindings: Res<RaytracingSceneBindings>,
398
asset_server: Res<AssetServer>,
399
) {
400
let bind_group_layout = BindGroupLayoutDescriptor::new(
401
"solari_lighting_bind_group_layout",
402
&BindGroupLayoutEntries::sequential(
403
ShaderStages::COMPUTE,
404
(
405
texture_storage_2d(
406
ViewTarget::TEXTURE_FORMAT_HDR,
407
StorageTextureAccess::ReadWrite,
408
),
409
storage_buffer_sized(false, None),
410
storage_buffer_sized(false, None),
411
texture_storage_2d(TextureFormat::Rgba32Uint, StorageTextureAccess::ReadWrite),
412
texture_storage_2d(TextureFormat::Rgba32Uint, StorageTextureAccess::ReadWrite),
413
storage_buffer_sized(false, None),
414
storage_buffer_sized(false, None),
415
texture_2d(TextureSampleType::Uint),
416
texture_depth_2d(),
417
texture_2d(TextureSampleType::Float { filterable: true }),
418
texture_2d(TextureSampleType::Uint),
419
texture_depth_2d(),
420
uniform_buffer::<ViewUniform>(true),
421
uniform_buffer::<PreviousViewData>(true),
422
storage_buffer_sized(false, None),
423
storage_buffer_sized(false, None),
424
storage_buffer_sized(false, None),
425
storage_buffer_sized(false, None),
426
storage_buffer_sized(false, None),
427
storage_buffer_sized(false, None),
428
storage_buffer_sized(false, None),
429
storage_buffer_sized(false, None),
430
storage_buffer_sized(false, None),
431
storage_buffer_sized(false, None),
432
),
433
),
434
);
435
436
let bind_group_layout_world_cache_active_cells_dispatch = BindGroupLayoutDescriptor::new(
437
"solari_lighting_bind_group_layout_world_cache_active_cells_dispatch",
438
&BindGroupLayoutEntries::single(ShaderStages::COMPUTE, storage_buffer_sized(false, None)),
439
);
440
441
#[cfg(all(feature = "dlss", not(feature = "force_disable_dlss")))]
442
let bind_group_layout_resolve_dlss_rr_textures = BindGroupLayoutDescriptor::new(
443
"solari_lighting_bind_group_layout_resolve_dlss_rr_textures",
444
&BindGroupLayoutEntries::sequential(
445
ShaderStages::COMPUTE,
446
(
447
texture_storage_2d(TextureFormat::Rgba8Unorm, StorageTextureAccess::WriteOnly),
448
texture_storage_2d(TextureFormat::Rgba8Unorm, StorageTextureAccess::WriteOnly),
449
texture_storage_2d(TextureFormat::Rgba16Float, StorageTextureAccess::WriteOnly),
450
texture_storage_2d(TextureFormat::Rg16Float, StorageTextureAccess::WriteOnly),
451
),
452
),
453
);
454
455
let create_pipeline = |label: &'static str,
456
entry_point: &'static str,
457
shader: Handle<Shader>,
458
extra_bind_group_layout: Option<&BindGroupLayoutDescriptor>,
459
extra_shader_defs: Vec<ShaderDefVal>| {
460
let mut layout = vec![
461
scene_bindings.bind_group_layout.clone(),
462
bind_group_layout.clone(),
463
];
464
if let Some(extra_bind_group_layout) = extra_bind_group_layout {
465
layout.push(extra_bind_group_layout.clone());
466
}
467
468
let mut shader_defs = vec![ShaderDefVal::UInt(
469
"WORLD_CACHE_SIZE".into(),
470
WORLD_CACHE_SIZE as u32,
471
)];
472
shader_defs.extend_from_slice(&extra_shader_defs);
473
474
pipeline_cache.queue_compute_pipeline(ComputePipelineDescriptor {
475
label: Some(label.into()),
476
layout,
477
immediate_size: 8,
478
shader,
479
shader_defs,
480
entry_point: Some(entry_point.into()),
481
..default()
482
})
483
};
484
485
commands.insert_resource(SolariLightingPipelines {
486
bind_group_layout: bind_group_layout.clone(),
487
bind_group_layout_world_cache_active_cells_dispatch:
488
bind_group_layout_world_cache_active_cells_dispatch.clone(),
489
#[cfg(all(feature = "dlss", not(feature = "force_disable_dlss")))]
490
bind_group_layout_resolve_dlss_rr_textures: bind_group_layout_resolve_dlss_rr_textures
491
.clone(),
492
decay_world_cache_pipeline: create_pipeline(
493
"solari_lighting_decay_world_cache_pipeline",
494
"decay_world_cache",
495
load_embedded_asset!(asset_server.as_ref(), "world_cache_compact.wgsl"),
496
Some(&bind_group_layout_world_cache_active_cells_dispatch),
497
vec!["WORLD_CACHE_NON_ATOMIC_LIFE_BUFFER".into()],
498
),
499
compact_world_cache_single_block_pipeline: create_pipeline(
500
"solari_lighting_compact_world_cache_single_block_pipeline",
501
"compact_world_cache_single_block",
502
load_embedded_asset!(asset_server.as_ref(), "world_cache_compact.wgsl"),
503
Some(&bind_group_layout_world_cache_active_cells_dispatch),
504
vec!["WORLD_CACHE_NON_ATOMIC_LIFE_BUFFER".into()],
505
),
506
compact_world_cache_blocks_pipeline: create_pipeline(
507
"solari_lighting_compact_world_cache_blocks_pipeline",
508
"compact_world_cache_blocks",
509
load_embedded_asset!(asset_server.as_ref(), "world_cache_compact.wgsl"),
510
Some(&bind_group_layout_world_cache_active_cells_dispatch),
511
vec![],
512
),
513
compact_world_cache_write_active_cells_pipeline: create_pipeline(
514
"solari_lighting_compact_world_cache_write_active_cells_pipeline",
515
"compact_world_cache_write_active_cells",
516
load_embedded_asset!(asset_server.as_ref(), "world_cache_compact.wgsl"),
517
Some(&bind_group_layout_world_cache_active_cells_dispatch),
518
vec!["WORLD_CACHE_NON_ATOMIC_LIFE_BUFFER".into()],
519
),
520
sample_di_for_world_cache_pipeline: create_pipeline(
521
"solari_lighting_sample_di_for_world_cache_pipeline",
522
"sample_di",
523
load_embedded_asset!(asset_server.as_ref(), "world_cache_update.wgsl"),
524
None,
525
vec![],
526
),
527
sample_gi_for_world_cache_pipeline: create_pipeline(
528
"solari_lighting_sample_gi_for_world_cache_pipeline",
529
"sample_gi",
530
load_embedded_asset!(asset_server.as_ref(), "world_cache_update.wgsl"),
531
None,
532
vec!["WORLD_CACHE_QUERY_ATOMIC_MAX_LIFETIME".into()],
533
),
534
blend_new_world_cache_samples_pipeline: create_pipeline(
535
"solari_lighting_blend_new_world_cache_samples_pipeline",
536
"blend_new_samples",
537
load_embedded_asset!(asset_server.as_ref(), "world_cache_update.wgsl"),
538
None,
539
vec![],
540
),
541
presample_light_tiles_pipeline: create_pipeline(
542
"solari_lighting_presample_light_tiles_pipeline",
543
"presample_light_tiles",
544
load_embedded_asset!(asset_server.as_ref(), "presample_light_tiles.wgsl"),
545
None,
546
vec![],
547
),
548
di_initial_and_temporal_pipeline: create_pipeline(
549
"solari_lighting_di_initial_and_temporal_pipeline",
550
"initial_and_temporal",
551
load_embedded_asset!(asset_server.as_ref(), "restir_di.wgsl"),
552
None,
553
vec![],
554
),
555
di_spatial_and_shade_pipeline: create_pipeline(
556
"solari_lighting_di_spatial_and_shade_pipeline",
557
"spatial_and_shade",
558
load_embedded_asset!(asset_server.as_ref(), "restir_di.wgsl"),
559
None,
560
vec![],
561
),
562
gi_initial_and_temporal_pipeline: create_pipeline(
563
"solari_lighting_gi_initial_and_temporal_pipeline",
564
"initial_and_temporal",
565
load_embedded_asset!(asset_server.as_ref(), "restir_gi.wgsl"),
566
None,
567
vec!["WORLD_CACHE_FIRST_BOUNCE_LIGHT_LEAK_PREVENTION".into()],
568
),
569
gi_spatial_and_shade_pipeline: create_pipeline(
570
"solari_lighting_gi_spatial_and_shade_pipeline",
571
"spatial_and_shade",
572
load_embedded_asset!(asset_server.as_ref(), "restir_gi.wgsl"),
573
None,
574
vec![],
575
),
576
specular_gi_pipeline: create_pipeline(
577
"solari_lighting_specular_gi_pipeline",
578
"specular_gi",
579
load_embedded_asset!(asset_server.as_ref(), "specular_gi.wgsl"),
580
None,
581
vec![],
582
),
583
#[cfg(all(feature = "dlss", not(feature = "force_disable_dlss")))]
584
specular_gi_with_psr_pipeline: create_pipeline(
585
"solari_lighting_specular_gi_with_psr_pipeline",
586
"specular_gi",
587
load_embedded_asset!(asset_server.as_ref(), "specular_gi.wgsl"),
588
Some(&bind_group_layout_resolve_dlss_rr_textures),
589
vec!["DLSS_RR_GUIDE_BUFFERS".into()],
590
),
591
#[cfg(all(feature = "dlss", not(feature = "force_disable_dlss")))]
592
resolve_dlss_rr_textures_pipeline: create_pipeline(
593
"solari_lighting_resolve_dlss_rr_textures_pipeline",
594
"resolve_dlss_rr_textures",
595
load_embedded_asset!(asset_server.as_ref(), "resolve_dlss_rr_textures.wgsl"),
596
Some(&bind_group_layout_resolve_dlss_rr_textures),
597
vec!["DLSS_RR_GUIDE_BUFFERS".into()],
598
),
599
});
600
}
601
602