@@ -254,14 +254,6 @@ pub fn update_mesh_previous_global_transforms(
254
254
255
255
#[ derive( Resource , Clone ) ]
256
256
pub struct PrepassPipeline {
257
- pub internal : PrepassPipelineInternal ,
258
- pub material_pipeline : MaterialPipeline ,
259
- }
260
-
261
- /// Internal fields of the `PrepassPipeline` that don't need the generic bound
262
- /// This is done as an optimization to not recompile the same code multiple time
263
- #[ derive( Clone ) ]
264
- pub struct PrepassPipelineInternal {
265
257
pub view_layout_motion_vectors : BindGroupLayout ,
266
258
pub view_layout_no_motion_vectors : BindGroupLayout ,
267
259
pub mesh_layouts : MeshLayouts ,
@@ -277,6 +269,7 @@ pub struct PrepassPipelineInternal {
277
269
/// Whether binding arrays (a.k.a. bindless textures) are usable on the
278
270
/// current render device.
279
271
pub binding_arrays_are_usable : bool ,
272
+ pub material_pipeline : MaterialPipeline ,
280
273
}
281
274
282
275
impl FromWorld for PrepassPipeline {
@@ -339,7 +332,7 @@ impl FromWorld for PrepassPipeline {
339
332
let depth_clip_control_supported = render_device
340
333
. features ( )
341
334
. contains ( WgpuFeatures :: DEPTH_CLIP_CONTROL ) ;
342
- let internal = PrepassPipelineInternal {
335
+ PrepassPipeline {
343
336
view_layout_motion_vectors,
344
337
view_layout_no_motion_vectors,
345
338
mesh_layouts : mesh_pipeline. mesh_layouts . clone ( ) ,
@@ -348,9 +341,6 @@ impl FromWorld for PrepassPipeline {
348
341
depth_clip_control_supported,
349
342
binding_arrays_are_usable : binding_arrays_are_usable ( render_device, render_adapter) ,
350
343
empty_layout : render_device. create_bind_group_layout ( "prepass_empty_layout" , & [ ] ) ,
351
- } ;
352
- PrepassPipeline {
353
- internal,
354
344
material_pipeline : world. resource :: < MaterialPipeline > ( ) . clone ( ) ,
355
345
}
356
346
}
@@ -373,12 +363,9 @@ impl SpecializedMeshPipeline for PrepassPipelineSpecializer {
373
363
if self . properties . bindless {
374
364
shader_defs. push ( "BINDLESS" . into ( ) ) ;
375
365
}
376
- let mut descriptor = self . pipeline . internal . specialize (
377
- key. mesh_key ,
378
- shader_defs,
379
- layout,
380
- & self . properties ,
381
- ) ?;
366
+ let mut descriptor =
367
+ self . pipeline
368
+ . specialize ( key. mesh_key , shader_defs, layout, & self . properties ) ?;
382
369
383
370
// This is a bit risky because it's possible to change something that would
384
371
// break the prepass but be fine in the main pass.
@@ -396,7 +383,7 @@ impl SpecializedMeshPipeline for PrepassPipelineSpecializer {
396
383
}
397
384
}
398
385
399
- impl PrepassPipelineInternal {
386
+ impl PrepassPipeline {
400
387
fn specialize (
401
388
& self ,
402
389
mesh_key : MeshPipelineKey ,
@@ -726,7 +713,7 @@ impl FromWorld for PrepassViewBindGroup {
726
713
let render_device = world. resource :: < RenderDevice > ( ) ;
727
714
let empty_bind_group = render_device. create_bind_group (
728
715
"prepass_view_empty_bind_group" ,
729
- & pipeline. internal . empty_layout ,
716
+ & pipeline. empty_layout ,
730
717
& [ ] ,
731
718
) ;
732
719
PrepassViewBindGroup {
@@ -753,7 +740,7 @@ pub fn prepare_prepass_view_bind_group(
753
740
) {
754
741
prepass_view_bind_group. no_motion_vectors = Some ( render_device. create_bind_group (
755
742
"prepass_view_no_motion_vectors_bind_group" ,
756
- & prepass_pipeline. internal . view_layout_no_motion_vectors ,
743
+ & prepass_pipeline. view_layout_no_motion_vectors ,
757
744
& BindGroupEntries :: with_indices ( (
758
745
( 0 , view_binding. clone ( ) ) ,
759
746
( 1 , globals_binding. clone ( ) ) ,
@@ -764,7 +751,7 @@ pub fn prepare_prepass_view_bind_group(
764
751
if let Some ( previous_view_uniforms_binding) = previous_view_uniforms. uniforms . binding ( ) {
765
752
prepass_view_bind_group. motion_vectors = Some ( render_device. create_bind_group (
766
753
"prepass_view_motion_vectors_bind_group" ,
767
- & prepass_pipeline. internal . view_layout_motion_vectors ,
754
+ & prepass_pipeline. view_layout_motion_vectors ,
768
755
& BindGroupEntries :: with_indices ( (
769
756
( 0 , view_binding) ,
770
757
( 1 , globals_binding) ,
0 commit comments